/* webscan — interface d'audit. Register product : la couleur = l'information
   (sévérité), le reste en neutres froids tintés. OKLCH partout. */

:root {
  /* Neutres tintés vers un violet-ardoise froid (jamais de #000/#fff) */
  --surface-0: oklch(18% 0.012 275);   /* fond le plus profond */
  --surface-1: oklch(21% 0.014 275);   /* panneaux */
  --surface-2: oklch(25% 0.016 275);   /* éléments surélevés */
  --surface-3: oklch(30% 0.018 275);   /* hover, contrôles */
  --line:      oklch(34% 0.02 275);    /* bordures */
  --line-soft: oklch(28% 0.016 275);

  --text:      oklch(94% 0.008 275);
  --text-2:    oklch(74% 0.012 275);
  --text-3:    oklch(58% 0.014 275);

  /* Accent unique (actions, focus, sélection) — indigo froid, hors palette sévérité */
  --accent:    oklch(70% 0.15 268);
  --accent-2:  oklch(62% 0.16 268);
  --accent-weak: oklch(70% 0.15 268 / 0.12);

  /* Palette sévérité — le SEUL vrai signal couleur de l'app */
  --sev-critical: oklch(64% 0.21 18);
  --sev-high:     oklch(72% 0.17 50);
  --sev-medium:   oklch(80% 0.14 90);
  --sev-low:      oklch(74% 0.12 220);
  --sev-info:     oklch(66% 0.02 275);

  --ok:        oklch(74% 0.15 158);
  --warn:      oklch(80% 0.14 90);

  --radius:    14px;
  --radius-sm: 9px;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1); /* ease-out-quint */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--surface-0);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  /* halo discret, pas de glassmorphism décoratif */
  background-image: radial-gradient(120% 80% at 50% -10%, oklch(24% 0.03 275) 0%, var(--surface-0) 55%);
  background-attachment: fixed;
}

::selection { background: var(--accent-weak); }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand .mark {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: var(--surface-0); font-size: 18px; font-weight: 700;
  box-shadow: 0 4px 16px oklch(70% 0.15 268 / 0.3);
}
.brand h1 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.brand .tag { font-size: 11px; color: var(--text-3); letter-spacing: 0.09em; text-transform: uppercase; }
.brand .stack { display: flex; flex-direction: column; line-height: 1.3; }
.nav-link {
  color: var(--text-3); text-decoration: none; font-size: 13px;
  font-family: var(--mono); transition: color 0.18s var(--ease);
}
.nav-link:hover { color: var(--text); }

/* ---------- Layout ---------- */
main { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 56px 24px 40px; }

/* ---------- Hero / form ---------- */
.hero-eyebrow {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  letter-spacing: 0.06em; margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.hero-eyebrow::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 8px var(--ok);
}
.hero h2 {
  font-size: clamp(28px, 4vw, 38px); font-weight: 680; letter-spacing: -0.025em;
  line-height: 1.08; margin-bottom: 14px;
}
.lead { color: var(--text-2); font-size: 16px; max-width: 60ch; margin-bottom: 32px; }

form { margin-bottom: 18px; }
.input-row { display: flex; gap: 10px; margin-bottom: 20px; }
#url {
  flex: 1; background: var(--surface-1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 18px; color: var(--text);
  font-size: 15px; font-family: var(--mono);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}
#url::placeholder { color: var(--text-3); }
#url:hover { border-color: var(--line); background: var(--surface-2); }
#url:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-weak); background: var(--surface-1);
}

