/*
    Feuille de Style Personnalisée - Thème "Google Material / Clarity Pro"
    Projet: GesDep
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* 1. Variables Globales et Fondations
-------------------------------------------------- */
:root {
    --primary-color: #1a73e8;
    /* Google Blue */
    --primary-hover-color: #1557b0;
    --light-bg: #f8f9fa;
    /* Fond de page très subtil */
    --content-bg: #ffffff;
    /* Fond des cartes, sidebar */
    --border-color: #dadce0;
    /* Bordure discrète type Google */
    --text-dark: #202124;
    /* Texte principal profond et lisible */
    --text-muted-color: #5f6368;
    /* Texte secondaire type Google */
    --font-family-sans-serif: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --box-shadow-soft: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    /* Ombre Material 3 */
    --box-shadow-hover: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 2px 6px 2px rgba(60, 64, 67, 0.15);

    /* Sidebar Vars */
    --sidebar-width: 280px;
    --sidebar-bg: var(--content-bg);
    --sidebar-item-active-bg: #e8f0fe;
    --sidebar-item-active-color: #1a73e8;
    --sidebar-item-hover-bg: #f1f3f4;
}

/* 2. Styles de Base et Typographie
-------------------------------------------------- */
body {
    font-family: var(--font-family-sans-serif);
    background-color: var(--light-bg);
    color: var(--text-dark);
    font-size: 14.5px;
    letter-spacing: 0.2px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

a:hover {
    color: var(--primary-hover-color);
    text-decoration: none;
}

/* 3. Structure Principale (Wrapper, Sidebar, Navbar)
-------------------------------------------------- */
#wrapper {
    display: flex;
}

#sidebar-wrapper {
    min-height: 100vh;
    width: var(--sidebar-width);
    /* background-color: var(--sidebar-bg); */
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    transition: margin 0.25s ease-out;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#wrapper.toggled #sidebar-wrapper {
    margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-heading {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-heading b {
    letter-spacing: -0.5px;
}

.sidebar-category {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted-color);
    margin: 1.5rem 0 0.5rem 1.5rem;
}

.list-group {
    padding: 0.5rem 0.75rem;
}

.list-group-item {
    background-color: transparent !important;
    color: var(--text-dark) !important;
    border: none;
    padding: 0.75rem 1.25rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
    border-radius: 50px;
    /* Style "Pill" façon Google Workspace */
    transition: background-color 0.15s ease, color 0.15s ease;
    display: flex;
    align-items: center;
}

.list-group-item .fa-fw {
    width: 1.5em;
    color: var(--text-muted-color);
    margin-right: 12px;
    transition: color 0.15s ease;
    font-size: 1.1em;
}

.list-group-item:hover,
.list-group-item:focus {
    background-color: var(--sidebar-item-hover-bg) !important;
}

.list-group-item.active {
    color: var(--sidebar-item-active-color) !important;
    background-color: var(--sidebar-item-active-bg) !important;
    font-weight: 600;
}

.list-group-item.active .fa-fw {
    color: var(--sidebar-item-active-color);
}

/* Submenu */
.collapse .list-group-item {
    padding-left: 3.5rem;
    /* Indentation for submenus */
    font-weight: 400;
    font-size: 0.95em;
}

#page-content-wrapper {
    width: 100%;
}

.navbar {
    background-color: var(--content-bg) !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 0.75rem 1.5rem;
}

.navbar .btn-light {
    background: transparent;
    border: none;
    color: var(--text-muted-color);
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.15s ease;
}

.navbar .btn-light:hover {
    background: var(--sidebar-item-hover-bg);
    color: var(--text-dark);
}

.dropdown-menu {
    border: none;
    box-shadow: var(--box-shadow-soft);
    border-radius: 8px;
    padding: 0.5rem 0;
}

.dropdown-item {
    color: var(--text-dark);
    padding: 0.5rem 1.5rem;
    font-size: 0.95rem;
}

.dropdown-item:hover {
    color: var(--text-dark);
    background-color: var(--sidebar-item-hover-bg);
}

/* 4. Overrides des Composants (Cartes, Formulaires, etc.)
-------------------------------------------------- */

/* 4. Overrides des Composants (Cartes, Formulaires, Tableaux, etc.)
-------------------------------------------------- */

.card {
    background-color: var(--content-bg);
    border: 1px solid var(--border-color);
    box-shadow: none;
    /* Look plus clean pour les cartes simples, ou on peut utiliser l'ombre douce */
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--box-shadow-soft);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    font-size: 1.1rem;
    padding: 1.25rem 1.5rem;
    color: var(--text-dark);
}

.card-body {
    padding: 1.5rem;
}

/* Configuration des formulaires Material */
.form-control,
.form-select {
    background-color: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    /* Coins arrondis modernes */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
    /* Focus ring façon Google */
    outline: 0;
}

/* Style Global des Tableaux (DataTables compris) */
.table {
    border-color: var(--border-color);
    margin-bottom: 0;
}

