/**
 * ============================================================
 * PURESTORA HERO CAROUSEL - BULLETPROOF MOBILE FIX
 * Unique class names to avoid conflicts
 * Handles desktop images as fallback on mobile
 * ============================================================
 */

 :root {
    --ps-hero-chip-active: #8B9E5F;
    --ps-hero-transition: 800ms cubic-bezier(0.4, 0, 0.2, 1);
    --ps-hero-border-color: #E5E5E5;
}

/* ============================================================
   SECTION CONTAINER
   ============================================================ */
.hero-banner-section {
    position: relative;
    width: 100%;
    max-width: 1920px;
    margin: 20px auto 25px;
    padding: 0 20px;
}

.hero-banner-wrapper {
    position: relative;
    border: 2px solid var(--ps-hero-border-color);
    border-radius: 20px;
    padding: 8px;
    background: #ffffff;
}

/* ============================================================
   CAROUSEL CONTAINER - CRITICAL FIX FOR WHITE SPACE
   ============================================================ */
.hero-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #F5F5F5;
    border-radius: 14px;
    margin-bottom: 0;
    /* IMPORTANT: Don't set height - let content determine it */
    /* Fix for border overflow on some images */
    isolation: isolate;
}

.hero-slides {
    position: relative;
    width: 100%;
    /* CRITICAL: This must be relative to wrap content properly */
}

/* ============================================================
   SLIDES - THE KEY TO FIXING WHITE SPACE
   ============================================================ */
.hero-slide {
    /* Hide all inactive slides completely */
    display: none;
    width: 100%;
    opacity: 0;
    visibility: hidden;
}

.hero-slide.active {
    /* Only active slide is displayed */
    display: block;
    position: relative;
    opacity: 1;
    visibility: visible;
    z-index: 1;
    /* Active slide determines the height */
}

.hero-slide a {
    display: block;
    width: 100%;
    position: relative;
    line-height: 0; /* Remove any line-height spacing */
}

/* ============================================================
   PICTURE & IMAGE - PROPER RESPONSIVE HANDLING
   ============================================================ */
.hero-slide picture {
    display: block;
    width: 100%;
    line-height: 0;
}

.hero-slide img {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
    border-radius: inherit;
    transition: transform 0.5s ease-out;
    /* Remove any spacing */
    margin: 0;
    padding: 0;
    /* Prevent border overflow */
    object-fit: contain;
}

/* Only animate active slides */
.hero-slide.active img {
    animation: psHeroSubtleZoom 0.8s ease-out forwards;
}

@keyframes psHeroSubtleZoom {
    from { transform: scale(1.02); }
    to { transform: scale(1); }
}

.hero-slide.active a:hover img {
    transform: scale(1.015);
}

/* ============================================================
   CHIPS - COMPACT & UNIQUE NAMING
   ============================================================ */
.hero-chips-container {
    position: relative;
    z-index: 10;
    padding: 8px 0 4px;
    background: transparent;
}

.hero-chips-wrapper {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 0 12px;
}

.hero-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    min-height: 32px;
    
    background: #FFFFFF;
    border: 1.5px solid var(--ps-hero-border-color);
    border-radius: 100px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #333333;
    letter-spacing: 0.2px;
    
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    user-select: none;
}

