/* --- Mise en page principale --- */
html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8f9fa;
}

.main-wrapper {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    position: relative;
}

/* --- Barre latérale (Sidebar) --- */
.sidebar {
    width: 260px;
    min-width: 260px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    background-color: #fff;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
    position: fixed; /* Rendre fixe sur toutes les vues */
    left: 0;
    top: 0;
    z-index: 1030; /* Z-index élevé pour être au-dessus de tout */
}

/* --- Wrapper du Contenu Principal --- */
/* CORRIGÉ : C'est ce wrapper qui doit avoir la marge */
.main-content-wrapper {
    flex-grow: 1;
    height: 100vh;
    overflow-y: auto;
    transition: margin-left 0.3s ease;
    margin-left: 260px; /* Espace pour la sidebar sur desktop */
}

/* --- Contenu Principal --- */
.main-content {
    padding: 1.5rem;
}

/* --- Barre de navigation mobile --- */
.mobile-header {
    display: none;
    background-color: #fff;
    padding: 0.5rem 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1020;
}

/* --- AJOUTÉ : Overlay pour le menu mobile --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1029; /* Juste en dessous de la sidebar */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.is-visible {
    display: block;
    opacity: 1;
}


/* --- Styles pour mobile (Responsive) --- */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%); /* Cacher la sidebar par défaut */
    }

    .sidebar.is-open {
        transform: translateX(0); /* Montrer la sidebar */
    }

    /* CORRIGÉ : On retire la marge sur mobile */
    .main-content-wrapper {
        margin-left: 0;
    }
    
    .main-content {
        padding-top: 5rem; /* Espace pour la barre de navigation mobile fixe */
    }

    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
}


/* --- Styles pour les éléments de la sidebar --- */
.sidebar .nav-link {
    color: #5a6a85;
    font-weight: 500;
    padding: 12px 16px;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
}
.sidebar .nav-link:hover {
    background-color: #e9ecef;
    color: #0d6efd;
}
.sidebar .nav-link.active {
    background-color: #0d6efd;
    color: #fff;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.2);
}
.sidebar .nav-link i { font-size: 1.1rem; }
.sidebar .sidebar-footer { border-top: 1px solid #dee2e6; }

/* --- Autres styles --- */
.card { border-radius: 1rem !important; }
.card-header { border-bottom: 0 !important; }
.badge.rounded-pill { padding: 0.4em 0.8em; font-size: 0.8em; font-weight: 600; }