/* ==========================================================================
   Mobile Sidebar (Conteneur dédié pour le menu mobile) - Version Pro
   ========================================================================== */

.mobile-sidebar {
    display: none !important; /* Caché par défaut */
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    max-width: 90vw;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%) !important;
    z-index: 1002; /* Au-dessus de l'overlay (999) */
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    border-right: 1px solid rgba(0,0,0,0.05);
}

/* Afficher la sidebar quand active */
.mobile-sidebar.active {
    display: block !important;
    transform: translateX(0) !important;
}

/* Contenu de la sidebar */
.mobile-sidebar-content {
    padding: 0;
    background-color: transparent !important;
}

/* Header de la sidebar mobile */
.mobile-sidebar-header {
    background: linear-gradient(135deg, #28a745, #20c997);
    padding: 1.25rem 1.5rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 10;
}

.mobile-sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.mobile-sidebar-header .logo i {
    font-size: 1.5rem;
}

.mobile-sidebar-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.mobile-sidebar-close:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.mobile-sidebar-content ul {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
}

.mobile-sidebar-content > ul {
    padding: 0.5rem 0;
}

.mobile-sidebar-content li {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0 1rem;
}

.mobile-sidebar-content > ul > li {
    margin-bottom: 0.25rem;
}

.mobile-sidebar-content a {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    font-size: 0.95rem;
    color: #495057;
    text-decoration: none;
    border-radius: 10px;
    margin: 0.25rem 0;
    background-color: transparent;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.mobile-sidebar-content a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #28a745;
    transform: scaleY(0);
    transition: transform 0.25s ease;
}

.mobile-sidebar-content a:hover {
    background: linear-gradient(90deg, rgba(40, 167, 69, 0.1) 0%, rgba(40, 167, 69, 0.05) 100%) !important;
    color: #28a745 !important;
    transform: translateX(4px);
    padding-left: 1.5rem;
}

.mobile-sidebar-content a:hover::before {
    transform: scaleY(1);
}

.mobile-sidebar-content a.active {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    transform: translateX(4px);
    padding-left: 1.5rem;
}

.mobile-sidebar-content a.active::before {
    background: white;
    transform: scaleY(1);
}

.mobile-sidebar-content a i {
    margin-right: 1rem;
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Bouton fermer dans la sidebar - maintenant dans le header */
.menu-close-mobile {
    display: none !important; /* Utiliser mobile-sidebar-close à la place */
}

/* Mega Dropdown dans la sidebar */
.mobile-sidebar .mega-dropdown {
    position: relative;
    display: block;
}

.mobile-sidebar .mega-dropdown-trigger {
    justify-content: space-between;
    color: #495057;
    font-weight: 600;
}

.mobile-sidebar .mega-dropdown-trigger i.fa-chevron-down {
    transition: transform 0.3s ease;
    font-size: 0.85rem;
}

.mobile-sidebar .mega-dropdown.active .mega-dropdown-trigger i.fa-chevron-down {
    transform: rotate(180deg);
}

.mobile-sidebar .mega-dropdown-content {
    display: none;
    position: static !important;
    box-shadow: none !important;
    padding: 0.5rem 0 0.75rem 0 !important;
    margin: 0.5rem 0 0 0 !important;
    background: linear-gradient(180deg, rgba(248, 249, 250, 0.5) 0%, rgba(233, 236, 239, 0.3) 100%) !important;
    border-radius: 0 0 10px 10px;
    width: 100% !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    border-left: 3px solid #28a745;
    margin-left: 1.25rem !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.mobile-sidebar .mega-dropdown-content.show {
    display: block !important;
    max-height: 2000px;
    padding: 0.75rem 0 1rem 0 !important;
}

.mobile-sidebar .mega-dropdown-section {
    padding: 0 1.5rem;
    margin-bottom: 0.75rem;
}

.mobile-sidebar .mega-dropdown-section:last-child {
    margin-bottom: 0;
}

.mobile-sidebar .mega-dropdown-section h4 {
    font-size: 0.75rem;
    color: #6c757d;
    margin: 0.75rem 0 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-sidebar .mega-dropdown-section h4 i {
    font-size: 0.85rem;
    width: auto;
    margin: 0;
}

.mobile-sidebar .mega-dropdown-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-sidebar .mega-dropdown-section ul li {
    padding: 0;
    margin: 0;
}

.mobile-sidebar .mega-dropdown-section a {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
    border-radius: 8px;
    margin: 0.25rem 0;
}

.mobile-sidebar .mega-dropdown-section a:hover {
    background: linear-gradient(90deg, rgba(40, 167, 69, 0.15) 0%, rgba(40, 167, 69, 0.05) 100%) !important;
    color: #28a745 !important;
    transform: translateX(4px);
}

.mobile-sidebar .mega-dropdown-section a i {
    font-size: 0.9rem;
    width: 20px;
    margin-right: 0.75rem;
}

/* Cacher l'ancien menu en mobile */
@media (max-width: 768px) {
    .nav-menu {
        display: none !important;
    }
    
    /* S'assurer que le bouton hamburger est visible et amélioré */
    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        color: white !important;
        background: rgba(255, 255, 255, 0.15) !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
        border-radius: 10px !important;
        width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        transition: all 0.3s ease !important;
        font-size: 1.25rem !important;
    }
    
    .menu-toggle:hover {
        background: rgba(255, 255, 255, 0.25) !important;
        border-color: rgba(255, 255, 255, 0.5) !important;
        transform: scale(1.05);
    }
    
    .menu-toggle:active {
        transform: scale(0.95);
    }
}

/* Améliorations générales pour mobile */
@media (max-width: 768px) {
    /* Scrollbar personnalisée pour la sidebar */
    .mobile-sidebar::-webkit-scrollbar {
        width: 6px;
    }
    
    .mobile-sidebar::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    .mobile-sidebar::-webkit-scrollbar-thumb {
        background: #28a745;
        border-radius: 3px;
    }
    
    .mobile-sidebar::-webkit-scrollbar-thumb:hover {
        background: #20c997;
    }
}


