/* ============================================
   SIDEBAR MOBILE - Panneau plein écran
   ============================================ */

/* Overlay - couvre tout l'écran */
.sidebar-mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1030;
    backdrop-filter: blur(2px);
}

.sidebar-mobile-overlay.active {
    display: block;
}

/* Sidebar mobile - plein écran, slide depuis la droite */
.sidebar-mobile {
    position: fixed;
    top: 0;
    right: -100%;
    left: auto;
    width: 100%;
    max-width: 360px;
    height: 100%;
    max-height: 100%;
    background: #2F386F;
    z-index: 1040;
    overflow-y: auto;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

/* État actif - visible plein écran */
.sidebar-mobile.active {
    right: 0;
}

/* Header de la sidebar */
.sidebar-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.sidebar-mobile-header h4 {
    color: #ffffff;
    font-size: 1.7rem;
    font-weight: 700;
}

/* Logo dans le header du drawer */
.sidebar-mobile-logo {
    flex: 1;
    display: flex;
    align-items: center;
}

.sidebar-mobile-logo a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.sidebar-mobile-logo img {
    max-height: 35px;
    width: auto;
    filter: brightness(0) invert(1);
}

/* Bouton fermer */
.sidebar-mobile-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.sidebar-mobile-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sidebar-mobile-close svg {
    width: 22px;
    height: 22px;
}

/* Liste des menus */
.sidebar-mobile-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-mobile-menu > li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-mobile-menu > li > .menu-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-mobile-menu > li > .menu-item-header > a {
    display: block;
    flex: 1;
    padding: 1.2rem 1.5rem;
    color: #ffffff;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 600;
}

.sidebar-mobile-menu > li > .menu-item-header > a:hover,
.sidebar-mobile-menu > li.has-submenu.open > .menu-item-header > a {
    background: rgba(255, 255, 255, 0.1);
}

/* Bouton de toggle pour les sous-menus */
.submenu-toggle {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 1.2rem 1.5rem;
    transition: transform 0.3s ease;
}

.submenu-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.toggle-icon {
    display: inline-flex;
    transition: transform 0.3s ease;
}

/* Sous-menus */
.sidebar-mobile-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.2);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.sidebar-mobile-submenu:not(.hidden) {
    max-height: 1000px;
    opacity: 1;
}

.sidebar-mobile-submenu.hidden {
    display: block;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.sidebar-mobile-submenu > li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-mobile-submenu > li:last-child {
    border-bottom: none;
}

.sidebar-mobile-submenu > li > a {
    display: block;
    padding: 1rem 1.5rem 1rem 2.5rem;
    color: #ffffff;
    text-decoration: none;
    font-size: 1.3rem;
    transition: background 0.2s ease, padding-left 0.2s ease;
}

.sidebar-mobile-submenu > li > a:hover {
    background: rgba(255, 255, 255, 0.1);
    padding-left: 3rem;
}

/* Animation d'entrée des items */
.sidebar-mobile.active .sidebar-mobile-menu > li {
    opacity: 0;
    transform: translateX(20px);
    animation: slideIn 0.3s ease forwards;
}

.sidebar-mobile.active .sidebar-mobile-menu > li:nth-child(1) { animation-delay: 0.05s; }
.sidebar-mobile.active .sidebar-mobile-menu > li:nth-child(2) { animation-delay: 0.1s; }
.sidebar-mobile.active .sidebar-mobile-menu > li:nth-child(3) { animation-delay: 0.15s; }
.sidebar-mobile.active .sidebar-mobile-menu > li:nth-child(4) { animation-delay: 0.2s; }
.sidebar-mobile.active .sidebar-mobile-menu > li:nth-child(5) { animation-delay: 0.25s; }
.sidebar-mobile.active .sidebar-mobile-menu > li:nth-child(6) { animation-delay: 0.3s; }
.sidebar-mobile.active .sidebar-mobile-menu > li:nth-child(7) { animation-delay: 0.35s; }

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

/* ============================================
   TOP BAR dans le drawer mobile
   ============================================ */

.sidebar-mobile-topbar {
    flex-shrink: 0;
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-mobile-topbar h5 {
    margin: 0 0 1rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-mobile-topbar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-mobile-topbar li {
    margin: 0;
}

.sidebar-mobile-topbar li + li {
    margin-top: 0.25rem;
}

.sidebar-mobile-topbar a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 1.35rem;
    font-weight: 500;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-mobile-topbar a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar-mobile-topbar-icon {
    width: 1.4rem;
    height: 1.4rem;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.sidebar-mobile-topbar a:hover .sidebar-mobile-topbar-icon {
    opacity: 1;
}

/* Responsive - masqué sur desktop (≥992px) */
@media (min-width: 992px) {
    .sidebar-mobile,
    .sidebar-mobile-overlay {
        display: none !important;
    }
}