/* Styles pour le menu mobile */

/* État initial du menu mobile */
.mobile-menu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: max-height 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

/* Menu ouvert */
.mobile-menu.active {
    max-height: 100vh;
    opacity: 1;
    transform: translateY(0);
}

/* Alternative avec display */
.mobile-menu.show {
    display: block !important;
    animation: slideDown 0.3s ease forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Icônes du bouton */
.menu-icon,
.close-icon {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.menu-icon.hidden,
.close-icon.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    position: absolute;
}

/* Bouton mobile amélioré */
.mobile-menu-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

/* Amélioration pour iOS */
@supports (-webkit-touch-callout: none) {
    .mobile-menu {
        -webkit-transform: translate3d(0, 0, 0);
        -webkit-backface-visibility: hidden;
    }
    
    body.menu-open {
        position: fixed;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
}

/* Overlay pour fermer le menu */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Liens du menu mobile */
.mobile-menu a {
    display: block;
    padding: 12px 16px;
    color: rgba(156, 163, 175, 1);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.mobile-menu a:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.mobile-menu a:hover:before {
    left: 100%;
}

.mobile-menu a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.mobile-menu a:active {
    transform: translateX(2px) scale(0.98);
}

/* Bouton CTA dans le menu */
.mobile-menu button {
    width: 100%;
    margin-top: 12px;
    padding: 12px 24px;
    background: white;
    color: black;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-menu button:hover {
    background: rgba(229, 231, 235, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.mobile-menu button:active {
    transform: translateY(0);
}

/* Media queries pour s'assurer que le menu fonctionne */
@media (max-width: 767px) {
    .mobile-menu-btn {
        display: flex !important;
    }
    
    .mobile-menu {
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        z-index: 45;
    }
    
    /* Masquer les éléments desktop */
    .hidden.sm\:block {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .mobile-menu-btn {
        display: none !important;
    }
    
    .mobile-menu {
        display: none !important;
    }
    
    .mobile-menu-overlay {
        display: none !important;
    }
}

/* Amélioration de l'accessibilité */
.mobile-menu-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.mobile-menu a:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

/* Animation de rotation pour l'icône */
@keyframes rotateIn {
    from {
        transform: rotate(-180deg) scale(0);
    }
    to {
        transform: rotate(0) scale(1);
    }
}

@keyframes rotateOut {
    from {
        transform: rotate(0) scale(1);
    }
    to {
        transform: rotate(180deg) scale(0);
    }
}

.menu-icon.rotating-out {
    animation: rotateOut 0.3s ease forwards;
}

.close-icon.rotating-in {
    animation: rotateIn 0.3s ease forwards;
}

/* Fix pour éviter le scroll horizontal */
body.menu-open {
    overflow-x: hidden;
    overflow-y: hidden;
    position: relative;
}

/* Amélioration de la performance */
.mobile-menu,
.mobile-menu-btn,
.menu-icon,
.close-icon {
    will-change: transform, opacity;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .mobile-menu {
        background: rgba(0, 0, 0, 0.98);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .mobile-menu,
    .menu-icon,
    .close-icon,
    .mobile-menu a {
        transition: none !important;
        animation: none !important;
    }
}