/* Banner Section */

/* Skeleton Loader for instant perceived performance */
.banner-skeleton {
    width: 100%;
    height: 45rem;
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.05) 25%, 
        rgba(255,255,255,0.1) 50%, 
        rgba(255,255,255,0.05) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.banner-skeleton.hidden {
    display: none;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* --- Desktop View --- */
@media (min-width: 769px) {
    .banner-section {
        margin-top: 5rem;
        overflow: hidden;
        height: 45rem; /* Increased from 30rem to 50rem for more prominent banner */
        position: relative;
        clip-path: polygon(
            0% 0%, 0% 97%, 55% 97%, 58% 100%, 100% 100%, 100% 3%, 53% 3%, 50% 0%
        );
    }

    .banner-slider-container, .banner-slider {
        width: 100%;
        height: 100%;
    }

    .banner-slider .banner-item {
        list-style-type: none;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-position: center;
        background-size: cover;
        transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
        transform: translateZ(0); /* Force GPU layer */
        will-change: transform, opacity; /* Hint browser optimization */
        backface-visibility: hidden; /* Prevent flickering */
        opacity: 0; /* Start invisible */
    }

    /* Smooth fade-in when image loads */
    .banner-slider .banner-item.image-loaded {
        opacity: 1;
        transition: opacity 0.6s ease-out;
    }

    /* Skeleton loading state - matches theme */
    .banner-slider .banner-item.loading {
        background-color: var(--card-background) !important;
        position: relative;
        background-size: 200% 100%;
        animation: shimmer 1.5s infinite;
    }

    @keyframes shimmer {
        0% { background-position: -200% 0; }
        100% { background-position: 200% 0; }
    }

    .banner-slider .banner-item.is-feature {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 10;
        opacity: 1;
        transform: translateX(0) translateZ(0);
        transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    }
    
    /* Special transition state for when main card is leaving */
    .banner-slider .banner-item.is-feature.transitioning-out {
        opacity: 0;
        transform: translateX(0) translateZ(0); /* Stay in place, just fade out */
        z-index: 0; /* Behind everything, including background */
        transition: opacity 0.2s ease-out; /* Faster fade-out */
    }

    .banner-slider .banner-item.is-leaving {
        opacity: 0;
        transform: translateX(-100%) translateZ(0);
        z-index: 2;
        transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    }
    
    .banner-slider .banner-item.is-entering {
        opacity: 0;
        transform: translateX(100%) translateZ(0);
        z-index: 9;
        transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    }

    #banner-background {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1;
        background-size: cover;
        background-position: center;
        background-color: var(--card-background);
        opacity: 0.7;
        filter: blur(5px);
        transition: background-image 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    }

    .banner-slider .banner-item.is-feature {
        z-index: 10;
        background: none !important;
    }

    .is-feature .banner-bubble {
        position: absolute;
        top: 50%;
        left: 5%;
        transform: translateY(-50%);
        width: 55%;
        height: 90%;
        border-radius: 20px;
        box-shadow: 0 15px 35px rgba(0,0,0,0.3);
        overflow: hidden;
        background-size: cover;
        background-position: center;
        background-color: var(--card-background);
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }

    .is-feature .banner-content {
        width: 100%;
        padding: 1.5rem 2rem;
        color: white;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 20%, transparent 100%);
        text-shadow: 0 2px 5px rgba(0,0,0,0.5);
        box-sizing: border-box;
        text-align: left;
    }

    .is-feature .banner-content .banner-title {
        font-size: 2rem;
        margin-bottom: 0.4rem;
    }

    .is-feature .banner-content .banner-description {
        margin-bottom: 0.8rem;
    }

    .is-feature .banner-content .banner-cta {
        display: inline-block;
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        background-color: var(--color-primary);
        color: var(--button-text-color);
        text-decoration: none;
        border-radius: 4px;
        transition: background-color 0.3s;
    }

    .is-feature .banner-content .banner-cta:hover {
        background-color: var(--color-primary-light);
    }

    .banner-slider .banner-item.is-preview {
        width: 200px;
        height: 250px;
        top: 50%;
        transform: translateY(-50%) translateZ(0);
        border-radius: 20px;
        border: 3px solid var(--color-primary);
        box-shadow: 0 10px 30px rgba(0,0,0,0.2);
        z-index: 5;
        opacity: 1; /* Always visible */
        will-change: transform;
    }

    .is-preview .banner-bubble {
        display: none;
    }

    .is-preview.is-preview-1 { left: 70%; }
    .is-preview.is-preview-2 { left: calc(70% + 220px); }
    .is-preview.is-preview-3 { left: calc(70% + 440px); }
    .is-preview.is-preview-4 { left: calc(70% + 660px); }
    .is-preview.is-preview-5 { left: calc(70% + 880px); }
    .is-preview.is-preview-6 { left: calc(70% + 1100px); }

    .banner-slider .banner-item.is-hidden {
        opacity: 0;
        pointer-events: none;
    }

    .banner-nav {
        position: absolute;
        bottom: 2rem;
        left: 80%;
        transform: translateX(-50%);
        z-index: 20;
        display: flex;
        gap: 1rem;
    }

    .banner-nav .btn {
        background-color: var(--color-primary);
        color: var(--button-text-color);
        width: 70px;  /* Wider for better usability */
        height: 50px;
        border-radius: 0;  /* Remove circle */
        font-size: 25px;
        cursor: pointer;
        display: flex;
        justify-content: center;
        align-items: center;
        transition: all 0.3s ease;
        position: relative;
        
        /* Subtle cyberpunk clip-path - cut corners */
        clip-path: polygon(
            12px 0%,        /* Top left cut */
            100% 0%,        /* Top right */
            100% calc(100% - 12px),  /* Bottom right cut start */
            calc(100% - 12px) 100%,  /* Bottom right cut */
            0% 100%,        /* Bottom left */
            0% 12px         /* Top left cut end */
        );
        
        /* Cyberpunk glow effect */
        box-shadow: 
            0 5px 15px rgba(0,0,0,0.3),
            0 0 15px rgba(42, 145, 208, 0.3);
    }

    .banner-nav .btn:hover {
        background-color: var(--color-primary-light);
        transform: translateY(-2px);
        
        /* Stronger glow on hover */
        box-shadow: 
            0 8px 20px rgba(0,0,0,0.4),
            0 0 25px rgba(42, 145, 208, 0.5);
    }
    
    /* Optional: Add subtle border for more tech feel */
    .banner-nav .btn::before {
        content: '';
        position: absolute;
        inset: 0;
        clip-path: inherit;
        border: 1px solid rgba(255, 255, 255, 0.1);
        pointer-events: none;
    }

    @media (max-width: 1200px) {
        .is-preview.is-preview-1 { left: 65%; }
        .is-preview.is-preview-2 { left: calc(65% + 220px); }
        .banner-slider .banner-item.is-preview-3,
        .banner-slider .banner-item.is-preview-4,
        .banner-slider .banner-item.is-preview-5,
        .banner-slider .banner-item.is-preview-6 { display: none; }
    }

    @media (max-width: 992px) {
        .is-feature .banner-bubble { width: 90%; left: 5%; }
        .banner-slider .banner-item.is-preview { display: none; }
    }

   
    /* Animation lock to prevent multiple clicks during transitions */
    .banner-slider.is-animating .banner-item {
        pointer-events: none;
    }

    [data-theme="dark"] .banner-nav .btn:hover {
        background-color: var(--color-primary);
    }

    /* Desktop loading placeholder */
    .banner-loading-placeholder-desktop {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
        overflow: hidden;
    }

    .banner-loading-placeholder-desktop .loading-shimmer {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(
            90deg,
            transparent 0%,
            rgba(255,255,255,0.6) 50%,
            transparent 100%
        );
        animation: shimmer 2s infinite;
    }
}

