﻿/* detail-modal.css */
.car-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 2000;
    overflow-y: auto;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    scroll-behavior: smooth;
}

.car-detail-overlay.active {
    display: block;
    opacity: 1;
}

/* STICKY HEADER */
/* STICKY HEADER */
.detail-header {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    /* Ensure sticky works within the overlay scrolling context */
    position: -webkit-sticky;
}

.header-left .header-car-name {
    font-size: 16px;
    font-weight: 800;
    color: #444;
    text-transform: uppercase;
}

.header-nav {
    display: flex;
    gap: 30px;
    height: 100%;
}

.nav-item {
    display: flex;
    align-items: center;
    height: 100%;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    text-decoration: none;
    text-transform: uppercase;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-blue, #004d99);
    border-bottom-color: var(--primary-blue, #004d99);
}

.header-right .close-btn-header {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #6d6d6d;
    background: transparent;
    font-size: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: 0.2s;
}

.header-right .close-btn-header:hover {
    background: #f0f0f0;
    color: #333;
}

/* HERO SECTION */
.detail-hero {
    position: relative;
    width: 100%;
    height: 80vh;
    /* Taller hero */
    min-height: 500px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    /* Align content to bottom */
    color: white;
}

.detail-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 70%, rgba(0, 0, 0, 0.9) 100%);
}

.hero-content {
    position: relative;
    z-index: 10;
    padding: clamp(20px, 4vw, 60px);
    max-width: 1400px;
    /* Allow wider on large screens */
    width: 100%;
    margin: 0 auto;
}

.hero-title {
    font-size: 32px;
    /* Fallback */
    font-size: clamp(24px, 4vw, 72px);
    /* Responsive Scaling */
    font-weight: 800;
    margin: 0 0 16px 0;
    margin-bottom: clamp(12px, 2vw, 32px);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
    line-height: 1.1;
}

.hero-description {
    font-size: 14px;
    /* Fallback */
    font-size: clamp(14px, 1.25vw, 22px);
    margin-bottom: clamp(16px, 3vw, 40px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.hero-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 30px;
}

.hero-btn {
    padding: 12px 28px;
    padding: clamp(10px, 0.8vw, 18px) clamp(20px, 1.5vw, 40px);
    border-radius: 4px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-size: clamp(13px, 1vw, 20px);
    transition: transform 0.2s;
}

.hero-btn:active {
    transform: scale(0.96);
}

.hero-primary {
    background: #0056b3;
    color: white;
}

.hero-outline {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
}

.hero-footer-info {
    display: flex;
    gap: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 20px;
    max-width: 600px;
}


.info-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 4px;
}

.info-value {
    font-size: 18px;
    font-weight: 800;
    color: white;
}


/* MAIN CONTENT CONTAINER */
.detail-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    color: #333;
}

/* Sections padding for scroll to work nicely with sticky header */
.detail-section {
    scroll-margin-top: 80px;
    /* Offset for sticky header */
    padding-top: 60px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f5f5f5;
}

/* TOP SPLIT: Image + Pricing */
.detail-top-section {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 60px;
}

/* Left: Car Viewer */
.car-viewer {
    text-align: center;
}

.car-main-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 400px;
    margin-bottom: 20px;
}

.color-picker {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.color-option {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px #ddd;
    cursor: pointer;
    transition: transform 0.2s;
}

.color-option.active {
    transform: scale(1.2);
    box-shadow: 0 0 0 2px var(--primary-blue);
}

/* Right: Pricing Table */
.pricing-panel {
    border-top: 4px solid var(--primary-blue);
}

.panel-header {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 20px;
    text-transform: uppercase;
    padding-top: 10px;
}

.version-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    /* Remove bottom margin to fit in frame */
}

.version-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #eee;
}

.version-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.version-row:hover {
    background-color: #f8f9fa;
}

.version-row.active {
    background-color: #e6f0fa;
    border-left: 3px solid var(--primary-blue);
}

.v-name {
    font-weight: 600;
    color: #333;
}

.v-price {
    font-weight: 700;
    color: var(--primary-blue);
    text-align: right;
}

.panel-actions {
    display: flex;
    gap: 12px;
}

.full-width-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary-blue);
    color: white;
    border: none;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
}

/* SECTIONS */
.section-title {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 30px;
    text-transform: uppercase;
}

.features-content {
    font-size: 15px;
    line-height: 1.6;
    color: #555;
}

