/* LabriHub — reprise du langage visuel de GCU WEB.
   Valeurs (couleurs, formes, ombres) alignées sur IHM/public/style.css de
   gcu-web, pour que les deux applications se ressemblent. Pas de framework :
   une console d'administration ne doit pas dépendre d'un CDN pour s'afficher. */

:root {
    --bleu-france:      #000091;   /* action principale */
    --bleu-france-vif:  #1212FF;   /* survol */
    --bandeau:          #649abe;   /* bandeau supérieur */
    --rouge:            #cc0000;
    --rouge-sombre:     #a30000;
    --gris:             #808080;

    --encart:           rgba(255, 255, 255, 0.95);
    --champ:            #f6f6f6;
    --champ-trait:      #9c9c9c;
    --entete-tableau:   #f3f3f3;
    --bordure:          #ddd;
    --survol-ligne:     #f9f9f9;
    --survol-clic:      #e8f0fe;

    --texte:            #1c1c1c;
    --texte-doux:       #666;
    --texte-faible:     #8a8a8a;

    --ok-fond:   #d4edda; --ok-texte:   #155724; --ok-bord:   #c3e6cb;
    --err-fond:  #f8d7da; --err-texte:  #721c24; --err-bord:  #f5c6cb;
    --warn-fond: #fff3cd; --warn-texte: #856404; --warn-bord: #ffeeba;
    --info-fond: #e8f0fe; --info-texte: #0b3d91; --info-bord: #c6dafc;

    --ombre-encart: 0 0 20px rgba(0, 0, 0, 0.3);
    --ombre-bandeau: 0 2px 5px rgba(0, 0, 0, 0.3);
    --hauteur-bandeau: 50px;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    font-family: Arial, sans-serif;
    color: var(--texte);
}

body {
    background-image: url("/static/img/background.jpg");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { color: var(--bleu-france); }

/* =========================
   Bandeau supérieur
   ========================= */
.top-bar {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    background: var(--bandeau);
    color: #fff;
    z-index: 1000;
    box-shadow: var(--ombre-bandeau);
}

.top-bar__inner {
    height: var(--hauteur-bandeau);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
}

.top-left {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap;
    min-width: 0;
}

.top-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand { color: #fff; text-decoration: none; white-space: nowrap; }
.brand small { font-weight: normal; opacity: .8; font-size: 11px; margin-left: 6px; }

.user-name {
    font-size: 14px;
    line-height: 1.2;
    text-align: right;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-name span { display: block; font-size: 11px; opacity: .85; }

/* Navigation */
.nav-links { display: flex; align-items: center; gap: 4px; }

.nav-link {
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: normal;
    padding: 6px 12px;
    transition: background-color .2s ease;
    white-space: nowrap;
}
.nav-link:hover { background: rgba(255, 255, 255, .18); }
.nav-link.active { background: var(--bleu-france); }

/* Bouton hamburger + panneau mobile */
.nav-toggle {
    display: none;
    width: auto;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .5);
    color: #fff;
    padding: 5px 9px;
    cursor: pointer;
    line-height: 0;
}
.nav-toggle:hover { background: rgba(255, 255, 255, .18); }
.nav-toggle svg { width: 18px; height: 18px; }

.mobile-nav {
    display: none;
    background: var(--bandeau);
    border-top: 1px solid rgba(255, 255, 255, .25);
    padding: 8px 20px 12px;
}
.mobile-nav .nav-link { display: block; padding: 9px 12px; }
.mobile-nav__foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-top: 10px; padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, .25);
}

/* =========================
   Encarts et page
   ========================= */
.page {
    flex: 1;
    padding: calc(var(--hauteur-bandeau) + 20px) 20px 20px;
}

.box {
    background: var(--encart);
    padding: 30px;
    width: 950px;
    max-width: 100%;
    border-radius: 0;
    box-shadow: var(--ombre-encart);
    margin: 0 auto 25px;
}
.box--wide   { width: 1400px; }
.box--narrow { width: 420px; }
.box--flush  { padding: 0; }

.box h1, .box h2 { margin: 0 0 6px; font-size: 20px; }
.box h3 { margin: 0 0 10px; font-size: 16px; }

.box-head {
    display: flex; flex-wrap: wrap; align-items: flex-end;
    justify-content: space-between; gap: 15px;
    padding: 20px 25px; border-bottom: 1px solid var(--bordure);
}
.box-foot {
    padding: 10px 25px; border-top: 1px solid var(--bordure);
    font-size: 12px; color: var(--texte-doux);
}
.box-section { padding: 20px 25px; }

