/* ==========================================================================
   Product Gallery
   - Desktop: thumbnails à gauche, image principale à droite
   - Mobile: thumbnails horizontales sous l'image
   - Lightbox fullscreen au clic sur l'image
   ========================================================================== */

.product-gallery {
    display: flex;
    gap: 20px;
    max-width: 100%;
}

.product-gallery--single {
    justify-content: center;
}

.product-gallery--single .product-gallery__main {
    max-width: 600px;
}

/* ---------- Thumbnails ---------- */

.product-gallery__thumbnails-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 80px;
    flex-shrink: 0;
}

.product-gallery__thumbnails {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 500px;
    position: relative;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.product-gallery__thumbnails::-webkit-scrollbar {
    display: none;
}

.product-gallery__thumbnails-track {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px;
}

.product-gallery__thumb {
    width: 72px;
    height: 72px;
    padding: 0;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
    flex-shrink: 0;
    opacity: 0.6;
}

.product-gallery__thumb:hover {
    opacity: 1;
    border-color: #ddd;
}

.product-gallery__thumb.active {
    opacity: 1;
    border-color: #0B3954;
}

.product-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Flèches thumbnails : masquées par défaut */
.product-gallery__nav {
    display: none;
}

/* ---------- Image principale ---------- */

.product-gallery__main {
    flex: 1;
    position: relative;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

.product-gallery__main-track {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
}

.product-gallery__slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: none;
    z-index: 0;
}

.product-gallery__slide.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}

.product-gallery__slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* ---------- Icône loupe ---------- */

.product-gallery__zoom {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-gallery__main:hover .product-gallery__zoom {
    opacity: 1;
}

.product-gallery__zoom:hover {
    background: #0B3954;
    color: #fff;
}

/* ---------- Navigation image principale (desktop hover) ---------- */

.product-gallery__main-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.product-gallery__main:hover .product-gallery__main-nav {
    opacity: 1;
}

.product-gallery__main-prev,
.product-gallery__main-next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #333;
    transition: all 0.2s ease;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-gallery__main-prev:hover,
.product-gallery__main-next:hover {
    background: #0B3954;
    color: #fff;
}

/* ---------- Compteur ---------- */

.product-gallery__counter {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    z-index: 2;
}

.product-gallery__separator {
    margin: 0 4px;
    opacity: 0.6;
}

/* ---------- Dots (masqués, réservés pour usage futur) ---------- */

.product-gallery__dots {
    display: none;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.product-gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.product-gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.product-gallery-lightbox__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 2;
}

.product-gallery-lightbox__close:hover {
    background: rgba(0, 0, 0, 0.75);
}

.product-gallery-lightbox__image-wrapper {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-gallery-lightbox__image-wrapper img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.product-gallery-lightbox__prev,
.product-gallery-lightbox__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 2;
}

.product-gallery-lightbox__prev {
    left: 20px;
}

.product-gallery-lightbox__next {
    right: 20px;
}

.product-gallery-lightbox__prev:hover,
.product-gallery-lightbox__next:hover {
    background: rgba(0, 0, 0, 0.75);
}

.product-gallery-lightbox__counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Responsive - Tablette / Mobile
   ========================================================================== */

@media (max-width: 768px) {
    .product-gallery {
        flex-direction: column;
        gap: 12px;
    }

    .product-gallery__thumbnails-wrapper {
        flex-direction: row;
        width: 100%;
        height: auto;
        order: 2;
    }

    /* Pas de flèches sur les thumbnails mobile, scroll libre */
    .product-gallery__nav {
        display: none;
    }

    .product-gallery__thumbnails {
        max-height: none;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .product-gallery__thumbnails-track {
        flex-direction: row;
        gap: 8px;
    }

    .product-gallery__thumb {
        width: 56px;
        height: 56px;
        border-color: #e8e8e8;
        opacity: 1;
    }

    .product-gallery__main {
        border-radius: 8px;
        order: 1;
    }

    .product-gallery__main-nav {
        opacity: 1;
    }

    .product-gallery__main-prev,
    .product-gallery__main-next {
        width: 34px;
        height: 34px;
    }

    .product-gallery__zoom {
        opacity: 1;
        width: 34px;
        height: 34px;
        top: 12px;
        right: 12px;
    }

    .product-gallery__counter {
        bottom: 12px;
        right: 12px;
        padding: 4px 10px;
        font-size: 12px;
    }

    /* Lightbox mobile */
    .product-gallery-lightbox__prev,
    .product-gallery-lightbox__next {
        width: 40px;
        height: 40px;
        background: rgba(0, 0, 0, 0.6);
    }

    .product-gallery-lightbox__prev {
        left: 8px;
    }

    .product-gallery-lightbox__next {
        right: 8px;
    }

    .product-gallery-lightbox__close {
        top: 12px;
        right: 12px;
        background: rgba(0, 0, 0, 0.6);
    }
}

@media (max-width: 480px) {
    .product-gallery__thumb {
        width: 48px;
        height: 48px;
    }

    .product-gallery__counter {
        bottom: 10px;
        right: 10px;
    }
}