/* GALLERY GRID */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.gallery-item {
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #eee;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* RESPONSIVE */
.responsive-hide {
    display: none;
}

@media (max-width: 900px) {
    .detail-top-section {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .detail-hero {
        height: 50vh;
    }

    .hero-title {
        font-size: 32px;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-header {
        padding: 0 16px;
        overflow-x: auto;
    }

    .header-nav {
        gap: 16px;
    }

    .nav-item {
        font-size: 12px;
        white-space: nowrap;
    }
}

/* UPDATED PRICING PANEL */
.pricing-panel {
    border-top: none;
    /* Remove blue top border */
}

.panel-header {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    /* Dark color instead of blue */
    margin-bottom: 20px;
    text-transform: none;
    /* Normal case */
    padding-top: 0;
}

/* Version List */
.version-list {
    display: block;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 0;
    margin-bottom: 24px;
    background: #fff;
    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.version-list::-webkit-scrollbar {
    width: 6px;
}

.version-list::-webkit-scrollbar-track {
    background: transparent;
}

.version-list::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 20px;
}

.version-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.vc-name {
    font-weight: 700;
    color: #444;
    font-size: 14px;
}

.vc-price {
    font-weight: 700;
    color: var(--primary-blue);
    font-size: 15px;
}

/* Specs List */
.specs-list {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-top: 12px;
    border-top: 1px solid #f5f5f5;
    white-space: nowrap;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.spec-left {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
}

.spec-icon {
    width: 18px;
    height: 18px;
    fill: #004b9b;
    /* Icon color */
}

.spec-right {
    font-weight: 600;
    color: #333;
    text-align: right;
}

/* New Action Buttons */
.panel-actions-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.action-btn {
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.btn-outline {
    background: white;
    border: 1px solid #004b9b;
    color: #004b9b;
}

.btn-outline:hover {
    background: #f0f7ff;
}

.btn-solid {
    background: #004b9b;
    color: white;
    border: none;
    padding: 14px;
    font-size: 15px;
}

.btn-solid:hover {
    background: #003366;
}

/* === 360 VIEWER & COLOR SELECTOR STYLES === */

/* Mode Toggles */
.ecat-mode-button {
    padding: 8px 16px;
    margin: 0 5px;
    border: 1px solid #ccc;
    background-color: #f8f9fa;
    color: #333;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.ecat-mode-button:hover {
    background-color: #e9ecef;
    border-color: #bbb;
}

.ecat-mode-button.active {
    background-color: #004b9b;
    color: #fff;
    border-color: #004b9b;
}

/* Color Buttons */
.ecat-color-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 2px solid #ddd;
    border-radius: 20px;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    background: #f9f9f9;
    margin: 4px;
    font-size: 13px;
    color: #333;
}

.ecat-color-button:hover {
    border-color: #004b9b;
}

.ecat-color-button.active {
    border-color: #004b9b !important;
    box-shadow: 0 0 0 4px rgba(0, 75, 155, 0.2) !important;
    transform: scale(1.15) !important;
    z-index: 5;
    background-color: transparent !important;
    /* Ensure bg doesn't look weird on round icon */
}

.ecat-color-button img,
.ecat-color-button .swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #ccc;
    object-fit: cover;
    display: block;
}

/* Unified Display Area */
#ecat-unified-display-area {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    border: 1px solid #eee;
}

#ecat-unified-display-area img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 360 Viewer specific */
/* Fullscreen White Background Override */
.viewer-360-wrapper:-webkit-full-screen,
.viewer-360-wrapper:fullscreen {
    background-color: white !important;
}

.viewer-360-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.viewer-360-container {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    user-select: none;
    cursor: grab;
}

.viewer-360-container.grabbing {
    cursor: grabbing;
}

.viewer-360-podium {
    position: absolute;
    bottom: 12%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 15%;
    background-image: url('https://scaleflex.cloudimg.io/v7/plugins/js-cloudimage-360-view/assets/img/360.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 1;
    opacity: 0.7;
    transition: opacity 0.3s ease-in-out;
}

.viewer-360-podium.hidden {
    opacity: 0;
}

.viewer-360-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #ccc;
    color: #333;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, box-shadow 0.2s;
    backdrop-filter: blur(2px);
    border: none;
}

.viewer-360-nav:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.viewer-360-prev {
    left: 10px;
}

.viewer-360-next {
    right: 10px;
}

/* 360 Controls (Magnify, Fullscreen) */
.viewer-360-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    display: flex;
    gap: 8px;
}

.viewer-360-button {
    width: 32px;
    height: 32px;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    background-size: 60%;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-color 0.2s;
}

.viewer-360-button:hover {
    background-color: #fff;
}

.viewer-360-magnify-button {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23333"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
}

.viewer-360-fullscreen-button {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23333"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
}

/* Magnifier Lens */
.magnifier-lens {
    position: absolute;
    border: 2px solid #004b9b;
    border-radius: 50%;
    width: 150px;
    height: 150px;
    cursor: crosshair;
    display: none;
    z-index: 4;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(1px);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}


/* Spec List Styles */
/* Spec List Styles */
.detail-specs-list {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.spec-item {
    display: flex;
    align-items: center;
    padding: 0;
    border: none;
    gap: 8px;
}

.spec-left {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
}

.spec-icon {
    width: 20px;
    height: 20px;
    fill: #999;
}

.spec-icon svg {
    width: 100%;
    height: 100%;
}

.spec-right {
    font-weight: 600;
    color: #333;
}

/* CAROUSEL STYLES */
.ecat-carousel-container {
    position: relative;
    margin-top: 15px;
    padding: 0 30px;
    /* Space for arrows */
}

.ecat-carousel-track-wrapper {
    overflow: hidden;
    width: 100%;
}

.ecat-carousel-track {
    display: flex;
    gap: 10px;
    transition: transform 0.3s ease-in-out;
}

.ecat-carousel-item {
    flex: 0 0 80px;
    /* Width of thumbnail */
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
}

.ecat-carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ecat-carousel-item:hover {
    opacity: 1;
}

.ecat-carousel-item.active {
    border-color: #004b9b;
    opacity: 1;
    transform: scale(1.05);
}

.ecat-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 20px;
    color: #004b9b;
    cursor: pointer;
    z-index: 2;
    padding: 0;
    width: 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ecat-carousel-nav:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.ecat-carousel-nav.prev {
    left: 0;
}

.ecat-carousel-nav.next {
    right: 0;
}

/* ACTION BAR STYLES */
.ecat-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #eee;
}

.btn-action-view360,
.btn-action-brochure {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-action-view360 {
    background: white;
    color: #333;
    border-color: #ddd;
}

.btn-action-view360.active {
    background: #e6f0ff;
    color: #004b9b;
    border-color: #004b9b;
}

.btn-action-brochure {
    background: #004b9b;
    color: white;
}

.btn-action-brochure:hover {
    background: #003366;
}

.btn-nav-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 1px solid #ddd;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 18px;
}

.btn-nav-circle:hover {
    background: #f0f0f0;
    color: #004b9b;
    border-color: #004b9b;
}

/* Update Carousel: Restore arrows padding */
.ecat-carousel-container {
    padding: 0 30px;
    margin-top: 10px;
    position: relative;
}

.ecat-carousel-nav.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* MOBILE OPTIMIZATIONS (<= 767px for phones. iPad/Desktop >= 768px get full nav) */
@media (max-width: 767px) {

    /* Header Compact */
    .detail-header {
        height: 60px !important;
        /* Increased height for better spacing */
        padding: 10px 10px 8px 10px !important;
        /* Added bottom padding */
        align-items: flex-start !important;
        /* Align items to top */
    }

    /* Hide long nav links strictly */
    .header-nav {
        display: none !important;
    }

    /* Smaller Title/Name */
    .header-left .header-car-name {
        font-size: 12px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 160px;
    }

    .header-right .close-btn-header {
        width: 30px !important;
        height: 30px !important;
        font-size: 18px !important;
        margin-top: 0;
        /* Align with top padding */
    }

    /* Hero Section Super Compact */
    .detail-hero {
        min-height: unset !important;
    }

    .hero-content {
        padding: 12px !important;
        width: 100% !important;
    }

    .hero-title {
        font-size: 16px !important;
        /* Reduced from 20 to 16 */
        margin-bottom: 4px !important;
        line-height: 1.2;
    }

    .hero-description {
        font-size: 11px !important;
        /* Reduced from 12 to 11 */
        margin-bottom: 8px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        max-height: 28px !important;
        line-height: 1.3 !important;
    }

    .hero-actions {
        gap: 6px !important;
        width: 100%;
        display: flex;
        margin-bottom: 0 !important;
    }

    .hero-btn {
        padding: 6px 10px !important;
        font-size: 11px !important;
        /* Reduced */
        flex: 1;
        white-space: nowrap;
        height: 32px;
        /* Reduced height */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Adjust Layouts */
    .detail-container {
        padding: 10px !important;
    }

    .detail-section {
        margin-bottom: 12px !important;
        padding: 12px !important;
    }

    .detail-top-section {
        flex-direction: column !important;
    }

    /* Ensure other elements don't overflow */
    .ecat-carousel-container {
        padding: 0 10px !important;
    }
}

/* Visibility Enhancements for Video Background */
.hero-title,
.hero-description {
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8), 0 1px 3px rgba(0, 0, 0, 0.6);
}

.hero-btn {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* --- LIGHTBOX / GALLERY VIEWER (SMOOTH SLIDER) --- */
.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    touch-action: none;
}

.gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* Header */
.lightbox-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 20px;
    z-index: 10002;
}

