/* ============================================
   CORRECTIONS DES PROBLÈMES D'AFFICHAGE - VERSION DÉFINITIVE
   ============================================ */

/* 1. Enlever le trait blanc avant le footer */
.contact-section {
    border-bottom: none !important;
    margin-bottom: 0 !important;
}

.footer {
    border-top: none !important;
    margin-top: 0 !important;
}

/* Forcer la suppression de tout espace entre contact et footer */
section:last-of-type {
    margin-bottom: 0 !important;
}

/* 2. Mobile: élargir COMPLÈTEMENT les boxes produits (presque sans marges) */
@media (max-width: 768px) {
    .product-grid,
    .product-container,
    .product-content,
    .product-box,
    .purchase-section,
    .product-info-section .container {
        padding-left: 2px !important;
        padding-right: 2px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .container {
        padding-left: 5px !important;
        padding-right: 5px !important;
        max-width: 100% !important;
    }

    /* Forcer les sections de configuration à utiliser toute la largeur */
    .configuration-section,
    .purchase-section,
    .product-details,
    .product-info {
        margin-left: 2px !important;
        margin-right: 2px !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}

/* 3. Mobile: réduire espace entre fil d'ariane et photo */
@media (max-width: 768px) {
    .breadcrumb {
        margin-bottom: 10px !important;
        padding-bottom: 5px !important;
    }

    .product-gallery,
    .gallery-main,
    .product-image-section {
        margin-top: 0 !important;
        padding-top: 10px !important;
    }
}

/* 4. Logo WhatsApp TOTALEMENT transparent - FIX QUART DE CERCLE BLEU */
/* Supprimer complètement le background du bouton */
.chat-widget {
    background: transparent !important;
    border-radius: 0 !important; /* Empêcher les arrondis qui créent le quart de cercle */
}

.chat-button {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important; /* Empêcher les arrondis */
    /* Optionnel: ajouter une ombre très légère pour la visibilité */
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15)) !important;
}

.chat-button:hover {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    transform: scale(1.1) !important;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2)) !important;
}

.chat-button::before,
.chat-button::after,
.chat-widget::before,
.chat-widget::after {
    display: none !important; /* Supprimer tout pseudo-élément qui pourrait créer le quart de cercle */
}

/* Icône WhatsApp avec sa propre couleur */
.chat-button i.fa-whatsapp,
.chat-button .fab.fa-whatsapp {
    background: transparent !important;
    color: #25D366 !important; /* Couleur verte WhatsApp sur l'icône */
    font-size: 32px !important; /* Augmenter la taille de l'icône */
    border-radius: 50% !important; /* L'icône elle-même peut être ronde */
}

/* S'assurer que toutes les variantes sont transparentes */
#whatsapp-widget,
.whatsapp-float,
.whatsapp-btn,
.whatsapp-widget,
.whatsapp-button,
.whatsapp-icon,
.whatsapp-logo,
[class*="whatsapp"] {
    background: transparent !important;
    background-color: transparent !important;
}

[class*="whatsapp"] img {
    background: transparent !important;
    background-color: transparent !important;
}

