/* ===================================================== */
/* MENU RESPONSIVE - MIZARA FAHAZAVANA (CORRIGÉ) */
/* Compatible mobile/tablette/desktop */
/* ===================================================== */

/* ===== 1. VARIABLES RESPONSIVES ===== */
:root {
    /* Couleurs */
    --primary-color: #1e4d2b;
    --secondary-color: #2c5530;
    --accent-color: #3a6b47;
    --light-green: #8fb996;
    --text-light: #ffffff;
    --text-dark: #2d3748;
    --background-light: #f8f9fa;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    
    /* Breakpoints */
    --mobile: 576px;
    --tablet: 768px;
    --desktop: 992px;
    --large-desktop: 1200px;
}

/* ===== 2. TOP BANNER RESPONSIVE ===== */
.top-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 15px 5%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-light);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    text-align: center;
    overflow: hidden;
}

.top-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--text-light);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background: var(--text-light);
    padding: 3px;
    flex-shrink: 0;
}

.animated-text {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    
    /* Gestion texte long */
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
    word-break: break-word;
    hyphens: auto;
}

/* ===== 3. NAVBAR RESPONSIVE ===== */
.navbar {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    padding: 0 5%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: 70px;
    overflow: visible !important;
}

/* Toggle menu mobile */
.toggle {
    display: none;
    background: none;
    border: 2px solid var(--text-light);
    color: var(--text-light);
    font-size: 1.8rem;
    padding: 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle:hover {
    background: var(--text-light);
    color: var(--primary-color);
}

/* ===== 4. MENU PRINCIPAL RESPONSIVE ===== */
.nav-links {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
    flex-wrap: wrap;
    overflow: visible !important;
}

.nav-links > li {
    position: relative;
    overflow: visible !important;
}

.nav-links > li > a {
    color: var(--text-light);
    text-decoration: none;
    padding: 1rem 1.2rem;
    display: block;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 5px;
    white-space: nowrap;
    position: relative;
}

.nav-links > li > a:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* Badges de notification */
.fb-notification-badge, 
.fb-notification-badge-small,
.commande-badge-simple,
.badge_ctc {
    background: #ff4757;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.8rem;
    margin-left: 5px;
    vertical-align: super;
}

/* ===== 5. DROPDOWNS RESPONSIVE ===== */
.dropdown {
    position: relative;
    overflow: visible !important;
}

/* CORRECTION : DROPDOWNS CACHÉS PAR DÉFAUT */
.dropdown-content {
    /* CACHÉ PAR DÉFAUT */
    display: none !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    
    /* POSITION ET STYLE */
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--text-light);
    min-width: 240px;
    max-width: 320px;
    box-shadow: var(--shadow);
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    z-index: 1001;
    
    /* TRANSITION */
    transition: all 0.3s ease;
    overflow: visible !important;
}

/* AFFICHER SEULEMENT AU SURVOL */
.dropdown:hover .dropdown-content {
    display: block !important;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-content li {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.dropdown-content li:last-child {
    border-bottom: none;
}

.dropdown-content a {
    color: var(--text-dark);
    padding: 0.9rem 1.2rem;
    display: block;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 400;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.dropdown-content a:hover {
    background: var(--accent-color);
    color: var(--text-light);
    padding-left: 1.5rem;
}

/* Harona mini panier */
#miniPanierWrapper {
    position: relative;
}

#miniPanierDropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    max-width: 90vw;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    z-index: 1002;
    display: none;
}

#miniPanierWrapper:hover #miniPanierDropdown {
    display: block;
}

/* ===== 6. RESPONSIVE BREAKPOINTS ===== */