.lightbox-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Slider Track */
.lightbox-slider-area {
    flex: 1;
    position: relative;
    width: 100%;
    overflow: hidden;
}

.lightbox-track {
    display: flex;
    height: 100%;
    /* 3 Panels: Left (Prev), Center (Curr), Right (Next) */
    width: 300%;
    position: absolute;
    left: -100%;
    /* Start focused on Center */
    top: 0;
}

.lightbox-slide {
    width: 33.333%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 10px;
    /* Small padding */
}

.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    /* Let touch pass to container */
}

/* Controls */
.lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    font-size: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    backdrop-filter: blur(2px);
}

.lightbox-btn:hover {
    background: #004b9b;
    /* Brand */
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* Counter */
.lightbox-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
    z-index: 10002;
}

@media (max-width: 768px) {
    .lightbox-btn {
        display: none;
    }

    /* Swipe only on mobile */
    .lightbox-close {
        top: 15px;
        right: 15px;
    }
}

/* Load More Brand Update */
.btn-load-more {
    grid-column: 1 / -1;
    margin: 20px auto;
    padding: 12px 40px;
    background: white;
    border: 1px solid #004b9b;
    color: #004b9b;
    border-radius: 4px;
    /* Matches Brand Style */
    cursor: pointer;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 13px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-load-more:hover {
    background: #004b9b;
    color: white;
    box-shadow: 0 4px 8px rgba(0, 75, 155, 0.2);
}

/* Lightbox Spinner */
.lightbox-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -20px;
    margin-left: -20px;
    animation: lb-spin 0.8s infinite linear;
    z-index: 10;
    display: none;
    /* Hidden by default */
}

