/* ============================================================
   VoiceScribe — Global Design System
   Dark, premium, editorial. Charcoal + amber.
   ============================================================ */

:root {
  /* Colors */
  --bg-base: #0A0A0A;
  --bg-surface: #111111;
  --bg-elevated: #1A1A1A;
  --bg-border: #2A2A2A;
  --accent: #F59E0B;
  --accent-hover: #D97706;
  --accent-dim: rgba(245, 158, 11, 0.15);
  --text-primary: #FAFAFA;
  --text-secondary: #A1A1A1;
  --text-muted: #525252;
  --success: #10B981;
  --error: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;

  /* Typography */
  --font-display: 'Clash Display', 'DM Sans', sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;

  /* Spacing */
  --radius: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.55);

  --nav-h: 72px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.75rem); }
h3 { font-size: 1.35rem; }

::selection { background: var(--accent); color: #0A0A0A; }

/* ---------- Layout helpers ---------- */
.container { width: min(1200px, 100% - 48px); margin-inline: auto; }
.section { padding: 96px 0; }
.text-center { text-align: center; }
.muted { color: var(--text-secondary); }
.accent-text { color: var(--accent); }
.eyebrow {
  display: inline-block;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 16px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius);
  font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
  white-space: nowrap; min-height: 44px;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #0A0A0A; }
.btn--primary:hover { background: var(--accent-hover); box-shadow: 0 6px 20px var(--accent-dim); }
.btn--ghost { background: transparent; color: var(--text-primary); border-color: var(--bg-border); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--dark { background: #0A0A0A; color: var(--text-primary); }
.btn--dark:hover { background: #000; }
.btn--danger { background: transparent; color: var(--error); border-color: rgba(239,68,68,.4); }
.btn--danger:hover { background: rgba(239,68,68,.12); }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 14px; min-height: 36px; font-size: 0.85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card--hover { transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease; }
.card--hover:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: var(--shadow); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: .02em;
  background: var(--accent-dim); color: var(--accent);
}
.badge--success { background: rgba(16,185,129,.15); color: var(--success); }
.badge--error   { background: rgba(239,68,68,.15);  color: var(--error); }
.badge--warning { background: rgba(245,158,11,.15); color: var(--warning); }
.badge--info    { background: rgba(59,130,246,.15); color: var(--info); }
.badge--muted   { background: var(--bg-border); color: var(--text-secondary); }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 8px; color: var(--text-secondary); }
.input, .select, .textarea {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text-primary);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.textarea { resize: vertical; min-height: 120px; }
.input-group { position: relative; }
.input-group .toggle-pw {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); padding: 4px;
}
.field-error { color: var(--error); font-size: 0.8rem; margin-top: 6px; display: none; }
.field-hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 6px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
}
.modal-overlay.is-open { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-elevated); border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg); width: min(520px, 100%);
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  transform: scale(.95); transition: transform .25s ease;
}
.modal-overlay.is-open .modal { transform: scale(1); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--bg-border); }
.modal__head h3 { margin: 0; }
.modal__close { color: var(--text-muted); font-size: 1.4rem; line-height: 1; padding: 4px; }
.modal__close:hover { color: var(--text-primary); }
.modal__body { padding: 24px; }
.modal__foot { padding: 16px 24px; border-top: 1px solid var(--bg-border); display: flex; gap: 12px; justify-content: flex-end; }

/* ---------- Toasts ---------- */
#toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 10px; max-width: 360px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-elevated); border: 1px solid var(--bg-border);
  border-left: 4px solid var(--text-muted);
  padding: 14px 18px; border-radius: var(--radius); box-shadow: var(--shadow);
  animation: toastIn .3s ease forwards; font-size: 0.9rem;
}
.toast.toast--out { animation: toastOut .3s ease forwards; }
.toast--success { border-left-color: var(--success); }
.toast--error   { border-left-color: var(--error); }
.toast--warning { border-left-color: var(--warning); }
.toast--info    { border-left-color: var(--info); }
@keyframes toastIn  { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.9);
  display: none; align-items: center; justify-content: center; padding: 40px;
}
.lightbox.is-open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: var(--radius); }

/* ---------- Skeleton / spinner ---------- */
.skeleton { background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-border) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3); border-top-color: currentColor;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 56px 24px; color: var(--text-secondary); }
.empty-state svg { margin: 0 auto 16px; color: var(--text-muted); }
.empty-state h3 { color: var(--text-primary); margin-bottom: 8px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--bg-border); border-radius: var(--radius-lg); }
table.data { width: 100%; border-collapse: collapse; min-width: 600px; }
table.data th, table.data td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--bg-border); font-size: 0.9rem; }
table.data th { color: var(--text-secondary); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .05em; background: var(--bg-surface); }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .15s ease; }
table.data tbody tr:hover { background: var(--bg-surface); }

/* ---------- Utility ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.hidden { display: none !important; }
.grid { display: grid; }
.divider { height: 1px; background: var(--bg-border); margin: 24px 0; }
.progress { height: 8px; background: var(--bg-border); border-radius: 999px; overflow: hidden; }
.progress__bar { height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }

@media (max-width: 768px) {
  .section { padding: 64px 0; }
  .modal { width: 100%; max-height: 100vh; border-radius: 0; }
}
