/* ============================================================
   QUICK VIEW MODAL — Premium Product Gallery & Quick View System
   Trimurti Handicrafts
   All selectors prefixed with .qv- to avoid conflicts
   ============================================================ */

/* ── Overlay ── */
.qv-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 16px 16px 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    overflow-y: auto;
}

.qv-overlay.qv-open {
    opacity: 1;
    visibility: visible;
}

/* ── Modal Container ── */
.qv-modal {
    position: relative;
    background: var(--bg-primary, #ffffff);
    border-radius: 20px;
    width: 100%;
    max-width: 960px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: row;
    gap: 0;
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.35),
        0 8px 24px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255,255,255,0.1);
    transform: scale(0.95) translateY(16px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
    opacity: 0;
    scroll-behavior: smooth;
}

.qv-overlay.qv-open .qv-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Scrollbar styling inside modal */
.qv-modal::-webkit-scrollbar { width: 4px; }
.qv-modal::-webkit-scrollbar-track { background: transparent; }
.qv-modal::-webkit-scrollbar-thumb { background: var(--accent-light, #e0d6c8); border-radius: 4px; }

/* ── Close Button ── */
.qv-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-dark, #1a1a1a);
    transition: background 0.2s ease, transform 0.2s ease;
    outline: none;
}

.qv-close:hover { background: rgba(0, 0, 0, 0.18); transform: rotate(90deg); }
.qv-close:focus-visible { outline: 2px solid var(--bg-tertiary, #a07850); outline-offset: 2px; }

/* ── Left Panel — Gallery ── */
.qv-gallery {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 24px 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--bg-secondary, #f7f4ef);
    border-radius: 20px 0 0 20px;
    position: relative;
    overflow: hidden;
}

/* ── Main Image Wrapper ── */
.qv-main-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-primary, #fff);
    cursor: zoom-in;
}

.qv-main-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform-origin: center;
}

.qv-main-img.qv-fade-out {
    opacity: 0;
    transform: scale(0.97);
}

/* Desktop Zoom on hover */
@media (hover: hover) {
    .qv-main-img-wrap:hover .qv-main-img {
        transform: scale(1.07);
        cursor: zoom-in;
    }
    .qv-main-img.qv-fade-out:hover { transform: scale(0.97); }
}

/* ── Arrow Navigation ── */
.qv-arrows {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 8px;
    pointer-events: none;
    z-index: 4;
}

.qv-arrow {
    pointer-events: all;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-dark, #1a1a1a);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    outline: none;
}

.qv-arrow:hover {
    background: var(--bg-tertiary, #a07850);
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 14px rgba(0,0,0,0.22);
}

.qv-arrow:focus-visible { outline: 2px solid var(--bg-tertiary, #a07850); outline-offset: 2px; }

.qv-arrows.qv-hidden { display: none; }

/* ── Thumbnails Strip ── */
.qv-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.qv-thumbs.qv-hidden { display: none; }

.qv-thumb {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    flex-shrink: 0;
    background: var(--bg-primary, #fff);
}

.qv-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.15s;
}

.qv-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.qv-thumb.qv-active {
    border-color: var(--bg-tertiary, #a07850);
    box-shadow: 0 0 0 3px rgba(160, 120, 80, 0.25), 0 4px 12px rgba(0,0,0,0.15);
}

.qv-thumb.qv-active img { transform: scale(1.05); }

/* ── Right Panel — Info ── */
.qv-info {
    flex: 1;
    padding: 28px 24px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
}

.qv-info::-webkit-scrollbar { width: 3px; }
.qv-info::-webkit-scrollbar-track { background: transparent; }
.qv-info::-webkit-scrollbar-thumb { background: var(--accent-light, #e0d6c8); border-radius: 4px; }

/* Product badge */
.qv-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--bg-tertiary, #a07850);
    color: #fff;
    margin-bottom: 10px;
    align-self: flex-start;
}

/* Product title */
.qv-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark, #1a1a1a);
    line-height: 1.25;
    margin: 0 0 6px;
}

/* Product code */
.qv-code {
    font-size: 0.78rem;
    color: var(--text-mid, #888);
    margin-bottom: 14px;
    font-family: monospace;
}

/* Price row */
.qv-price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.qv-price {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-dark, #1a1a1a);
    letter-spacing: -0.5px;
}

.qv-price-unit {
    font-size: 0.82rem;
    color: var(--text-mid, #888);
}

.qv-moq {
    font-size: 0.8rem;
    color: var(--text-mid, #888);
    background: var(--bg-secondary, #f7f4ef);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

/* Divider */
.qv-divider {
    height: 1px;
    background: var(--accent-light, #e8e0d5);
    margin: 14px 0;
}

/* Short description */
.qv-desc {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-mid, #555);
    margin-bottom: 0;
}

/* Specs table */
.qv-specs-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dark, #333);
    margin-bottom: 10px;
}

.qv-specs {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    font-size: 0.84rem;
}

.qv-spec-key {
    color: var(--text-mid, #888);
    font-weight: 600;
    white-space: nowrap;
}

.qv-spec-val {
    color: var(--text-dark, #333);
}

/* Features list */
.qv-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.qv-features li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.84rem;
    color: var(--text-mid, #555);
}

.qv-features li::before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.7rem;
    color: var(--bg-tertiary, #a07850);
    margin-top: 3px;
    flex-shrink: 0;
}

/* ── Quantity Selector ── */
.qv-qty-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.qv-qty-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dark, #333);
    white-space: nowrap;
}

.qv-qty-ctrl {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--accent-light, #ddd);
    border-radius: 10px;
    overflow: hidden;
}

.qv-qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark, #1a1a1a);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    outline: none;
}

.qv-qty-btn:hover { background: var(--bg-secondary, #f0ebe3); }
.qv-qty-btn:focus-visible { outline: 2px solid var(--bg-tertiary, #a07850); outline-offset: -2px; }

.qv-qty-num {
    min-width: 38px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark, #1a1a1a);
    border-left: 1.5px solid var(--accent-light, #ddd);
    border-right: 1.5px solid var(--accent-light, #ddd);
    line-height: 36px;
    user-select: none;
}

/* ── Action Buttons ── */
.qv-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.qv-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 13px 22px;
    border-radius: 12px;
    border: none;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    outline: none;
    width: 100%;
    text-decoration: none;
    font-family: inherit;
}

.qv-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.18); }
.qv-btn:active { transform: translateY(0); }
.qv-btn:focus-visible { outline: 2px solid var(--bg-tertiary, #a07850); outline-offset: 2px; }

.qv-btn-primary {
    background: var(--bg-tertiary, #a07850);
    color: #fff;
}

.qv-btn-primary:hover { filter: brightness(1.1); }

.qv-btn-secondary {
    background: transparent;
    border: 2px solid var(--bg-tertiary, #a07850);
    color: var(--bg-tertiary, #a07850);
}

.qv-btn-secondary:hover {
    background: var(--bg-tertiary, #a07850);
    color: #fff;
}

/* Success animation on add to cart */
.qv-btn.qv-added {
    background: #22c55e !important;
    border-color: #22c55e !important;
    color: #fff !important;
    transform: scale(0.98);
}

/* ── Loading skeleton for images ── */
.qv-img-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #f0ebe3 25%, #e8dfd4 50%, #f0ebe3 75%);
    background-size: 200% 100%;
    animation: qvSkeleton 1.2s ease-in-out infinite;
    border-radius: 14px;
    z-index: 2;
    transition: opacity 0.3s;
}

@keyframes qvSkeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Mobile: Bottom Sheet ── */
@media (max-width: 768px) {
    .qv-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .qv-modal {
        flex-direction: column;
        max-width: 100%;
        width: 100%;
        max-height: 92vh;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s ease;
    }

    .qv-overlay.qv-open .qv-modal {
        transform: translateY(0);
        opacity: 1;
    }

    .qv-gallery {
        flex: none;
        max-width: 100%;
        width: 100%;
        border-radius: 24px 24px 0 0;
        padding: 20px 16px 14px;
    }

    /* Drag handle for mobile bottom sheet */
    .qv-gallery::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(0,0,0,0.18);
        border-radius: 2px;
        margin: 0 auto 14px;
    }

    .qv-main-img-wrap {
        aspect-ratio: 4 / 3;
    }

    .qv-info {
        padding: 18px 16px 32px;
        overflow-y: visible;
    }

    .qv-title { font-size: 1.25rem; }
    .qv-price { font-size: 1.45rem; }

    .qv-thumb {
        width: 54px;
        height: 54px;
    }

    .qv-close {
        top: 16px;
        right: 16px;
    }
}

/* ── Tablet ── */
@media (min-width: 769px) and (max-width: 1024px) {
    .qv-modal { max-width: 800px; }
    .qv-gallery { flex: 0 0 46%; max-width: 46%; padding: 20px; }
    .qv-info { padding: 22px 20px 20px; }
    .qv-title { font-size: 1.3rem; }
}

/* ── Accessibility: reduce motion ── */
@media (prefers-reduced-motion: reduce) {
    .qv-overlay, .qv-modal, .qv-main-img, .qv-thumb, .qv-btn, .qv-close, .qv-arrow {
        transition: none !important;
        animation: none !important;
    }
}
