@charset "UTF-8";

/**
 * Modern Banner Component
 * 
 * Purpose: Modern, responsive banner display with position-based layout
 * Features:
 * - Position-based display (Slider Right First/Second, Slider Bottom)
 * - Modern card design
 * - Smooth hover effects
 * - 100% responsive
 * 
 * @version 1.0.0
 * @date 2026-01-25
 */

/* ============================================================
   HOME HERO SECTION (Left Banners | Slider | Right Banners)
   ============================================================ */

.nx-home-hero-section {
    padding: 2rem 0;
    background: #fafafa;
}

.nx-home-hero-section .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.nx-home-hero-wrapper {
    display: grid;
    gap: 1.5rem;
    align-items: stretch;
    min-height: 400px;
}

/* Dynamic Grid Layout Based on Banner Presence */
/* Scenario 1: Left + Slider + Right */
.nx-home-hero-wrapper {
    grid-template-columns: 1fr;
}

.nx-home-hero-section.has-side-banners .nx-home-hero-wrapper {
    grid-template-columns: 28% 1fr 28%;
}

/* Scenario 2: Only Right Banners */
.nx-home-hero-section.nx-slider-left-expanded .nx-home-hero-wrapper {
    grid-template-columns: 1fr 28%;
}

/* Scenario 3: Only Left Banners */
.nx-home-hero-section.nx-slider-right-expanded .nx-home-hero-wrapper {
    grid-template-columns: 28% 1fr;
}

/* Scenario 4: No Side Banners - Full Width */
.nx-home-hero-section.nx-full-width-slider .nx-home-hero-wrapper {
    grid-template-columns: 1fr;
}

.nx-home-slider-col {
    width: 100%;
    min-height: 400px;
    height: 100%;
    display: flex;
    align-items: stretch;
}

.nx-home-banner-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    height: 100%;
    align-items: stretch;
}

.nx-banner-col-left,
.nx-banner-col-right {
    min-height: 400px;
    height: 100%;
    align-self: stretch;
    display: flex;
    flex-direction: column;
}

/* Side Banner Cards - Equal Height Distribution */
.nx-banner-side {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
}

/* When 1 banner: size by aspect-ratio 345×400 */
.nx-home-banner-col:has(.nx-banner-side:only-child) .nx-banner-side {
    flex: 0 0 auto;
    height: auto;
    width: 100%;
}

/* When 2 banners: each sizes by aspect-ratio 868×476 */
.nx-home-banner-col:has(.nx-banner-side:nth-child(2)) .nx-banner-side {
    flex: 0 0 auto;
    height: auto;
    width: 100%;
}

/* Small devices (< 768px): Slider first, then ONE row with auto-slider for ALL banners */
@media (max-width: 767px) {
    .nx-home-hero-section .nx-home-hero-wrapper {
        grid-template-columns: 1fr !important;
        gap: 1rem;
        display: flex !important;
        flex-direction: column !important;
        min-height: 0; /* no extra space below slider; height = content */
    }
    
    /* Slider always comes first, full width; height from slider content only */
    .nx-home-slider-col {
        order: 1 !important;
        width: 100% !important;
        min-height: 0;
        height: auto;
    }
    
    /* Hide desktop left/right banner columns on mobile; all banners move to mobile slider */
    .nx-home-banner-col.nx-banner-col-left,
    .nx-home-banner-col.nx-banner-col-right {
        display: none !important;
    }
    
    /* Hide desktop bottom banner section on mobile (shown in mobile slider instead) */
    .nx-banner-section.nx-desktop-bottom-banners {
        display: none !important;
    }
}

/* ============================================================
   MOBILE BANNERS: one row, horizontal auto-slider (left + right + bottom)
   ============================================================ */

.nx-mobile-banners-outer {
    display: none;
    padding: 0.75rem 0 1rem;
    background: #fafafa;
    width: 100%;
    overflow: hidden;
}

.nx-mobile-banners-container {
    width: 100%;
    padding: 0 0.5rem;
}

.nx-mobile-banners-row {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 0.5rem;
}
.nx-mobile-banners-row::-webkit-scrollbar {
    display: none;
}

.nx-mobile-banner-slide {
    flex: 0 0 85%;
    min-width: 85%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: block;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
}

.nx-mobile-banner-slide .nx-banner-image-wrapper {
    width: 100%;
    aspect-ratio: 4 / 2; /* Taller on small device (was 16/9) */
    padding-top: 0 !important;
    flex: none;
    margin: 0;
    border-radius: 12px;
}

.nx-mobile-banner-slide .nx-banner-image-wrapper img {
    object-fit: cover;
    object-position: center;
}

@media (max-width: 767px) {
    .nx-mobile-banners-outer {
        display: block;
    }
}

@media (min-width: 768px) {
    .nx-mobile-banners-outer {
        display: none !important;
    }
}

