/* Coach de vente — identité famille Sakira, deux thèmes (jour / nuit). Voir DESIGN.md. */

/* JOUR (défaut) : fond doré clair, textes foncés. Confortable pour le dialogue. */
:root {
  --bg: #f0e5c6;
  --surface: #fbf5e4;
  --surface-2: #f4ead1;
  --line: #e1d1a6;
  --line-hover: #cdb87f;
  --ink: #2a2316;
  --muted: #7a6d51;
  --gold: #e0a83c;          /* fond des boutons */
  --gold-ink: #2a2007;      /* texte sur boutons dorés */
  --gold-text: #a5731c;     /* or utilisé comme texte / labels */
  --good: #2f9e6a;
  --bad: #c9503f;
  --coach: #3f63c4;
  --code-bg: #efe3c5;
  --code-ink: #8a5e15;
  --shadow: 0 1px 2px rgba(120,95,30,.10), 0 8px 24px rgba(120,95,30,.10);
  --topbar-bg: rgba(240,229,198,.88);
  --glow: rgba(224,168,60,.30);
  --bubble-user-bg: rgba(224,168,60,.22);
  --bubble-user-bd: rgba(165,115,28,.45);
  --coach-bg: rgba(63,99,196,.09);
  --coach-bd: rgba(63,99,196,.40);
  --tag-facile-bg: rgba(47,158,106,.16); --tag-facile-ink: #227a4f;
  --tag-moyen-bg: rgba(224,168,60,.22);  --tag-moyen-ink: #96661a;
  --tag-difficile-bg: rgba(201,80,63,.16); --tag-difficile-ink: #a83f30;

  --radius: 14px;
  --radius-sm: 10px;
  --display: "Cabinet Grotesk", ui-sans-serif, system-ui, sans-serif;
  --body: "General Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

/* NUIT : ambiance sombre Sakira. */
:root[data-theme="dark"] {
  --bg: #0f0f14;
  --surface: #17171e;
  --surface-2: #1e1e27;
  --line: #2a2a35;
  --line-hover: #3a3a47;
  --ink: #f4f2ee;
  --muted: #9a97a4;
  --gold: #e0a83c;
  --gold-ink: #1a1508;
  --gold-text: #f0c268;
  --good: #4ccd8d;
  --bad: #e2685f;
  --coach: #7aa2f7;
  --code-bg: #24242e;
  --code-ink: #f0c268;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  --topbar-bg: rgba(15,15,20,.85);
  --glow: rgba(224,168,60,.20);
  --bubble-user-bg: rgba(224,168,60,.14);
  --bubble-user-bd: rgba(224,168,60,.35);
  --coach-bg: rgba(122,162,247,.08);
  --coach-bd: rgba(122,162,247,.40);
  --tag-facile-bg: rgba(76,205,141,.14); --tag-facile-ink: #6fe0a8;
  --tag-moyen-bg: rgba(224,168,60,.14);  --tag-moyen-ink: #eec27a;
  --tag-difficile-bg: rgba(226,104,95,.14); --tag-difficile-ink: #f0a09a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}

h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; }
h1 { font-size: 1.95rem; font-weight: 800; margin: 0 0 8px; }
h2 { font-size: 1.3rem; font-weight: 700; margin: 0 0 18px; }
h3 { font-size: 1.02rem; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.lead { font-size: 1.06rem; color: var(--muted); max-width: 60ch; }
code { background: var(--code-bg); color: var(--code-ink); padding: 1px 6px; border-radius: 6px; font-size: .88em; font-family: "JetBrains Mono", ui-monospace, monospace; }
a.link { color: var(--gold-text); text-decoration: none; }
a.link:hover { text-decoration: underline; }

/* Barre du haut */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-family: var(--display); font-weight: 800; font-size: 1.12rem; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand::before { content: "◆ "; color: var(--gold-text); }
.topbar nav { display: flex; align-items: center; gap: 18px; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.topbar nav a:hover { color: var(--ink); }
.theme-toggle {
  background: transparent; border: 1px solid var(--line); color: var(--ink);
  width: 34px; height: 34px; border-radius: 999px; cursor: pointer; font-size: 1rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; transition: border-color .15s ease, background .15s ease;
}
.theme-toggle:hover { border-color: var(--line-hover); background: var(--surface-2); }

.wrap { max-width: 940px; margin: 0 auto; padding: 30px 20px 72px; }
section { margin-bottom: 44px; }

/* Boutons */
.btn {
  display: inline-block; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 18px; font-family: var(--body); font-size: .95rem; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: filter .15s ease, background .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--gold); color: var(--gold-ink); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: .55; cursor: default; filter: none; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-hover); }
.btn-stop { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn-stop:hover { background: rgba(201,80,63,.10); }
.btn-stop:disabled { opacity: .6; cursor: default; }
.btn-coach { background: var(--coach-bg); border-color: var(--coach-bd); color: var(--coach); }
.btn-coach:hover { filter: brightness(1.05); border-color: var(--coach); }
.btn-coach:disabled { opacity: .55; cursor: default; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Héros */
.hero {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 32px; box-shadow: var(--shadow);
}
.hero::before {
  content: ""; position: absolute; top: -55%; right: -12%; width: 520px; height: 520px;
  background: radial-gradient(circle, var(--glow), transparent 68%); pointer-events: none;
}
.hero > * { position: relative; }
.hero h1 { font-size: 2.2rem; }
.hero-actions { display: flex; align-items: center; gap: 16px; margin-top: 20px; flex-wrap: wrap; }
.playbook-badge { color: var(--muted); font-size: .86rem; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; }
.warn { background: rgba(224,168,60,.12); border: 1px solid rgba(165,115,28,.35); color: var(--gold-text); padding: 12px 14px; border-radius: var(--radius-sm); margin-top: 16px; }

/* Cartes */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; transition: border-color .15s ease, transform .15s ease; }
.card:hover { border-color: var(--line-hover); transform: translateY(-2px); }
.card-body { padding: 18px; flex: 1; }
.card .btn { margin: 0 18px 18px; text-align: center; }

.tag { display: inline-block; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; padding: 3px 9px; border-radius: 999px; margin-bottom: 10px; }
.tag-facile { background: var(--tag-facile-bg); color: var(--tag-facile-ink); }
.tag-moyen { background: var(--tag-moyen-bg); color: var(--tag-moyen-ink); }
.tag-difficile { background: var(--tag-difficile-bg); color: var(--tag-difficile-ink); }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; max-width: 580px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: .9rem; color: var(--ink); }
.form input, .form textarea, .form select,
.coach-ask input, .composer textarea, .mode-row select {
  font: inherit; font-family: var(--body); color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 12px;
}
.form input:focus, .form textarea:focus, .form select:focus,
.coach-ask input:focus, .composer textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(224,168,60,.18);
}
details summary { cursor: pointer; font-weight: 600; color: var(--ink); }
details summary::marker { color: var(--gold-text); }

