/**
 * DriveTrust ID - Menu Mobile Hamburger
 * Active le menu déroulant sur mobile uniquement
 */

/* ========================================= */
/* MOBILE UNIQUEMENT (< 768px)              */
/* ========================================= */

@media (max-width: 768px) {

    /* ----- HEADER MOBILE ----- */

    .header {
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
        background: white !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
        padding: 12px 16px !important;
    }

    .header-content {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        max-width: 100% !important;
        padding: 0 !important;
    }

    /* ----- HAMBURGER BUTTON (Toujours Visible sur Mobile) ----- */

    .hamburger-menu {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        gap: 5px !important;
        background: none !important;
        border: none !important;
        padding: 8px !important;
        cursor: pointer !important;
        width: 44px !important;
        height: 44px !important;
        z-index: 1001 !important;
    }

    .hamburger-line {
        display: block !important;
        width: 24px !important;
        height: 3px !important;
        background: #0066FF !important;
        border-radius: 2px !important;
        transition: all 0.3s ease !important;
    }

    /* Animation hamburger quand menu ouvert */
    .hamburger-menu.active .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translateY(8px) !important;
    }

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

    .hamburger-menu.active .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translateY(-8px) !important;
    }

    /* ----- LOGO (Centré sur Mobile) ----- */

    .logo {
        flex: 1 !important;
        display: flex !important;
        justify-content: center !important;
        cursor: pointer !important;
    }

    .logo h1 {
        font-size: 18px !important;
        margin: 0 !important;
    }

    /* ----- MENU NAVIGATION (Slide depuis la gauche) ----- */

    .nav-menu {
        position: fixed !important;
        top: 64px !important;  /* En dessous du header */
        left: -300px !important;  /* Caché par défaut */
        width: 280px !important;
        height: calc(100vh - 64px) !important;
        background: white !important;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15) !important;
        z-index: 999 !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        overflow-y: auto !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 20px 0 !important;
    }

    /* Menu ouvert */
    .nav-menu.mobile-open {
        left: 0 !important;
    }

    /* Liens du menu */
    .nav-link {
        display: block !important;
        padding: 16px 24px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        color: #1e293b !important;
        text-decoration: none !important;
        cursor: pointer !important;
        border-bottom: 1px solid #f1f5f9 !important;
        transition: all 0.2s !important;
    }

    .nav-link:hover,
    .nav-link.active {
        background: #f0f9ff !important;
        color: #0066FF !important;
        border-left: 4px solid #0066FF !important;
        padding-left: 20px !important;
    }

    /* Badge de notifications sur les liens */
    .nav-link .badge {
        float: right !important;
        background: #ef4444 !important;
        color: white !important;
        font-size: 11px !important;
        padding: 2px 6px !important;
        border-radius: 10px !important;
        min-width: 18px !important;
        text-align: center !important;
    }

    /* ----- USER MENU (Avatar à Droite) ----- */

    .header-right,
    .user-menu {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    /* Profile button */
    .user-profile {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 6px 10px !important;
        background: #f8fafc !important;
        border-radius: 8px !important;
        cursor: pointer !important;
    }

    /* Avatar */
    .user-avatar {
        width: 36px !important;
        height: 36px !important;
        font-size: 14px !important;
        background: #0066FF !important;
        color: white !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-weight: 700 !important;
    }

    /* Cacher le nom d'utilisateur sur mobile */
    .user-name {
        display: none !important;
    }

    /* ----- BACKDROP (Fond noir semi-transparent) ----- */

    /* Quand le menu est ouvert, assombrir le reste */
    .header.menu-active::after {
        content: '' !important;
        position: fixed !important;
        top: 64px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(0, 0, 0, 0.4) !important;
        z-index: 998 !important;
        opacity: 1 !important;
        transition: opacity 0.3s !important;
    }

    /* Empêcher scroll du body quand menu ouvert */
    body.menu-open {
        overflow: hidden !important;
    }

}

/* ========================================= */
/* DESKTOP (> 768px) - Menu Normal           */
/* ========================================= */

@media (min-width: 769px) {

    /* Cacher le hamburger sur desktop */
    .hamburger-menu {
        display: none !important;
    }

    /* Menu horizontal classique sur desktop */
    .nav-menu {
        position: static !important;
        left: auto !important;
        width: auto !important;
        height: auto !important;
        background: none !important;
        box-shadow: none !important;
        flex-direction: row !important;
        padding: 0 !important;
        gap: 24px !important;
    }

    .nav-link {
        padding: 8px 0 !important;
        border: none !important;
        font-size: 15px !important;
    }

    .nav-link:hover,
    .nav-link.active {
        background: none !important;
        border-left: none !important;
        padding-left: 0 !important;
        color: #0066FF !important;
    }

    /* Afficher le nom utilisateur sur desktop */
    .user-name {
        display: inline !important;
    }

}
