/* ============================================================
   Charte graphique VION — Extranet EVOAIR
   ============================================================ */
:root {
  --rouge: #E2231A;
  --anthracite: #2D2D2D;
  --gris: #7A7A7A;
  --fond: #FFFFFF;
  --fond-leger: #F5F5F5;
  --bordure: #E0E0E0;
  --succes: #2E7D32;
  --rouge-clair: #fdecec;
  --radius: 8px;
  --ombre: 0 1px 3px rgba(0,0,0,.06);
  --ombre-hover: 0 6px 18px rgba(0,0,0,.10);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--anthracite);
  background: var(--fond);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--rouge); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Barre de progression globale (style nprogress) --- */
#global-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--rouge);
  z-index: 9999;
  transition: width .2s ease, opacity .3s ease;
  opacity: 0;
  box-shadow: 0 0 8px rgba(226,35,26,.6);
}
#global-progress.active { opacity: 1; }

/* --- En-tete --- */
header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--bordure);
  background: var(--fond);
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand:hover { text-decoration: none; opacity: .85; }
.brand .logo { font-weight: 800; letter-spacing: .5px; color: var(--rouge); font-size: 20px; }
.brand .sub { color: var(--gris); font-size: 13px; }
.topnav { display: flex; align-items: center; gap: 18px; }
.topnav a { color: var(--anthracite); font-weight: 500; }
.topnav a.active { color: var(--rouge); }
.topnav .who { color: var(--gris); font-size: 13px; }

/* --- Conteneur --- */
.container { max-width: 1100px; margin: 0 auto; padding: 28px; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 28px 0 12px; }
.page-sub { color: var(--gris); margin: 0 0 24px; }

/* --- Bouton signature VION --- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--rouge);
  border: 1.5px solid var(--rouge);
  border-radius: var(--radius);
  padding: 9px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .18s ease;
  font-family: var(--font);
}
.btn .arrow { transition: transform .18s ease; }
.btn:hover { background: var(--rouge); color: #fff; text-decoration: none; }
.btn:hover .arrow { transform: translateX(3px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { color: var(--anthracite); border-color: var(--bordure); }
.btn.secondary:hover { background: var(--fond-leger); color: var(--anthracite); }
.btn.small { padding: 6px 12px; font-size: 13px; }

/* --- Grille de cartes --- */
.cards-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.tool-card {
  background: #fff; border: 1px solid var(--bordure);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--ombre);
  transition: box-shadow .18s ease, transform .18s ease;
  display: flex; flex-direction: column; gap: 10px;
  position: relative; overflow: hidden;
}
.tool-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--gris);
}
.tool-card.type-verification::before { background: #1976D2; }
.tool-card.type-correction::before { background: var(--rouge); }
.tool-card:hover { box-shadow: var(--ombre-hover); transform: translateY(-2px); }
.tool-card:hover { text-decoration: none; }
a.tool-card { color: var(--anthracite); text-decoration: none; cursor: pointer; }
.tool-card .icone { font-size: 30px; }
.tool-card .titre { font-weight: 700; font-size: 16px; }
.tool-card .desc { color: var(--gris); font-size: 13.5px; flex: 1; }
.tool-card .card-open {
  margin-top: 8px; font-weight: 600; font-size: 13.5px; color: var(--rouge);
  display: inline-flex; align-items: center; gap: 6px;
}
.tool-card .card-open .arrow { transition: transform .18s ease; }
.tool-card:hover .card-open .arrow { transform: translateX(4px); }

/* --- En-tete de la page-application d'un outil --- */
.app-header {
  display: flex; gap: 18px; align-items: center;
  background: var(--fond-leger); border: 1px solid var(--bordure);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 22px;
  position: relative; overflow: hidden;
}
.app-header::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--gris);
}
.app-header.type-verification::before { background: #1976D2; }
.app-header.type-correction::before { background: var(--rouge); }
.app-icone { font-size: 40px; line-height: 1; }
.app-meta { flex: 1; }
.app-title-row { display: flex; align-items: center; gap: 12px; }
.app-title-row h1 { margin: 0; }
.app-meta .muted { margin: 6px 0 0; }

/* --- Lien direct vers Odoo sur une ligne de resultat --- */
.odoo-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; font-weight: 600; color: var(--rouge);
  border: 1px solid var(--bordure); border-radius: 6px; padding: 2px 8px;
  white-space: nowrap; text-decoration: none;
}
.odoo-link:hover { background: var(--rouge); color: #fff; border-color: var(--rouge); text-decoration: none; }
.tool-card .pastille {
  align-self: flex-start; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .4px;
}
.pastille.verification { background: #e8f0fe; color: #1976D2; }
.pastille.correction { background: var(--rouge-clair); color: var(--rouge); }
.tool-card .run-zone { margin-top: 6px; }

/* --- Zone de resultat (HTMX) --- */
.run-zone .spinner-inline {
  display: none; width: 14px; height: 14px;
  border: 2px solid rgba(226,35,26,.25); border-top-color: var(--rouge);
  border-radius: 50%; animation: spin .7s linear infinite;
}
/* hx-indicator : visible pendant la requete */
.htmx-request .spinner-inline { display: inline-block; }
.htmx-request.btn { opacity: .7; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Barre d'action (selection + bouton en lot) --- */
.action-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 12px 0; padding: 12px 14px;
  background: var(--fond-leger); border: 1px solid var(--bordure); border-radius: var(--radius);
}
.action-bar .checkbox-row { font-size: 13.5px; }
.row-select, .select-all { cursor: pointer; }

.progress-block { margin-top: 12px; }
.progress-bar-outer {
  height: 8px; background: var(--fond-leger); border-radius: 6px; overflow: hidden;
  border: 1px solid var(--bordure);
}
.progress-bar-inner {
  height: 100%; background: var(--rouge); width: 0; transition: width .4s ease;
}
.progress-label { font-size: 12.5px; color: var(--gris); margin-top: 6px; }

/* --- Tableau de resultat --- */
.result-summary {
  display: flex; align-items: center; gap: 10px; margin: 12px 0;
  font-weight: 600;
}
.result-summary .count {
  background: var(--rouge); color: #fff; border-radius: 20px;
  padding: 2px 12px; font-size: 13px;
}
.result-summary.ok .count { background: var(--succes); }
.table-wrap { overflow-x: auto; border: 1px solid var(--bordure); border-radius: var(--radius); }
table.result { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.result th, table.result td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--bordure); }
table.result th { background: var(--fond-leger); font-weight: 600; position: sticky; top: 0; }
table.result tr:last-child td { border-bottom: none; }
.empty-state { padding: 18px; color: var(--succes); font-weight: 600; }
.card-error {
  padding: 14px; background: var(--rouge-clair); border: 1px solid var(--rouge);
  border-radius: var(--radius); color: var(--rouge); margin-top: 12px;
}

/* --- Formulaires --- */
form .field { margin-bottom: 16px; }
label { display: block; font-size: 13px; color: var(--gris); margin-bottom: 5px; font-weight: 500; }
input[type=text], input[type=password], input[type=email], input[type=time],
input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--bordure);
  border-radius: var(--radius); font-family: var(--font); font-size: 14px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--rouge); }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.checkbox-row label { margin: 0; color: var(--anthracite); }
