/* Style inspiré de Donozeo avec fond proche du noir pour sidebar */
:root {
    /* CE :root NE DEFINIT PLUS AUCUNE COULEUR.

       Il en portait une palette entiere — bleu-canard #006494, gris
       #ecf0f1 — qui gouvernait la colonne, les boutons et les cartes des
       douze ecrans chargeant cette feuille. Les quarante-neuf autres ne
       la recevaient pas : deux apparences pour une seule application.

       Les noms restent, parce que les regles plus bas les emploient ;
       leurs valeurs viennent desormais des jetons. Cette feuille se
       charge APRES composants.css et gagnerait donc sur elle : sans ce
       reaiguillage, elle ramenerait le bleu-canard sur les douze ecrans
       qui la chargent.

       Regle du projet : aucune couleur ne se decide hors de tokens.css. */

    --sidebar-width: 250px;
    --header-height: 60px;

    --primary-color-gradient: var(--h229-navy);
    --primary-color: var(--h229-navy);
    --secondary-color: var(--h229-navy-2);
    --background-color: var(--h229-bg);
    --default-background-color: var(--h229-card);
    --card-bg: var(--h229-card);
    --header-bg: var(--h229-card);
    --header-text-color: var(--h229-text);
    --header-border-color: var(--h229-border);
    --sidebar-text-color: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, .09);
    --sidebar-active-bg: rgba(255, 255, 255, .13);
    --sidebar-link-color: #ffffff;
    --sidebar-link-hover-color: #ffffff;
    --sidebar-link-active-color: #ffffff;
    --sidebar-icon-color: #ffffff;
    --sidebar-icon-hover-color: #ffffff;
    --sidebar-menu-title-color: #c4ccd5;
    --sidebar-menu-dropdown-color: #ffffff;
    --text-color: var(--h229-text);
    --muted-color: var(--h229-muted);
    --link-color: var(--h229-gold-dk);
    --link-hover-color: var(--h229-text);
    --link-active-color: var(--h229-text);
    --border-color: var(--h229-border);
    --card-border-radius: var(--h229-radius);
    --card-shadow: none;
    --card-hover-shadow: none;
    --card-padding: 22px 24px;
    --card-title-font-size: 19px;
    --card-text-color: var(--h229-muted);
}
.bg-primary {
    --bs-bg-opacity: 1;
    background-color: var(--primary-color) !important;
}

.btn.btn-primary {
    /* Les douze couleurs de ce bouton etaient ecrites en dur en
       bleu-canard. Elles suivent le laiton de la direction retenue ;
       le texte reste encre, du blanc n'y donnerait que 2 pour 1. */
    --bs-btn-color: var(--h229-text);
    --bs-btn-bg: var(--h229-gold-lt);
    --bs-btn-border-color: var(--h229-gold-lt);
    --bs-btn-hover-color: var(--h229-text);
    --bs-btn-hover-bg: var(--h229-gold);
    --bs-btn-hover-border-color: var(--h229-gold);
    --bs-btn-active-color: var(--h229-text);
    --bs-btn-active-bg: var(--h229-gold);
    --bs-btn-active-border-color: var(--h229-gold);
    --bs-btn-active-shadow: none;
    --bs-btn-disabled-color: var(--h229-muted);
    --bs-btn-disabled-bg: var(--h229-line-2);
    --bs-btn-disabled-border-color: var(--h229-line);
}

.btn-outline-primary {
    /* Meme motif que ci-dessus : le contour bleu-canard passe a
       l'ardoise. Un bouton de contour ne se remplit pas au survol, il
       se teinte — sinon deux boutons pleins se disputent l'ecran. */
    --bs-btn-color: var(--h229-navy);
    --bs-btn-border-color: var(--h229-line);
    --bs-btn-hover-color: var(--h229-text);
    --bs-btn-hover-bg: var(--h229-hover);
    --bs-btn-hover-border-color: var(--h229-navy);
    --bs-btn-active-color: var(--h229-text);
    --bs-btn-active-bg: var(--h229-hover);
    --bs-btn-active-border-color: var(--h229-navy);
    --bs-btn-active-shadow: none;
    --bs-btn-disabled-color: var(--h229-muted);
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: var(--h229-line);
    --bs-gradient: none;
}

