/* ==========================================================================
   Back-office CODELISTES — thème inspiré de Gentelella (github.com/ColorlibHQ/gentelella),
   réécrit pour Bootstrap 5 (sans jQuery ni Bootstrap 3).
   ========================================================================== */
:root {
    --g-bleu: #2A3F54;          /* barre latérale */
    --g-bleu-2: #34495E;
    --g-vert: #1ABB9C;          /* accent */
    --g-vert-btn: #26B99A;
    --g-fond: #F7F7F7;          /* zone de contenu */
    --g-haut: #EDEDED;          /* barre du haut */
    --g-bord: #E6E9ED;
    --g-texte: #73879C;
    --g-largeur: 230px;
    --g-largeur-petit: 70px;
}

.g-body {
    margin: 0; background: var(--g-bleu); color: var(--g-texte);
    font-family: "Helvetica Neue", Roboto, Arial, "Droid Sans", sans-serif; font-size: 13px; line-height: 1.47;
    --bs-body-color: var(--g-texte); --bs-body-font-size: 13px;
    --bs-primary: var(--g-vert-btn); --bs-primary-rgb: 38, 185, 154;
    --bs-link-color: #5A738E; --bs-link-color-rgb: 90, 115, 142; --bs-link-hover-color: var(--g-vert);
}
.g-body h1, .g-body h2, .g-body h3, .g-body h4, .g-body h5, .g-body h6, .g-body .h5, .g-body .h6 { color: #5A738E; }
.g-body .text-body { color: #5A738E !important; }
.g-body strong, .g-body .fw-semibold, .g-body .fw-bold { color: #4c6278; }
.g-conteneur { min-height: 100vh; }

/* ---------- Barre latérale ---------- */
.g-gauche {
    position: fixed; inset: 0 auto 0 0; width: var(--g-largeur); background: var(--g-bleu); z-index: 1030;
    display: flex; flex-direction: column; transition: width .2s, transform .25s;
}
.g-titre { height: 57px; display: flex; align-items: center; padding: 0 10px; flex-shrink: 0; }
.g-site { display: flex; align-items: center; gap: 10px; color: #ECF0F1; text-decoration: none; font-size: 21px; font-weight: 400; overflow: hidden; white-space: nowrap; }
.g-site:hover { color: #fff; }
.g-logo { width: 46px; height: 46px; border: 1px solid #EAEAEA; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: #fff; overflow: hidden; flex-shrink: 0; }
.g-logo .brand-logo, .g-logo img { max-width: 36px; max-height: 36px; border-radius: 6px; }
.g-nom { overflow: hidden; text-overflow: ellipsis; }

.g-profil { display: flex; align-items: center; gap: 10px; padding: 18px 14px 14px; flex-shrink: 0; }
.g-avatar { width: 56px; height: 56px; border-radius: 50%; background: #fff; color: var(--g-bleu); font-weight: 700; font-size: 1.2rem;
    display: inline-flex; align-items: center; justify-content: center; border: 3px solid rgba(255,255,255,.35); flex-shrink: 0; }
.g-avatar.petit { width: 29px; height: 29px; font-size: .75rem; border-width: 0; background: var(--g-bleu); color: #fff; }
.g-profil-info span { font-size: 13px; color: #BAB8B8; line-height: 1.6; }
.g-profil-info h2 { font-size: 14px; color: #ECF0F1; margin: 2px 0 0; font-weight: 300; }

.g-menu { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding-bottom: 12px; }
.g-menu::-webkit-scrollbar { width: 6px; } .g-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.g-section h3 { padding-left: 15px; color: #fff !important; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; font-size: 11px;
    margin: 10px 0 6px; text-shadow: 1px 1px rgba(0,0,0,.25); }
.g-nav { list-style: none; margin: 0; padding: 0; }
.g-nav > li > a { display: flex; align-items: center; gap: 10px; padding: 13px 15px 12px; color: #E7E7E7; text-decoration: none; font-weight: 500; position: relative; }
.g-nav > li > a > i:first-child { width: 26px; font-size: 18px; opacity: .99; text-align: center; flex-shrink: 0; }
.g-nav > li > a:hover { color: #F2F5F7; background: rgba(255,255,255,.04); }
.g-nav > li.actif > a, .g-nav > li.ouvert > a, .g-nav > li.actif-parent > a {
    background: linear-gradient(#334556, #2C4257), #2A3F54; box-shadow: rgba(0,0,0,.25) 0 1px 0, inset rgba(255,255,255,.16) 0 1px 0;
    text-shadow: rgba(0,0,0,.25) 0 -1px 0; color: #fff;
}
.g-nav > li.actif, .g-nav > li.actif-parent { border-right: 5px solid var(--g-vert); }
.g-chevron { margin-left: auto; font-size: 11px; transition: transform .2s; }
.g-groupe.ouvert .g-chevron { transform: rotate(180deg); }
.g-badge { margin-left: auto; } .g-badge + .g-chevron { margin-left: 6px; }
.g-enfants { list-style: none; margin: 0; padding: 0; display: none; background: rgba(255,255,255,.02); }
.g-groupe.ouvert .g-enfants { display: block; }
.g-enfants li { position: relative; }
.g-enfants li::before { content: ""; position: absolute; left: 26px; top: 50%; width: 7px; height: 7px; margin-top: -3px; border-radius: 50%; background: #425668; z-index: 1; }
.g-enfants::before { content: ""; position: absolute; }
.g-groupe { position: relative; }
.g-groupe.ouvert .g-enfants { border-left: 0; position: relative; }
.g-groupe.ouvert .g-enfants::after { content: ""; position: absolute; left: 29px; top: 0; bottom: 0; width: 1px; background: #425668; }
.g-enfants a { display: flex; align-items: center; padding: 9px 15px 9px 50px; color: rgba(255,255,255,.75); text-decoration: none; font-size: 12px; position: relative; }
.g-enfants a:hover { color: #fff; background: rgba(255,255,255,.06); }
.g-enfants li.actif > a { color: #fff; }
.g-enfants li.actif::before, .g-enfants li:hover::before { background: var(--g-vert); }

.g-pied-menu { display: flex; flex-shrink: 0; background: #172D44; }
.g-pied-menu a { flex: 1; text-align: center; padding: 9px 0; color: #5A738E; font-size: 16px; text-decoration: none; }
.g-pied-menu a:hover { background: #425567; color: #fff; }

/* ---------- Barre du haut ---------- */
.g-haut {
    position: sticky; top: 0; z-index: 1020; margin-left: var(--g-largeur); height: 57px; background: var(--g-haut);
    border-bottom: 1px solid #D9DEE4; display: flex; align-items: center; gap: 4px; padding: 0 15px; transition: margin-left .2s;
}
.g-bascule { border: 0; background: transparent; color: #5A738E; font-size: 26px; padding: 2px 10px; line-height: 1; }
.g-bascule:hover { color: var(--g-bleu); }
.g-lien-haut { display: inline-flex; align-items: center; gap: 6px; color: #515356; text-decoration: none; padding: 8px 12px; font-size: 13px; }
.g-lien-haut:hover { color: var(--g-bleu); background: #D9DEE4; }
.g-lien-haut i { font-size: 16px; }
.g-pastille { position: absolute; top: 2px; right: 0; font-size: 10px; }
.g-utilisateur { display: inline-flex; align-items: center; gap: 8px; color: #515356; text-decoration: none; padding: 8px 12px; font-weight: 500; }
.g-utilisateur:hover { background: #D9DEE4; color: #515356; }
.g-dropdown { border-radius: 0 0 4px 4px; border-color: var(--g-bord); box-shadow: 0 6px 16px rgba(0,0,0,.08); min-width: 220px; font-size: 13px; }

/* ---------- Contenu ---------- */
.g-droite { margin-left: var(--g-largeur); background: var(--g-fond); padding: 10px 20px 20px; min-height: calc(100vh - 57px - 43px); transition: margin-left .2s; }
.g-titre-page { padding: 10px 0 6px; }
.g-titre-page h3 { margin: 6px 0 4px; font-size: 24px; font-weight: 400; color: #73879C !important; }
.g-pied { margin-left: var(--g-largeur); background: #fff; padding: 12px 20px; border-top: 1px solid var(--g-bord); color: var(--g-texte); transition: margin-left .2s; }

/* Panneaux façon « x_panel » */
.g-droite .card { border: 1px solid var(--g-bord); border-radius: 0; box-shadow: none; background: #fff; }
.g-droite .card-header { background: #fff !important; border-bottom: 2px solid var(--g-bord); padding: 10px 17px; color: #5A738E; font-size: 15px; }
.g-droite .card-header.fw-semibold, .g-droite .card-header .fw-semibold { font-weight: 400 !important; font-size: 16px; color: #5A738E; }
.g-droite .card-body { padding: 12px 17px; }
.g-droite .card.card-body { padding: 12px 17px; }
.g-droite .card .h6:first-child, .g-droite .card-body > h2.h6 { font-size: 16px; font-weight: 400; color: #5A738E; border-bottom: 2px solid var(--g-bord); padding-bottom: 8px; margin-bottom: 12px; }
.g-droite .card-footer { background: #fff !important; border-top: 1px solid var(--g-bord); }

/* Tableaux */
.g-droite .table { --bs-table-color: #73879C; font-size: 13px; }
.g-droite .table thead th { color: #5A738E; font-weight: 700; border-bottom-width: 1px; background: #f8f9fa; }
.g-droite .table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f1f3f5; }

/* Boutons et formulaires */
.g-body .btn { border-radius: 3px; font-size: 13px; }
.g-body .btn-lg { font-size: 15px; }
.g-body .btn-primary { --bs-btn-bg: var(--g-vert-btn); --bs-btn-border-color: #169F85; --bs-btn-hover-bg: #169F85; --bs-btn-hover-border-color: #138a73;
    --bs-btn-active-bg: #138a73; --bs-btn-active-border-color: #138a73; --bs-btn-disabled-bg: #8fd8c8; --bs-btn-disabled-border-color: #8fd8c8; }
.g-body .btn-outline-primary { --bs-btn-color: #169F85; --bs-btn-border-color: var(--g-vert-btn); --bs-btn-hover-bg: var(--g-vert-btn); --bs-btn-hover-border-color: var(--g-vert-btn);
    --bs-btn-active-bg: #169F85; --bs-btn-active-border-color: #169F85; }
.g-body .btn-check:checked + .btn-outline-primary, .g-body .btn-check:checked + .btn-outline-secondary { background: var(--g-bleu-2); border-color: var(--g-bleu-2); color: #fff; }
.g-body .btn-success { --bs-btn-bg: #26B99A; --bs-btn-border-color: #169F85; --bs-btn-hover-bg: #169F85; }
.g-body .btn-dark { --bs-btn-bg: var(--g-bleu); --bs-btn-border-color: var(--g-bleu); }
.g-body .form-control, .g-body .form-select { border-radius: 0; border-color: #ccc; font-size: 13px; box-shadow: none; }
.g-body .form-control:focus, .g-body .form-select:focus { border-color: #CCD0D7; box-shadow: none; }
.g-body .form-control-lg, .g-body .form-select-lg { font-size: 16px; }
.g-body .input-group-text { border-radius: 0; font-size: 13px; }
.g-body .form-check-input:checked { background-color: var(--g-vert-btn); border-color: var(--g-vert-btn); }
.g-body .text-primary { color: #169F85 !important; }
.g-body .bg-primary, .g-body .text-bg-primary { background-color: var(--g-vert-btn) !important; color: #fff !important; }
.g-body .badge { font-weight: 600; }
.g-body .nav-tabs .nav-link.active { color: #5A738E; }
.g-body .nav-tabs .nav-link { color: #5A738E; }
.g-body .alert { border-radius: 0; }
.g-body .list-group-item { font-size: 13px; }
.g-body .pagination { --bs-pagination-active-bg: var(--g-vert-btn); --bs-pagination-active-border-color: var(--g-vert-btn); }

/* Tuiles de statistiques du tableau de bord (style « tile_count ») */
.g-droite .stat-card, .g-droite .kpi { border-left: 0; }

/* ---------- Menu réduit (icônes seules) ---------- */
html.g-petit .g-gauche { width: var(--g-largeur-petit); }
html.g-petit .g-haut, html.g-petit .g-droite, html.g-petit .g-pied { margin-left: var(--g-largeur-petit); }
html.g-petit .g-nom, html.g-petit .g-profil-info, html.g-petit .g-section h3, html.g-petit .g-nav span, html.g-petit .g-chevron,
html.g-petit .g-enfants, html.g-petit .g-pied-menu a:not(:last-child) { display: none !important; }
html.g-petit .g-titre { justify-content: center; padding: 0; }
html.g-petit .g-profil { justify-content: center; padding: 14px 0; }
html.g-petit .g-avatar:not(.petit) { width: 40px; height: 40px; font-size: .9rem; }
html.g-petit .g-nav > li > a { justify-content: center; flex-direction: column; gap: 2px; padding: 12px 4px; font-size: 10px; }
html.g-petit .g-nav > li > a > i:first-child { font-size: 22px; width: auto; }
html.g-petit .g-badge { position: absolute; top: 4px; right: 6px; }

/* ---------- Mobile : volet ---------- */
.g-voile { display: none; }
@media (max-width: 991.98px) {
    .g-gauche { transform: translateX(-100%); width: var(--g-largeur) !important; }
    html.g-mobile-ouvert .g-gauche { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
    html.g-mobile-ouvert .g-voile { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1025; }
    .g-haut, .g-droite, .g-pied { margin-left: 0 !important; }
    .g-droite { padding: 8px 12px 16px; }
    .g-titre-page h3 { font-size: 20px; }
    html.g-petit .g-nom, html.g-petit .g-profil-info, html.g-petit .g-section h3, html.g-petit .g-nav span, html.g-petit .g-chevron { display: initial !important; }
    html.g-petit .g-nav > li > a { flex-direction: row; justify-content: flex-start; font-size: 13px; padding: 13px 15px 12px; }
    html.g-petit .g-groupe.ouvert .g-enfants { display: block !important; }
}

/* ---------- Pages de connexion (style login Gentelella) ---------- */
.g-login { background: #F7F7F7; color: #73879C; font-family: "Helvetica Neue", Roboto, Arial, sans-serif; font-size: 13px; }
.g-login h1 { font: 400 25px "Helvetica Neue", Arial, sans-serif; letter-spacing: -.05em; color: #73879C; }
.g-login .card { border: 0; border-radius: 0; background: transparent; box-shadow: none !important; }
.g-login .card-body { padding: 0 !important; }
.g-login .card h2 { font-size: 25px; font-weight: 400; color: #73879C; text-align: center; position: relative; margin-bottom: 22px !important; }
.g-login .card h2::before, .g-login .card h2::after { content: ""; position: absolute; top: 50%; width: 12%; height: 1px; background: #7e7e7e;
    background: linear-gradient(to right, rgba(126,126,126,0) 0%, #7e7e7e 100%); }
.g-login .card h2::before { left: 0; } .g-login .card h2::after { right: 0; transform: scaleX(-1); }
.g-login .form-control { border-radius: 3px; box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,.08) inset; border: 1px solid #c8c8c8; padding: 10px; font-size: 13px; }
.g-login .btn-primary { --bs-btn-bg: var(--g-vert-btn); --bs-btn-border-color: #169F85; --bs-btn-hover-bg: #169F85; --bs-btn-hover-border-color: #169F85; border-radius: 3px; }
.g-login .btn-outline-secondary { border-radius: 3px; }
.g-login a { color: #5A738E; }
.g-login .g-login-pied { border-top: 1px solid #D8D8D8; margin-top: 22px; padding-top: 14px; text-align: center; }

/* ---------- Impression (bons, rapports) : seulement le contenu ---------- */
@media print {
    .g-gauche, .g-haut, .g-pied, .g-voile, .g-titre-page, .no-print, .nav-tabs { display: none !important; }
    .g-droite { margin: 0 !important; padding: 0 !important; background: #fff !important; min-height: 0; }
    .g-body { background: #fff !important; }
    .g-droite .card { box-shadow: none !important; }
}