.checkbox-list { border: 1px solid var(--bordure); border-radius: var(--radius); padding: 12px; max-height: 220px; overflow-y: auto; }
.form-actions { display: flex; gap: 12px; margin-top: 20px; }

/* --- Tableaux admin --- */
table.admin { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; border: 1px solid var(--bordure); border-radius: var(--radius); overflow: hidden; }
table.admin th, table.admin td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--bordure); }
table.admin th { background: var(--fond-leger); font-weight: 600; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.badge.on { background: #e6f4ea; color: var(--succes); }
.badge.off { background: var(--fond-leger); color: var(--gris); }
.badge.admin { background: var(--rouge-clair); color: var(--rouge); }

/* --- Login --- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--fond-leger); }
.login-card { background: #fff; border: 1px solid var(--bordure); border-radius: 12px; padding: 36px; width: 360px; box-shadow: var(--ombre); }
.login-card .logo { color: var(--rouge); font-weight: 800; font-size: 26px; text-align: center; }
.login-card .sub { color: var(--gris); text-align: center; margin-bottom: 24px; font-size: 13px; }

/* --- Cartes/stats admin --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 16px; margin-bottom: 28px; }
.stat { background: var(--fond-leger); border: 1px solid var(--bordure); border-radius: var(--radius); padding: 18px; }
.stat .num { font-size: 28px; font-weight: 800; color: var(--rouge); }
.stat .lbl { color: var(--gris); font-size: 13px; }

/* --- Toasts --- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 10000; }
.toast {
  background: var(--anthracite); color: #fff; padding: 12px 18px; border-radius: var(--radius);
  box-shadow: var(--ombre-hover); font-size: 14px; max-width: 360px;
  animation: toast-in .25s ease; border-left: 4px solid var(--gris);
}
.toast.success { border-left-color: var(--succes); }
.toast.error { border-left-color: var(--rouge); }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- Explorateur d'arborescences --- */
.taxo-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 18px; }
.explorer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.breadcrumb { font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.breadcrumb .sep { color: var(--gris); }
.breadcrumb .current { font-weight: 700; color: var(--anthracite); }
.node-meta { font-size: 12.5px; margin: 8px 0 14px; }
.node-children { display: flex; flex-direction: column; gap: 6px; }
.node-row {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 14px; border: 1px solid var(--bordure); border-radius: var(--radius);
  background: #fff; color: var(--anthracite); text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}
.node-row:hover { border-color: var(--rouge); background: var(--fond-leger); text-decoration: none; }
.node-label { flex: 0 0 38%; font-weight: 600; }
.node-bar { flex: 1; height: 8px; background: var(--fond-leger); border-radius: 6px; overflow: hidden; border: 1px solid var(--bordure); }
.node-bar-fill { display: block; height: 100%; background: var(--rouge); }
.node-count { flex: 0 0 70px; text-align: right; font-variant-numeric: tabular-nums; color: var(--gris); }
.node-row .arrow { color: var(--rouge); }

.muted { color: var(--gris); }
.right { text-align: right; }
.inline-form { display: inline; }
hr.sep { border: none; border-top: 1px solid var(--bordure); margin: 24px 0; }