@keyframes lb-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Review Video Grid */
/* Review Video Grid - Dynamic Viewport Logic */
.review-grid {
    display: grid;
    gap: 20px;
    margin-top: 20px;
    /* Default: Portrait / Mobile -> Single Column */
    grid-template-columns: 1fr;
}

/* Landscape Mode (Width > Height) -> Multi Column */
@media (orientation: landscape) {
    .review-grid.cols-2 {
        grid-template-columns: 1fr 1fr;
    }

    .review-grid.cols-3 {
        grid-template-columns: 1fr 1fr 1fr;
    }

    /* Ensure even on small landscape phones it flows well, maybe limit? 
       But user asked for width > height -> 3 cols. So we keep it simple. */
}

/* QR Code Modal */
.modal-qr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

.modal-qr-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-qr-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-qr-overlay.active .modal-qr-content {
    transform: translateY(0);
}

.close-qr-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.close-qr-btn:hover {
    color: #333;
}

.qr-header h3 {
    margin: 0 0 8px 0;
    color: var(--primary-blue, #004b9b);
    font-size: 20px;
    font-weight: 700;
}

.qr-header p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

#qrcode-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

#qrcode-container img {
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 8px;
}

.qr-footer p {
    margin: 0;
    font-size: 13px;
    color: #888;
}

.qr-footer a {
    color: var(--primary-blue, #004b9b);
    text-decoration: underline;
    font-weight: 600;
}

/* --- SIMILAR CARS LAYOUT --- */
.similar-cars-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    padding-bottom: 20px;
    /* Default spacing */
}

/* Default card width on large screens */
.similar-card-item {
    width: 300px;
    max-width: 100%;
}

/* Mobile Carousel Logic */
@media (max-width: 768px) {
    .similar-cars-container {
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;

        /* Enable scroll snapping */
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        /* Smooth scrolling on iOS */

        /* Spacing for scrollbar and swipe comfort */
        padding-left: 20px;
        padding-right: 20px;
        margin-left: -10px;
        /* Slight breakout alignment adjust if needed */
        margin-right: -10px;
        width: calc(100% + 20px);

        /* Hide Scrollbar visually but allow scroll */
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE 10+ */
    }

    .similar-cars-container::-webkit-scrollbar {
        width: 0px;
        background: transparent;
        /* Chrome/Safari/Webkit */
    }

    .similar-card-item {
        /* Fixed width for carousel items so they don't shrink */
        flex: 0 0 auto;
        width: 280px;

        /* Snap alignment */
        scroll-snap-align: center;

        margin-bottom: 10px;
        /* Shadow clearance */
    }
}

/* Disable Hover Effects for Similar Cars */
.similar-card-item:hover {
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

.similar-card-item:hover .card-img {
    transform: none !important;
}