/* ═══════════════════════════════════════════════════════════════════════════
   Hey Future Scraper — Design System
   Beige sablé chaud · Cabinet Grotesk + Satoshi · Accent bleu profond
   Inspiration : heyfuture.fr · agence IA B2B moderne
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables (CSS custom props pour usage hors Tailwind) ───────────────── */
:root {
  --color-stage:   #eae6de;
  --color-paper:   #f0ece4;
  --color-paper2:  #e8e4dd;
  --color-fg:      #0f0f0e;
  --color-fg-muted:#6b6760;
  --color-accent:  oklch(0.45 0.22 260);
  --color-accent-fallback: #243d8b;
  --line:          oklch(0.2 0 0 / 0.08);
  --line-strong:   oklch(0.2 0 0 / 0.15);
  --shadow-warm:   0 2px 8px oklch(0.2 0.01 80 / 0.08);
  --shadow-warm-lg:0 8px 24px -4px oklch(0.2 0.01 80 / 0.12);
  --radius-pill:   9999px;
  --radius-card:   0.75rem;
  --radius-input:  0.5rem;
}

@supports not (color: oklch(0.5 0.2 260)) {
  :root {
    --color-accent: #243d8b;
    --line:        rgba(15,15,14,0.08);
    --line-strong: rgba(15,15,14,0.15);
    --shadow-warm: 0 2px 8px rgba(80,60,30,0.08);
  }
}