/* Medium devices and above (>= 768px): Show banners in two rows, one column */
@media (min-width: 768px) {
    .nx-home-banner-col {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nx-banner-side {
        flex: 1 1 0;
        width: 100%;
        max-width: 100%;
    }
    
    /* When 1 banner: takes 100% height */
    .nx-home-banner-col:has(.nx-banner-side:only-child) .nx-banner-side {
        flex: 1 1 100%;
        height: 100%;
    }
    
    /* When 2 banners: each takes 50% height */
    .nx-home-banner-col:has(.nx-banner-side:nth-child(2)) .nx-banner-side {
        flex: 1 1 calc(50% - 0.5rem);
        height: calc(50% - 0.5rem);
    }
}

@media (max-width: 768px) {
    .nx-home-hero-section {
        padding: 1.5rem 0;
    }
    
    .nx-home-banner-col {
        flex-direction: column !important;
        width: 100%;
    }
    
    .nx-banner-side {
        flex: 1 1 100% !important;
        min-height: 200px;
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 1rem;
    }
    
    .nx-banner-side:last-child {
        margin-bottom: 0;
    }
    
    .nx-home-slider-col {
        min-height: 300px;
    }
}

/* ============================================================
   BANNER SECTION (Bottom Banners)
   ============================================================ */

.nx-banner-section {
    padding-top: 0;
    padding-bottom: 2rem;
    background: #fafafa;
}

.nx-banner-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ============================================================
   SIDE BANNER IMAGE WRAPPER (Left/Right Columns)
   ============================================================ */

/* Side Banner Image Wrapper - Dynamic dimensions (345×400 or 868×476) */
.nx-banner-side .nx-banner-image-wrapper {
    flex: 1 1 0;
    min-height: 0;
    position: relative;
    width: 100%;
    padding-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: transparent;
}

/* 1 side banner: perfect slot 345×400 — aspect-ratio drives responsive height */
.nx-home-banner-col:has(.nx-banner-side:only-child) .nx-banner-side .nx-banner-image-wrapper {
    height: auto;
    flex: none;
    aspect-ratio: 345 / 400;
}

/* 2 side banners: each slot 868×476 */
.nx-home-banner-col:has(.nx-banner-side:nth-child(2)) .nx-banner-side .nx-banner-image-wrapper {
    height: auto;
    flex: none;
    aspect-ratio: 868 / 476;
}

.nx-banner-side .nx-banner-image-wrapper picture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* object-fit: cover supports any image size; different sizes still look good */
.nx-banner-side .nx-banner-image-wrapper img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    max-width: 100%;
    max-height: 100%;
}

@media (max-width: 991px) {
    /* Keep aspect-ratios on tablet; wrapper stays responsive */
    .nx-home-banner-col:has(.nx-banner-side:only-child) .nx-banner-side .nx-banner-image-wrapper {
        aspect-ratio: 345 / 400;
    }
    .nx-home-banner-col:has(.nx-banner-side:nth-child(2)) .nx-banner-side .nx-banner-image-wrapper {
        aspect-ratio: 868 / 476;
    }
}