/* 📱 MOBILE (max 576px) */
@media (max-width: 576px) {
    .top-banner {
        flex-direction: column;
        gap: 10px;
        padding: 12px 3%;
    }
    
    .top-logo {
        width: 60px;
        height: 60px;
    }
    
    .animated-text {
        font-size: 1.1rem;
        line-height: 1.3;
        padding: 0 10px;
    }
    
    .navbar {
        padding: 0 3%;
        min-height: 60px;
        flex-wrap: wrap;
    }
    
    .toggle {
        display: block;
        order: 1;
    }
    
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        order: 2;
        background: var(--secondary-color);
        position: absolute;
        top: 100%;
        left: 0;
        padding: 10px 0;
        box-shadow: 0 5px 15px rgba(0,0,0,0.2);
        z-index: 999;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links > li {
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .nav-links > li > a {
        padding: 0.9rem 1.2rem;
        white-space: normal;
        text-align: left;
        border-radius: 0;
    }
    
    /* CORRECTION MOBILE : dropdowns en clic */
    .dropdown-content {
        display: none !important;
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(0,0,0,0.05);
        margin-left: 20px;
        min-width: auto;
        max-width: 100%;
        border: none;
        border-radius: 0;
    }
    
    .dropdown.active .dropdown-content {
        display: block !important;
    }
    
    /* Flèche pour mobile */
    .dropdown > a::after {
        content: ' ▾';
        float: right;
        transition: transform 0.3s;
    }
    
    .dropdown.active > a::after {
        content: ' ▴';
    }
    
    #miniPanierDropdown {
        width: 280px;
        right: -50px;
    }
}

/* 📱 TABLETTE (577px - 768px) */
@media (min-width: 577px) and (max-width: 768px) {
    .top-banner {
        gap: 15px;
        padding: 15px 4%;
    }
    
    .top-logo {
        width: 70px;
        height: 70px;
    }
    
    .animated-text {
        font-size: 1.3rem;
    }
    
    .navbar {
        padding: 0 4%;
    }
    
    .nav-links {
        gap: 0.3rem;
        flex-wrap: wrap;
    }
    
    .nav-links > li > a {
        padding: 0.8rem 0.7rem;
        font-size: 0.9rem;
        white-space: normal;
        text-align: center;
        line-height: 1.2;
    }
    
    .dropdown-content {
        min-width: 200px;
    }
}

/* 💻 TABLETTE LANDSCAPE / PETIT DESKTOP (769px - 992px) */
@media (min-width: 769px) and (max-width: 992px) {
    .top-banner {
        padding: 15px 4%;
    }
    
    .animated-text {
        font-size: 1.4rem;
    }
    
    .navbar {
        padding: 0 4%;
    }
    
    .nav-links {
        gap: 0.4rem;
    }
    
    .nav-links > li > a {
        padding: 0.9rem 0.8rem;
        font-size: 0.95rem;
    }
    
    .dropdown-content {
        min-width: 220px;
    }
}

/* 🖥️ DESKTOP (993px - 1200px) */
@media (min-width: 993px) and (max-width: 1200px) {
    .top-banner {
        padding: 15px 5%;
    }
    
    .animated-text {
        font-size: 1.5rem;
    }
    
    .navbar {
        padding: 0 5%;
    }
    
    .nav-links {
        gap: 0.5rem;
    }
    
    .nav-links > li > a {
        padding: 1rem 1rem;
    }
}

/* 🖥️ GRAND DESKTOP (1201px et plus) */
@media (min-width: 1201px) {
    .top-banner {
        padding: 15px 8%;
    }
    
    .animated-text {
        font-size: 1.6rem;
    }
    
    .navbar {
        padding: 0 8%;
    }
    
    .nav-links {
        gap: 0.6rem;
    }
    
    .nav-links > li > a {
        padding: 1rem 1.2rem;
    }
    
    .dropdown-content {
        min-width: 260px;
    }
}

/* ===== 7. UTILITAIRES RESPONSIVES ===== */

/* Cache éléments sur mobile */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
    
    /* Traduction française plus discrète sur mobile */
    .translation-fr {
        font-size: 0.8rem;
        opacity: 0.8;
        display: block;
        margin-top: 2px;
    }
}

/* Gestion des longs textes dans dropdowns */
.dropdown-content .long-text {
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
}

/* ===== 8. CORRECTIONS SPÉCIFIQUES ===== */

/* Empêcher le débordement horizontal */
body, html {
    overflow-x: hidden;
    max-width: 100%;
}

/* Container principal */
.container, .wrapper, main {
    overflow-x: hidden;
}

/* Gestion des dropdowns alignés à droite */
.nav-links > li:last-child .dropdown-content,
.nav-links > li:nth-last-child(2) .dropdown-content {
    left: auto;
    right: 0;
}

/* Style pour le sélecteur de langue */
.lang-switcher {
    background: transparent;
    border: 1px solid var(--text-light);
    color: var(--text-light);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

/* ===== 9. ANIMATIONS ===== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 10. IMPRESSION ===== */
@media print {
    .navbar, .top-banner, .toggle {
        display: none !important;
    }
}