/* ============================================================
   FICHIER : static/css/style.css
   RÔLE    : Toute la mise en forme du portail (pas de framework).
   ============================================================ */

/* ===== 1. VARIABLES ===== */
:root {
  --ground: #f5f4f0;
  --surface: #ffffff;
  --ink: #16181d;
  --muted: #5b6270;
  --line: #e2e0da;
  --line-soft: #efede8;
  --accent: #2b3a8c;
  --accent-dark: #1c2766;
  --accent-soft: #eef0fb;
  --pin: #c2410c;
  --ok: #166534;
  --ok-soft: #dcfce7;
  --warn-ink: #5c3a06;
  --warn-soft: #fef3c7;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 12px;
  --space: 20px;
}

/* ===== 2. RESET LÉGER ===== */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.5 var(--font); }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

/* ===== 3. TYPOGRAPHIE ===== */
h1 { font-size: 1.8rem; line-height: 1.15; margin: 0 0 6px; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.strong { font-weight: 600; }
.eyebrow { display: block; font-size: 0.8rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; margin: 0; }
.site-name { font-size: 1.7rem; margin: 2px 0; }

/* ===== 4. MISE EN PAGE ===== */
.container { max-width: 1180px; margin: 0 auto; padding: 24px; }
main.container { display: flex; flex-direction: column; gap: var(--space); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.stack-lg { display: flex; flex-direction: column; gap: var(--space); }
.row-between { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.two-cols { display: flex; flex-wrap: wrap; gap: var(--space); align-items: flex-start; }
.col-main { flex: 999 1 560px; min-width: 0; }
.col-side { flex: 1 1 320px; min-width: 0; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.narrow { max-width: 460px; margin: 40px auto; }
.narrow-left { max-width: 520px; }

/* ===== 5. COMPOSANTS ===== */
/* En-tête */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding-block: 12px; }
.brand { color: var(--ink); text-decoration: none; font-size: 1.25rem; }
.brand span { color: var(--muted); font-size: 0.95rem; margin-left: 6px; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.nav form { margin: 0; }

/* Cartes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space); margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; }
.kpi { display: flex; flex-direction: column; }
.kpi strong { font-size: 1.8rem; }
.kpi .accent { color: var(--pin); }
.empty { padding: 20px; margin: 0; color: var(--muted); }

/* Liste de demandes */
.list-row { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); color: inherit; text-decoration: none; min-height: 64px; }
.list-row:hover { background: var(--accent-soft); color: inherit; }

/* Pastilles de statut */
.chip { padding: 4px 11px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.chip-nouvelle { background: #ffe4d5; color: #9a3412; }
.chip-encours { background: #e0e7ff; color: #1e3a8a; }
.chip-avalider { background: var(--warn-soft); color: #854d0e; }
.chip-validee { background: var(--ok-soft); color: var(--ok); }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font: 600 0.95rem var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn-big { min-height: 52px; font-size: 1rem; padding: 14px 22px; }
.btn-light { background: var(--surface); color: var(--ink); border: 1px solid #c9ccd3; font-weight: 500; }
.btn-light:hover { background: var(--accent-soft); color: var(--ink); }
.btn-ok { background: var(--ok); }
.btn-link { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; min-height: 40px; font: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Formulaires */
label { font-weight: 600; font-size: 0.92rem; }
input[type="text"], input[type="email"], input:not([type]), textarea { width: 100%; font: 400 1rem var(--font); padding: 10px 12px; border: 1px solid #c9ccd3; border-radius: 8px; min-height: 44px; color: var(--ink); background: #fff; }
fieldset { border: 1px solid var(--line); }
legend { font-weight: 700; padding: 0 6px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 400; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice span { display: flex; flex-direction: column; }
.choice small { color: var(--muted); }

/* Messages d'information */
.notice { padding: 14px 18px; border-radius: 10px; background: var(--accent-soft); margin: 0; }
.notice.warn { background: var(--warn-soft); color: var(--warn-ink); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }

/* Onglets de pages et filtres */
.tabs, .filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tab, .filters a { padding: 8px 14px; border-radius: 999px; border: 1px solid #c9ccd3; background: #fff; color: var(--ink); font: 500 0.9rem var(--font); cursor: pointer; text-decoration: none; min-height: 40px; display: inline-flex; align-items: center; }
.tab[aria-selected="true"], .filters a[aria-current="page"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Pages et puces */
.page-view { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.page-view img[data-pin-target] { cursor: crosshair; }
.pin { position: absolute; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; background: var(--pin); color: #fff; border: 2px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35); display: flex; align-items: center; justify-content: center; font-weight: 700; pointer-events: none; }
.pin-badge { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--pin); color: #fff; font-weight: 700; font-size: 0.85rem; display: inline-flex; align-items: center; justify-content: center; }
.pin-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.pin-line { display: flex; gap: 10px; align-items: flex-start; }
.thumb { width: 120px; height: 80px; object-fit: cover; border-radius: 6px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }

/* Échanges */
.msg { padding: 10px 12px; border-radius: 10px; max-width: 90%; }
.msg p { margin: 4px 0 0; white-space: pre-line; }
.msg-client { background: #fff; border: 1px solid var(--line); align-self: flex-start; }
.msg-edwan { background: var(--accent-soft); align-self: flex-end; }

/* ===== 6. RESPONSIVE ===== */
@media (max-width: 640px) {
  .container { padding: 16px; }
  h1 { font-size: 1.5rem; }
  .list-row { padding: 12px 14px; }
}