/* --- Mobile View --- */
@media (max-width: 768px) {
    .banner-section {
        margin-top: 3rem;
        height: 25rem; /* Fixed height for consistency */
        position: relative;
        clip-path: polygon(0% 0%, 0% 97%, 55% 97%, 58% 100%, 100% 100%, 100% 3%, 53% 3%, 50% 0%);
        overflow: hidden;
    }

    .banner-slider-container {
        height: 100%;
    }

    #banner-background, .banner-nav, .banner-slider {
        display: none; /* Hide desktop elements */
    }

    /* Mobile banner container - full size within clip-path */
    .banner-mobile-container {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
    }

    /* Main mobile banner - full size */
    .banner-main-mobile {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-size: cover;
        background-position: center;
        background-color: var(--card-background);
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
        transform: translateZ(0);
        will-change: transform;
        backface-visibility: hidden;
        opacity: 0; /* Start invisible */
    }

    /* Mobile banner smooth fade-in */
    .banner-main-mobile.image-loaded {
        opacity: 1;
        transition: opacity 0.8s ease-out;
    }

    /* Mobile loading shimmer - matches theme */
    .banner-main-mobile.loading {
        background-color: var(--card-background) !important;
        background-size: 200% 100%;
        animation: shimmer 1.5s infinite;
        position: relative;
        min-height: 400px; /* Ensure space for spinner */
    }
    
    /* Banner section container for spinner */
    .banner-section {
        position: relative;
        min-height: 400px;
    }

    /* Banner content overlay */
    .banner-content-mobile {
        padding: 2rem 1.5rem;
        background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
        color: white;
        text-shadow: 0 2px 8px rgba(0,0,0,0.7);
    }

    .banner-content-mobile .banner-title {
        font-size: 1.5rem;
        font-weight: bold;
        margin-bottom: 0.5rem;
        line-height: 1.2;
    }

    .banner-content-mobile .banner-description {
        font-size: 0.9rem;
        margin-bottom: 1rem;
        opacity: 0.9;
        line-height: 1.4;
    }

    .banner-content-mobile .banner-cta {
        display: inline-block;
        padding: 0.7rem 1.5rem;
        background-color: var(--color-primary);
        color: white;
        text-decoration: none;
        border-radius: 6px;
        font-weight: 500;
        font-size: 0.9rem;
        transition: background-color 0.3s ease;
    }

    .banner-content-mobile .banner-cta:hover {
        background-color: var(--color-primary-light);
    }

    /* Transparent edge hints for swipe indication */
    .banner-swipe-hint {
        position: absolute;
        top: 0;
        bottom: 0;
        width: 30px;
        pointer-events: none;
        z-index: 20;
    }

    .banner-swipe-hint-left {
        left: 0;
        background: linear-gradient(to right, rgba(255,255,255,0.1) 0%, transparent 100%);
    }

    .banner-swipe-hint-right {
        right: 0;
        background: linear-gradient(to left, rgba(255,255,255,0.1) 0%, transparent 100%);
    }

    /* Hide old mobile elements */
    #banner-background-mobile,
    .banner-bubble-mobile,
    .banner-previews-scroller-mobile,
    .banner-animation-clone,
    .banner-preview-card-mobile {
        display: none;
    }

    /* Mobile navigation arrows */
    .banner-nav-mobile {
        position: absolute;
        bottom: 1.5rem;
        right: 1.5rem;
        display: flex;
        gap: 0.8rem;
        z-index: 25;
    }

    .banner-nav-mobile button {
        width: 45px;
        height: 45px;
        border-radius: 50%;
        background: rgba(0,0,0,0.4);
        border: 2px solid rgba(255,255,255,0.2);
        color: white;
        font-size: 18px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        backdrop-filter: blur(10px);
        opacity: 0.7;
    }

    .banner-nav-mobile button:hover {
        background: rgba(0,0,0,0.6);
        border-color: var(--color-primary);
        transform: scale(1.05);
        opacity: 1;
    }

    .banner-nav-mobile button:active {
        transform: scale(0.95);
    }

    /* Progress indicator dots */
    .banner-dots-mobile {
        position: absolute;
        bottom: 0.5rem;
        right: 1.5rem;
        display: flex;
        gap: 0.5rem;
        z-index: 25;
    }

    .banner-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: rgba(255,255,255,0.4);
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .banner-dot.active {
        background: var(--color-primary);
        transform: scale(1.2);
    }

    .banner-dot:hover {
        background: rgba(255,255,255,0.7);
    }

    /* Loading placeholders for better UX */
    .banner-loading-placeholder {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
        border-radius: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }

    .loading-shimmer {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(
            90deg,
            transparent 0%,
            rgba(255,255,255,0.4) 50%,
            transparent 100%
        );
        animation: shimmer 2s infinite;
    }

    .loading-content {
        padding: 2rem 1.5rem;
        background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
    }

    .loading-title {
        width: 60%;
        height: 1.5rem;
        background: rgba(255,255,255,0.3);
        border-radius: 4px;
        margin-bottom: 0.5rem;
        animation: pulse 1.5s ease-in-out infinite alternate;
    }

    .loading-description {
        width: 80%;
        height: 0.9rem;
        background: rgba(255,255,255,0.2);
        border-radius: 4px;
        margin-bottom: 1rem;
        animation: pulse 1.5s ease-in-out infinite alternate;
        animation-delay: 0.2s;
    }

    .loading-cta {
        width: 120px;
        height: 2.5rem;
        background: rgba(255,255,255,0.4);
        border-radius: 6px;
        animation: pulse 1.5s ease-in-out infinite alternate;
        animation-delay: 0.4s;
    }

    @keyframes shimmer {
        0% { transform: translateX(-100%); }
        100% { transform: translateX(100%); }
    }

    @keyframes pulse {
        0% { opacity: 0.6; }
        100% { opacity: 1; }
    }

    .banner-error-state {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        text-align: center;
        color: #666;
        font-size: 0.9rem;
    }
}
