/**
 * Galerie produit avec lightbox - Aratice
 * Version moderne avec miniatures et navigation
 */

/* === Container principal === */
.aratice-product-gallery {
    position: relative;
    width: 100%;
    max-width: 100%;
}

/* === Image principale === */
.aratice-gallery-main {
    position: relative;
    width: 100%;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aratice-gallery-main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.aratice-gallery-main:hover .aratice-gallery-main-image {
    transform: scale(1.02);
}

/* Bouton zoom/loupe */
.aratice-gallery-zoom-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    z-index: 10;
}

.aratice-gallery-zoom-btn:hover {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.aratice-gallery-zoom-btn svg {
    width: 20px;
    height: 20px;
    stroke: #333;
}

/* Navigation précédent/suivant sur l'image principale */
.aratice-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    z-index: 10;
    opacity: 0;
}

.aratice-product-gallery:hover .aratice-gallery-nav {
    opacity: 1;
}

.aratice-gallery-nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.aratice-gallery-nav.prev {
    left: 16px;
}

.aratice-gallery-nav.next {
    right: 16px;
}

.aratice-gallery-nav svg {
    width: 20px;
    height: 20px;
    stroke: #333;
}

/* Masquer la navigation si une seule image */
.aratice-product-gallery.single-image .aratice-gallery-nav,
.aratice-product-gallery.single-image .aratice-gallery-thumbnails {
    display: none;
}

/* === Miniatures === */
.aratice-gallery-thumbnails {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #163C79 #e5e7eb;
}

.aratice-gallery-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.aratice-gallery-thumbnails::-webkit-scrollbar-track {
    background: #e5e7eb;
    border-radius: 3px;
}

.aratice-gallery-thumbnails::-webkit-scrollbar-thumb {
    background: #163C79;
    border-radius: 3px;
}

.aratice-gallery-thumb {
    flex: 0 0 auto;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    background: #fff;
}

.aratice-gallery-thumb:hover {
    border-color: #163C79;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.aratice-gallery-thumb.active {
    border-color: #163C79;
    box-shadow: 0 0 0 3px rgba(22, 60, 121, 0.2);
}

.aratice-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* === Lightbox === */
.aratice-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.aratice-lightbox.active {
    display: flex;
    opacity: 1;
}

.aratice-lightbox-content {
    position: static;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.aratice-lightbox-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
}

/* Bouton fermer - position fixe par rapport à l'écran */
.aratice-lightbox-close {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.aratice-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.aratice-lightbox-close svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
}

/* Navigation lightbox - position fixe par rapport à l'écran */
.aratice-lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.aratice-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.aratice-lightbox-nav.prev {
    left: 24px;
}

.aratice-lightbox-nav.next {
    right: 24px;
}

.aratice-lightbox-nav svg {
    width: 28px;
    height: 28px;
    stroke: #fff;
}

/* Compteur d'images */
.aratice-lightbox-counter {
    color: #fff;
    font-size: 14px;
    margin-top: 16px;
    font-weight: 500;
    opacity: 0.8;
}

/* Miniatures dans la lightbox */
.aratice-lightbox-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    max-width: 80vw;
    overflow-x: auto;
    padding: 8px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.aratice-lightbox-thumbs::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.aratice-lightbox-thumb {
    flex: 0 0 auto;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.aratice-lightbox-thumb:hover {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.5);
}

.aratice-lightbox-thumb.active {
    opacity: 1;
    border-color: #fff;
}

.aratice-lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* === Badge État (conservé) === */
.aratice-product-gallery .single-product-badge-state {
    position: absolute;
    top: 20px;
    left: 20px;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1.1px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.aratice-product-gallery .single-product-badge-state-seconde-main {
    background-color: #DDEAFF;
    color: #236197;
}

/* === Responsive === */
@media (max-width: 768px) {
    .aratice-gallery-main {
        border-radius: 8px;
        margin-bottom: 12px;
    }

    .aratice-gallery-thumb {
        width: 64px;
        height: 64px;
    }

    .aratice-gallery-nav {
        width: 36px;
        height: 36px;
        opacity: 1;
    }

    .aratice-gallery-nav.prev {
        left: 8px;
    }

    .aratice-gallery-nav.next {
        right: 8px;
    }

    .aratice-gallery-zoom-btn {
        width: 36px;
        height: 36px;
        top: 12px;
        right: 12px;
    }

    .aratice-lightbox-nav {
        width: 44px;
        height: 44px;
    }

    .aratice-lightbox-nav.prev {
        left: 12px;
    }

    .aratice-lightbox-nav.next {
        right: 12px;
    }

    .aratice-lightbox-close {
        top: 12px;
        right: 12px;
    }

    .aratice-lightbox-thumbs {
        display: none;
    }

    .aratice-product-gallery .single-product-badge-state {
        top: 12px;
        left: 12px;
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Animation d'entrée */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.aratice-lightbox.active .aratice-lightbox-content {
    animation: fadeIn 0.3s ease;
}

/* Désactiver les styles WooCommerce par défaut qui posent problème */
.aratice-product-gallery .woocommerce-product-gallery__trigger {
    display: none !important;
}

/* Cacher la galerie WooCommerce originale quand notre galerie est active */
.has-aratice-gallery .woocommerce-product-gallery:not(.aratice-product-gallery) {
    display: none !important;
}
