/* ========================================
   INSTAPRODUIT MEGA MENU STYLES
   Modifiez ces valeurs pour personnaliser l'apparence du menu mega
   ======================================== */

/* Conteneur du mega menu - ajustez la largeur, couleurs, etc. */
.instaproduit-mega {
    display: none;
    position: absolute !important; /* Absolute relative to parent li */
    left: 0 !important;
    top: 100% !important;
    margin-top: 10px !important; /* Distance from top */
    background: #fff !important; /* Couleur de fond */
    border: 1px solid #ddd !important; /* Bordure */
    border-radius: 10px !important; /* Coins ronds */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1) !important; /* Ombre */
    padding: 15px !important; /* Espacement intérieur réduit */
    z-index: 9999 !important;
    width: auto !important; /* Largeur automatique selon le contenu */
    min-width: 400px !important; /* Largeur minimale */
    max-width: 90vw !important; /* Maximum 90% de la largeur de la fenêtre */
    box-sizing: border-box !important;
}

/* Affichage du mega menu quand ouvert */
.instaproduit-open .instaproduit-mega {
    display: flex !important;
}

/* Chaque colonne/famille - colonnes flex */
.instaproduit-mega .instaproduit-col {
    flex: 0 1 auto !important; /* Les colonnes s'adaptent à leur contenu */
    padding: 0 20px !important; /* Plus d'espace entre les colonnes */
    min-width: 200px !important; /* Largeur minimale pour chaque colonne */
}

/* Liens des familles - police, couleur, etc. */
.instaproduit-mega .instaproduit-link {
    display: block !important;
    font-weight: 400 !important; /* Graisse normale pour les produits */
    color: #333 !important; /* Couleur du texte */
    text-decoration: none !important;
    padding: 2px 0 !important; /* Espacement encore plus réduit */
    margin: 0 !important;
    font-size: 13px !important; /* Taille légèrement réduite */
    line-height: 1.2 !important; /* Ligne plus serrée */
}

/* Liens des produits - espacement supplémentaire */
.instaproduit-mega .instaproduit-product-link {
    margin-bottom: 4px !important;
    white-space: nowrap !important; /* Empêche le texte de passer sur plusieurs lignes */
    overflow: hidden !important; /* Cache le texte qui dépasse */
    text-overflow: ellipsis !important; /* Ajoute des ... si le texte est trop long */
    max-width: 100% !important; /* S'assure que le lien ne dépasse pas de la colonne */
    display: block !important; /* Assure un produit par ligne */
}

/* Texte "Aucun produit" */
.instaproduit-mega .instaproduit-no-products {
    display: block !important;
    color: #999 !important;
    font-size: 12px !important;
    font-style: italic !important;
    margin-top: 4px !important;
}

/* Conteneur pour sous-colonnes (quand il y a beaucoup de produits) */
.instaproduit-mega .instaproduit-subcols {
    display: flex !important;
    gap: 15px !important;
    margin-top: 5px !important;
}

/* Chaque sous-colonne de produits */
.instaproduit-mega .instaproduit-subcol {
    flex: 1 !important;
    min-width: 0 !important; /* Permet au contenu de ne pas déborder */
}

/* Titre de la famille */
.instaproduit-mega .instaproduit-family-title {
    font-weight: 700 !important; /* Gras pour le titre */
    font-size: 15px !important;
    margin-bottom: 8px !important;
    border-bottom: 1px solid #eee !important;
    padding-bottom: 5px !important;
}

/* Hover des liens */
.instaproduit-mega .instaproduit-link:hover {
    text-decoration: underline !important;
    color: #007cba !important; /* Couleur au survol */
}

/* Positionnement du conteneur parent */
.instaproduit-menu-item {
    position: relative !important;
}

/* Masquer l'ancien sous-menu du thème */
.instaproduit-menu-item .sub-menu,
.instaproduit-menu-item .children,
.instaproduit-menu-item ul {
    display: none !important;
}

/* ========================================
   STYLES POUR LA BOUTIQUE
   ======================================== */
.instaproduit-shop-families a {
    text-decoration: none;
}
.instaproduit-shop-families a:hover {
    text-decoration: underline;
}

/* ========================================
   STYLES POUR LES PAGES D'ARCHIVE DE FAMILLE
   ======================================== */
/* Réduire la taille des vignettes de produits sur les pages de famille */
.tax-product_family .products .product {
    width: 20% !important; /* 5 produits par ligne sur desktop */
    margin: 1% !important;
}

.tax-product_family .products .product img {
    max-height: 150px !important; /* Limiter la hauteur des images */
    object-fit: contain !important;
}

.tax-product_family .products .product .woocommerce-loop-product__title {
    font-size: 13px !important; /* Titre plus petit */
    margin: 5px 0 !important;
}

.tax-product_family .products .product .price {
    font-size: 14px !important; /* Prix plus petit */
}

/* Responsive pour tablettes */
@media (max-width: 992px) {
    .tax-product_family .products .product {
        width: 30% !important; /* 3 produits par ligne */
        margin: 1.66% !important;
    }
}

/* Responsive pour mobile */
@media (max-width: 576px) {
    .tax-product_family .products .product {
        width: 48% !important; /* 2 produits par ligne */
        margin: 1% !important;
    }
}

/* Masquer la pagination sur les pages de famille */
.tax-product_family .woocommerce-pagination {
    display: none !important;
}

/* ========================================
   RESPONSIVE STYLES FOR MOBILE
   ======================================== */
