/* ====================================================================
   Prompt Fighter Prof : feuille de styles (palette de Prompt Fighter)
   ==================================================================== */

:root {
  --ink: #17131c;
  --ink-2: #241e2b;
  --ink-line: rgba(255, 255, 255, 0.08);
  --paper: #f5efe6;
  --paper-2: #fffaf3;
  --card: #ffffff;
  --text: #221d26;
  --muted: #6b6270;
  --line: #e4d9ca;
  --orange: #f28a1a;
  --red: #d8361f;
  --yellow: #ffc93c;
  --good: #2f9e5b;
  --mid: #d99a12;
  --bad: #d8361f;
  --track: #ece3d6;
  --code-bg: #f1e8da;
  --shadow: 0 1px 2px rgba(23, 19, 28, 0.06), 0 6px 20px rgba(23, 19, 28, 0.06);
  --radius: 14px;
  --font-display: "Anton", "Impact", "Arial Narrow", sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b171f;
    --paper-2: #221d27;
    --card: #26202b;
    --text: #efe8de;
    --muted: #a99fae;
    --line: #3a3240;
    --track: #3a3240;
    --code-bg: #322a38;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

.btn {
  font: inherit; font-weight: 700; cursor: pointer;
  background: var(--orange); color: var(--ink); border: 0; border-radius: 9px; padding: 10px 14px;
}
.btn-side { font: inherit; font-weight: 700; cursor: pointer; background: var(--orange); color: var(--ink); border: 0; border-radius: 9px; padding: 10px 14px; }
.btn:hover, .btn-side:hover { background: var(--yellow); }
.badge-prof { color: var(--orange); }

/* Mise en page */
.layout { display: grid; grid-template-columns: 272px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink); color: #f4ece0;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 16px;
  padding: 12px 18px 22px;
  border-right: 4px solid var(--orange);
}
.brand { position: relative; text-align: center; }
.brand img { width: 150px; height: auto; filter: drop-shadow(0 6px 14px rgba(242, 138, 26, 0.25)); }
.badge-prof {
  position: absolute; right: 18px; bottom: 6px;
  font-family: var(--font-display); font-size: 22px; letter-spacing: 0.06em;
  background: var(--ink); color: var(--yellow); border: 2px solid var(--orange);
  border-radius: 8px; padding: 0 8px; transform: rotate(-6deg);
}
.pick { display: flex; flex-direction: column; gap: 6px; }
.pick span { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.1em; font-size: 12.5px; color: var(--orange); }
.pick select {
  font: inherit; font-size: 15px; color: #f4ece0; background: var(--ink-2);
  border: 1.5px solid #4a4050; border-radius: 9px; padding: 8px 10px; cursor: pointer;
}
.pick select:focus { outline: none; border-color: var(--orange); }
.sidebar-foot {
  margin-top: auto; display: grid; justify-items: center; gap: 8px;
  border-top: 1px solid var(--ink-line); padding-top: 14px; font-size: 12px; color: #9d93a3;
}
.logo-card { display: block; background: #fff; border-radius: 8px; padding: 6px 10px; }
.logo-card img { display: block; height: 32px; width: auto; }

/* Zone principale */
.stage { padding: 36px clamp(16px, 4vw, 52px) 80px; max-width: 1240px; width: 100%; outline: none; }
.titre-rapport { font-family: var(--font-display); font-weight: 400; font-size: clamp(28px, 3.4vw, 40px); letter-spacing: 0.01em; margin: 0; line-height: 1.1; }
.sous-titre { color: var(--muted); margin: 6px 0 26px; }
.vide { color: var(--muted); padding: 40px 0; }
.erreur { color: var(--bad); font-weight: 600; }

.section { margin-top: 30px; }
.section > h2 {
  font-family: var(--font-display); font-weight: 400; text-transform: uppercase;
  letter-spacing: 0.06em; font-size: 18px; color: var(--orange); margin: 0 0 12px;
}
.carte { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }

/* Indicateurs */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.kpi .val { font-family: var(--font-display); font-size: 34px; line-height: 1.1; }
.kpi .val small { font-family: var(--font-body); font-size: 15px; color: var(--muted); margin-left: 2px; }
.kpi .lbl { font-size: 13.5px; color: var(--muted); }
.v-good { color: var(--good); } .v-mid { color: var(--mid); } .v-bad { color: var(--bad); }

/* Barres par critère */
.crit { display: grid; grid-template-columns: minmax(150px, 230px) 1fr 64px; gap: 12px; align-items: center; padding: 7px 0; }
.crit + .crit { border-top: 1px dashed var(--line); }
.crit .nom { font-weight: 600; font-size: 15px; }
.crit .nom small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.barre { height: 14px; background: var(--track); border-radius: 7px; overflow: hidden; }
.barre > i { display: block; height: 100%; border-radius: 7px; }
.b-good { background: var(--good); } .b-mid { background: var(--mid); } .b-bad { background: var(--bad); }
.crit .score { font-family: var(--font-mono); font-weight: 600; text-align: right; }

/* Histogramme des notes */
.histo { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; align-items: end; height: 150px; }
.histo .col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.histo .col i { display: block; width: 70%; background: var(--orange); border-radius: 6px 6px 0 0; min-height: 2px; }
.histo .col b { font-family: var(--font-mono); font-size: 13px; }
.histo-lbl { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* Grille à deux colonnes */
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .deux { grid-template-columns: 1fr; } }

/* Fiches de prompt (meilleurs / à retravailler) */
.fiche { border-left: 4px solid var(--line); padding: 4px 0 4px 14px; margin: 0 0 16px; }
.fiche.top { border-left-color: var(--good); }
.fiche.flop { border-left-color: var(--bad); }
.fiche-tete { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; }
.fiche-tete .note { font-family: var(--font-mono); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { font-size: 12.5px; border-radius: 999px; padding: 1px 9px; border: 1px solid var(--line); background: var(--paper-2); }
.chip.c-good { border-color: var(--good); } .chip.c-bad { border-color: var(--bad); }
pre.prompt {
  font-family: var(--font-mono); font-size: 13px; white-space: pre-wrap; word-break: break-word;
  background: var(--code-bg); border-radius: 9px; padding: 10px 12px; margin: 6px 0 0; max-height: 220px; overflow: auto;
}
.commentaire { font-size: 14px; color: var(--muted); margin: 4px 0 0; }

/* Point faible et pistes */
.pistes { margin: 8px 0 0; padding-left: 20px; }
.pistes li { margin-bottom: 6px; }

/* Synthèse IA */
.synthese-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.synthese-actions .info { color: var(--muted); font-size: 14px; }
.markdown h2 { font-size: 19px; margin: 18px 0 6px; }
.markdown h2:first-child { margin-top: 4px; }
.markdown ul, .markdown ol { padding-left: 22px; }
.markdown h1 { font-size: 22px; margin: 4px 0 8px; }
.markdown hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.markdown table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 14.5px; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.markdown th { background: var(--paper-2); }
.markdown pre { white-space: pre-wrap; background: var(--code-bg); border-radius: 9px; padding: 10px 12px; }
.btn[disabled] { opacity: 0.5; cursor: wait; }

/* Tableau des soumissions */
.tableau { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tableau th, .tableau td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tableau th { font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.tableau th.num { text-align: right; }
.tableau td.num {font-family: var(--font-mono); text-align: right; white-space: nowrap; }
.tableau a { color: var(--orange); font-weight: 600; }
.tableau details summary { cursor: pointer; color: var(--orange); font-weight: 600; }
.tableau tr.ko td { color: var(--muted); font-style: italic; }
.defile { overflow-x: auto; }

/* Écrans étroits */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .crit { grid-template-columns: 1fr 60px; }
  .crit .barre { grid-column: 1 / -1; grid-row: 2; }
}
