/* ============================================
   Carrousel Produits Sœurs - Horizontal Scroll
   ============================================ */

.produits-soeurs-wrapper {
    margin: 40px 0;
    position: relative;
    padding: 0 60px;
}

/* Boutons de navigation */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.carousel-nav:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

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

.carousel-nav:focus {
    outline: 2px solid;
    outline-offset: 2px;
}

.carousel-nav-prev {
    left: 0;
}

.carousel-nav-next {
    right: 0;
}

.carousel-nav svg {
    width: 24px;
    height: 24px;
}

/* Désactiver le bouton quand on ne peut pas scroller */
.carousel-nav[style*="opacity: 0.3"] {
    cursor: not-allowed;
    background: #f5f5f5;
    border-color: #ddd;
    color: #999;
}

.carousel-nav[style*="opacity: 0.3"]:hover {
    background: #f5f5f5;
    color: #999;
    transform: translateY(-50%) scale(1);
}

/* Carrousel horizontal pour toutes les tailles d'écran */
.produits-soeurs-carousel {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 20px 0;
    /* Créer un effet de fade sur le côté droit pour montrer qu'on peut scroller */
    position: relative;
}

/* Gradient de fade à droite pour desktop */
.produits-soeurs-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 60px;
    width: 80px;
    height: calc(100% - 20px);
    background: linear-gradient(to left, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
    z-index: 1;
}

@media (max-width: 992px) {
    .produits-soeurs-wrapper::after {
        right: 50px;
    }
}

@media (max-width: 576px) {
    .produits-soeurs-wrapper::after {
        width: 50px;
        right: 40px;
    }
}

@media (max-width: 400px) {
    .produits-soeurs-wrapper::after {
        right: 35px;
    }
}

/* Scrollbar stylisée */
.produits-soeurs-carousel::-webkit-scrollbar {
    height: 8px;
}

.produits-soeurs-carousel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.produits-soeurs-carousel::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.produits-soeurs-carousel::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Lien de la carte - Desktop: 3 colonnes + aperçu 4ème */
.produit-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    /* Calcul: (100% - gaps) / 3.3 pour montrer ~3 colonnes + aperçu */
    flex: 0 0 calc((100% - 72px) / 3.3);
    scroll-snap-align: start;
    min-width: 280px;
    max-width: 380px;
}

/* Carte produit - Taille uniforme desktop et mobile */
.produit-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.produit-card-link:hover .produit-card {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
}

/* Image du produit - Taille fixe */
.produit-card-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: #f5f5f5;
}

/* Carousel d'images du produit */
.produit-carousel {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
}

.produit-carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.produit-carousel-slide.active {
    opacity: 1;
    z-index: 1;
}

.produit-carousel-slide.active::after {
    background-image: linear-gradient(0deg, rgba(0, 0, 0, .35), transparent 75%);
    background-repeat: no-repeat;
    bottom: 0;
    content: "";
    display: block;
    height: 100%;
    opacity: 1;
    position: absolute;
    transition: all .3s ease-out;
    width: 100%;
}

.produit-carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Boutons de navigation du carousel d'images */
.produit-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(255, 255, 255, 0.4) !important;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    cursor: pointer;
    color: #333;
}

.produit-card-link:hover .produit-carousel-btn {
    opacity: 1;
}

.produit-carousel-btn:hover {
    background: #fff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.produit-carousel-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.produit-carousel-prev {
    left: 10px;
}

.produit-carousel-next {
    right: 10px;
}

.produit-carousel-btn svg {
    width: 18px;
    height: 18px;
}

/* Indicateurs du carousel d'images */
.produit-carousel-indicators {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    gap: 6px;
}

.produit-carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.produit-carousel-indicator:hover {
    background: rgba(255, 255, 255, 0.8);
}

.produit-carousel-indicator.active {
    background: #fff;
    width: 24px;
    border-radius: 4px;
}

/* Overlay du produit */
.produit-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease;
    z-index: 1;
    opacity: 0.3;
}

/* Au survol, l'overlay disparaît légèrement */
.produit-card-link:hover .produit-card-overlay {
    opacity: 0;
}

/* Image non disponible */
.produit-card-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0e0e0;
    color: #999;
    font-size: 14px;
}

/* Contenu de la carte */
.produit-card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Titre du produit - Max 3 lignes (comme dans listing_produits_taxonomie) */
.produit-card-title {
    margin: 0 0 12px 0;
    font-size: 16px !important;
    font-weight: 500;
    line-height: 1.4;
    color: #4A90E2;
    transition: color 0.2s ease;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: calc(1.4em * 3);
}

.produit-card-link:hover .produit-card-title {
    color: #2040CC;
}

/* Description limitée à 4 lignes */
.produit-card-description {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 16px 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bouton CTA */
.produit-card-cta {
    display: block;
    padding: 12px 24px;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    transition: all 0.3s ease;
    align-self: stretch;
}

/* Messages d'erreur */
.no-current-post,
.no-taxonomy,
.no-terms,
.no-related-products {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 20px 0;
}

/* ============================================
   RESPONSIVE - Ajustements pour tablette et mobile
   ============================================ */

/* Tablette - 2 colonnes visibles + aperçu */
@media (max-width: 992px) {
    .produits-soeurs-wrapper {
        padding: 0 50px;
    }
    
    .carousel-nav {
        width: 42px;
        height: 42px;
    }
    
    .carousel-nav svg {
        width: 20px;
        height: 20px;
    }
    
    .produit-card-link {
        flex: 0 0 calc(50% - 12px);
        min-width: 280px;
        max-width: 380px;
    }
}

/* Mobile - 1 colonne visible + aperçu */
@media (max-width: 576px) {
    .produits-soeurs-wrapper {
        margin: 30px 0;
        padding: 0 40px;
    }
    
    .carousel-nav {
        width: 36px;
        height: 36px;
        border-width: 1.5px;
    }
    
    .carousel-nav svg {
        width: 18px;
        height: 18px;
    }
    
    .carousel-nav-prev {
        left: 0;
    }
    
    .carousel-nav-next {
        right: 0;
    }
    
    .produits-soeurs-carousel {
        gap: 16px;
        padding: 0 0 20px 0;
    }
    
    .produits-soeurs-carousel::-webkit-scrollbar {
        height: 6px;
    }
    
    .produit-card-link {
        flex: 0 0 85%;
        min-width: 280px;
        max-width: 320px;
    }
    
    .produit-card-content {
        padding: 16px;
    }
    
    .produit-card-title {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .produit-card-description {
        font-size: 13px;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        margin-bottom: 12px;
    }
    
    .produit-card-cta {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* Très petits écrans */
@media (max-width: 400px) {
    .produits-soeurs-wrapper {
        padding: 0 35px;
    }
    
    .carousel-nav {
        width: 32px;
        height: 32px;
    }
    
    .carousel-nav svg {
        width: 16px;
        height: 16px;
    }
    
    .produit-card-link {
        flex: 0 0 90%;
        min-width: 260px;
        max-width: 300px;
    }
}