button.primary {
  position: relative; background: var(--accent); color: var(--surface-0);
  border: none; border-radius: var(--radius); padding: 0 28px; min-width: 124px;
  font-size: 15px; font-weight: 640; cursor: pointer; white-space: nowrap;
  font-family: var(--sans);
  transition: background 0.18s var(--ease), transform 0.06s var(--ease), box-shadow 0.18s var(--ease);
}
button.primary:hover { background: var(--accent-2); box-shadow: 0 6px 22px oklch(70% 0.15 268 / 0.28); }
button.primary:active { transform: translateY(1px); }
button.primary:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
button.primary .spinner { display: none; }
button.primary.loading .label { visibility: hidden; }
button.primary.loading .spinner {
  display: block; position: absolute; inset: 0; margin: auto;
  width: 17px; height: 17px; border: 2px solid oklch(18% 0.012 275 / 0.4);
  border-top-color: var(--surface-0); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.options { display: flex; flex-direction: column; gap: 11px; }
.opt {
  display: flex; gap: 11px; align-items: flex-start; font-size: 14px;
  color: var(--text-2); cursor: pointer; user-select: none;
}
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .box {
  width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px;
  border: 1.5px solid var(--line); border-radius: 5px; background: var(--surface-1);
  display: grid; place-items: center;
  transition: all 0.16s var(--ease);
}
.opt .box svg { width: 11px; height: 11px; opacity: 0; transform: scale(0.6); transition: all 0.16s var(--ease); stroke: var(--surface-0); }
.opt input:checked + .box { background: var(--accent); border-color: var(--accent); }
.opt input:checked + .box svg { opacity: 1; transform: scale(1); }
.opt input:focus-visible + .box { box-shadow: 0 0 0 4px var(--accent-weak); }
.opt.legal {
  background: var(--surface-1); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 13px 15px; align-items: center;
}
.opt.legal .req { color: var(--sev-critical); font-weight: 600; }

.notice {
  display: flex; align-items: center; gap: 10px;
  margin-top: 22px; font-size: 13px; color: var(--text-3);
  font-family: var(--mono);
}
.notice svg { width: 15px; height: 15px; stroke: var(--warn); flex-shrink: 0; }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface-1); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 26px; margin-top: 30px;
  animation: rise 0.4s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-head h3 { font-size: 16px; font-weight: 620; }
.mono-target { font-family: var(--mono); font-size: 12.5px; color: var(--accent); word-break: break-all; }

/* ---------- Progress ---------- */
.bar { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.bar > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 99px; transition: width 0.5s var(--ease);
}
.prog-meta { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12.5px; color: var(--text-3); margin-bottom: 18px; }
.prog-meta .step { color: var(--text); }

.steps { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.steps li {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 13px; color: var(--text-3);
  padding: 7px 0;
}
.steps li .dot {
  width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%;
  border: 1.5px solid var(--line); display: grid; place-items: center;
}
.steps li.done { color: var(--text-2); }
.steps li.done .dot { background: var(--ok); border-color: var(--ok); }
.steps li.done .dot::after { content: ""; width: 5px; height: 8px; border: solid var(--surface-0); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-0.5px, -1px); }
.steps li.active { color: var(--text); }
.steps li.active .dot { border-color: var(--accent); }
.steps li.active .dot::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.1s var(--ease) infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- Report header ---------- */
.report-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.report-head .title h3 { font-size: 16px; font-weight: 620; margin-bottom: 4px; }
.score {
  text-align: right; display: flex; flex-direction: column; align-items: flex-end;
}
.score .val { font-family: var(--mono); font-size: 40px; font-weight: 700; line-height: 0.9; letter-spacing: -0.02em; }
.score .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-top: 4px; }
.score.s-critical .val { color: var(--sev-critical); }
.score.s-high .val { color: var(--sev-high); }
.score.s-medium .val { color: var(--sev-medium); }
.score.s-low .val { color: var(--sev-low); }
.score.s-info .val { color: var(--ok); }

/* Barre de répartition par sévérité (remplace les cartes identiques) */
.sev-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; margin-bottom: 12px; background: var(--surface-3); }
.sev-bar > span { display: block; transition: width 0.5s var(--ease); }
.sev-bar .critical { background: var(--sev-critical); }
.sev-bar .high { background: var(--sev-high); }
.sev-bar .medium { background: var(--sev-medium); }
.sev-bar .low { background: var(--sev-low); }
.sev-bar .info { background: var(--sev-info); }

.sev-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 22px; font-family: var(--mono); font-size: 12.5px; }
.sev-legend span { display: flex; align-items: center; gap: 7px; color: var(--text-3); }
.sev-legend span.has { color: var(--text); }
.sev-legend i { width: 9px; height: 9px; border-radius: 3px; }
.sev-legend .critical { background: var(--sev-critical); }
.sev-legend .high { background: var(--sev-high); }
.sev-legend .medium { background: var(--sev-medium); }
.sev-legend .low { background: var(--sev-low); }
.sev-legend .info { background: var(--sev-info); }