.nx-banner-slider-right {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 991px) {
    .nx-banner-slider-right {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* ============================================================
   SLIDER BOTTOM BANNERS (Position 3) - Dynamic Spacing
   ============================================================ */

.nx-banner-slider-bottom {
    display: grid;
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* 1 Banner: full width — dimension 1152×196 */
.nx-banner-slider-bottom.nx-banner-bottom-one {
    grid-template-columns: minmax(0, 1fr);
}
.nx-banner-slider-bottom.nx-banner-bottom-one .nx-banner-image-wrapper {
    aspect-ratio: 1152 / 196;
    flex: 0 0 auto;
    width: 100%;
    min-height: 120px; /* fallback if aspect-ratio not supported */
    padding-top: 0 !important;
}

/* 2 Banners: half each — dimension 568×196 each */
.nx-banner-slider-bottom.nx-banner-bottom-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.nx-banner-slider-bottom.nx-banner-bottom-two .nx-banner-image-wrapper {
    aspect-ratio: 568 / 196;
    flex: 0 0 auto;
    width: 100%;
    min-height: 80px;
    padding-top: 0 !important;
}

/* 3 Banners: third each — dimension 384×196 each */
.nx-banner-slider-bottom.nx-banner-bottom-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.nx-banner-slider-bottom.nx-banner-bottom-three .nx-banner-image-wrapper {
    aspect-ratio: 384 / 196;
    flex: 0 0 auto;
    width: 100%;
    min-height: 60px;
    padding-top: 0 !important;
}

/* Bottom banner cards - height comes from image wrapper aspect-ratio */
.nx-banner-slider-bottom .nx-banner-card {
    min-height: 0;
    height: auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Prevent collapse: size by aspect-ratio, do not shrink (flex: 0 0 auto) */
.nx-banner-slider-bottom .nx-banner-image-wrapper {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

@media (max-width: 991px) {
    .nx-banner-slider-bottom.nx-banner-bottom-three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .nx-banner-slider-bottom.nx-banner-bottom-three .nx-banner-image-wrapper {
        aspect-ratio: 568 / 196;
    }
}

@media (max-width: 576px) {
    .nx-banner-slider-bottom {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 0.5rem;
    }
    .nx-banner-slider-bottom.nx-banner-bottom-one .nx-banner-image-wrapper,
    .nx-banner-slider-bottom.nx-banner-bottom-two .nx-banner-image-wrapper,
    .nx-banner-slider-bottom.nx-banner-bottom-three .nx-banner-image-wrapper {
        aspect-ratio: 1152 / 196;
    }
}

/* ============================================================
   BANNER CARD - UNIQUE STYLE
   ============================================================ */

.nx-banner-card {
    position: relative;
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: none;
    border: none;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
    isolation: isolate;
    min-height: 200px;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* No hover effect on banner */
.nx-banner-card:hover {
    /* same as default – no transform or visual change */
}

.nx-banner-card:nth-child(1) { animation-delay: 0.1s; }
.nx-banner-card:nth-child(2) { animation-delay: 0.2s; }
.nx-banner-card:nth-child(3) { animation-delay: 0.3s; }
.nx-banner-card:nth-child(n+4) { animation-delay: 0.4s; }

.nx-banner-card::before {
    display: none;
}

.nx-banner-card:hover::before {
    display: none;
}

.nx-banner-card:hover .nx-banner-image-wrapper {
    /* no hover effect */
}

.nx-banner-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
    z-index: 1;
}

.nx-banner-card:hover::after {
    opacity: 0;
    background: transparent;
}

/* ============================================================
   BANNER IMAGE
   ============================================================ */

.nx-banner-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio - default for bottom banners */
    overflow: hidden;
    background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 50%, #fafafa 100%);
    isolation: isolate;
    border-radius: 18px;
    margin: 2px;
    z-index: 1;
}

/* Bottom banners: height from aspect-ratio (see .nx-banner-bottom-one/two/three) */
.nx-banner-slider-bottom .nx-banner-image-wrapper {
    padding-top: 0 !important;
    position: relative;
    height: auto;
}

.nx-banner-slider-bottom .nx-banner-card:hover .nx-banner-image-wrapper::after {
    display: none;
}

/* Side banners (left/right) use height-based sizing, not padding-top */
.nx-banner-side .nx-banner-image-wrapper {
    padding-top: 0 !important;
    height: 100%;
    margin: 0;
    border-radius: 18px;
    background: transparent;
}

@media (max-width: 991px) {
    .nx-banner-side .nx-banner-image-wrapper {
        padding-top: 56.25% !important; /* 16:9 on tablet/mobile */
        height: auto;
        position: relative;
    }
}

.nx-banner-image-wrapper picture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* cover = any image size fills slot; supports different dimensions */
.nx-banner-image-wrapper img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    max-width: 100%;
    max-height: 100%;
    filter: brightness(1) contrast(1) saturate(1);
}

.nx-banner-card:hover .nx-banner-image-wrapper img,
.nx-banner-side:hover .nx-banner-image-wrapper img {
    /* no hover effect on banner image */
}

/* ============================================================
   LOADING STATE
   ============================================================ */

.nx-banner-image-wrapper img[data-src] {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.nx-banner-image-wrapper img[src]:not([data-src]),
.nx-banner-image-wrapper img.loaded {
    opacity: 1;
}

.nx-banner-image-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: translateX(-100%);
    animation: shimmer 2s infinite;
    z-index: 1;
    pointer-events: none;
}

.nx-banner-image-wrapper img.loaded ~ ::after,
.nx-banner-image-wrapper img[src]:not([data-src]) ~ ::after {
    animation: none;
    opacity: 0;
}

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

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gradient-shift {
    0% {
        background-position: 0% center;
    }
    50% {
        background-position: 100% center;
    }
    100% {
        background-position: 0% center;
    }
}

/* Additional smooth hover effects */
.nx-banner-card {
    will-change: transform, background;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Smooth image transitions (no hover; kept for potential JS/animation) */
.nx-banner-image-wrapper img {
    transition: none;
}

@keyframes gradient-rotate {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */

@media (max-width: 768px) {
    .nx-banner-section {
        padding-top: 0;
        padding-bottom: 1.5rem;
    }
    
    .nx-banner-container {
        padding: 0 1rem;
    }
    
    .nx-banner-card {
        border-radius: 12px;
        min-height: 180px;
    }
    
    .nx-banner-image-wrapper {
        padding-top: 50%;
    }
}

@media (max-width: 576px) {
    .nx-banner-section {
        padding-top: 0;
        padding-bottom: 1rem;
    }
    
    .nx-banner-container {
        padding: 0 0.75rem;
    }
    
    .nx-banner-card {
        border-radius: 8px;
        min-height: 150px;
    }
    
    .nx-banner-image-wrapper {
        padding-top: 45%;
    }
    
    .nx-banner-side .nx-banner-image-wrapper {
        min-height: 150px;
    }
}

/* ============================================================
   PERFORMANCE OPTIMIZATIONS
   ============================================================ */

.nx-banner-card {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.nx-banner-image-wrapper img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .nx-banner-card,
    .nx-banner-image-wrapper img {
        transition: none !important;
        animation: none !important;
    }
    
    .nx-banner-card {
        opacity: 1 !important;
        transform: none !important;
    }
}