/* The Magic */
.btn-breadcrumb .btn:not(:last-child):after {
    content: " ";
    display: block;
    width: 0;
    height: 0;
    border-top: 17px solid transparent;
    border-bottom: 17px solid transparent;
    border-left: 10px solid white;
    position: absolute;
    top: 50%;
    margin-top: -17px;
    left: 100%;
    z-index: 3;
}
.btn-breadcrumb .btn:not(:last-child):before {
    content: " ";
    display: block;
    width: 0;
    height: 0;
    border-top: 17px solid transparent;
    border-bottom: 17px solid transparent;
    border-left: 10px solid rgb(173, 173, 173);
    position: absolute;
    top: 50%;
    margin-top: -17px;
    margin-left: 1px;
    left: 100%;
    z-index: 2;
}

/* The Spacing */
.btn-breadcrumb .btn {
    position: relative;
    padding: 6px 12px 6px 24px;
    border-radius: 0;
}
.btn-breadcrumb .btn:first-child {
    padding: 6px 6px 6px 10px;
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}
.btn-breadcrumb .btn:last-child {
    padding: 6px 18px 6px 24px;
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

/* Hover background color */
.btn-breadcrumb .btn:hover {
    background-color: var(--h229-border);
    color: var(--h229-text);
}

/* Default button */
.btn-breadcrumb .btn:first-child,
.btn-breadcrumb .btn:last-child {
    border-radius: 0;
}
.btn-breadcrumb .btn.btn-default:not(:last-child):after {
    border-left: 10px solid #fff;
}
.btn-breadcrumb .btn.btn-default:not(:last-child):before {
    border-left: 10px solid var(--h229-line);
}
.btn-breadcrumb .btn.btn-default:hover:not(:last-child):after {
    border-left: 10px solid var(--h229-line-2) !important;
}
.btn-breadcrumb .btn.btn-default:hover:not(:last-child):before {
    border-left: 10px solid var(--h229-line) !important;
}
.page-header-title {
    font-size: 2rem;
    font-weight: bold;
}

#header {
    background-color: var(--default-background-color);
    height: var(--header-height);
    display: flex;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}
/* Sidebar */
.container-sidebar {
    padding-left: 0.5rem;
}
/* Police moderne */
body {
    font-family: "Inter", sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    overflow-y: scroll; /* Pour appliquer la scrollbar personnalisée */
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-size: 15px; /* Taille de police par défaut */
    line-height: 1.5; /* Hauteur de ligne pour une meilleure lisibilité */
}

/* Layout principal */
#layout-wrapper {
    min-height: 100vh;
}
.sidebar .navbar-nav .nav-link {
    color: var(--h229-border);
    font-size: 14px;
}
.sidebar .collapse .nav .nav-link {
    padding: 0.2rem 0.6rem;
    font-size: 85%;
}

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

div.h-head {
    height: 60px;
    justify-content: center;
    display: flex;
    align-items: center;
    background: white;
}
.sidebar .nav-link {
    justify-content: flex-start;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    background: var(--primary-color-gradient);
    /*box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);*/
    z-index: 2000;
    display: flex;
    flex-direction: column;
    padding: 10px 0 20px; /* Ajustement pour correspondre à px-3 */
    height: calc(100% - var(--header-height));
    top: var(--header-height);
    left: 0;
    overflow: auto;
}

/* Définition de bg-dark */
.bg-dark {
    background-color: var(--primary-color) !important;
}