.report-stats { display: flex; gap: 24px; flex-wrap: wrap; font-family: var(--mono); font-size: 12.5px; color: var(--text-3); padding-bottom: 22px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.report-stats b { color: var(--text); font-weight: 600; }

/* ---------- Findings (full borders + leading badge, PAS de side-stripe) ---------- */
.findings { display: flex; flex-direction: column; }
.finding { border-bottom: 1px solid var(--line-soft); }
.finding:last-child { border-bottom: none; }
.f-head {
  display: flex; align-items: center; gap: 13px; padding: 15px 4px; cursor: pointer;
  transition: background 0.14s var(--ease);
}
.f-head:hover { background: var(--surface-2); border-radius: 8px; padding-left: 10px; padding-right: 10px; }
.badge {
  font-family: var(--mono); font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 4px 8px; border-radius: 6px; white-space: nowrap;
  border: 1px solid transparent;
}
.badge.critical { color: var(--sev-critical); background: oklch(64% 0.21 18 / 0.13); border-color: oklch(64% 0.21 18 / 0.3); }
.badge.high     { color: var(--sev-high); background: oklch(72% 0.17 50 / 0.13); border-color: oklch(72% 0.17 50 / 0.3); }
.badge.medium   { color: var(--sev-medium); background: oklch(80% 0.14 90 / 0.12); border-color: oklch(80% 0.14 90 / 0.28); }
.badge.low      { color: var(--sev-low); background: oklch(74% 0.12 220 / 0.12); border-color: oklch(74% 0.12 220 / 0.28); }
.badge.info     { color: var(--text-2); background: var(--surface-3); border-color: var(--line); }
.f-title { flex: 1; font-weight: 540; font-size: 14.5px; }
.f-cat { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.f-chev { width: 16px; height: 16px; stroke: var(--text-3); transition: transform 0.2s var(--ease); flex-shrink: 0; }
.finding.open .f-chev { transform: rotate(90deg); }

.f-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.25s var(--ease); }
.finding.open .f-body { grid-template-rows: 1fr; }
.f-body > div { overflow: hidden; }
.f-inner { padding: 4px 4px 20px; font-size: 14px; }
.f-desc { color: var(--text-2); margin-bottom: 14px; max-width: 70ch; }
.f-field { margin-bottom: 12px; }
.f-field .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 5px; }
.f-field code, .f-field .v {
  font-family: var(--mono); font-size: 12.5px; color: var(--accent);
  background: var(--surface-0); border: 1px solid var(--line-soft);
  border-radius: 7px; padding: 9px 11px; display: block; word-break: break-all; white-space: pre-wrap;
}
.f-field.fix .v { color: var(--ok); border-color: oklch(74% 0.15 158 / 0.25); background: oklch(74% 0.15 158 / 0.06); }
.f-refs { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.f-refs a { color: var(--accent); text-decoration: none; }
.f-refs a:hover { text-decoration: underline; }

/* ---------- Empty / error ---------- */
.empty { text-align: center; padding: 40px 20px; }
.empty .icon { width: 44px; height: 44px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 12px; background: oklch(74% 0.15 158 / 0.1); }
.empty .icon svg { width: 22px; height: 22px; stroke: var(--ok); }
.empty.error .icon { background: oklch(64% 0.21 18 / 0.1); }
.empty.error .icon svg { stroke: var(--sev-critical); }
.empty h4 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.empty p { color: var(--text-3); font-size: 14px; max-width: 46ch; margin: 0 auto; }

.report-actions { display: flex; gap: 10px; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line-soft); }
button.ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text-2);
  border-radius: var(--radius-sm); padding: 10px 18px; cursor: pointer; font-size: 13.5px;
  font-family: var(--sans);
  transition: all 0.16s var(--ease);
}
button.ghost:hover { border-color: var(--accent); color: var(--text); }

footer { text-align: center; padding: 28px; color: var(--text-3); font-size: 12px; font-family: var(--mono); border-top: 1px solid var(--line-soft); }

@media (max-width: 600px) {
  main { padding: 36px 18px; }
  .topbar { padding: 16px 18px; }
  .input-row { flex-direction: column; }
  button.primary { padding: 14px; }
  .report-head { flex-direction: column-reverse; align-items: flex-start; gap: 14px; }
  .score { align-items: flex-start; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