.hero-chip:hover {
    background: #FAFAFA;
    border-color: #CCCCCC;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.hero-chip.active {
    background: linear-gradient(135deg, #90AD46 0%, #66A92F 100%);
    border-color: #90AD46;
    color: #FFFFFF;
    box-shadow: 0 3px 10px rgba(139, 158, 95, 0.25);
}

.hero-chip .chip-icon {
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.hero-chip .chip-icon i {
    font-size: 13px;
}

.hero-chip .chip-label {
    white-space: nowrap;
    font-weight: 600;
    line-height: 1.2;
}

.hero-chip .chip-progress {
    position: absolute;
    bottom: -1.5px;
    left: 0;
    height: 2.5px;
    width: 0%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 3px;
    transition: width 6s linear;
}

.hero-chip.active .chip-progress {
    width: 100%;
}

/* ============================================================
   NAVIGATION ARROWS - DESKTOP ONLY
   ============================================================ */
.hero-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 50%;
    
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hero-carousel:hover .hero-nav {
    opacity: 0.95;
    visibility: visible;
}

.hero-nav:hover {
    background: #FFFFFF;
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    opacity: 1 !important;
}

.hero-nav svg {
    width: 20px;
    height: 20px;
}

.hero-nav-prev {
    left: 20px;
}

.hero-nav-next {
    right: 20px;
}

/* ============================================================
   DOTS - DESKTOP ONLY
   ============================================================ */
.hero-indicators {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    
    display: flex;
    gap: 7px;
    align-items: center;
    padding: 7px 11px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.hero-indicator {
    width: 6px;
    height: 6px;
    background: rgba(0, 0, 0, 0.25);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.hero-indicator.active {
    width: 18px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.7);
}

.hero-indicator:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (min-width: 1400px) {
    .hero-banner-section {
        padding: 0 40px;
    }
    
    .hero-banner-wrapper {
        padding: 10px;
        border-radius: 24px;
    }
    
    .hero-carousel {
        border-radius: 18px;
    }
}

@media (max-width: 1024px) {
    .hero-banner-section {
        margin: 18px auto 30px;
        padding: 0 16px;
    }
    
    .hero-banner-wrapper {
        padding: 12px;
        border-radius: 18px;
    }
    
    .hero-carousel {
        border-radius: 12px;
    }
}

/* ============================================================
   MOBILE - CRITICAL FIX FOR WHITE SPACE
   ============================================================ */
@media (max-width: 768px) {
    .hero-banner-section {
        margin: 14px auto 24px;
        padding: 0 12px;
    }
    
    .hero-banner-wrapper {
        padding: 10px;
        border-radius: 14px;
        border-width: 1.5px;
    }
    
    .hero-carousel {
        border-radius: 10px;
        /* Add bottom margin for spacing from chips */
        margin-bottom: 0;
    }
    
    /* Ensure images scale properly on mobile - REVERTED */
    .hero-slide img {
        /* Desktop images will scale down proportionally */
        width: 100%;
        height: auto;
        /* Revert object-fit back to contain to prevent cropping */
        object-fit: contain;
        /* Remove min-height that was causing cropping */
    }
    
    /* HIDE NAVIGATION ON MOBILE */
    .hero-nav,
    .hero-indicators {
        display: none !important;
    }
    
    /* COMPACT CHIPS WITH REDUCED SPACING - OPTIMIZED */
    .hero-chips-container {
        padding: 8px 0 4px; /* Reduced from 12px 0 6px */
        margin-top: 2px; /* Reduced from 4px */
    }
    
    .hero-chips-wrapper {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        padding: 0 10px 4px 10px;
        gap: 6px;
        
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .hero-chips-wrapper::-webkit-scrollbar {
        display: none;
    }
    
    /* SMALLER CHIPS ON MOBILE */
    .hero-chip {
        scroll-snap-align: start;
        flex-shrink: 0;
        padding: 3px 9px; /* Reduced from 4px 10px */
        font-size: 10px; /* Reduced from 11px */
        min-height: 26px; /* Reduced from 28px */
        gap: 4px; /* Reduced from 5px */
        border-width: 1px; /* Thinner border */
    }
    
    .hero-chip .chip-icon {
        font-size: 11px; /* Reduced from 12px */
        width: 12px; /* Reduced from 14px */
        height: 12px;
    }
    
    .hero-chip .chip-icon i {
        font-size: 10px; /* Reduced from 11px */
    }
    
    .hero-chip .chip-label {
        font-size: 10px; /* Ensure label matches */
    }
}

@media (max-width: 480px) {
    .hero-banner-section {
        margin: 12px auto 20px;
        padding: 0 10px;
    }
    
    .hero-banner-wrapper {
        padding: 8px;
        border-radius: 12px;
    }
    
    .hero-carousel {
        border-radius: 8px;
    }
}

@media (max-width: 360px) {
    .hero-banner-section {
        padding: 0 8px;
    }
    
    .hero-banner-wrapper {
        padding: 7px;
        border-radius: 10px;
    }
    
    .hero-carousel {
        border-radius: 7px;
    }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
.hero-chip:focus,
.hero-nav:focus,
.hero-indicator:focus {
    outline: 2px solid var(--ps-hero-chip-active);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .hero-slide,
    .hero-slide img,
    .hero-chip,
    .hero-nav {
        animation: none !important;
        transition: none !important;
    }
}

.hero-slide.loading img {
    filter: blur(8px);
    opacity: 0.6;
}

@media print {
    .hero-chips-container,
    .hero-nav,
    .hero-indicators {
        display: none;
    }
    
    .hero-banner-wrapper {
        border: 1px solid #ccc;
    }
    
    .hero-slide {
        display: block !important;
        position: relative !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
}