@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&display=swap');

/* ============ Design tokens ============ */
:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f2f0eb;
  --surface-glass: rgba(255, 255, 255, 0.82);
  --ink: #15161b;
  --ink-2: #5d606c;
  --ink-3: #9a9ca6;
  --line: #e7e4dd;
  --focus: rgba(255, 79, 94, 0.28);

  --brand: #ff4f5e;
  --brand-grad: linear-gradient(120deg, #ff8a3d 0%, #ff4f5e 50%, #ff2d87 100%);
  --violet: #7c5cff;
  --success: #00b37e;
  --success-bg: rgba(0, 179, 126, 0.12);
  --danger: #e5484d;
  --danger-bg: rgba(229, 72, 77, 0.1);

  --font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(21, 22, 27, 0.06), 0 2px 8px rgba(21, 22, 27, 0.05);
  --shadow: 0 2px 6px rgba(21, 22, 27, 0.05), 0 18px 40px -16px rgba(21, 22, 27, 0.28);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e12;
    --surface: #17181e;
    --surface-2: #1f2028;
    --surface-glass: rgba(23, 24, 30, 0.84);
    --ink: #f3f3f5;
    --ink-2: #a9abb6;
    --ink-3: #6f717c;
    --line: #2a2b34;
    --success: #2fd69c;
    --success-bg: rgba(47, 214, 156, 0.14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 18px 40px -16px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.1; margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.grad-text {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ============ Marque ============ */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; }
.brand img { width: 36px; height: 36px; display: block; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: -0.02em; white-space: nowrap; }
.brand-name em { font-style: normal; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ============ Formulaires ============ */
.field { margin-top: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input-wrap { position: relative; }
input[type='text'], input[type='email'], input[type='password'], input:not([type]) {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover { border-color: var(--ink-3); }
input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--focus); }
.input-wrap input { padding-right: 76px; }
.reveal {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--ink-2);
  font: 600 12px var(--font); padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.reveal:hover { background: var(--surface-2); color: var(--ink); }

/* ============ Boutons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px;
  border: 0; border-radius: 999px;
  font: 700 15px var(--font);
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.2s, filter 0.2s, background 0.2s;
  text-decoration: none !important;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  color: #fff;
  background: var(--brand-grad);
  background-size: 140% 100%;
  box-shadow: 0 8px 22px -8px rgba(255, 79, 94, 0.7);
}
.btn-primary:hover { background-position: 100% 0; box-shadow: 0 12px 28px -8px rgba(255, 45, 135, 0.7); }
.btn-primary:disabled { filter: grayscale(0.6) opacity(0.55); cursor: not-allowed; box-shadow: none; }
.btn-block { width: 100%; }
.btn-ghost { background: var(--surface-2); color: var(--ink); }
.btn-ghost:hover { background: var(--line); }
.btn-sm { height: 38px; padding: 0 16px; font-size: 14px; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.4); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.msg { min-height: 22px; margin: 12px 0 0; font-size: 14px; font-weight: 500; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--success); }

/* Onglets segmentés */
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 4px; gap: 4px;
  background: var(--surface-2); border-radius: 999px;
}
.segmented button {
  height: 38px; border: 0; border-radius: 999px; background: transparent;
  color: var(--ink-2); font: 600 14px var(--font); cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.segmented button[aria-selected='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ============ Page d'authentification ============ */
.auth-shell { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }

.auth-hero {
  position: relative; overflow: hidden;
  padding: 40px 56px;
  display: flex; flex-direction: column; gap: 28px;
  color: #f5f5f7;
  background:
    radial-gradient(60% 50% at 85% 10%, rgba(255, 45, 135, 0.35), transparent 70%),
    radial-gradient(55% 45% at 10% 95%, rgba(124, 92, 255, 0.4), transparent 70%),
    radial-gradient(40% 40% at 70% 85%, rgba(255, 138, 61, 0.25), transparent 70%),
    #101118;
}
.auth-hero .brand { color: #fff; }
.auth-hero h1 { font-size: clamp(38px, 4.6vw, 64px); font-weight: 800; margin-top: 12px; }
.auth-hero .lead { font-size: 17px; color: rgba(245, 245, 247, 0.72); max-width: 470px; margin: 0; }

.hero-visual { position: relative; width: 100%; max-width: 520px; aspect-ratio: 4 / 3; margin: 0 auto; }
.hero-visual svg { width: 100%; height: 100%; display: block; }
.hv-street { stroke: rgba(255, 255, 255, 0.09); stroke-width: 2; fill: none; }
.hv-street.major { stroke: rgba(255, 255, 255, 0.16); stroke-width: 5; }
.hv-rival { fill: rgba(124, 92, 255, 0.22); stroke: #7c5cff; stroke-width: 2; stroke-dasharray: 6 6; }
.hv-rival.cyan { fill: rgba(0, 184, 255, 0.18); stroke: #00b8ff; }
.hv-loop {
  fill: none; stroke: url(#hv-grad); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: hv-draw 6s var(--ease) infinite;
}
.hv-area { fill: url(#hv-grad); opacity: 0; animation: hv-fill 6s ease infinite; }
@keyframes hv-draw {
  0% { stroke-dashoffset: 1; opacity: 1; }
  50% { stroke-dashoffset: 0; }
  88% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes hv-fill {
  0%, 50% { opacity: 0; }
  60% { opacity: 0.45; }
  88% { opacity: 0.32; }
  100% { opacity: 0; }
}
.hv-chip {
  position: absolute; right: 6%; top: 14%;
  padding: 10px 16px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.95); color: #15161b;
  font: 800 20px var(--font-display);
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, 0.6);
  opacity: 0; transform: translateY(10px) scale(0.9);
  animation: hv-chip 6s var(--ease) infinite;
}
.hv-chip small { display: block; font: 600 11px var(--font); color: #5d606c; text-transform: uppercase; letter-spacing: 0.06em; }
@keyframes hv-chip {
  0%, 55% { opacity: 0; transform: translateY(10px) scale(0.9); }
  62%, 86% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-6px); }
}

.steps { list-style: none; margin: auto 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.steps li {
  padding: 16px; border-radius: var(--r);
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  font-size: 13px; color: rgba(245, 245, 247, 0.7);
}
.steps strong { display: block; font: 700 16px var(--font-display); color: #fff; margin: 6px 0 2px; }
.step-num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-grad); color: #fff; font: 700 13px var(--font);
}

.auth-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { display: none; margin-bottom: 28px; }
.auth-card h2 { font-size: 32px; font-weight: 800; }
.auth-card .sub { color: var(--ink-2); margin: 8px 0 24px; }
.auth-card form .btn { margin-top: 24px; }
.auth-foot { margin-top: 28px; font-size: 13px; color: var(--ink-3); text-align: center; }

.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.strength span { height: 4px; border-radius: 4px; background: var(--line); transition: background 0.25s; }
.strength[data-score='1'] span:nth-child(-n + 1) { background: var(--danger); }
.strength[data-score='2'] span:nth-child(-n + 2) { background: #ff8a3d; }
.strength[data-score='3'] span:nth-child(-n + 3) { background: #f5b800; }
.strength[data-score='4'] span { background: var(--success); }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

@media (max-width: 960px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 20px 32px; gap: 20px; }
  .auth-hero .brand { display: none; }
  .auth-hero h1 { margin-top: 0; }
  .hero-visual { max-width: 380px; }
  .steps { grid-template-columns: 1fr; gap: 8px; }
  .steps li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
  .steps strong { margin: 0; font-size: 15px; min-width: 86px; }
  .step-num { flex-shrink: 0; }
  .auth-panel { order: -1; padding: 32px 16px; }
  .auth-card .brand { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .hv-loop { stroke-dashoffset: 0; }
  .hv-area { opacity: 0.35; }
  .hv-chip { opacity: 1; transform: none; }
}

/* ============ 404 ============ */
.simple-page { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; text-align: center; }
.simple-page .big { font: 800 clamp(72px, 16vw, 140px) var(--font-display); line-height: 1; }
.simple-page p { color: var(--ink-2); margin: 12px 0 28px; }
