/* ==========================================
   MENU HAMBURGER - COMPLÉMENT AU CSS EXISTANT
   Ce fichier ajoute uniquement le menu hamburger mobile
   sans toucher aux styles desktop existants
   ========================================== */

/* Variables pour faciliter la personnalisation */
:root {
    --hamburger-color: #0066cc;
    --menu-overlay-bg: rgba(0, 0, 0, 0.5);
    --menu-mobile-width: 280px;
    --transition-speed: 0.3s;
}

/* ==========================================
   BOUTON HAMBURGER (visible uniquement sur mobile)
   ========================================== */
.hamburger {
    display: none; /* Caché par défaut sur desktop */
    flex-direction: column;
    justify-content: space-around;
    width: 32px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: relative;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background-color: var(--hamburger-color);
    border-radius: 3px;
    transition: all var(--transition-speed) ease;
}

/* Animation hamburger → X quand le menu est ouvert */
.hamburger.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Focus pour accessibilité */
.hamburger:focus {
    outline: 2px solid var(--hamburger-color);
    outline-offset: 4px;
}

/* ==========================================
   OVERLAY (arrière-plan sombre sur mobile)
   ========================================== */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--menu-overlay-bg);
    z-index: 999;
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
}

.menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Désactiver le scroll du body quand le menu est ouvert */
body.menu-open {
    overflow: hidden;
}

/* ==========================================
   RESPONSIVE - ACTIVATION DU MENU HAMBURGER
   ========================================== */

/* Tablette et mobile (< 768px) */
@media screen and (max-width: 768px) {
    
    /* Afficher le bouton hamburger */
    .hamburger {
        display: flex;
    }

    /* Modifier le comportement du container de navigation */
    .navbar .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Cacher ou réduire le texte du logo si nécessaire */
    .nav-brand .brand-text {
        font-size: 1rem;
    }

    /* Transformer le menu en panneau latéral */
    .nav-menu {
        position: fixed !important;
        top: 0;
        right: -100%;
        width: var(--menu-mobile-width);
        height: 100vh;
        background-color: white;
        flex-direction: column !important;
        padding: 80px 20px 20px;
        gap: 0 !important;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        transition: right var(--transition-speed) ease;
        overflow-y: auto;
        z-index: 1000;
        margin: 0 !important;
        list-style: none;
    }

    /* Menu ouvert (glisse depuis la droite) */
    .nav-menu.active {
        right: 0;
    }

    /* Réinitialiser les styles des éléments de liste */
    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid #eee;
        margin: 0 !important;
        padding: 0 !important;
    }

    .nav-menu li:last-child {
        border-bottom: none;
    }

    /* Réinitialiser les styles des liens */
    .nav-menu li a {
        display: block;
        padding: 16px 12px !important;
        font-size: 1rem !important;
        border-radius: 0 !important;
        width: 100%;
        text-decoration: none;
        color: #333;
        transition: all 0.2s ease;
    }

    /* Effet hover sur les liens */
    .nav-menu li a:hover {
        background-color: #f5f5f5;
        padding-left: 20px !important;
        color: var(--hamburger-color);
    }

    /* Animation d'entrée */
    @keyframes slideInFromRight {
        from {
            transform: translateX(100%);
            opacity: 0;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }

    .nav-menu.active {
        animation: slideInFromRight var(--transition-speed) ease;
    }
}

/* Très petits écrans (< 480px) */
@media screen and (max-width: 480px) {
    
    /* Menu pleine largeur sur très petit écran */
    .nav-menu {
        width: 100%;
    }

    /* Ajuster la taille du hamburger */
    .hamburger {
        width: 28px;
        height: 24px;
    }

    /* Réduire encore le logo si nécessaire */
    .nav-brand .brand-text {
        font-size: 0.9rem;
    }
}

/* ==========================================
   COMPATIBILITÉ AVEC LE CSS EXISTANT
   ========================================== */

/* Sur desktop (> 768px), ces styles n'affectent rien */
@media screen and (min-width: 769px) {
    /* Le menu hamburger reste caché */
    .hamburger {
        display: none !important;
    }
    
    /* L'overlay reste caché */
    .menu-overlay {
        display: none !important;
    }
    
    /* Le menu reste en mode horizontal normal */
    .nav-menu {
        position: static !important;
        flex-direction: row !important;
    }
}