.table> :not(caption)>*>* {
    padding: 1rem 1.5rem;
    vertical-align: middle;
}

.table thead th {
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-muted-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: var(--light-bg);
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: var(--sidebar-item-hover-bg);
}

/* Modals */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

/* Boutons */
.btn {
    border-radius: 20px;
    /* Format "Pill" Google */
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: all 0.2s ease-in-out;
    letter-spacing: 0.2px;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--primary-hover-color);
    border-color: var(--primary-hover-color);
    box-shadow: 0 2px 4px -1px rgba(26, 115, 232, 0.4);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--border-color);
}

.btn-outline-primary:hover {
    background-color: #f4f8ff;
    /* Bleu très doux */
    border-color: var(--border-color);
    color: var(--primary-hover-color);
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.85rem;
}

/* 5. Page de Login Épurée
-------------------------------------------------- */
.login-container {
    max-width: 450px;
    margin: 10vh auto;
    padding: 2.5rem;
    background: var(--content-bg);
    border-radius: 8px;
    border: none;
    box-shadow: var(--box-shadow-soft);
}

/* 6. Responsive
-------------------------------------------------- */
@media (max-width: 768px) {
    #sidebar-wrapper {
        margin-left: -260px;
    }

    #wrapper.toggled #sidebar-wrapper {
        margin-left: 0;
    }

    .card-body {
        padding: 1rem;
    }
}

/*
    7. Centre de Notifications
-------------------------------------------------- */
#notification-bell-wrapper {
    position: relative;
}

#notification-bell .fa-bell {
    font-size: 1.2rem;
    color: var(--text-muted-color);
    transition: color 0.2s ease;
}

#notification-bell:hover .fa-bell {
    color: var(--text-dark);
}

#notification-badge {
    position: absolute;
    top: 5px;
    right: 0px;
    font-size: 0.6em;
    padding: 0.3em 0.5em;
}

.notification-dropdown {
    width: 270px;

    max-height: 400px;
    overflow-y: auto;
    padding: 0;
}

.notification-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-dark);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background-color: #f8f9fa;
}

.notification-item.unread {
    background-color: #e6efff;
    /* Bleu léger pour les non-lus */
}

.notification-item .icon-wrapper {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 5px;
    color: #fff;
}

.icon-wrapper.bg-info {
    background-color: #0dcaf0;
}

.icon-wrapper.bg-success {
    background-color: #198754;
}

.icon-wrapper.bg-warning {
    background-color: #ffc107;
}

.icon-wrapper.bg-danger {
    background-color: #dc3545;
}

.notification-item .message-wrapper {
    flex-grow: 1;
}

.notification-item .message {
    font-size: 0.9em;
    display: block;
    margin-bottom: 2px;
}

.notification-item .timestamp {
    font-size: 0.75em;
    color: var(--text-muted-color);
}

/*
    7. Centre de Notifications (Version Excellence)
-------------------------------------------------- */
#notification-bell-wrapper .nav-link {
    position: relative;
    /* Contexte pour le badge */
}

#notification-bell .fa-bell {
    font-size: 1.3rem;
    /* Légèrement plus grande */
    color: var(--text-muted-color);
    transition: color 0.2s ease;
}

#notification-bell:hover .fa-bell,
#notification-bell-wrapper.show .fa-bell {
    color: var(--primary-color);
    /* La cloche devient bleue quand le menu est ouvert */
}

#notification-badge {
    font-size: 0.6em;
    padding: 0.3em 0.5em;
    /* Le positionnement est maintenant dans le HTML pour plus de contrôle */
}

/* Le menu déroulant lui-même */
.notification-dropdown {
    width: 380px;
    /* Plus large pour plus de confort */
    max-height: 450px;
    overflow-y: auto;
    padding: 0;
    border: 1px solid var(--border-color);
    box-shadow: var(--box-shadow-soft);
    border-radius: 8px;
    margin-top: 10px !important;
    /* Petit espace par rapport à la navbar */
}

/* En-tête du menu déroulant */
.notification-dropdown-header {
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    font-size: 1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: #f8f9fa;
    /* Léger fond pour le distinguer */
}

/* Pied de page du menu déroulant */
.notification-dropdown-footer {
    padding: 0.75rem 1.25rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background-color: #f8f9fa;
}

.notification-dropdown-footer a {
    font-weight: 500;
    font-size: 0.9em;
}

/* Chaque notification */
.notification-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-dark);
    transition: background-color 0.2s ease;
}

.notification-item:last-of-type {
    /* Cible le dernier item pour ne pas avoir de double bordure */
    border-bottom: none;
}

.notification-item:hover {
    background-color: #f0f5ff;
    /* Surlignage bleu léger */
}

.notification-item.unread {
    background-color: #e6efff;
    font-weight: 500;
}

.notification-item.unread:hover {
    background-color: #d9e6ff;
}

.notification-item .icon-wrapper {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    color: #fff;
}

