/**
 * Sub Banner Slider Styles
 * 
 * @package TwentyTwenty Child
 * @since 1.0.0
 */

/* ==========================================================================
   Sub Banner Container
   ========================================================================== */

.sub-banner {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #f8f9fa;
}

.sub-banner .swiper {
    width: 100%;
    height: auto;
    position: relative;
}

.sub-banner .swiper-wrapper {
    display: flex;
    align-items: center;
}

.sub-banner .swiper-slide {
    position: relative;
    width: 100%;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Banner Slide Content
   ========================================================================== */

.banner-slide-content {
    position: relative;
    width: 100%;
    height: auto;
}

.banner-slide-content img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.banner-slide-content:hover img {
    transform: scale(1.02);
}

/* ==========================================================================
   Banner Caption
   ========================================================================== */

.banner-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    padding: 40px 20px 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.banner-slide-content:hover .banner-caption {
    transform: translateY(0);
}

.banner-caption-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.banner-caption-content h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
}

.banner-caption-content p {
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    opacity: 0.9;
}

/* ==========================================================================
   Navigation Arrows
   ========================================================================== */

.sub-banner .swiper-button-next,
.sub-banner .swiper-button-prev {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    color: var(--hisense-primary, #00a8cc);
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.sub-banner .swiper-button-next:hover,
.sub-banner .swiper-button-prev:hover {
    background: var(--hisense-primary, #00a8cc);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 168, 204, 0.3);
}

.sub-banner .swiper-button-next::after,
.sub-banner .swiper-button-prev::after {
    font-size: 16px;
    font-weight: 900;
}

.sub-banner .swiper-button-next {
    right: 20px;
}

.sub-banner .swiper-button-prev {
    left: 20px;
}

/* ==========================================================================
   Pagination Dots
   ========================================================================== */

.sub-banner .swiper-pagination {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    position: absolute;
}

.sub-banner .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    margin: 0 6px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.sub-banner .swiper-pagination-bullet-active {
    background: var(--hisense-primary, #00a8cc);
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(0, 168, 204, 0.5);
}

.sub-banner .swiper-pagination-bullet:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

/* Dynamic Bullets */
.sub-banner .swiper-pagination-bullet-active-main {
    background: var(--hisense-primary, #00a8cc);
}

.sub-banner .swiper-pagination-bullet-active-prev,
.sub-banner .swiper-pagination-bullet-active-next {
    background: rgba(0, 168, 204, 0.6);
    transform: scale(0.8);
}

/* ==========================================================================
   Loading States
   ========================================================================== */

/* Initial loading state */
.sub-banner .swiper {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Show swiper when initialized */
.sub-banner .swiper.swiper-initialized {
    opacity: 1;
}

/* Fallback for when swiper fails to load */
.sub-banner .swiper.swiper-loaded,
.sub-banner .swiper[data-swiper-initialized="true"] {
    opacity: 1;
}

/* Force show after 2 seconds if swiper hasn't loaded */
.sub-banner .swiper {
    animation: forceShow 2s forwards;
}

@keyframes forceShow {
    0% { opacity: 0; }
    95% { opacity: 0; }
    100% { opacity: 1; }
}

/* Fallback loaded state */
.sub-banner .swiper.swiper-fallback-loaded {
    opacity: 1 !important;
}

/* Ready state */
.sub-banner .swiper.swiper-ready {
    opacity: 1 !important;
}

/* Ensure images are visible */
.sub-banner .swiper-slide img {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.sub-banner .swiper-slide {
    opacity: 0;
    animation: fadeInSlide 0.8s ease forwards;
}

.sub-banner .swiper-slide-active {
    animation-delay: 0.2s;
}

@keyframes fadeInSlide {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Mobile-Specific ACF Styling
   ========================================================================== */

/* Mobile Banner Height Controls */
.sub-banner.is-mobile.mobile-height-200px .swiper,
.sub-banner.is-mobile.mobile-height-200px .swiper-slide {
    height: 200px;
}

.sub-banner.is-mobile.mobile-height-300px .swiper,
.sub-banner.is-mobile.mobile-height-300px .swiper-slide {
    height: 300px;
}

.sub-banner.is-mobile.mobile-height-400px .swiper,
.sub-banner.is-mobile.mobile-height-400px .swiper-slide {
    height: 400px;
}

.sub-banner.is-mobile.mobile-height-custom .swiper,
.sub-banner.is-mobile.mobile-height-custom .swiper-slide {
    height: var(--mobile-banner-height, 250px);
}

/* Mobile Banner Image Fit */
.sub-banner.is-mobile:not(.mobile-height-auto) .banner-slide-content img {
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Hide Navigation on Mobile by Default */
.sub-banner.is-mobile .swiper-button-next,
.sub-banner.is-mobile .swiper-button-prev {
    display: none;
}

/* Show Navigation on Mobile when enabled */
.sub-banner.is-mobile.show-mobile-nav .swiper-button-next,
.sub-banner.is-mobile.show-mobile-nav .swiper-button-prev {
    display: flex;
    width: 35px;
    height: 35px;
    font-size: 12px;
}

.sub-banner.is-mobile.show-mobile-nav .swiper-button-next::after,
.sub-banner.is-mobile.show-mobile-nav .swiper-button-prev::after {
    font-size: 12px;
}

/* Mobile Pagination Adjustments */
.sub-banner.is-mobile .swiper-pagination {
    bottom: 10px;
}

.sub-banner.is-mobile .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    margin: 0 3px;
}

/* Mobile Caption Adjustments */
.sub-banner.is-mobile .banner-caption {
    padding: 15px 10px 10px;
    font-size: 14px;
}

.sub-banner.is-mobile .banner-caption-content h2 {
    font-size: 18px;
    margin-bottom: 6px;
}

.sub-banner.is-mobile .banner-caption-content p {
    font-size: 13px;
}

/* Desktop-Specific Styling */
.sub-banner.is-desktop .swiper-button-next,
.sub-banner.is-desktop .swiper-button-prev {
    display: flex; /* Always show on desktop */
}

/* ==========================================================================
   Mobile Optimizations
   ========================================================================== */

/* Mobile-first approach */
@media (max-width: 1024px) {
    .sub-banner {
        /* Improve mobile performance */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    .sub-banner .swiper {
        /* Enable hardware acceleration */
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }

    .banner-slide-content img {
        /* Optimize image rendering on mobile */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

@media (max-width: 768px) {
    .sub-banner {
        /* Reduce banner height on mobile if needed */
        max-height: 250px;
        overflow: hidden;
    }

    .sub-banner .swiper-slide {
        /* Ensure proper mobile display */
        height: auto;
        min-height: 200px;
    }

    .banner-slide-content img {
        /* Better mobile image handling */
        width: 100%;
        height: auto;
        min-height: 200px;
        object-fit: cover;
        object-position: center;
    }

    /* Mobile Navigation */
    .sub-banner .swiper-button-next,
    .sub-banner .swiper-button-prev {
        width: 35px;
        height: 35px;
        font-size: 12px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(8px);
        margin-top: -17.5px; /* Center vertically */
    }

    .sub-banner .swiper-button-next::after,
    .sub-banner .swiper-button-prev::after {
        font-size: 12px;
        font-weight: 900;
    }

    .sub-banner .swiper-button-next {
        right: 8px;
    }

    .sub-banner .swiper-button-prev {
        left: 8px;
    }

    /* Mobile Pagination */
    .sub-banner .swiper-pagination {
        bottom: 12px;
        padding: 8px 12px;
        background: rgba(0, 0, 0, 0.3);
        border-radius: 20px;
        backdrop-filter: blur(10px);
        width: auto;
        left: 50%;
        transform: translateX(-50%);
    }

    .sub-banner .swiper-pagination-bullet {
        width: 8px;
        height: 8px;
        margin: 0 3px;
        background: rgba(255, 255, 255, 0.6);
        opacity: 1;
    }

    .sub-banner .swiper-pagination-bullet-active {
        background: var(--hisense-primary, #00a8cc);
        transform: scale(1.3);
    }

    /* Mobile Caption */
    .banner-caption {
        padding: 15px 12px 12px;
        background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    }

    .banner-caption-content h2 {
        font-size: 18px;
        margin-bottom: 6px;
        line-height: 1.3;
    }

    .banner-caption-content p {
        font-size: 13px;
        line-height: 1.4;
    }

    /* Touch-friendly hover states */
    .banner-slide-content:hover img {
        transform: none; /* Disable hover zoom on mobile */
    }

    .banner-slide-content .banner-caption {
        transform: translateY(0); /* Always show caption on mobile */
        opacity: 0.9;
    }
}

@media (max-width: 480px) {
    .sub-banner .swiper-button-next,
    .sub-banner .swiper-button-prev {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }
    
    .sub-banner .swiper-button-next::after,
    .sub-banner .swiper-button-prev::after {
        font-size: 12px;
    }
    
    .banner-caption {
        padding: 15px 10px 10px;
    }
    
    .banner-caption-content h2 {
        font-size: 18px;
        margin-bottom: 6px;
    }
    
    .banner-caption-content p {
        font-size: 13px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.sub-banner .swiper-button-next:focus,
.sub-banner .swiper-button-prev:focus,
.sub-banner .swiper-pagination-bullet:focus {
    outline: 2px solid var(--hisense-primary, #00a8cc);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .sub-banner .swiper-slide,
    .banner-slide-content img,
    .banner-caption,
    .sub-banner .swiper-button-next,
    .sub-banner .swiper-button-prev,
    .sub-banner .swiper-pagination-bullet {
        transition: none;
        animation: none;
    }
    
    .banner-slide-content:hover img {
        transform: none;
    }
    
    .banner-slide-content:hover .banner-caption {
        transform: translateY(0);
    }
}
