/* Container for the main content to center it and add padding */
.stock-item-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 30px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* Main Layout: Image and Details Side-by-Side (Desktop) */
.stock-detail-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr; /* Image column narrower than info column */
    gap: 40px;
}

/* --- Media Column Layout --- */
.stock-image-col {
    position: relative;
}

/* Gallery Container */
.gallery-container {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

/* Main Aspect-Ratio Display Window */
.gallery-main-stage {
    position: relative;
    width: 100%;
    background-color: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    display: grid; /* Layers items on top of one another smoothly */
    grid-template-areas: "overlay";
}

/* Hidden by default, absolute crossfade style */
.gallery-slide {
    grid-area: overlay;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Active Slide state */
.gallery-slide.active {
    opacity: 1;
    visibility: visible;
    position: relative;
    z-index: 2;
}

/* FIX: Target images strictly within the gallery slide so they don't break the lightbox */
.gallery-slide img {
    max-width: 100%;
    height: auto;
    max-height: 500px; /* Keeps item detail proportions uniform */
    object-fit: contain; /* Changed from 'cover' to prevent cutting off product edges */
    border-radius: 8px;
    display: block;
    transition: filter 0.3s ease;
}

.gallery-slide video {
    max-width: 100%;
    height: auto;
    max-height: 500px;
    display: block;
    border-radius: 8px;
    background-color: #000;
}

/* Grayscale effect for sold items */
.gallery-main-stage:has(.sold-out-overlay-detail) img {
    filter: brightness(50%) grayscale(50%);
}

/* Navigation Indicators */
.gallery-nav-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background-color: #e0e0e0;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.3s, border-color 0.3s;
}

.nav-dot.active {
    background-color: #333; /* Dark/accent color for active slide indicator */
    border-color: #333;
}

.zoomable-image {
    cursor: zoom-in;
}

/* Sold Out Banner Overlay */
.sold-out-overlay-detail {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-10deg); /* Center and tilt */
    padding: 10px 30px;
    background-color: rgba(220, 53, 69, 0.8); /* Darker red */
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    border: 4px solid white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

/* --- Info Column styling --- */
.stock-info-col h1 {
    color: var(--color-sapphire-blue, #004D99);
    font-size: 2.5em;
    margin-top: 0;
    margin-bottom: 20px;
}

/* Detail Groups (Gem Type, Status, Price) */
.info-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    font-size: 1.1em;
}

.detail-label {
    margin-bottom: 0;
    font-weight: 500;
    color: #555;
}

.detail-value {
    margin-bottom: 0;
    font-weight: 600;
    text-align: right;
    color: var(--color-text-dark, #222);
}

.price-group {
    border-top: 2px solid var(--color-secondary-light, #eee);
    margin-top: 15px;
    padding-top: 15px;
}

.price-group .price {
    font-size: 1.6em;
    color: var(--color-accent-gold, #D4AF37);
    font-weight: 700;
}

/* Description Section */
.description-section {
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.description-section h2 {
    font-size: 1.8em;
    margin-bottom: 15px;
    color: var(--color-sapphire-blue, #004D99);
}

.description-section p {
    font-size: 1em;
    line-height: 1.6;
    color: #555;
}

/* Action Button */
.action-buttons {
    margin-top: 30px;
    display: flex;
}

.btn-checkout .btn-add-to-cart {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
}

.btn-back-to-list {
    margin-bottom: 25px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 1em;
    padding: 8px 15px;
    border: 1px solid var(--color-text-fade-dark, #555);
    color: var(--color-text-fade-dark, #555);
    background-color: transparent;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.btn-back-to-list:hover {
    background-color: var(--color-secondary-light, #eee);
    color: var(--color-text-dark, #222);
}


/* ==========================================
   3. FIXED LIGHTBOX LUX-MODAL STYLING
   ========================================== */
.lux-modal {
    display: none;
    position: fixed;
    z-index: 3000;
    inset: 0;
    background: #0a0a0a;
}

.lux-toolbar {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 28px;
    z-index: 3010; /* Keep close button above stage layers */
    cursor: pointer;
}

/* Viewer stage */
#viewerStage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Fixed Viewer image properties to allow unrestrained canvas scaling */
#viewerImage {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain; /* Completely overrides the global "cover" rule */
    transform-origin: center;
    transition: transform 0.15s ease-out;
    cursor: grab;
    border-radius: 0; /* Clear container rounding inside full viewer */
}


/* --- RESPONSIVENESS (Mobile View) --- */
@media (max-width: 900px) {
    .stock-item-container {
        max-width: 90%;
        margin: 20px auto;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .stock-detail-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .stock-info-col h1 {
        font-size: 2em;
        text-align: center;
        margin-bottom: 10px;
    }
    .gallery-slide img,
    .gallery-slide video {
        max-height: 400px;
    }
    .btn-back-to-list {
        display: block;
        width: 100%;
        text-align: center;
        margin-bottom: 30px;
    }
    .description-section h2 {
        font-size: 1.5em;
    }
    .info-group, .description-section p {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .stock-item-container {
        padding: 15px;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
    .gallery-slide img,
    .gallery-slide video {
        max-height: 300px;
    }
    .stock-info-col h1 {
        font-size: 1.8em;
    }
    .price-group .price {
        font-size: 1.4em;
    }
    .btn-checkout {
        padding: 12px;
        font-size: 1.1em;
    }
    .sold-out-overlay-detail {
        font-size: 1.4em;
        padding: 8px 20px;
    }
}