/* LIGHTBOX (GLOBAL & PRODUCTS) */
.product-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    /* Dark overlay */
    z-index: 10000;
    /* Topmost */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(5px);
}

.product-lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* LIGHTBOX CONTENT STYLES */
.lightbox-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 60px;
    min-height: 80vh;
    width: 90%;
    background: #fff;
    /* Ensure content has background */
    padding: 40px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.lightbox-left {
    flex: 1;
}

.lightbox-left img {
    flex: 1.2;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    /* Stack image and thumbs */
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lb-main-img-wrapper {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#lb-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.lb-thumbnails {
    width: 100%;
    height: 80px;
    margin-top: 15px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 5px 0;
    justify-content: center;
    /* Center initially */
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.lb-thumb {
    height: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    cursor: pointer !important;
    opacity: 0.5;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    z-index: 100;
}

.lb-thumb:hover,
.lb-thumb.active {
    opacity: 1;
    border-color: #333;
    transform: scale(1.05);
}

.lightbox-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 0;
}

.lb-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 3.5rem;
    margin-bottom: 20px;
    color: #111;
}

.lb-desc {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #555;
    margin-bottom: 40px;
}

.lb-attrs {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.lb-attr {
    display: flex;
    justify-content: space-between;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
}

.lb-attr label {
    font-weight: 600;
    color: #222;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}

.lb-attr value {
    color: #666;
}

.lightbox-close {
    position: fixed;
    top: 40px;
    right: 40px;
    font-size: 2rem;
    cursor: pointer;
    color: #333;
}

/* =========================================================================
   CRITICAL LIGHTBOX FIX - V-FINAL
   Forces lightbox to be hidden unless .active class is present.
   ========================================================================= */

.product-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.85) !important;
    z-index: 20000 !important;
    /* Higher than anything */

    /* Default State: Hidden & Non-Interactive */
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;

    display: flex !important;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease, visibility 0.3s ease !important;
    backdrop-filter: blur(5px);
}

.product-lightbox.active {
    /* Active State: Visible & Interactive */
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.lightbox-content {
    width: 95%;
    /* More width on mobile */
    max-width: 1200px;
    height: auto;
    max-height: 90vh;
    /* Don't exceed viewport */
    background: #fff;
    display: flex;
    gap: 0;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    /* Allow scrolling content */
    overflow-x: hidden;
}

/* LIGHTBOX LAYOUT - RESTORED (Thumbs Below, Rounded Buttons) */
.lightbox-left {
    flex: 1.5;
    background: #f9f9f9;
    padding: 20px;
    display: flex;
    flex-direction: column;
    /* Thumbs Below Image */
    gap: 15px;
    /* Spacing */
    align-items: center;
    justify-content: center;
}

.lb-main-img-wrapper {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lb-main-img-wrapper img {
    max-width: 100%;
    max-height: 60vh;
    /* Adjust height to fit thumbs below */
    object-fit: contain;
}

.lb-thumbnails-container {
    width: 100%;
    height: 120px;
    /* Increased height for portrait thumbs */
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
}

.lb-thumbnails {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    /* Horizontal Strip */
    gap: 12px;
    overflow-x: auto;
    /* Scroll Horizontally */
    overflow-y: hidden;
    padding: 5px 2px;
    scroll-behavior: smooth;

    /* Hide Scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.lb-thumbnails::-webkit-scrollbar {
    display: none;
}

.lb-thumb {
    height: 100%;
    /* Fill container height */
    width: auto;
    aspect-ratio: 2 / 3 !important;
    /* Portrait Ratio preserved */
    object-fit: cover;
    cursor: pointer;
    opacity: 0.5;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.lb-thumb:hover {
    opacity: 0.8;
    transform: translateY(-2px);
}

.lb-thumb.active {
    opacity: 1;
    border: 1px solid #111;
    transform: scale(1.05);
}

/* Horizontal Nav Arrows */
.lb-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #eee;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    /* Rounded Arrows */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.lb-prev {
    left: -10px;
}

.lb-next {
    right: -10px;
}

/* Mobile Fixes */
@media (max-width: 768px) {
    .lightbox-content {
        flex-direction: column;
        width: 95%;
        margin-top: 50px;
        /* Space for close button */
    }

    .lightbox-left {
        flex: none;
        width: 100%;
        padding: 15px;
    }

    .lightbox-right {
        flex: none;
        width: 100%;
        padding: 20px 25px 40px;
        /* More bottom padding for scroll */
    }

    .lb-thumbnails-container {
        height: 80px;
        /* Slightly smaller for mobile */
        width: 100%;
    }

    .lb-main-img-wrapper img {
        max-height: 50vh;
        /* Better ratio for mobile */
    }

    .lb-title {
        font-size: 2rem;
        /* Scaled down */
        margin-bottom: 10px;
    }

    .lb-desc {
        font-size: 0.95rem;
        margin-bottom: 25px;
    }

    .lightbox-close {
        top: 15px;
        right: 15px;
        color: #fff;
        /* White close button on mobile over dark backdrop */
        background: rgba(0, 0, 0, 0.5);
        width: 40px;
        height: 40px;
        display: flex;
        justify-content: center;
        align-items: center;
        border-radius: 50%;
        z-index: 20005;
    }
}