/* ============================================================
   MENU MOBILE — Geofixe v2
   Design premium, animation fluide
   ============================================================ */

/* === OVERLAY === */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    /* Fond semi-opaque qui s'affiche en premier */
    background: rgba(5, 5, 12, 0);
    visibility: hidden;
    transition: background 0.3s ease, visibility 0s 0.3s;
    overflow: hidden;
}

.mobile-menu-overlay.active {
    background: rgba(5, 5, 12, 0.6);
    visibility: visible;
    transition: background 0.3s ease, visibility 0s 0s;
}

/* === PANNEAU PRINCIPAL (slide depuis la droite) === */
.mobile-menu {
    position: absolute;
    top: 0;
    right: 0;
    width: min(360px, 100vw);
    height: 100%;
    background: #0c0c1a;
    border-left: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    flex-direction: column;
    /* Entrée depuis la droite */
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Lueur de fond */
    box-shadow: -20px 0 80px rgba(0, 0, 0, 0.6);
}

.mobile-menu-overlay.active .mobile-menu {
    transform: translateX(0);
}

/* Décor : lueur violette en haut à droite */
.mobile-menu::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -60px;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(162, 56, 255, 0.12) 0%, transparent 65%);
    pointer-events: none;
    z-index: 0;
}

/* === HEADER DU MENU === */
.menu-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 72px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.menu-logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #a238ff 0%, #c44bff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Bouton fermeture */
.menu-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s ease, border-color 0.2s ease;
    position: relative;
    flex-shrink: 0;
}
.menu-close:hover {
    background: rgba(162, 56, 255, 0.1);
    border-color: rgba(162, 56, 255, 0.25);
}
.menu-close span {
    position: absolute;
    width: 14px;
    height: 1.5px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 2px;
    transition: background 0.2s ease;
}
.menu-close:hover span { background: var(--primary-light, #c063ff); }
.menu-close span:nth-child(1) { transform: rotate(45deg); }
.menu-close span:nth-child(2) { transform: rotate(-45deg); }

/* === NAVIGATION === */
.menu-items {
    position: relative;
    z-index: 1;
    flex: 1;
    list-style: none;
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Étiquette de section */
.menu-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.25);
    padding: 12px 12px 6px;
    list-style: none;
}

/* Séparateur */
.menu-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 8px 12px;
    list-style: none;
}

/* Item de navigation */
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: rgba(238, 238, 255, 0.65);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 12px;
    transition: color 0.18s ease, background 0.18s ease;
    min-height: 50px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    /* Animation d'entrée staggerée */
    opacity: 0;
    transform: translateX(12px);
}

.mobile-menu-overlay.active .menu-item {
    animation: menuSlideIn 0.3s ease-out forwards;
}

/* Délais staggerés */
.menu-items li:nth-child(1) .menu-item { animation-delay: 0.05s; }
.menu-items li:nth-child(2) .menu-item { animation-delay: 0.09s; }
.menu-items li:nth-child(3) .menu-item { animation-delay: 0.13s; }
.menu-items li:nth-child(4) .menu-item { animation-delay: 0.17s; }
.menu-items li:nth-child(5) .menu-item { animation-delay: 0.21s; }
.menu-items li:nth-child(6) .menu-item { animation-delay: 0.25s; }
.menu-items li:nth-child(7) .menu-item { animation-delay: 0.29s; }

@keyframes menuSlideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.menu-item:hover,
.menu-item:active {
    color: rgba(238, 238, 255, 0.95);
    background: rgba(255, 255, 255, 0.05);
}

.menu-item.active {
    color: #c063ff;
    background: rgba(162, 56, 255, 0.1);
}

/* Icône de menu */
.menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 1rem;
    flex-shrink: 0;
    transition: background 0.18s ease;
}

.menu-item:hover .menu-icon {
    background: rgba(162, 56, 255, 0.12);
}

/* Item logout */
.menu-item.logout {
    color: rgba(255, 255, 255, 0.35);
}
.menu-item.logout:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.07);
}
.menu-item.logout .menu-icon {
    background: rgba(239, 68, 68, 0.07);
}

/* Item "Mon compte" — accent visuel */
.menu-item[href*="dashboard"] {
    color: rgba(192, 99, 255, 0.85);
}

/* === ZONE CTA (bas du menu) === */
.menu-cta {
    position: relative;
    z-index: 1;
    padding: 16px 20px 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: auto;
    /* Animation d'entrée */
    opacity: 0;
    transform: translateY(8px);
}
.mobile-menu-overlay.active .menu-cta {
    animation: menuSlideIn 0.35s ease-out 0.3s forwards;
}

.menu-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 20px;
    background: linear-gradient(135deg, #a238ff 0%, #c44bff 100%);
    border: none;
    border-radius: 50px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 52px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}
.menu-cta-btn:active {
    transform: scale(0.97);
}
.menu-cta-btn:hover {
    box-shadow: 0 8px 28px rgba(162, 56, 255, 0.4);
}

.menu-cta-note {
    text-align: center;
    font-size: 0.73rem;
    color: rgba(255, 255, 255, 0.28);
    margin-top: 10px;
    line-height: 1.5;
}

/* === ACCESSIBILITÉ === */
.menu-item:focus-visible {
    outline: 2px solid rgba(162, 56, 255, 0.6);
    outline-offset: 2px;
}
.menu-close:focus-visible {
    outline: 2px solid rgba(162, 56, 255, 0.6);
    outline-offset: 2px;
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    .mobile-menu,
    .menu-item,
    .menu-cta {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}
