:root {
    /* --- COULEURS --- */
    --mm-bg: #F9F8F4;       /* Fond crème/nature */
    --mm-text: #2c3e50;     /* Gris foncé */
    --mm-accent: #27ae60;   /* Vert du logo */
    --mm-border: #e8e6e1;   /* Bordure subtile */
    
    /* --- DIMENSIONS --- */
    --mm-nav-height: 60px;
}

/* --- BASE --- */
.megamenu-container {
    width: 100%;
    font-family: 'Roboto', sans-serif;
    position: relative;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

/* --- TRIGGER MOBILE --- */
.megamenu-mobile-trigger {
    display: none;
    padding: 15px;
    background: var(--mm-accent);
    text-align: center;
    color: #fff;
    cursor: pointer;
    font-weight: bold;
    border-radius: 60px;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* --- NAVBAR --- */
.megamenu-navbar {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    height: var(--mm-nav-height);
    padding: 0 15px;
    box-sizing: border-box;
}

.level-1-list {
    display: flex;
    height: 100%;
    margin: 0; 
    padding: 0;
    list-style: none;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.level-1-item {
    height: 100%;
    display: flex; 
    align-items: center;
    flex-shrink: 1; 
}

.level-1-link {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 10px;
    color: var(--mm-text) !important;
    text-transform: uppercase;
    font-weight: 800;
    font-size: 13px; 
    text-decoration: none !important;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

/* Effets Hover Navbar */
.level-1-item:hover .level-1-link,
.level-1-item.active .level-1-link {
    color: var(--mm-accent) !important;
    border-bottom-color: var(--mm-accent);
    background-color: rgba(0,0,0,0.02);
}

.dropdown-icon { 
    margin-left: 4px; 
    font-size: 14px;
    color: #999;
    transition: transform 0.3s;
}

.level-1-item:hover .dropdown-icon {
    transform: rotate(180deg);
    color: var(--mm-accent);
}

/* --- DROPDOWN WRAPPER --- */
.megamenu-dropdown-wrapper {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--mm-bg);
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    border-top: 1px solid var(--mm-border);
    z-index: 9999;
}

.megamenu-dropdown-wrapper.visible {
    display: block !important;
    animation: slideDown 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-container {
    max-width: 1600px;
    margin: 0 auto;
    background: var(--mm-bg);
    min-height: 350px;
    padding: 0 15px;
}

/* --- STRUCTURE INTERNE --- */
.megamenu-pane {
    display: none;
    width: 100%;
    padding: 40px 0;
}
.megamenu-pane.active { display: block; }

.pane-inner-flex {
    display: flex;
    width: 100%;
    gap: 60px;
}

/* --- COLONNES LIENS --- */
.pane-links-area {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: 40px;
    row-gap: 35px;
    align-content: start;
}

/* === TITRES DE NIVEAU 2 === */
.column-title { 
    position: relative;
    margin-bottom: 18px; 
    padding-bottom: 8px;
}

/* Le lien texte */
.column-title a {
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--mm-text) !important;
    text-decoration: none !important;
    display: block;
    letter-spacing: 0.5px;
}

/* Le Trait Vert */
.column-title::after {
    content: '';
    display: block !important;
    position: absolute;
    left: 0;
    bottom: 0;
    width: 35px;
    height: 3px;
    background-color: var(--mm-accent) !important;
    border-radius: 2px;
    transition: width 0.3s ease;
    z-index: 1;
}

/* Animation au survol */
.column-title:hover::after {
    width: 60px;
}

/* --- SOUS-LIENS (Niveau 3) --- */
.level-3-list { 
    list-style: none; 
    padding: 0; 
    margin: 0; 
}

.level-3-list li { 
    margin-bottom: 8px; 
}

.level-3-list a {
    font-size: 13px;
    color: #5d6d7e !important;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-block;
}

.level-3-list a:hover { 
    color: var(--mm-accent) !important; 
    transform: translateX(5px);
}

/* --- IMAGE DROITE --- */
.pane-image-area {
    width: 320px;
    flex-shrink: 0;
}

.promo-link {
    display: block; 
    width: 100%; 
    height: 100%; 
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.pane-image-area img {
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    display: block;
    transition: transform 0.6s ease;
}

.promo-link:hover img {
    transform: scale(1.05);
}

.image-overlay {
    position: absolute; 
    bottom: 20px; 
    left: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    font-weight: 800; 
    color: var(--mm-text);
    text-transform: uppercase; 
    font-size: 13px;
    border-radius: 4px;
    backdrop-filter: blur(5px);
}

/* =========================================
   GESTION DU MENU MOBILE (PANNEAU LATÉRAL)
   ========================================= */

/* Overlay sombre quand menu ouvert */
.megamenu-mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9997;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.megamenu-container.mobile-open .megamenu-mobile-overlay {
    display: block;
    opacity: 1;
}

/* Header du panneau mobile avec bouton fermeture */
.mobile-menu-header {
    display: none;
    padding: 20px;
    background: var(--mm-accent);
    color: white;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

.megamenu-container.mobile-open .mobile-menu-header {
    display: flex;
}

.mobile-menu-title {
    font-weight: bold;
    font-size: 16px;
    text-transform: uppercase;
}

.mobile-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Le panneau qui slide depuis la gauche */
.megamenu-container.mobile-open .megamenu-navbar {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 400px;
    height: 100vh;
    background: var(--mm-bg);
    box-shadow: 2px 0 20px rgba(0,0,0,0.3);
    padding: 0;
    margin: 0;
    z-index: 9998;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Animation d'ouverture */
.megamenu-container.mobile-open .megamenu-navbar.slide-in {
    transform: translateX(0);
}

/* Liste verticale */
.megamenu-container.mobile-open .level-1-list {
    flex-direction: column;
    height: auto;
    padding: 10px 0;
    align-items: stretch;
}

.megamenu-container.mobile-open .level-1-item {
    width: 100%;
    height: auto;
    border-bottom: 1px solid #eee;
    flex-direction: column;
    align-items: stretch;
}

.megamenu-container.mobile-open .level-1-link {
    justify-content: space-between;
    padding: 15px 20px;
    width: 100%;
    font-size: 14px;
    border-bottom: none;
}

.megamenu-container.mobile-open .level-1-link:hover {
    background-color: rgba(39, 174, 96, 0.1);
}

/* Icône de dropdown en mobile */
.megamenu-container.mobile-open .dropdown-icon {
    transition: transform 0.3s;
    transform: rotate(0deg);
}

.megamenu-container.mobile-open .level-1-item.mobile-expanded .dropdown-icon {
    transform: rotate(180deg);
}

/* Sous-menu accordéon en mobile */
.megamenu-container.mobile-open .megamenu-dropdown-wrapper {
    /* Il faut forcer l'affichage block sinon il reste caché */
    display: block !important; 
    position: static;
    width: 100%;
    box-shadow: none;
    border: none;
    background: #f5f5f5;
    
    /* Animation hauteur */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

/* Quand on ouvre, on agrandit la zone */
.megamenu-container.mobile-open .level-1-item.mobile-expanded .megamenu-dropdown-wrapper {
    max-height: 2500px; /* Assez grand pour tout afficher */
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
}

.megamenu-container.mobile-open .dropdown-container {
    padding: 0;
    min-height: auto;
}

.megamenu-container.mobile-open .megamenu-pane {
    padding: 15px 20px;
}

.megamenu-container.mobile-open .pane-inner-flex {
    flex-direction: column;
    gap: 20px;
}

.megamenu-container.mobile-open .pane-links-area {
    grid-template-columns: 1fr;
    gap: 20px;
}

.megamenu-container.mobile-open .column-title {
    margin-bottom: 12px;
}

.megamenu-container.mobile-open .level-3-list li {
    margin-bottom: 10px;
}

.megamenu-container.mobile-open .pane-image-area {
    width: 100%;
}

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
    .megamenu-navbar { 
        display: none; 
    }
    .megamenu-mobile-trigger { 
        display: flex; 
    }
}

@media (min-width: 1025px) and (max-width: 1350px) {
    .level-1-link { 
        font-size: 11px; 
        padding: 0 5px; 
    }
    .megamenu-navbar { 
        padding: 0 5px; 
    }
    .pane-inner-flex { 
        gap: 30px; 
    }
}
