/* ============================================================================
   FILE: quick-view.css
   DESCRIPTION: Premium Product Details Modal.
   Handles the pop-up product details overlay, ensuring separate 
   optimizations for mobile (sticky bottom) and desktop (dual layout).
   ============================================================================ */

/* --- 1. THE MAIN OVERLAY --- */
.qv-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    /* FIX: Adapts correctly to mobile browser address bars */
    height: 100dvh; 
    background: var(--bg-body);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(100%); 
    transition: transform 0.6s cubic-bezier(0.77, 0, 0.175, 1), opacity 0.4s ease, visibility 0s linear 0.6s;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: none; /* Stops rubber-banding/background peeking */
    /* PRO FIX: Removed 'will-change: transform' so fixed elements stick to screen correctly */
}

.qv-overlay.active {
    opacity: 1;
    visibility: visible;
    /* CRITICAL FIX: Transform MUST be 'none' (not translateY(0)) so that
       position:fixed children (like the sticky bottom bar) anchor to the
       viewport instead of the transformed parent. This is a CSS spec
       requirement — a transformed element creates a new containing block. */
    transform: none; 
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.4s ease, visibility 0s linear 0s;
}

/* --- 2. HEADER --- */
.qv-header {
    position: sticky;
    top: 0;
    background: rgba(253, 251, 247, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 15px 5%;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    z-index: 1000;
    display: flex;
    justify-content: space-between; 
    align-items: center;
}

.qv-back-btn {
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 5px 0;
}

.qv-back-btn:hover { color: var(--primary-gold); }

/* --- 3. MAIN CONTENT GRID --- */
.qv-content {
    display: grid;
    grid-template-columns: 1fr; 
    padding-bottom: 100px; /* Space so text doesn't hide behind mobile sticky bottom */
}

/* --- 4. MEDIA GALLERY CAROUSEL --- */
.qv-gallery-wrapper {
    position: relative;
    width: 100%;
    background: transparent; 
    overflow: hidden;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.qv-gallery {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden; 
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none; 
    -ms-overflow-style: none; 
    touch-action: pan-x; 
}

.qv-gallery::-webkit-scrollbar { display: none; }

.qv-media-item {
    flex: 0 0 100%;
    scroll-snap-align: center;
    aspect-ratio: 1 / 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent; 
}

.qv-media-item img, .qv-media-item video {
    width: 100%;
    height: 100%;
    object-fit: contain; 
    padding: 0; 
}

.qv-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(253, 251, 247, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0,0,0,0.05);
    color: var(--text-main);
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.qv-arrow:hover { background: #fff; color: var(--primary-gold); transform: translateY(-50%) scale(1.05); }
.qv-arrow-left { left: 15px; }
.qv-arrow-right { right: 15px; }

/* --- 5. CORE DETAILS --- */
.qv-details { padding: 25px 5%; display: flex; flex-direction: column; gap: 15px; position: relative;}
.qv-title { font-size: 1.6rem; line-height: 1.2; color: var(--text-main); }
.qv-trust-badge { font-size: 0.75rem; color: var(--primary-gold); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.qv-desc { font-size: 0.95rem; color: var(--text-muted); line-height: 1.6; }
.qv-price { font-size: 1.5rem; font-weight: 700; color: var(--text-main); margin-top: 5px; }

/* --- 6. HIGHLIGHTS & ACCORDIONS --- */
.qv-highlights {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 25px 0; margin: 10px 0;
    border-top: 1px solid rgba(0,0,0,0.06); border-bottom: 1px solid rgba(0,0,0,0.06);
}

.qv-highlight-item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; font-size: 0.7rem; font-weight: 600; color: #666; }
.qv-highlight-item svg { color: var(--primary-gold); }

.qv-accordions-wrapper { display: flex; flex-direction: column; }
.qv-accordion-item { border-bottom: 1px solid rgba(0,0,0,0.06); }
.qv-accordion-header {
    width: 100%; background: none; border: none; text-align: left; padding: 20px 0;
    font-size: 1rem; font-weight: 600; color: var(--text-main); display: flex; justify-content: space-between; align-items: center; cursor: pointer;
}
.qv-accordion-icon { transition: transform 0.4s ease; color: var(--primary-gold); }
.qv-accordion-item.active .qv-accordion-icon { transform: rotate(180deg); }
.qv-accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.4s cubic-bezier(0.2, 0.8, 0.3, 1); }
.qv-accordion-inner { padding-bottom: 20px; font-size: 0.95rem; color: var(--text-muted); line-height: 1.6; }

/* --- 7. BUTTON STYLING --- */
.qv-select { 
    flex: 1; 
    padding: 12px 30px 12px 10px; 
    border-radius: var(--btn-radius); 
    border: 1px solid rgba(0,0,0,0.1); 
    font-size: 0.85rem; 
    outline: none; 
    font-weight: 500; 
    cursor: pointer; 
    -webkit-appearance: none; 
    appearance: none; 
    color: var(--text-main) !important;
    -webkit-text-fill-color: var(--text-main);
    background-color: var(--bg-body);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}
.qv-add-btn { flex: 1.5; background: var(--text-main); color: var(--text-light); border: none; border-radius: var(--btn-radius); font-size: 0.85rem; font-weight: 600; padding: 12px; cursor: pointer; transition: all 0.3s ease; letter-spacing: 0.05em; text-transform: none;}
/* --- PREMIUM QUICK VIEW ADD EFFECT --- */
@media (hover: hover) {
    /* Prevent hover effect on disabled button */
    .qv-add-btn:not(:disabled):hover { 
        background-color: var(--primary-gold); 
        color: var(--text-light);
    }
}

.qv-add-btn.added-success {
    background-color: var(--wa-green) !important;
    color: var(--text-light) !important;
    pointer-events: none; /* Prevents double clicks */
}

/* Add missing disabled state for 'Out of Stock' products */
.qv-add-btn:disabled {
    background: #eeeeee;
    color: #888888;
    cursor: not-allowed;
}

/* --- 8. MOBILE RESPONSIVENESS (Strict Mobile Isolation) --- */
@media (max-width: 768px) {
    /* PRO FIX: Applied 'fixed' positioning strictly for mobile devices */
    .qv-sticky-bottom {
        position: fixed;
        bottom: 0; left: 0;
        width: 100%;
        background: var(--text-light);
        padding: 15px 5% calc(15px + env(safe-area-inset-bottom));
        box-shadow: 0 -5px 20px rgba(0,0,0,0.08);
        z-index: 1000; 
        display: flex; gap: 15px; align-items: center;
    }
}

/* --- 9. DESKTOP RESPONSIVENESS (Luxury Dual Layout) --- */
/* On desktop (>=769px), the Quick View transforms into a side-by-side
   layout: sticky image gallery on the left, scrollable product details
   on the right. This mirrors premium e-commerce product pages. */
@media (min-width: 769px) {
    .qv-overlay { padding-top: 0; }
    
    .qv-content {
        /* FIX: Restored Side-by-side layout without !important blocking it */
        grid-template-columns: 1fr 1fr; 
        gap: 50px;
        padding: 40px 5% 100px 5%;
        max-width: 1200px;
        margin: 0 auto;
        align-items: start; 
    }

    /* Desktop Sticky Gallery Carousel */
    .qv-gallery-wrapper {
        position: sticky;
        top: 100px;
        border-radius: var(--card-radius);
        background: rgba(253, 251, 247, 0.4);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        box-shadow: 0 15px 35px rgba(0,0,0,0.04);
        border: 1px solid rgba(0,0,0,0.03);
    }
    
    .qv-media-item { 
        aspect-ratio: 1 / 1; 
        max-height: calc(100vh - 150px); 
    }

    /* Desktop Floating Sticky Add-to-Cart */
    .qv-sticky-bottom {
        position: sticky; 
        bottom: 20px;
        width: 100%;
        border-radius: var(--card-radius);
        border: 1px solid rgba(212, 160, 23, 0.3);
        box-shadow: 0 15px 40px rgba(0,0,0,0.08);
        padding: 20px;
        margin-top: 30px;
        background: rgba(255,255,255,0.95);
        backdrop-filter: blur(10px);
        display: flex; gap: 15px; align-items: center;
    }
}