/* ============================================
   PRODUCT ZOOM GALLERY COMPONENT
   Comprehensive image zoom with Drift.js & PhotoSwipe
   ============================================ */

/* ===== MAIN CONTAINER ===== */
.product-zoom-gallery-wrapper {
    position: relative;
    width: 100%;
}

.product-gallery-main-container {
    position: relative;
}

/* ===== MAIN IMAGE WRAPPER ===== */
.zoom-main-image-wrapper {
    position: relative;
    overflow: visible;
    border-radius: 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef4f9 100%);
    border: 3px solid rgba(212, 175, 55, 0.15);
    box-shadow: 0 8px 32px rgba(10, 31, 61, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: crosshair;
}

.zoom-main-image-wrapper:hover {
    box-shadow:
        0 12px 48px rgba(212, 175, 55, 0.2),
        0 0 0 1px rgba(212, 175, 55, 0.1);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Main image styling */
.product-main-img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 500px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef4f9 100%);
    transition: transform 0.3s ease;
}

.zoom-main-image-wrapper:hover .product-main-img {
    transform: scale(1.02);
}

/* ===== ZOOM HINT OVERLAY (Mobile) ===== */
.zoom-hint-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

.zoom-main-image-wrapper:hover .zoom-hint-overlay,
.zoom-main-image-wrapper:focus-within .zoom-hint-overlay {
    opacity: 1;
}

.zoom-hint-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.95) !important;
    color: #0a1f3d !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    animation: pulse-hint 2s infinite;
    pointer-events: auto;
}

@keyframes pulse-hint {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ===== FULLSCREEN ZOOM BUTTON (Desktop) ===== */
.zoom-fullscreen-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(255, 255, 255, 0.95) !important;
    color: #0a1f3d !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 20;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.zoom-main-image-wrapper:hover .zoom-fullscreen-btn {
    opacity: 1;
    transform: scale(1.1);
}

.zoom-fullscreen-btn:hover {
    background: #d4af37 !important;
    color: #fff !important;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
    transform: scale(1.2);
}

/* ===== LOADING SPINNER ===== */
.zoom-image-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 15;
    display: none !important;
}

.zoom-image-loader.show {
    display: block !important;
}

/* ===== THUMBNAIL STRIP ===== */
.product-gallery-thumbs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 5px 0;
    max-height: 90px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.3) rgba(212, 175, 55, 0.1);
}

.product-gallery-thumbs::-webkit-scrollbar {
    width: 6px;
}

.product-gallery-thumbs::-webkit-scrollbar-track {
    background: rgba(212, 175, 55, 0.1);
    border-radius: 10px;
}

.product-gallery-thumbs::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 10px;
}

.product-gallery-thumbs::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.5);
}

/* Thumbnail Styling */
.product-thumb {
    width: 70px;
    height: 70px;
    min-width: 70px;
    padding: 0;
    border: 2px solid rgba(212, 175, 55, 0.15);
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(10, 31, 61, 0.06);
    font-size: 0;
    overflow: hidden;
}

.product-thumb:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.3);
}

.product-thumb.active {
    border-color: #d4af37;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
    background-color: rgba(212, 175, 55, 0.08);
}

.product-thumb:focus {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

/* ===== DRIFT.JS ZOOM LENS STYLES ===== */
.drift-zoom-pane {
    position: fixed;
    z-index: 999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.drift-zoom-pane.visible {
    opacity: 1;
}

.drift-zoom-pane-container {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

/* ===== FULLSCREEN LIGHTBOX MODAL ===== */
.zoom-lightbox-modal .modal-content {
    background: rgba(0, 0, 0, 0.95);
    border: none;
}

.zoom-modal-dialog {
    margin: 0;
    padding: 0;
    max-width: 100%;
}

.zoom-modal-content {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 0;
}

.zoom-lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Close Button */
.zoom-modal-close {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9) !important;
    border: none !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.zoom-modal-close::after {
    content: "\00d7";
    font-size: 1.5rem;
    color: #0a1f3d;
}

.zoom-modal-close:hover {
    opacity: 1;
    background: #d4af37 !important;
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
    transform: scale(1.1);
}

/* Lightbox Image Wrapper */
.zoom-lightbox-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.zoom-lightbox-image {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    width: auto;
    height: auto;
    user-select: none;
    cursor: grab;
    transition: transform 0.2s ease;
}

.zoom-lightbox-image.zoomed {
    cursor: grabbing;
}

/* Loading Spinner in Lightbox */
.zoom-lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
}

/* ===== LIGHTBOX CONTROLS ===== */
.zoom-lightbox-controls {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    padding: 12px 16px;
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.zoom-controls-group {
    display: flex;
    gap: 8px;
}

.zoom-control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.8) !important;
    color: #fff !important;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    font-size: 1rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.zoom-control-btn:hover {
    background: #d4af37 !important;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
}

.zoom-control-btn:active {
    transform: scale(0.95);
}

.zoom-control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(1);
}

/* Image Counter */
.zoom-image-counter {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0 12px;
    border-left: 2px solid rgba(212, 175, 55, 0.5);
    border-right: 2px solid rgba(212, 175, 55, 0.5);
    white-space: nowrap;
}

/* ===== NAVIGATION ARROWS ===== */
.zoom-nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1050;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.8) !important;
    color: #fff !important;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    font-size: 1.2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.zoom-prev-arrow {
    left: 20px;
}