.sidebar .nav-link {
    color: #ffffff; /* Liens principaux en blanc */
    font-weight: 500;
    padding: 0.5rem 0.6rem;
    border-radius: 4px; /* Coins arrondis */
    transition: background-color 0.2s;
    display: flex; /* Utilisation de flexbox pour aligner les chevrons */
    align-items: center; /* Alignement vertical */
    justify-content: flex-start; /* Espacement uniforme entre texte et chevron */
    font-size: 14px;
    margin: 1px 10px 1px 0; /* Marges pour espacement */
}
a.nav-link.menu-link.active,
a.nav-link.menu-link.active i {
    color: var(--sidebar-link-active-color); /* Couleur du texte actif */
}

a.nav-link.active {
    background-color: #ffffff; /* Fond pour le lien actif */
}

.sidebar .nav-item.line-section {
    text-transform: uppercase;
    font-size: 10px;
    opacity: 0.8;
    padding: 0.2rem 0.5rem;
}

a.nav-link.menu-link.active {
    background-color: var(--sidebar-active-bg); /* Fond pour le lien actif */
    margin-right: 0;
    border-radius: 4px 0 0 4px; /* Coins arrondis pour le lien actif */
}
.sidebar .nav-link:hover {
    background-color: #ffffff;
}
.sidebar .nav-link i {
    color: #ffffff; /* Icônes en blanc */
    margin-right: 0.5rem;
    font-size: 1.2rem;
}
.menu-title {
    font-size: 0.7rem;
    color: #ffffff;
    text-transform: uppercase;
    padding: 0.5rem 1rem;
}
.menu-dropdown .nav-link {
    padding-left: 2rem;
    font-size: 0.95rem;
    color: #ffffff; /* Sous-menus en blanc avec opacité 95% */
    display: block;
}
.menu-dropdown .nav-link i {
    display: none; /* Pas d'icônes pour sous-menus */
}
/* Suivait .bi-chevron-down. Sans cette regle, les chevrons du menu
   lateral perdraient leur alignement a droite et leur couleur. */
.sidebar .nav-link .ri-arrow-down-s-line {
    margin-left: auto; /* Pousse le chevron à droite */
    color: #ffffff; /* Chevrons en blanc */
    font-size: 1rem; /* Taille cohérente */
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    padding-top: calc(
        var(--header-height)
    ); /* Ajustement pour éviter le chevauchement */
}

/* Page content */
.page-content {
    min-height: calc(100vh - var(--header-height) * 2);
    display: flex;
    flex-direction: column;
}

/* Header */
.navbar {
    z-index: 1001;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--h229-border);
}
.navbar-nav .nav-link {
    color: var(--text-color);
    font-weight: 500;
}
.dropdown-menu {
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Footer */
.footer {
    /*margin-left: var(--sidebar-width);*/
    border-top: 1px solid var(--h229-border);
    font-size: 13px;
}

/* Cards (inspiré de Donozeo avec marges et centrage) */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    background-color: var(--card-bg);
    overflow: hidden;
    position: relative;
    margin: 0.5rem 0;
}
.card-animate .position-absolute svg {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    opacity: 0.05;
    fill: var(--secondary-color);
}
.card-body {
    z-index: 1;
    position: relative;
}
.card-title {
    font-size: 1.25rem;
    font-weight: 600;
}
.card-text {
    color: var(--muted-color);
}
/* Regle retiree : elle visait .fa-4x et .fa-5x, absentes de tous les
   gabarits meme avant la conversion. La reporter sur .fs-1/.fs-2 aurait
   recolore n'importe quel gros texte en carte. */

/* Vertical Overlay */
.vertical-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    display: none;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: var(--h229-line);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--h229-muted);
}
* {
    transition: all 0.5s ease;
}