.site-footer {
    background: transparent;
    text-align: center;
    padding: 12px 0 18px;
    font-size: 13px;
    color: #f0f0f0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

/* =========================
   Formulaires
   ========================= */
label { font-weight: bold; display: block; margin-bottom: 5px; font-size: 13px; }

input[type="text"], input[type="password"], input[type="email"], input[type="search"],
input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    padding: 8px;
    font-family: inherit;
    font-size: 13px;
    border: none;
    background: var(--champ);
    border-bottom: 2px solid var(--champ-trait);
    border-radius: .25rem .25rem 0 0;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-bottom-color: var(--bleu-france);
    background: #eef0f8;
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--bleu-france); }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field--inline { flex-direction: row; align-items: center; gap: 8px; margin-bottom: 0; }
.field small { color: var(--texte-doux); font-size: 12px; }
.field .err { color: var(--rouge); font-size: 12px; }
.field input.invalid, .field select.invalid { border-bottom-color: var(--rouge); }

/* =========================
   Boutons
   ========================= */
button, .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    width: auto;
    padding: 8px 16px;
    background: var(--bleu-france);
    color: #fff;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    text-decoration: none;
    line-height: 1.3;
    transition: background-color .2s ease;
}
button:hover, .btn:hover { background: var(--bleu-france-vif); color: #fff; }
button:disabled, .btn:disabled, .btn.is-disabled {
    background: #c9c9c9; color: #6b6b6b; cursor: not-allowed;
}
.btn--block { width: 100%; padding: 10px; font-size: 14px; }
.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--danger  { background: var(--rouge); }
.btn--danger:hover  { background: var(--rouge-sombre); }
.btn--neutral { background: var(--gris); }
.btn--neutral:hover { background: #000; }
.btn--ghost {
    background: transparent; border: 1px solid var(--bleu-france); color: var(--bleu-france);
}
.btn--ghost:hover { background: #F2F2F9; color: var(--bleu-france); }
.btn--icon { padding: 4px 8px; font-size: 13px; }

/* =========================
   Tableaux
   ========================= */
.scroll-x { overflow-x: auto; }

.result-table { width: 100%; border-collapse: collapse; background: #fff; }
.result-table th {
    padding: 10px; background: var(--entete-tableau); border: 1px solid var(--bordure);
    text-align: left; font-size: 13px; white-space: nowrap;
}
.result-table td { padding: 8px 10px; border: 1px solid var(--bordure); font-size: 13px; }
.result-table tr:hover td { background: var(--survol-ligne); }
.result-table .num { text-align: right; }
.result-table .sticky-col {
    position: sticky; left: 0; background: #fff; z-index: 1;
}
.result-table tr:hover .sticky-col { background: var(--survol-ligne); }
.result-table th.sticky-col { background: var(--entete-tableau); z-index: 2; }

.empty-state { padding: 45px 25px; text-align: center; color: var(--texte-doux); }
.empty-state p { margin: 4px 0; }

/* =========================
   Pastilles d'état
   ========================= */
.pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px; border-radius: 35px;
    font-size: 12px; font-weight: bold; white-space: nowrap;
    border: 1px solid;
}
.pill--ok    { color: var(--ok-texte);   background: var(--ok-fond);   border-color: var(--ok-bord); }
.pill--err   { color: var(--err-texte);  background: var(--err-fond);  border-color: var(--err-bord); }
.pill--warn  { color: var(--warn-texte); background: var(--warn-fond); border-color: var(--warn-bord); }
.pill--info  { color: var(--info-texte); background: var(--info-fond); border-color: var(--info-bord); }
.pill--muted { color: var(--texte-doux); background: #f0f0f0;          border-color: #dcdcdc; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot--ok { background: #1e8e3e; } .dot--err { background: var(--rouge); }
.dot--warn { background: #f0a500; } .dot--muted { background: #b0b0b0; }

.tag {
    display: inline-block; padding: 1px 7px; margin: 1px 2px 1px 0;
    background: #eceff4; border: 1px solid #dfe3e8;
    font-size: 11px; color: #46505c;
}

/* =========================
   Messages
   ========================= */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 15px; font-size: 13px; border: 1px solid; }
.alert-success { background: var(--ok-fond);   color: var(--ok-texte);   border-color: var(--ok-bord); }
.alert-error   { background: var(--err-fond);  color: var(--err-texte);  border-color: var(--err-bord); }
.alert-warning { background: var(--warn-fond); color: var(--warn-texte); border-color: var(--warn-bord); }
.alert-info    { background: var(--info-fond); color: var(--info-texte); border-color: var(--info-bord); }
.alert strong { font-weight: bold; }

#toasts {
    position: fixed; right: 16px; bottom: 16px; z-index: 2000;
    display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 380px;
}
.toast {
    padding: 12px 16px; border-radius: 6px; font-size: 13px; border: 1px solid;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .28); cursor: pointer; background: #fff;
}

/* =========================
   Onglets (fiche switch)
   ========================= */
.tabs {
    display: flex; flex-wrap: wrap; gap: 2px;
    padding: 8px 25px 0; border-bottom: 1px solid var(--bordure);
    background: #fafafa;
}
.tab-btn {
    background: transparent; color: var(--texte-doux);
    border: 1px solid transparent; border-bottom: none;
    padding: 8px 14px; font-size: 13px; border-radius: 0;
}
.tab-btn:hover { background: #eef1f5; color: var(--texte); }
.tab-btn.active {
    background: #fff; color: var(--bleu-france); font-weight: bold;
    border-color: var(--bordure); margin-bottom: -1px;
}

/* =========================
   Cartes de synthèse
   ========================= */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-card {
    display: block; padding: 14px 16px; background: #fff;
    border: 1px solid var(--bordure); text-decoration: none; color: inherit;
    transition: border-color .2s ease, background .2s ease;
}
.stat-card:hover { border-color: var(--bleu-france); background: #fbfbfe; }
.stat-card__label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-doux); }
.stat-card__value { margin-top: 4px; font-size: 26px; font-weight: bold; }
.v-ok { color: #1e8e3e; } .v-err { color: var(--rouge); }
.v-warn { color: #b8860b; } .v-neutral { color: var(--texte); }

/* =========================
   Diff de configuration
   ========================= */
.diff { max-height: 28rem; overflow: auto; background: #fff; border-top: 1px solid var(--bordure); }
.diff table { width: 100%; border-collapse: collapse; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.diff td { padding: 1px 6px; white-space: pre; }
.diff .lineno { width: 3.2rem; text-align: right; color: #aaa; user-select: none; background: #fafafa; }
.diff .add    { background: #e6ffed; color: #14532d; }
.diff .remove { background: #ffeef0; color: #86181d; }
.diff .hunk   { background: #f1f5fb; color: #0b3d91; }
.diff .context{ color: #444; }

/* =========================
   Console SSH
   ========================= */
.terminal-wrap { background: #000; padding: 8px; border: 1px solid var(--bordure); height: 60vh; min-height: 320px; }

/* =========================
   Utilitaires
   ========================= */
.row      { display: flex; align-items: center; gap: 10px; }
.row--top { align-items: flex-start; }
.row--end { align-items: flex-end; }
.wrap     { flex-wrap: wrap; }
.between  { justify-content: space-between; }
.col      { display: flex; flex-direction: column; gap: 8px; }
.grow     { flex: 1; min-width: 0; }
.right    { text-align: right; }
.nowrap   { white-space: nowrap; }
.mono     { font-family: ui-monospace, Menlo, Consolas, monospace; }
.muted    { color: var(--texte-doux); }
.faint    { color: var(--texte-faible); }
.small    { font-size: 12px; }
.tiny     { font-size: 11px; }
.strong   { font-weight: bold; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22rem; }
.mt-0 { margin-top: 0; }   .mt-1 { margin-top: 8px; }  .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.gap-sm { gap: 6px; } .gap-lg { gap: 20px; }

.htmx-indicator { display: none; font-size: 12px; color: var(--texte-doux); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

code, kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px;
            background: #eef0f4; padding: 1px 5px; border-radius: 3px; }

/* =========================
   Responsive
   ========================= */
@media (max-width: 900px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-toggle { display: inline-flex; }
    .mobile-nav.is-open { display: block; }
    .user-name, .top-right .btn--logout, .nav-search { display: none; }
    .box { padding: 20px; }
    .box-head, .box-section { padding: 15px; }
    .page { padding-left: 10px; padding-right: 10px; }
    .tabs { padding-left: 10px; padding-right: 10px; }
}

@media (max-width: 480px) {
    .top-left { font-size: 13px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    #toasts { left: 10px; right: 10px; max-width: none; }
}