.icon-wrapper.bg-info {
    background-color: #0dcaf0;
}

.icon-wrapper.bg-success {
    background-color: #198754;
}

.icon-wrapper.bg-warning {
    background-color: #ffc107;
}

.icon-wrapper.bg-danger {
    background-color: #dc3545;
}

.notification-item .message-wrapper {
    flex-grow: 1;
}

.notification-item .message {
    font-size: 0.9em;
    display: block;
    margin-bottom: 2px;
}

.notification-item .timestamp {
    font-size: 0.75em;
    color: var(--text-muted-color);
}


/*
    Vague 14 : Styles pour le Centre de Notifications
    --------------------------------------------------
*/

/* On cible le conteneur principal du dropdown via son ID pour être très spécifique. */
#notification-list {
    background-color: var(--content-bg);
    /* On garde notre fond sombre cohérent */
    border: 1px solid var(--border-color);
    padding: 0;
    /* On retire le padding par défaut pour un contrôle total */
}

/* On cible chaque élément 'a' à l'intérieur de la liste. */
#notification-list .notification-item {
    display: block;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    white-space: normal;
    /* Permet au texte de passer à la ligne */
    color: var(--text-muted-color);
    /* Couleur par défaut pour le texte */
    transition: background-color 0.2s ease-in-out;
}

/* On retire la bordure du dernier élément pour une finition propre. */
#notification-list li:last-child .notification-item {
    border-bottom: none;
}

/* Effet de survol : on éclaircit légèrement le fond pour indiquer l'interaction. */
#notification-list .notification-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    /* On rend le texte plus clair au survol */
}

/* Style pour le message principal de la notification. */
#notification-list .notification-item .small {
    color: var(--text-color);
    /* On s'assure que le texte principal est bien lisible (blanc cassé) */
    font-size: 0.9em;
}

/* Style pour la date et l'heure, qui sont des informations secondaires. */
#notification-list .notification-item .text-muted {
    font-size: 0.8em;
    color: var(--text-muted-color) !important;
    /* On force la couleur discrète */
}

/* Style pour le badge de notifications non lues. */
#notification-badge {
    font-size: 0.6em;
    padding: 0.25em 0.5em;
    border: 2px solid var(--content-bg);
    /* Crée un effet de "découpe" sur l'icône */
}

/* En-tête et pied de page du dropdown */
#notification-list .dropdown-header,
#notification-list .dropdown-footer a {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1.25rem;
    color: var(--text-color);
    font-weight: 500;
}

#notification-list .dropdown-footer a {
    display: block;
    text-align: center;
    transition: background-color 0.2s ease-in-out;
}

#notification-list .dropdown-footer a:hover {
    background-color: var(--primary-color);
}

/* Style pour les cartes interactives */
.card-interactive {
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.card-interactive:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    border-color: var(--primary-color) !important;
}

/*
    8. OMNISEARCH (Mac Spotlight Style)
    --------------------------------------------------
*/
.omnibar-modal {
    backdrop-filter: blur(8px);
    background-color: rgba(0, 0, 0, 0.4);
}

.omnibar-modal .modal-dialog {
    transform: translateY(-50px);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.omnibar-modal.show .modal-dialog {
    transform: translateY(0);
}

.omnibar-content {
    background: transparent !important;
    box-shadow: none !important;
}

.omnibar-container {
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background-color: #ffffff;
}

#omniSearchInput:focus {
    box-shadow: none;
    outline: none;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: #e0e0e0;
    border-radius: 10px;
}

.omni-result-item {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f8f9fa !important;
}

.omni-result-item:hover,
.omni-result-item.active {
    background-color: #f4f8ff !important;
    cursor: pointer;
}

.btn-search-omnibar:hover {
    background-color: #e9ecef !important;
    transform: translateY(-1px);
}

/*
    9. Responsive
    --------------------------------------------------
*/

/* --- Comportement sur les grands écrans (tablettes et plus) --- */
@media (min-width: 992px) {
    #sidebar-wrapper {
        margin-left: 0;
    }

    #wrapper.toggled #sidebar-wrapper {
        margin-left: calc(-1 * var(--sidebar-width));
    }

    #page-content-wrapper {
        min-width: 0;
        width: 100%;
    }
}

/* --- Comportement sur les petits écrans (téléphones et petites tablettes) --- */
@media (max-width: 991.98px) {
    #sidebar-wrapper {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1045;
        /* Au dessus du header, en dessous des Modals */
        margin-left: calc(-1 * var(--sidebar-width));
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
        transition: margin 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }

    #wrapper.toggled #sidebar-wrapper {
        margin-left: 0;
    }

    #page-content-wrapper {
        width: 100vw;
        min-width: 100vw;
    }

    /* Overlay backdrop sombre interactif (Géré par JS si cliqué) */
    #sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1040;
        backdrop-filter: blur(2px);
    }

    #wrapper.toggled~#sidebar-overlay,
    #sidebar-overlay.show {
        display: block;
    }
}