/* 響應式修復樣式 - 專門處理手機版和平板版的版型問題 */

/* =============================================
   1. 品牌資訊主要圖片調整（適配 1000x350 尺寸）
   ============================================= */

/* 平板版與小桌面版 (768px - 1220px) */
@media (max-width: 1220px) and (min-width: 768px) {
    /* 品牌主橫幅圖片 - 區塊1 (1000x350 尺寸) */
    .brand-main-hero-image {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        min-height: auto !important;
        object-fit: contain !important;
        object-position: center center !important;
        background: #f8f9fa !important;
    }

    /* 品牌Logo容器 */
    .brand-logo-hero {
        padding: 20px !important;
    }

    /* 品牌詳情頁主要圖片 - 區塊2 */
    .brand-section2-image {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        min-height: auto !important;
        object-fit: contain !important;
        object-position: center center !important;
        background: transparent !important;
        display: block !important;
    }

    /* 品牌主要圖片 - 可能有固定高度的情況 */
    .brand-main-image {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        min-height: auto !important;
        object-fit: contain !important;
        object-position: center center !important;
    }

    /* 品牌說明與主要圖片區塊調整 */
    .brand-description-section {
        display: flex !important;
        flex-direction: column !important;
        gap: 25px !important;
        min-height: auto !important;
    }

    .brand-description-section > div:last-child {
        width: 100% !important;
        max-width: 700px !important;
        margin: 0 auto !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* 確保圖片容器不會限制圖片大小 */
    .brand-description-section img {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        object-fit: contain !important;
    }
}

/* 手機版 (小於 768px) */
@media (max-width: 767px) {
    /* 品牌詳情頁主要圖片 - 區塊2 */
    .brand-section2-image {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
        background: transparent !important;
        margin: 0 auto !important;
        display: block !important;
    }

    /* 品牌說明與主要圖片區塊調整 */
    .brand-description-section {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        padding: 20px 15px !important;
    }

    .brand-description-section > div:last-child {
        width: 100% !important;
        text-align: center !important;
    }
}

/* =============================================
   2. 認證徽章調整（3顆一排）
   ============================================= */

/* 平板版與小桌面版認證徽章調整 */
@media (max-width: 1220px) and (min-width: 768px) {
    .certification-badges-section {
        padding: 30px 20px !important;
    }

    .certification-badges {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 25px !important;
        justify-items: center !important;
        max-width: 450px !important;
        margin: 0 auto !important;
    }

    .certification-badge {
        width: 100px !important;
        height: 100px !important;
        max-width: 100% !important;
    }
}

/* 手機版認證徽章調整 */
@media (max-width: 767px) {
    .certification-badges-section {
        padding: 25px 15px !important;
    }

    .certification-badges {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px !important;
        justify-items: center !important;
        padding: 0 10px !important;
    }

    .certification-badge {
        width: 80px !important;
        height: 80px !important;
        max-width: 100% !important;
        object-fit: contain !important;
    }
}

/* 小手機版認證徽章調整 (小於 480px) */
@media (max-width: 479px) {
    .certification-badges {
        gap: 10px !important;
        padding: 0 5px !important;
    }

    .certification-badge {
        width: 70px !important;
        height: 70px !important;
    }
}

/* =============================================
   3. 首頁 Banner 調整（1600x700 尺寸適配）
   ============================================= */

/* 平板版與小桌面版 Banner 調整 */
@media (max-width: 1220px) and (min-width: 768px) {
    /* Banner 容器 - 使用實際高度而非 height: 0 */
    .banner-carousel,
    .homepage-hero-carousel {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        min-height: 60vh !important;
        max-height: 70vh !important;
        overflow: hidden !important;
    }

    /* Banner 輪播項目 */
    .banner-carousel__slide,
    .hero-slide {
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 60vh !important;
    }

    /* Banner 圖片 - 塞滿區塊 */
    .banner__image,
    .hero-slide img,
    .banner-carousel img {
        width: 100% !important;
        height: 100% !important;
        min-height: 60vh !important;
        object-fit: cover !important;
        object-position: center center !important;
    }

    /* Banner 內容調整 */
    .banner__content,
    .hero-content {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 100% !important;
        padding: 30px 40px !important;
        z-index: 10 !important;
    }

    .banner__title,
    .hero-title {
        font-size: 2.5rem !important;
    }

    .banner__subtitle,
    .hero-subtitle {
        font-size: 1.1rem !important;
    }
}

/* 手機版 Banner 調整 */
@media (max-width: 767px) {
    /* Banner 容器 - 保持適當高度 */
    .banner-carousel,
    .homepage-hero-carousel {
        position: relative !important;
        width: 100% !important;
        height: 60vh !important;
        min-height: 400px !important;
        max-height: 600px !important;
        overflow: hidden !important;
    }

    /* Banner 輪播項目 */
    .banner-carousel__slide,
    .hero-slide {
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 50vh !important;
    }

    /* Banner 圖片 - 塞滿區塊 */
    .banner__image,
    .hero-slide img,
    .banner-carousel img {
        width: 100% !important;
        height: 100% !important;
        min-height: 50vh !important;
        object-fit: cover !important;
        object-position: center center !important;
    }

    /* Banner 內容調整 - 使用 bottom 定位確保按鈕可見 */
    .banner__content,
    .hero-content {
        position: absolute !important;
        top: auto !important;
        bottom: 40px !important; /* 從底部定位，確保按鈕不被裁切 */
        left: 50% !important;
        transform: translateX(-50%) !important; /* 只水平居中 */
        width: 100% !important;
        padding: 20px !important;
        z-index: 10 !important;
    }

    /* 確保 CTA 按鈕可見 */
    .banner__cta,
    .hero__cta {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        margin-top: 10px !important;
    }

    /* 調整切換按鈕位置 - 確保始終在視覺中間 */
    .banner-carousel__controls,
    .hero-controls {
        position: absolute !important;
        top: 50% !important;
        left: 0 !important;
        right: 0 !important;
        transform: translateY(-50%) !important;
        z-index: 100 !important;
        display: flex !important;
        justify-content: space-between !important;
        padding: 0 15px !important;
        pointer-events: none !important;
        width: 100% !important;
        height: 48px !important;
        align-items: center !important;
    }

    .banner-carousel__btn,
    .hero-prev,
    .hero-next {
        pointer-events: auto !important;
        width: 48px !important;
        height: 48px !important;
        font-size: 1.5rem !important;
        background: rgba(255, 255, 255, 0.9) !important;
        border: 1px solid rgba(0, 0, 0, 0.2) !important;
        color: #000000 !important;
        cursor: pointer !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important;
        transition: all 0.3s ease !important;
    }

    .banner-carousel__btn:hover,
    .hero-prev:hover,
    .hero-next:hover {
        background: rgba(255, 255, 255, 1) !important;
        transform: scale(1.05) !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
    }

    .banner__title,
    .hero-title {
        font-size: 2rem !important;
        line-height: 1.2 !important;
    }

    .banner__subtitle,
    .hero-subtitle {
        font-size: 1rem !important;
        line-height: 1.4 !important;
    }
}

/* 小手機版 Banner 調整 (小於 480px) */
@media (max-width: 479px) {
    /* Banner 內容文字調整 */
    .banner__content,
    .hero-content {
        padding: 15px !important;
    }

    .banner__title,
    .hero-title {
        font-size: 1.5rem !important;
    }

    .banner__subtitle,
    .hero-subtitle {
        font-size: 0.9rem !important;
    }

    /* 控制按鈕 */
    .hero-prev,
    .hero-next,
    .banner-carousel__btn {
        width: 35px !important;
        height: 35px !important;
        font-size: 1rem !important;
    }
}

/* =============================================
   橫向模式優化
   ============================================= */

/* 平板與小桌面橫向 */
@media (max-width: 1220px) and (orientation: landscape) {
    /* Banner 在橫向模式使用較小高度 */
    .banner-carousel,
    .homepage-hero-carousel {
        min-height: 50vh !important;
        max-height: 60vh !important;
    }

    .certification-badges {
        max-width: 500px !important;
    }
}

/* 手機橫向 */
@media (max-width: 767px) and (orientation: landscape) {
    /* Banner 在橫向模式使用較小高度和 margin-top */
    .banner-carousel,
    .homepage-hero-carousel {
        min-height: 40vh !important;
        max-height: 50vh !important;
        margin-top: 80px !important;
    }

    .banner__title,
    .hero-title {
        font-size: 1.8rem !important;
    }

    .certification-badges {
        max-width: 400px !important;
    }

    .certification-badge {
        width: 60px !important;
        height: 60px !important;
    }
}

/* =============================================
   通用優化設定
   ============================================= */

/* 防止水平滾動 */
@media (max-width: 1220px) {
    body {
        overflow-x: hidden !important;
    }

    .container,
    .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}

/* 確保圖片不會破版 */
@media (max-width: 767px) {
    img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* 修正可能的 z-index 問題 */
    .banner-carousel,
    .homepage-hero-carousel {
        z-index: 1 !important;
    }

    .banner__content,
    .hero-content {
        z-index: 10 !important;
        position: relative !important;
    }
}

/* 確保認證徽章在所有裝置上都維持正方形 */
@media (max-width: 1220px) {
    .certification-badge {
        aspect-ratio: 1 / 1 !important;
        object-fit: contain !important;
        filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1)) !important;
    }
}