@media (max-width: 768px) {
    /* Menu mobile comme sous-menu natif */
    .instaproduit-mega {
        position: static !important; /* Position normale dans le flux */
        width: 100% !important; /* Pleine largeur */
        max-width: none !important;
        left: auto !important;
        transform: none !important;
        margin-top: 0 !important;
        background: transparent !important; /* Pas de fond blanc */
        border: none !important; /* Pas de bordure */
        border-radius: 0 !important; /* Pas de coins arrondis */
        box-shadow: none !important; /* Pas d'ombre */
        padding: 0 !important; /* Pas de padding */
        max-height: 400px !important; /* Hauteur maximale pour le scroll */
        overflow-y: auto !important; /* Permet le scroll vertical */
        /*border: 2px solid red !important; /* Debug: red border to highlight */
        /*background: rgba(0,255,0,0.1) !important; /* Debug: green background to highlight */
    }
    
    /* Affichage en liste verticale sur mobile */
    .instaproduit-open .instaproduit-mega {
        display: block !important;
    }
    
    /* Chaque famille comme un item de menu mobile */
    .instaproduit-mega .instaproduit-col {
        min-width: 100% !important;
        margin-bottom: 0 !important;
        padding: 10px 20px !important; /* Padding comme les autres items de menu */
        border-bottom: 1px solid #eee !important; /* Séparateur entre familles */
        background: #f8f8f8 !important; /* Fond léger pour distinguer */
    }
    
    /* Titre de famille style menu mobile */
    .instaproduit-mega .instaproduit-family-title {
        font-size: 16px !important;
        font-weight: 600 !important;
        margin-bottom: 10px !important;
        padding-bottom: 8px !important;
        border-bottom: 1px solid #ddd !important;
        display: block !important;
    }
    
    /* Liens produits style sous-menu mobile */
    .instaproduit-mega .instaproduit-link {
        font-size: 14px !important;
        padding: 8px 0 8px 15px !important; /* Indentation pour les produits */
        display: block !important;
        border-left: 3px solid transparent !important;
    }
    
    .instaproduit-mega .instaproduit-product-link {
        margin-bottom: 0 !important;
        white-space: normal !important; /* Permettre le wrap sur mobile */
        overflow: visible !important;
        text-overflow: clip !important;
    }
    
    .instaproduit-mega .instaproduit-link:hover,
    .instaproduit-mega .instaproduit-link:active {
        border-left-color: #007cba !important;
        background: rgba(0,124,186,0.05) !important;
    }
    
    /* Sous-colonnes en liste simple sur mobile */
    .instaproduit-mega .instaproduit-subcols {
        display: block !important;
    }
    
    .instaproduit-mega .instaproduit-subcol {
        margin-bottom: 0 !important;
    }
    
    /* Dernier élément sans bordure */
    .instaproduit-mega .instaproduit-col:last-child {
        border-bottom: none !important;
    }
}

/* Masquer le badge reCAPTCHA */
.grecaptcha-badge {
    visibility: hidden !important;
}

/* Styles pour la page de produit */
.c-loading {
    /* Ajuste la largeur et centre pour coller au div central */
    max-width: 900px; /* S'assure qu'il ne dépasse pas la largeur du parent */
    margin: 0 auto; /* Centre la div horizontalement */
    box-sizing: border-box; /* Inclut le padding et la bordure dans la largeur */
}

.product__wrapper {
    display: flex;
    flex-wrap: wrap; /* Permet aux éléments de passer à la ligne sur de petits écrans */
    gap: 20px; /* Ajoute un espace entre les colonnes */
}

.product__specs {
    flex: 2; /* Prend 2/3 de la largeur */
    min-width: 300px; /* Largeur minimale pour éviter un écrasement excessif */
}

.product__summary {
    flex: 1; /* Prend 1/3 de la largeur */
    min-width: 300px; /* Largeur minimale */
    max-width: 100%; /* S'assure qu'il ne dépasse pas la largeur du parent */
    margin: 0; /* Réinitialise la marge pour le layout flex */
}

.product__info--quantity {
    font-size: 1.5em; /* Taille de police pour correspondre au total */
    font-weight: bold; /* Gras pour correspondre au total */
    color: #333; /* Couleur pour correspondre au total */
    /* Ajoutez d'autres styles si nécessaire pour correspondre exactement à .product__info--price */
}

/* ========================================
   FOOTER PRODUCT LIST STYLES
   ======================================== */
.footer-product-list {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px 0;
}

.footer-family-column {
    flex: 1;
    min-width: 180px;
}

.footer-family-column h4 {
    font-size: 16px;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.footer-family-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-family-column li a {
    color: #fff;
    font-family: 'Dosis', sans-serif;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.8;
}

.footer-family-column li a:hover {
    text-decoration: underline;
}


/* ========================================
   CORRECTIF FINAL CARROUSELS SUR MOBILE
   ======================================== */
@media (max-width: 769px) {
    /* Cible les deux sections de carrousel problématiques */
    .section__partners,
    .section__promotions {
        min-height: 120px; /* Assure une hauteur minimale pour éviter l'effondrement */
        height: auto !important;
    }

    /* Force la hauteur sur la "fenêtre" du carrousel */
    .section__partners .slick-list,
    .section__promotions .slick-list {
        height: 120px !important;
        min-height: 120px !important;
    }

    /* Centre les éléments à l'intérieur de chaque diapositive */
    .section__partners .slick-slide,
    .section__promotions .slick-slide {
        display: flex !important;
        align-items: center;
        justify-content: center;
        min-height: 120px;
    }

    /* S'assure que les images des logos ne dépassent pas */
    .section__partners .client img {
        max-height: 80px;
        width: auto;
        margin: auto;
    }
}
