/* ============================================
   PRODUCT GALLERY STYLES
   Styles pour les différents aspects de galerie
============================================ */

/* ===== STYLE PAR DÉFAUT (GRID) ===== */
.gallery-aspect-grid .woocommerce-product-gallery {
    display: block;
}

.gallery-aspect-grid .flex-viewport {
    margin-bottom: 10px;
}

.gallery-aspect-grid .flex-control-thumbs {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 colonnes comme demandé */
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gallery-aspect-grid .flex-control-thumbs li {
    margin: 0;
    padding: 0;
}

.gallery-aspect-grid .flex-control-thumbs img {
    width: 100%;
    height: 100px; /* Augmenté la hauteur */
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.gallery-aspect-grid .flex-control-thumbs img:hover,
.gallery-aspect-grid .flex-control-thumbs img.flex-active {
    opacity: 1;
    border-color: #000;
}

/* ===== STYLE VERTICAL ===== */
.gallery-aspect-vertical .woocommerce-product-gallery {
    display: flex;
    flex-direction: row-reverse;
    gap: 20px; /* Espacement augmenté */
    align-items: flex-start;
}

.gallery-aspect-vertical .flex-viewport {
    flex: 1;
}

.gallery-aspect-vertical .flex-control-thumbs {
    display: flex;
    flex-direction: column;
    gap: 12px; /* Espacement augmenté */
    margin: 0;
    padding: 0;
    list-style: none;
    width: 150px; /* Largeur augmentée pour images plus grandes */
}

.gallery-aspect-vertical .flex-control-thumbs li {
    margin: 0;
    padding: 0;
}

.gallery-aspect-vertical .flex-control-thumbs img {
    width: 100%;
    height: 120px; /* Hauteur augmentée pour images plus grandes */
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.gallery-aspect-vertical .flex-control-thumbs img:hover,
.gallery-aspect-vertical .flex-control-thumbs img.flex-active {
    opacity: 1;
    border-color: #000;
    transform: scale(1.02);
}

/* ===== STYLE CAROUSEL ===== */
.gallery-aspect-carousel .woocommerce-product-gallery {
    position: relative;
}

.gallery-aspect-carousel .flex-viewport {
    margin-bottom: 15px;
}

/* FORCE le style horizontal pour carousel */
.gallery-aspect-carousel .flex-control-thumbs {
    display: grid !important; /* Utilise grid pour un alignement parfait */
    grid-template-columns: repeat(6, 1fr) !important; /* Exactement 6 colonnes */
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto; /* Garde le scroll pour mobile */
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
    padding-bottom: 5px;
    width: 100%;
}

.gallery-aspect-carousel .flex-control-thumbs::-webkit-scrollbar {
    height: 6px;
}

.gallery-aspect-carousel .flex-control-thumbs::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.gallery-aspect-carousel .flex-control-thumbs::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.gallery-aspect-carousel .flex-control-thumbs::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.gallery-aspect-carousel .flex-control-thumbs li {
    margin: 0;
    padding: 0;
    display: block !important; /* Force l'affichage block */
    width: auto !important; /* Largeur automatique pour grid */
}

.gallery-aspect-carousel .flex-control-thumbs img {
    width: 100%; /* Prend toute la largeur de la cellule grid */
    height: 100px; /* Hauteur fixe pour uniformité */
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.gallery-aspect-carousel .flex-control-thumbs img:hover,
.gallery-aspect-carousel .flex-control-thumbs img.flex-active {
    opacity: 1;
    border-color: #000;
    transform: scale(1.05);
}

/* SUPPRESSION DES BOUTONS FLÈCHES POUR CAROUSEL */
.gallery-aspect-carousel .carousel-nav {
    display: none !important; /* Cache complètement la navigation */
}

/* ===== OVERRIDES IMPORTANTS POUR FORCER LES STYLES ===== */
/* S'assure que le carousel reste en grid avec 6 colonnes */
body.gallery-aspect-carousel .flex-control-thumbs {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important;
}

body.gallery-aspect-carousel .flex-control-thumbs li {
    display: block !important;
    float: none !important;
    width: auto !important;
}

/* S'assure que le vertical reste vertical sur desktop */
body.gallery-aspect-vertical .flex-control-thumbs {
    display: flex !important;
    flex-direction: column !important;
}

body.gallery-aspect-vertical .flex-control-thumbs li {
    display: block !important;
    float: none !important;
    width: 100% !important;
}

/* S'assure que la grille reste en grid */
body.gallery-aspect-grid .flex-control-thumbs {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
}

body.gallery-aspect-grid .flex-control-thumbs li {
    display: block !important;
    float: none !important;
    width: auto !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    /* Sur grands écrans mais pas trop grands, garde 6 colonnes */
    .gallery-aspect-carousel .flex-control-thumbs {
        grid-template-columns: repeat(6, 1fr) !important;
    }
}

@media (max-width: 992px) {
    /* Sur tablettes, passe à 4 colonnes pour le carousel */
    .gallery-aspect-carousel .flex-control-thumbs {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    /* Style vertical devient horizontal sur tablette */
    .gallery-aspect-vertical .woocommerce-product-gallery {
        flex-direction: column;
    }
    
    .gallery-aspect-vertical .flex-control-thumbs {
        flex-direction: row;
        width: 100%;
        overflow-x: auto;
        height: auto;
    }
    
    .gallery-aspect-vertical .flex-control-thumbs li {
        flex: 0 0 auto;
    }
    
    .gallery-aspect-vertical .flex-control-thumbs img {
        width: 80px;
        height: 80px;
    }
    
    /* Ajustements carousel tablette */
    .gallery-aspect-carousel .flex-control-thumbs img {
        height: 80px;
    }
    
    /* Ajustements grid tablette - reste en 4 colonnes */
    .gallery-aspect-grid .flex-control-thumbs {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .gallery-aspect-grid .flex-control-thumbs img {
        height: 80px;
    }
}

@media (max-width: 768px) {
    /* Sur petits écrans, carousel passe à 3 colonnes */
    .gallery-aspect-carousel .flex-control-thumbs {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 640px) {
    /* Sur très petits écrans, passe à 2 colonnes pour grid */
    .gallery-aspect-grid .flex-control-thumbs {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-aspect-vertical .flex-control-thumbs img,
    .gallery-aspect-carousel .flex-control-thumbs img {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 480px) {
    .gallery-aspect-grid .flex-control-thumbs {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .gallery-aspect-grid .flex-control-thumbs img {
        height: 70px;
    }
    
    .gallery-aspect-vertical .flex-control-thumbs img,
    .gallery-aspect-carousel .flex-control-thumbs img {
        width: 60px;
        height: 60px;
    }
    
    /* Sur mobile très petit, carousel passe à 2 colonnes */
    .gallery-aspect-carousel .flex-control-thumbs {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ===== ANIMATIONS ===== */
.gallery-aspect-carousel .flex-control-thumbs {
    scroll-behavior: smooth;
}

.gallery-aspect-grid .flex-control-thumbs img,
.gallery-aspect-vertical .flex-control-thumbs img,
.gallery-aspect-carousel .flex-control-thumbs img {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== ACCESSIBILITÉ ===== */
@media (prefers-reduced-motion: reduce) {
    .gallery-aspect-grid .flex-control-thumbs img,
    .gallery-aspect-vertical .flex-control-thumbs img,
    .gallery-aspect-carousel .flex-control-thumbs img {
        transition: none;
    }
    
    .gallery-aspect-carousel .flex-control-thumbs {
        scroll-behavior: auto;
    }
}

/* Focus visible pour l'accessibilité */
.gallery-aspect-grid .flex-control-thumbs img:focus,
.gallery-aspect-vertical .flex-control-thumbs img:focus,
.gallery-aspect-carousel .flex-control-thumbs img:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}