/* 5. Bulle du panier PARFAITEMENT RONDE et visible - CORRECTION DU CLIC */
.cart-count,
.cart-badge,
.cart-bubble,
.cart-items-count,
[class*="cart-count"]:not(.chat-button),
[class*="badge"]:not(.chat-button):not(.article-category-badge):not(.trust-badge):not([class*="trust"]) {
    top: -8px !important;
    right: -8px !important;
    overflow: visible !important;
    z-index: 10 !important; /* Réduire le z-index pour ne pas bloquer le clic */
    position: absolute !important;
    pointer-events: none !important; /* La bulle ne doit pas intercepter les clics */
    /* Forcer la forme ronde parfaite */
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    border-radius: 50% !important;
    /* Centrage du texte */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1 !important;
    /* Style de la bulle */
    background: #007bff !important;
    color: white !important;
    font-size: 11px !important;
    font-weight: bold !important;
    padding: 0 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

/* S'assurer que le bouton panier reste cliquable */
.cart-button,
.cart-icon,
.header-cart button,
[class*="cart"] button {
    position: relative !important;
    z-index: 9 !important; /* En dessous de la bulle mais cliquable */
    pointer-events: auto !important; /* Forcer le clic */
    cursor: pointer !important;
}

/* Forcer overflow visible sur TOUS les conteneurs parents */
.header,
.header-container,
.nav-right,
.header-icons,
.header-cart,
.cart-icon,
.cart-button,
[class*="cart"],
[class*="header"] {
    overflow: visible !important;
    position: relative !important;
}

/* S'assurer que le header n'a pas de overflow hidden */
header,
nav,
.navbar {
    overflow: visible !important;
}

/* 6. Retour à ligne titre page accueil PC */
@media (min-width: 1024px) {
    .hero-title,
    h1.title,
    .cta-title,
    .section-title:first-child {
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 90% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* Amélioration additionnelle pour mobile - MARGES MINIMALES */
@media (max-width: 480px) {
    /* Réduction MAXIMALE des marges sur très petit écran */
    .container {
        padding-left: 2px !important;
        padding-right: 2px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .product-box,
    .product-card,
    .configuration-section,
    .purchase-section {
        margin: 0 !important;
        padding: 10px !important;
        border-radius: 8px !important;
        width: calc(100% - 4px) !important;
        margin-left: 2px !important;
        margin-right: 2px !important;
    }
}

/* Fix pour le menu mobile et icônes sur petits écrans - CORRECTION DÉFINITIVE V3.0 */
@media (max-width: 768px) {
    /* Correction positionnement panier avec plus d'espace */
    .header-cart,
    .cart-icon,
    .nav-right {
        position: relative !important;
        z-index: 1001 !important;
        overflow: visible !important;
        padding-top: 5px !important; /* Ajouter du padding pour la bulle */
    }

    /* CORRECTION DÉFINITIVE DU BOUTON MOBILE HAMBURGER/X */
    /* Le bouton mobile-toggle utilise des spans transformés, pas une icône Font Awesome */
    .mobile-toggle,
    button.mobile-toggle,
    .header .mobile-toggle,
    header .mobile-toggle {
        width: 45px !important; /* Augmenté pour accommoder le X parfaitement */
        height: 45px !important;
        overflow: visible !important;
        padding: 0 !important; /* Pas de padding pour maximiser l'espace */
        position: relative !important;
        z-index: 1001 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 4px !important;
        background: transparent !important; /* Fond transparent */
        background-color: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* Ajuster les spans pour qu'ils restent centrés */
    .mobile-toggle span,
    button.mobile-toggle span {
        width: 24px !important; /* Taille standard des spans */
        height: 2px !important;
        margin: 0 !important; /* Pas de marges auto */
        display: block !important;
        background: var(--text-dark, #1a1a1a) !important;
        transition: all 0.3s ease !important;
        position: relative !important;
    }

    /* État par défaut des spans (hamburger - 3 barres) */
    /* Utilisation de [style] pour surcharger les styles inline JavaScript */
    .mobile-toggle:not(.active) span:nth-child(1)[style],
    .mobile-toggle:not(.active) span:nth-child(1),
    button.mobile-toggle:not(.active) span:nth-child(1)[style],
    button.mobile-toggle:not(.active) span:nth-child(1) {
        transform: translate(0, 0) rotate(0deg) !important;
    }

    .mobile-toggle:not(.active) span:nth-child(2)[style],
    .mobile-toggle:not(.active) span:nth-child(2),
    button.mobile-toggle:not(.active) span:nth-child(2)[style],
    button.mobile-toggle:not(.active) span:nth-child(2) {
        opacity: 1 !important;
        transform: scale(1) !important;
    }

    .mobile-toggle:not(.active) span:nth-child(3)[style],
    .mobile-toggle:not(.active) span:nth-child(3),
    button.mobile-toggle:not(.active) span:nth-child(3)[style],
    button.mobile-toggle:not(.active) span:nth-child(3) {
        transform: translate(0, 0) rotate(0deg) !important;
    }

    /* Masquer le span du milieu quand actif */
    .mobile-toggle.active span:nth-child(2),
    button.mobile-toggle.active span:nth-child(2) {
        opacity: 0 !important;
        transform: scale(0) !important;
    }

    /* Transformations pour former le X - CENTRÉ PARFAITEMENT */
    .mobile-toggle.active span:nth-child(1),
    button.mobile-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translateY(8px) !important;
    }

    .mobile-toggle.active span:nth-child(3),
    button.mobile-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translateY(-8px) !important;
    }

    /* Hover effet pour le bouton mobile-toggle - TRANSPARENT */
    .mobile-toggle:hover {
        background: transparent !important;
        transform: scale(1.05) !important; /* Légère augmentation de taille au hover */
    }

    /* FIX DÉFINITIF pour l'alignement vertical des liens du menu mobile */
    @media (max-width: 1024px) {
        /* Reset COMPLET de tous les styles problématiques */
        .mobile-menu .nav-center .nav-link,
        .nav-menu.active .nav-center .nav-link,
        .nav-center .nav-link {
            /* Reset de la position et du display */
            position: static !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;

            /* Hauteur et padding uniformes */
            height: 60px !important;
            min-height: 60px !important;
            max-height: 60px !important;
            padding: 0 15px !important; /* Padding horizontal seulement */

            /* Reset du texte */
            line-height: 1 !important;
            vertical-align: middle !important;
            text-align: center !important;

            /* Reset des marges et bordures */
            margin: 0 !important;
            border: none !important;
            border-bottom: none !important;
            border-top: none !important;

            /* Assurer l'uniformité */
            box-sizing: border-box !important;
            font-size: 16px !important;
            font-weight: 500 !important;
        }

        /* Supprimer TOUS les pseudo-éléments */
        .nav-center .nav-link::after,
        .nav-center .nav-link::before,
        .mobile-menu .nav-center .nav-link::after,
        .mobile-menu .nav-center .nav-link::before {
            display: none !important;
            content: none !important;
        }

        /* Forcer l'uniformité du conteneur parent */
        .mobile-menu .nav-center,
        .nav-menu.active .nav-center {
            display: flex !important;
            flex-direction: column !important;
            align-items: stretch !important;
            gap: 1.2rem !important;
            padding: 0 !important;
            margin: 0 !important;
        }

        /* S'assurer que le hover ne change pas l'alignement */
        .nav-center .nav-link:hover {
            height: 60px !important;
            padding: 0 15px !important;
            transform: none !important;
        }
    }

    /* Menu mobile overlay */
    .mobile-menu,
    .nav-menu.active {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 100000 !important;
        background: rgba(255, 255, 255, 0.98) !important;
        padding-top: 60px !important; /* Ajuster l'espace pour la croix repositionnée */
        overflow-y: auto !important;
        overflow-x: visible !important;
    }
}

/* Marges des boxes produits ULTRA RÉDUITES sur mobile */
@media (max-width: 768px) {
    .product-box,
    .product-card,
    .pricing-card,
    .configuration-section,
    .purchase-section,
    .toggle-option-card {
        margin: 1px !important; /* Marges quasi nulles */
        padding: 12px !important;
        width: calc(100% - 2px) !important;
    }

    .product-grid {
        gap: 2px !important; /* Gap minimal */
        padding: 0 !important;
    }

    /* Section du produit principal */
    .product-hero,
    .product-details,
    .product-info {
        padding-left: 3px !important;
        padding-right: 3px !important;
    }
}

/* Correction spécifique pour les cartes d'options sur mobile */
@media (max-width: 768px) {
    .chiller-option,
    .option-card,
    .toggle-option {
        margin-left: 2px !important;
        margin-right: 2px !important;
        width: calc(100% - 4px) !important;
    }
}

/* Force l'overflow visible sur toute la structure du header */
@media (max-width: 768px) {
    body,
    html {
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    header,
    .header,
    .header-container,
    .navbar,
    nav {
        overflow: visible !important;
        min-height: 60px !important; /* Hauteur minimale pour éviter la coupure */
        padding-top: 5px !important;
    }
}

/* 7. CORRECTION CRITIQUE: Panier qui s'ouvre en bas de page */
.cart-sidebar {
    position: fixed !important;
    top: 0 !important; /* Forcer le panier à commencer en haut de la page */
    right: -400px !important;
    height: 100vh !important; /* Utiliser toute la hauteur de la fenêtre */
    max-height: 100vh !important;
    bottom: auto !important; /* Éviter qu'il soit poussé en bas */
    z-index: 10000 !important;
}

.cart-sidebar.active {
    right: 0 !important;
}

/* Mobile: ajuster la largeur du panier */
@media (max-width: 768px) {
    .cart-sidebar {
        width: 100% !important; /* Pleine largeur sur mobile */
        right: -100% !important;
    }

    .cart-sidebar.active {
        right: 0 !important;
    }
}

/* Ajustement supplémentaire pour très petits écrans (<400px) */
/* SUPPRIMÉ - Les styles de la media query principale s'appliquent pour tous les mobiles */

/* 8. MASQUER LA NOTIFICATION DE CHAT SUR MOBILE */
@media (max-width: 768px) {
    /* Masquer le cercle de notification du chat */
    .chat-notification,
    .chat-badge,
    .chat-widget-badge,
    .chat-button .badge,
    .chat-button .notification,
    .chat-widget .notification,
    [class*="chat"] .badge,
    [class*="chat"] [class*="notification"],
    .chat-button::before,
    .chat-widget::before {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }

    /* S'assurer que seule l'icône WhatsApp est visible */
    .chat-button,
    .chat-widget {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    .chat-button i.fa-whatsapp {
        display: block !important;
        color: #25D366 !important;
        font-size: 36px !important;
    }
}