/* Table */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.table th { background: var(--surface-2); color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .72rem; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }

/* Séance / chat */
.seance-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.briefing { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
.brief-wide { grid-column: 1 / -1; }
.brief-item p { margin: 5px 0 0; white-space: pre-wrap; color: var(--ink); }
.brief-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--gold-text); font-weight: 700; }

.chat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-height: 320px; max-height: 62vh; overflow-y: auto; box-shadow: var(--shadow); }
.bubble { max-width: 82%; margin-bottom: 14px; animation: rise .18s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.bubble .who { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.bubble .text { padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; }
.bubble-prospect { margin-right: auto; }
.bubble-prospect .text { background: var(--surface-2); border: 1px solid var(--line); border-top-left-radius: 4px; }
.bubble-user { margin-left: auto; text-align: right; }
.bubble-user .who { text-align: right; color: var(--gold-text); }
.bubble-user .text { background: var(--bubble-user-bg); border: 1px solid var(--bubble-user-bd); color: var(--ink); border-top-right-radius: 4px; text-align: left; }
/* Apartés avec le coach : hors conversation, bleu froid */
.bubble-coachq { margin-left: auto; max-width: 66%; text-align: right; }
.bubble-coachq .who { text-align: right; color: var(--coach); }
.bubble-coachq .text { background: var(--coach-bg); border: 1px dashed var(--coach-bd); border-top-right-radius: 4px; font-style: italic; color: var(--coach); }
.bubble-coach { margin-right: auto; max-width: 84%; }
.bubble-coach .who { color: var(--coach); font-weight: 600; }
.bubble-coach .text { background: var(--coach-bg); border-left: 3px solid var(--coach); color: var(--ink); }

.composer { display: flex; gap: 10px; margin-top: 14px; }
.composer textarea { flex: 1; resize: vertical; }

/* Panneau coach + mode */
.coach-panel { margin-top: 14px; padding: 14px 16px; background: var(--coach-bg); border: 1px solid var(--coach-bd); border-radius: var(--radius); }
.coach-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.coach-ask { display: flex; gap: 8px; flex: 1; min-width: 240px; }
.coach-ask input { flex: 1; }
.mode-row { display: flex; gap: 12px; align-items: baseline; margin-top: 12px; flex-wrap: wrap; }
.mode-row label { font-weight: 600; font-size: .88rem; }
.mode-row select { padding: 5px 9px; }
.mode-hint { font-size: .78rem; color: var(--muted); }

/* Débrief */
.debrief { position: relative; }
.note-block { position: relative; margin: 20px 0 28px; padding: 24px 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.note-block::before { content: ""; position: absolute; top: -60%; left: -8%; width: 360px; height: 360px; background: radial-gradient(circle, var(--glow), transparent 68%); pointer-events: none; }
.note-big { position: relative; font-family: var(--display); font-size: 4rem; font-weight: 800; color: var(--gold-text); line-height: 1; }
.note-big span { font-size: 1.5rem; color: var(--muted); font-weight: 600; }
.debrief-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.panel h3 { color: var(--ink); }
.panel-good { border-left: 3px solid var(--good); }
.panel-bad { border-left: 3px solid var(--bad); }
.panel-key { border-left: 3px solid var(--gold); }
.panel .source { color: var(--muted); font-size: .84rem; margin-top: 12px; }
.panel strong { color: var(--gold-text); }
.panel ul { margin: 8px 0; padding-left: 18px; }
.debrief-actions { margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .debrief-grid, .briefing { grid-template-columns: 1fr; }
  .seance-head { flex-direction: column; }
  .hero h1 { font-size: 1.7rem; }
}