.zoom-next-arrow {
    right: 20px;
}

.zoom-nav-arrow:hover {
    background: #d4af37 !important;
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
}

.zoom-nav-arrow:active {
    transform: translateY(-50%) scale(0.9);
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet and below */
@media (max-width: 1024px) {
    .product-main-img {
        max-height: 400px;
    }

    .zoom-lightbox-controls {
        bottom: 20px;
        gap: 8px;
        padding: 10px 12px;
    }

    .zoom-control-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .zoom-nav-arrow {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    .zoom-image-counter {
        font-size: 0.8rem;
        padding: 0 8px;
    }

    .zoom-lightbox-image {
        max-width: 98vw;
        max-height: 98vh;
    }
}

/* Small devices (mobile) */
@media (max-width: 640px) {
    .product-main-img {
        max-height: 300px;
    }

    .product-thumb {
        width: 60px;
        height: 60px;
        min-width: 60px;
    }

    .zoom-fullscreen-btn {
        width: 36px;
        height: 36px;
        bottom: 8px;
        right: 8px;
        font-size: 0.9rem;
    }

    .zoom-hint-btn {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    .zoom-modal-close {
        width: 40px;
        height: 40px;
        top: 12px;
        right: 12px;
    }

    .zoom-lightbox-controls {
        bottom: 12px;
        left: 50%;
        transform: translateX(-50%);
        gap: 4px;
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    .zoom-controls-group {
        gap: 4px;
    }

    .zoom-control-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .zoom-image-counter {
        display: none;
    }

    .zoom-nav-arrow {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .zoom-prev-arrow {
        left: 10px;
    }

    .zoom-next-arrow {
        right: 10px;
    }

    .zoom-lightbox-image {
        max-width: 100vw;
        max-height: 100vh;
    }

    /* Hide side thumbnails on very small screens */
    .product-gallery-thumbs {
        max-height: 80px;
        gap: 8px;
    }

    .product-thumb {
        width: 55px;
        height: 55px;
        min-width: 55px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .product-main-img {
        max-height: 250px;
    }

    .product-thumb {
        width: 50px;
        height: 50px;
        min-width: 50px;
    }

    .zoom-lightbox-controls {
        gap: 2px;
        padding: 6px 8px;
    }

    .zoom-control-btn {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }

    .zoom-nav-arrow {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .zoom-modal-close {
        width: 36px;
        height: 36px;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .product-thumb,
    .zoom-main-image-wrapper,
    .zoom-control-btn,
    .zoom-nav-arrow,
    .product-main-img,
    .zoom-fullscreen-btn,
    .zoom-modal-close {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: more) {
    .zoom-lightbox-controls {
        background: rgba(0, 0, 0, 0.95);
        border: 2px solid #d4af37;
    }

    .zoom-control-btn {
        border: 2px solid #fff !important;
    }

    .zoom-nav-arrow {
        border: 2px solid #fff !important;
    }

    .zoom-modal-close {
        border: 2px solid #0a1f3d !important;
    }
}

/* Print styles */
@media print {
    .zoom-lightbox-controls,
    .zoom-nav-arrow,
    .zoom-modal-close,
    .zoom-fullscreen-btn,
    .zoom-hint-overlay {
        display: none !important;
    }
}

/* ===== ZOOM LENS DISPLAY (LEFT SIDE) ===== */
.zoom-lens-container {
    position: absolute;
    width: 450px;
    height: 450px;
    border: 3px solid var(--primary);
    border-radius: 12px;
    overflow: hidden;
    display: none;
    z-index: 100;
    background: white;
    box-shadow:
        0 12px 48px rgba(10, 31, 61, 0.25),
        0 0 0 1px rgba(212, 175, 55, 0.2);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    backdrop-filter: blur(0px);
}

.zoom-lens-container.active {
    display: block;
    opacity: 1;
}

.zoom-lens-image {
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-size: 100%;
    background-position: 0 0;
    background-origin: content-box;
}

/* Crosshair cursor for zoom */
.zoom-main-image-wrapper {
    cursor:
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><circle cx="16" cy="16" r="12" fill="none" stroke="%23d4af37" stroke-width="2"/><line x1="16" y1="4" x2="16" y2="8" stroke="%23d4af37" stroke-width="2"/><line x1="16" y1="24" x2="16" y2="28" stroke="%23d4af37" stroke-width="2"/><line x1="4" y1="16" x2="8" y2="16" stroke="%23d4af37" stroke-width="2"/><line x1="24" y1="16" x2="28" y2="16" stroke="%23d4af37" stroke-width="2"/></svg>')
            16 16,
        zoom-in;
}

/* ===== ZOOM FOCUS BOX (Indicator on image) ===== */
.zoom-focus-box {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 2px solid var(--primary);
    background: rgba(212, 175, 55, 0.1);
    pointer-events: none;
    display: none;
    z-index: 50;
    box-shadow:
        inset 0 0 0 1px var(--primary),
        0 0 10px rgba(212, 175, 55, 0.3);
    border-radius: 4px;
}

.zoom-focus-box.active {
    display: block;
}

/* Responsive: hide zoom lens on mobile/tablet */
@media (max-width: 1024px) {
    .zoom-lens-container {
        display: none !important;
    }
}