/* Responsive */
@media (max-width: 991px) {
    .sidebar {
        top: var(--header-height);
        width: 100%;
        height: calc(100vh - var(--header-height));
        overflow: auto;
        left: 0;
        display: none;
    }
    .sidebar .navbar-nav {
        flex-direction: column;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        margin-left: 0 !important;
    }
    .container {
        margin: auto !important;
        max-width: 100%;
    }
    .footer {
        margin-left: 0;
    }
    .vertical-overlay.show {
        display: block;
    }
}

/* Custom styles for Donozeo-like widgets */
.dashboard-widget {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: 8px;
    background-color: var(--card-bg);
    margin-bottom: 1rem;
    /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);*/
}
.dashboard-widget i {
    font-size: 2rem;
    margin-right: 1rem;
    color: var(--h229-navy-2);
}
.dashboard-widget .widget-content {
    flex-grow: 1;
}
.dashboard-widget .widget-title {
    font-size: 1rem;
    color: var(--muted-color);
    text-transform: uppercase;
}
.dashboard-widget .widget-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Centrage des cartes */
.row {
    justify-content: center;
}
.modal {
    z-index: 9999 !important;
}

#main-body {
    flex-grow: 1;
    min-height: 70vh;
}

#card-body,
.dashboard-card {
    display: flex;
    flex-direction: column;
    min-height: 70vh;
    padding: 1.5rem;
    background: var(--default-background-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

/* HOME CARD*/
.card .card-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.card .card-category {
    font-size: 1rem;
}
.card .card-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card.card-equal {
    min-height: 80px; /* hauteur fixe ou adaptative */
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.table-title {
    font-size: 1.25rem; /* fs-5 */
    font-weight: 300; /* fw-light */
    margin-bottom: 0; /* mb-0 */
    padding-top: 0.5rem; /* pt-2 */
    padding-bottom: 0.5rem; /* pb-2 */
}
.table tr > td,
.table tr > th {
    padding-left: 0.75rem; /* pl-2 */
    padding-right: 0.75rem; /* pr-2 */
}
.table > :not(caption) > * > * {
    vertical-align: middle;
    font-size: 95%;
}

.table tr .action-icons i {
    color: var(--card-text-color); /* couleur par défaut (noir ou héritée) */
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

table tbody tr {
    border-bottom: none !important;
}

.table {
    --bs-table-hover-bg: rgba(209, 219, 227, 0.8);
    --bs-table-striped-bg: var(--background-color);
}
.table > :not(caption) > * > * {
    border-bottom-width: 0;
}

@media (min-width: 768px) {
    .card.card-equal {
        min-height: 100px;
    }
}

@media (min-width: 1200px) {
    .card.card-equal {
        min-height: 120px;
    }
}

/* Card hover effect */
.card:hover {
    /* Le soulevement a ete retire : une carte qui n'est pas cliquable
       n'a pas a reagir au survol. Voir composants.css. */
    box-shadow: none;
}
/* Card active effect */
.card:active {
    box-shadow: var(--card-shadow);
    transform: translateY(0);
    transition: box-shadow 0.1s ease, transform 0.1s ease;
}

/************************************************/
tr .action-icons i {
    color: inherit; /* couleur par défaut (noir ou héritée) */
    opacity: 0.75;
    transition: opacity 0.2s ease;
}

tr:hover .action-icons i {
    opacity: 1;
}
.dataTables_filter label,
.dataTables_length label {
    display: flex;
    align-items: center;
    gap: 0.2em; /* espace entre le texte et le select */
    font-weight: normal;
    white-space: nowrap;
    margin: 0.5rem 0;
    font-size: smaller;
}
.dataTables_filter input,
.dataTables_length select {
    width: auto; /* Largeur automatique pour s'adapter au contenu */
}

.dataTables_length select {
    margin: 0 0.3em;
}

#accordionMenu {
    max-height: 85vh;
    overflow-y: auto;
    scrollbar-width: thin;
}
/**********************************************************/
.required:after {
    display: inline-block;
    /*vertical-align: top;*/
    margin: -0.2em 0 0 0.2em;
    content: '*';
    color: var(--h229-danger);
}