::selection { background: oklch(0.45 0.22 260 / 0.18); color: #0f0f0e; }

/* ── Typographie de base ─────────────────────────────────────────────────── */
body {
  font-family: 'Satoshi', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'ss01', 'ss02';
}
h1, h2, h3, h4, .font-display {
  font-family: 'Cabinet Grotesk', 'Satoshi', system-ui, sans-serif;
  letter-spacing: -0.02em;
}

/* ── Sidebar nav ─────────────────────────────────────────────────────────── */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 14px;
  font-weight: 500;
  color: #3f3d38;
  transition: background 120ms ease, color 120ms ease;
  min-height: 40px;
}
.nav-link:hover {
  background: oklch(0.2 0 0 / 0.04);
  color: #0f0f0e;
}
.nav-link.active {
  background: #0f0f0e;
  color: #f5f3ef;
  font-weight: 600;
}
.nav-link.active i { color: #f5f3ef; }
.nav-link i { color: #6b6760; transition: color 120ms ease; }
.nav-link:hover i { color: #0f0f0e; }

/* ── Boutons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: #0f0f0e;
  color: #f5f3ef;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.65rem 1.4rem;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.btn-primary:hover {
  background: #1a1916;
  box-shadow: var(--shadow-warm-lg);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: transparent;
  color: #0f0f0e;
  border: 1.5px solid oklch(0.2 0 0 / 0.2);
  border-radius: var(--radius-pill);
  padding: 0.6rem 1.3rem;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  transition: background 120ms ease, border-color 120ms ease;
}
.btn-secondary:hover {
  background: oklch(0.2 0 0 / 0.04);
  border-color: oklch(0.2 0 0 / 0.35);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: oklch(0.45 0.18 20);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.6rem 1.3rem;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  transition: background 120ms ease, box-shadow 120ms ease;
}
.btn-danger:hover {
  background: oklch(0.40 0.18 20);
  box-shadow: var(--shadow-warm-lg);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #6b6760;
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  min-height: 32px;
  min-width: 32px;
}
.btn-ghost:hover {
  background: oklch(0.2 0 0 / 0.05);
  color: #0f0f0e;
}

/* Boutons compacts (table actions, header bar) */
.btn-compact { min-height: 36px; padding: 0.4rem 0.9rem; font-size: 13px; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: #f0ece4;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-warm);
}
.card-padded {
  background: #f0ece4;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-warm);
  padding: 1.5rem;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 1.25rem; }

/* ── KPI / Stat card ─────────────────────────────────────────────────────── */
.stat-card {
  background: #f0ece4;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--shadow-warm);
  position: relative;
  overflow: hidden;
}
.stat-card .stat-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 12px;
  font-weight: 600;
  color: #6b6760;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}
.stat-card .stat-value {
  font-family: 'Cabinet Grotesk', system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1;
  color: #0f0f0e;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-card .stat-delta {
  font-size: 12px;
  margin-top: 0.5rem;
  color: #6b6760;
  font-weight: 500;
}

/* ── Badges (pills) ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
}
.badge-running { background: oklch(0.55 0.18 240 / 0.12); color: oklch(0.40 0.18 240); }
.badge-paused  { background: oklch(0.65 0.15 70 / 0.18);  color: oklch(0.40 0.15 70); }
.badge-done    { background: oklch(0.60 0.15 145 / 0.15); color: oklch(0.35 0.15 145); }
.badge-error   { background: oklch(0.55 0.18 20 / 0.13);  color: oklch(0.40 0.18 20); }
.badge-queued  { background: oklch(0.65 0.15 70 / 0.18);  color: oklch(0.40 0.15 70); }
.badge-draft   { background: oklch(0.2 0 0 / 0.06); color: #6b6760; }
.badge-neutral { background: oklch(0.2 0 0 / 0.06); color: #6b6760; }
.badge-accent  { background: oklch(0.45 0.22 260 / 0.12); color: oklch(0.45 0.22 260); }

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress-bar {
  height: 4px;
  border-radius: var(--radius-pill);
  background: oklch(0.2 0 0 / 0.08);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--color-accent-fallback);
  background: oklch(0.45 0.22 260);
  border-radius: var(--radius-pill);
  transition: width 500ms ease;
}

/* ── Console (terminal — reste sombre pour vibe code) ────────────────────── */
.console {
  background: #14130f;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 13px;
  overflow-y: auto;
  color: #d8d4cc;
}
.log-info    { color: #d8d4cc; }
.log-success { color: oklch(0.75 0.18 145); }
.log-warning { color: oklch(0.78 0.15 70); }
.log-error   { color: oklch(0.70 0.18 20); }

/* ── Tableaux ────────────────────────────────────────────────────────────── */
.data-table { width: 100%; font-size: 14px; }
.data-table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #6b6760;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
  background: #e8e4dd;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--line);
  transition: background 100ms ease;
}
.data-table tbody tr:nth-child(even) {
  background: oklch(0.2 0 0 / 0.015);
}
.data-table tbody tr:hover {
  background: oklch(0.2 0 0 / 0.03);
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody td {
  padding: 0.9rem 1rem;
  color: #1a1916;
}
.data-table .numeric { font-variant-numeric: tabular-nums; }

/* ── Inputs ──────────────────────────────────────────────────────────────── */
.form-input,
.form-select {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid oklch(0.2 0 0 / 0.15);
  color: #0f0f0e;
  border-radius: var(--radius-input);
  padding: 0.7rem 0.9rem;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  min-height: 44px;
}
.form-input::placeholder { color: #8c887e; }
.form-input:focus,
.form-select:focus {
  outline: 2px solid oklch(0.45 0.22 260);
  outline-offset: 2px;
  border-color: oklch(0.45 0.22 260);
}
.form-select { cursor: pointer; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #1a1916;
  margin-bottom: 0.4rem;
}
.form-help {
  font-size: 12px;
  color: #6b6760;
  margin-top: 0.4rem;
}
.form-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 0.25rem;
  border: 1.5px solid oklch(0.2 0 0 / 0.25);
  background: #ffffff;
  accent-color: #0f0f0e;
  cursor: pointer;
}

/* ── Stepper ─────────────────────────────────────────────────────────────── */
.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 200ms ease, color 200ms ease;
}
.step-dot.done,
.step-dot.active {
  background: #0f0f0e;
  color: #f5f3ef;
}
.step-dot.pending {
  background: transparent;
  border: 1.5px solid oklch(0.2 0 0 / 0.2);
  color: #8c887e;
}
.step-dot.error {
  background: oklch(0.45 0.18 20);
  color: white;
}

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 0.5rem;
  padding: 0.4rem 0.65rem;
  border-radius: 0.4rem;
  background: #0f0f0e;
  color: #f5f3ef;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
  z-index: 50;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.25s ease-out; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}
.blink { animation: blink 1.6s ease-in-out infinite; }

/* Skeleton loader (shimmer) */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #e8e4dd 25%, #f0ece4 50%, #e8e4dd 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 0.375rem;
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .blink, .skeleton { animation: none !important; }
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: oklch(0.2 0 0 / 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: oklch(0.2 0 0 / 0.25);
}

/* ── Niche card (wizard) ─────────────────────────────────────────────────── */
.niche-card {
  border: 1px solid var(--line);
  background: #f0ece4;
  border-radius: var(--radius-card);
  padding: 1.1rem;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
  min-height: 44px;
}
.niche-card:hover {
  border-color: oklch(0.2 0 0 / 0.25);
  background: #ede9e1;
}
.niche-card.selected {
  border-color: #0f0f0e;
  background: #ede9e1;
  box-shadow: 0 0 0 1px #0f0f0e, var(--shadow-warm);
}
.niche-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.niche-card.disabled:hover {
  border-color: var(--line);
  background: #f0ece4;
}

/* ── Range input ─────────────────────────────────────────────────────────── */
input[type="range"] {
  width: 100%;
  height: 4px;
  background: oklch(0.2 0 0 / 0.1);
  border-radius: var(--radius-pill);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #0f0f0e;
  cursor: pointer;
  border: 3px solid #f0ece4;
  box-shadow: var(--shadow-warm);
}
input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #0f0f0e;
  cursor: pointer;
  border: 3px solid #f0ece4;
}

/* ── Scores PageSpeed ────────────────────────────────────────────────────── */
.score-good    { color: oklch(0.45 0.15 145); }
.score-medium  { color: oklch(0.55 0.15 70); }
.score-bad     { color: oklch(0.45 0.18 20); }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  padding: 4rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-card);
  background: #e8e4dd;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: #8c887e;
}
.empty-state-title {
  font-family: 'Cabinet Grotesk', system-ui, sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #0f0f0e;
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}
.empty-state-desc {
  font-size: 13px;
  color: #6b6760;
  margin-bottom: 1.25rem;
}

