/**
 * Enhanced Product Image Viewer
 * Full-screen lightbox with zoom, slide navigation, and touch support
 * Professional e-commerce image viewing experience
 */

/* ============================================================
   LIGHTBOX MODAL OVERLAY
   ============================================================ */
.image-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: hidden;
}

.image-viewer-modal.active {
    display: flex;
    opacity: 1;
}

/* ============================================================
   MAIN IMAGE CONTAINER & ZOOM AREA
   ============================================================ */
.image-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.image-viewer-zoom-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    cursor: grab;
    user-select: none;
}

.image-viewer-zoom-wrapper.dragging {
    cursor: grabbing;
}

.image-viewer-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
    pointer-events: none;
    will-change: transform;
}

/* ============================================================
   ZOOM CONTROLS (Top Right)
   ============================================================ */
.image-viewer-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}

.image-viewer-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
}

.image-viewer-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.image-viewer-btn:active {
    transform: scale(0.95);
}

.image-viewer-zoom-level {
    position: absolute;
    top: 20px;
    left: 20px;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    min-width: 60px;
    text-align: center;
}

/* ============================================================
   SLIDE NAVIGATION ARROWS
   ============================================================ */
.image-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
}

.image-viewer-nav:hover {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.08);
}

.image-viewer-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.image-viewer-nav.prev {
    left: 20px;
}

.image-viewer-nav.next {
    right: 20px;
}

/* ============================================================
   IMAGE COUNTER & INFO
   ============================================================ */
.image-viewer-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    z-index: 100;
    white-space: nowrap;
}

/* ============================================================
   THUMBNAIL STRIP (Bottom of Modal)
   ============================================================ */
.image-viewer-thumbs-wrapper {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    max-width: 90%;
    overflow-x: auto;
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    z-index: 100;
    scrollbar-width: none;
}

.image-viewer-thumbs-wrapper::-webkit-scrollbar {
    display: none;
}

.image-viewer-thumb {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.image-viewer-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-viewer-thumb:hover {
    opacity: 0.9;
    border-color: rgba(255, 255, 255, 0.4);
}

.image-viewer-thumb.active {
    border-color: #ffffff;
    opacity: 1;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

/* ============================================================
   CLOSE BUTTON (Top Left)
   ============================================================ */
.image-viewer-close {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 101;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
}

.image-viewer-close:hover {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.image-viewer-close:active {
    transform: scale(0.95);
}

/* ============================================================
   KEYBOARD HINT (Bottom Right)
   ============================================================ */
.image-viewer-hint {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 12px;
    backdrop-filter: blur(10px);
    z-index: 100;
}

/* ============================================================
   CLICKABLE MAIN IMAGE INDICATOR
   ============================================================ */
.product-gallery-main {
    cursor: zoom-in;
    position: relative;
}

.product-gallery-main::after {
    content: "🔍 Click to zoom";
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.product-gallery-main:hover::after {
    opacity: 1;
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 768px) {
    .image-viewer-nav {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .image-viewer-nav.prev {
        left: 12px;
    }

    .image-viewer-nav.next {
        right: 12px;
    }

    .image-viewer-controls {
        top: 12px;
        right: 12px;
        gap: 8px;
    }

    .image-viewer-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .image-viewer-close {
        top: 12px;
        left: 12px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .image-viewer-zoom-level {
        top: 12px;
        left: 12px;
        padding: 6px 10px;
        font-size: 12px;
    }

    .image-viewer-info {
        bottom: 70px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .image-viewer-thumbs-wrapper {
        bottom: 60px;
        max-width: 95%;
        padding: 6px 8px;
    }

    .image-viewer-thumb {
        width: 50px;
        height: 50px;
    }

    .image-viewer-hint {
        display: none;
    }
}

@media (max-width: 480px) {
    .image-viewer-nav {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .image-viewer-nav.prev {
        left: 8px;
    }

    .image-viewer-nav.next {
        right: 8px;
    }

    .image-viewer-thumbs-wrapper {
        display: none;
    }

    .image-viewer-controls {
        top: 8px;
        right: 8px;
    }

    .image-viewer-close {
        top: 8px;
        left: 8px;
    }
}

/* ============================================================
   LOADING STATE
   ============================================================ */
.image-viewer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: image-viewer-spin 0.8s linear infinite;
    z-index: 100;
}

@keyframes image-viewer-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
.image-viewer-modal.active:focus-within {
    outline: none;
}

.image-viewer-btn:focus,
.image-viewer-nav:focus,
.image-viewer-close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Prevent body scroll when modal is open */
body.image-viewer-open {
    overflow: hidden;
}