/* ── Toast notifications ─────────────────────────────────────────────────── */
.toast {
  background: #f0ece4;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-warm-lg);
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 13.5px;
  max-width: 320px;
  animation: fadeIn 0.25s ease-out;
}
.toast-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}
.toast-pill.ok    { background: oklch(0.60 0.15 145 / 0.18); color: oklch(0.35 0.15 145); }
.toast-pill.warn  { background: oklch(0.65 0.15 70 / 0.18); color: oklch(0.40 0.15 70); }
.toast-pill.error { background: oklch(0.55 0.18 20 / 0.15); color: oklch(0.40 0.18 20); }

/* ── KBD ─────────────────────────────────────────────────────────────────── */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 0.4rem;
  border-radius: 0.25rem;
  background: #e8e4dd;
  border: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #3f3d38;
}

/* ── Helpers texte ───────────────────────────────────────────────────────── */
.tnums { font-variant-numeric: tabular-nums; }
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b6760;
}

/* ── Touch targets ≥ 44px ────────────────────────────────────────────────── */
@media (pointer: coarse) {
  .btn-ghost { min-height: 44px; min-width: 44px; }
  .nav-link { min-height: 48px; }
}

/* ── Responsive : mobile bottom bar (< 768px) ────────────────────────────── */
@media (max-width: 767px) {
  aside { display: none; } /* TODO Phase 2 : bottom bar mobile */
  main { margin-left: 0 !important; }
}
