/* ═══════════════════════════════════════════════════════════════
   ATSSC Language Tools — Unified Design System  v2.0
   theme.css  —  shared across all tools
   ═══════════════════════════════════════════════════════════════ */

/* ─── Font ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── Light-Mode Tokens ─── */
:root {
  /* Header gradient */
  --grad-header: linear-gradient(135deg, #0d1b5e 0%, #1a3fbf 52%, #4f72f7 100%);
  /* Action gradients */
  --grad-primary: linear-gradient(135deg, #1e40af 0%, #6366f1 100%);
  --grad-green:   linear-gradient(135deg, #065f46 0%, #059669 100%);
  --grad-bar:     linear-gradient(90deg,  #3b82f6 0%, #818cf8 100%);

  /* Surfaces */
  --bg:       #eef2fb;
  --surface:  #ffffff;
  --surface-2:#f4f6fd;
  --surface-3:#e8edf9;

  /* Text */
  --text-1:   #0f172a;
  --text-2:   #1e293b;
  --text-3:   #475569;
  --text-4:   #94a3b8;

  /* Brand shades */
  --blue-900: #0d1b5e;
  --blue-700: #1e40af;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-200: #bfdbfe;
  --blue-100: #dbeafe;
  --blue-50:  #eff6ff;
  --indigo:   #6366f1;
  --purple:   #7c3aed;
  --purple-100:#ede9fe;
  --green-700:#065f46;
  --green-600:#059669;
  --green-100:#d1fae5;
  --amber-600:#d97706;
  --amber-100:#fef3c7;
  --red-600:  #dc2626;
  --red-100:  #fee2e2;

  /* Borders */
  --border:        #e2e8f0;
  --border-strong: #c2cfe0;
  --border-focus:  var(--blue-500);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15,23,42,.05);
  --shadow-sm: 0 1px 4px rgba(15,23,42,.07), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 16px rgba(15,23,42,.09), 0 2px 6px rgba(15,23,42,.05);
  --shadow-lg: 0 12px 36px rgba(15,23,42,.13), 0 4px 12px rgba(15,23,42,.06);
  --shadow-focus: 0 0 0 3px rgba(59,130,246,.22);

  /* Geometry */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-pill: 9999px;

  /* Motion */
  --t: .14s ease;
}

/* ─── Dark-Mode Tokens ─── */
[data-theme="dark"] {
  --grad-header: linear-gradient(135deg, #04091c 0%, #0b1d52 52%, #162d8a 100%);

  --bg:       #07101e;
  --surface:  #0e1929;
  --surface-2:#121f35;
  --surface-3:#182742;

  --text-1:   #e8f0ff;
  --text-2:   #b8cae0;
  --text-3:   #7a90ad;
  --text-4:   #3d5068;

  --blue-100: #1c3366;
  --blue-50:  #111e42;
  --purple-100:#1c1046;
  --green-100:#042b1c;
  --amber-100:#291803;
  --red-100:  #260505;

  --border:        #1a2d45;
  --border-strong: #243d5a;
  --border-focus:  #60a5fa;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.35);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.5);
  --shadow-lg: 0 12px 36px rgba(0,0,0,.6);
  --shadow-focus: 0 0 0 3px rgba(96,165,250,.22);
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light dark; }
[data-theme="dark"] { color-scheme: dark; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ─── Site Header ─── */
.site-header {
  background: var(--grad-header);
  color: #fff;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
  /* subtle bottom glow line */
  box-shadow: 0 1px 0 rgba(255,255,255,.08), 0 4px 20px rgba(13,27,94,.4);
}

.site-header .header-icon {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-md);
  padding: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.site-header .header-title { flex: 1; min-width: 0; }
.site-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.4px;
  line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.site-header .header-sub {
  font-size: .84rem;
  opacity: .75;
  margin-top: 2px;
  font-weight: 400;
}

/* ─── Dark Toggle Button ─── */
.dark-toggle {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-pill);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  transition: background var(--t);
}
.dark-toggle:hover { background: rgba(255,255,255,.24); }
.dark-toggle svg { display: block; }
.icon-sun  { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none;  }

/* ─── Back / Header Badge ─── */
.header-badge {
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-sm);
  color: #fff;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .3px;
  padding: 6px 13px;
  text-decoration: none;
  transition: background var(--t);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.header-badge:hover { background: rgba(255,255,255,.24); }

/* ─── Footer ─── */
footer {
  text-align: center;
  color: var(--text-4);
  font-size: .78rem;
  padding: 22px 16px 26px;
  border-top: 1px solid var(--border);
}

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}
.card-header {
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header h2 {
  font-size: .94rem;
  font-weight: 600;
  color: var(--text-2);
}
.card-body { padding: 20px; }

/* ─── Step Number ─── */
.step-num {
  background: var(--grad-primary);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  transition: all var(--t);
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.4;
}

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(30,64,175,.3);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); box-shadow: 0 4px 14px rgba(30,64,175,.42); }
.btn-primary:disabled { background: var(--border-strong); color: var(--text-4); box-shadow: none; cursor: not-allowed; }

.btn-green {
  background: var(--grad-green);
  color: #fff;
  box-shadow: 0 2px 8px rgba(6,95,70,.3);
}
.btn-green:hover:not(:disabled) { filter: brightness(1.1); box-shadow: 0 4px 14px rgba(6,95,70,.4); }
.btn-green:disabled { background: var(--border-strong); color: var(--text-4); box-shadow: none; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  color: var(--blue-600);
  border: 1.5px solid var(--blue-500);
}
.btn-outline:hover { background: var(--blue-50); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-3); }
.btn-ghost:disabled { opacity: .45; cursor: not-allowed; }

.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-danger { background: linear-gradient(135deg, #b91c1c, #dc2626); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

/* ─── Form Elements ─── */
label {
  font-size: .84rem;
  font-weight: 600;
  color: var(--text-3);
  display: block;
  margin-bottom: 6px;
}
input[type=text],
input[type=password],
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 9px 13px;
  font-size: .93rem;
  outline: none;
  transition: border var(--t), box-shadow var(--t);
  font-family: inherit;
  background: var(--surface);
  color: var(--text-1);
  appearance: auto;
}
input[type=text]:focus,
input[type=password]:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}
textarea { resize: vertical; min-height: 80px; }

/* ─── Layout Row ─── */
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 200px; }

/* ─── Drop Zone ─── */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t);
  background: var(--surface-2);
}
.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--blue-500);
  background: var(--blue-50);
}
.drop-zone p   { color: var(--text-3); font-size: .9rem; }
.drop-zone strong { color: var(--blue-600); }
.drop-zone svg { opacity: .3; margin-bottom: 12px; display: block; margin-left: auto; margin-right: auto; }

/* ─── File Chip ─── */
.file-chip {
  display: inline-flex;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--r-pill);
  padding: 4px 13px;
  font-size: .8rem;
  color: var(--blue-700);
  align-items: center;
  gap: 7px;
  margin-top: 8px;
}
.file-chip .rm { cursor: pointer; color: var(--red-600); font-weight: 700; font-size: 1rem; }

/* ─── Alerts ─── */
.alert {
  border-radius: var(--r-md);
  padding: 11px 15px;
  font-size: .85rem;
  margin-top: 12px;
}
.alert-info    { background: var(--blue-50);  border: 1px solid var(--blue-200);  color: var(--blue-700); }
.alert-error   { background: var(--red-100);  border: 1px solid #fca5a5;          color: var(--red-600);  }
.alert-success { background: var(--green-100);border: 1px solid #6ee7b7;          color: var(--green-700);}
.alert-warn    { background: var(--amber-100);border: 1px solid #fcd34d;          color: var(--amber-600);}

/* ─── Log Box ─── */
.log-box {
  background: #060e1b;
  color: #a8bbce;
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-family: 'Cascadia Code', 'Consolas', 'Courier New', monospace;
  font-size: .75rem;
  line-height: 1.8;
  max-height: 240px;
  overflow-y: auto;
  margin-top: 12px;
  border: 1px solid #142236;
}
.log-time { color: #3d5a78; }
.log-ok   { color: #4ade80; }
.log-warn { color: #fbbf24; }
.log-err  { color: #f87171; }
.log-info { color: #60a5fa; }
.log-dim  { color: #3d5a78; }

/* ─── Progress Bar ─── */
.progress-bar-bg {
  background: var(--surface-3);
  border-radius: var(--r-pill);
  height: 8px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar-fill {
  background: var(--grad-bar);
  height: 100%;
  width: 0%;
  border-radius: var(--r-pill);
  transition: width .35s ease;
}

/* ─── Tables ─── */
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
  padding: 9px 10px;
  text-align: left;
  font-weight: 700;
  color: var(--text-3);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:hover td { background: var(--surface-2); }
tbody td { padding: 8px 10px; vertical-align: middle; color: var(--text-1); }
tbody tr.sel td { background: var(--blue-50); }

/* ─── Status Badges ─── */
.badge-ready, .badge-ok {
  background: var(--green-100); color: var(--green-700);
  border-radius: var(--r-pill); padding: 2px 10px;
  font-size: .75rem; font-weight: 700;
}
.badge-warn {
  background: var(--amber-100); color: var(--amber-600);
  border-radius: var(--r-pill); padding: 2px 10px;
  font-size: .75rem; font-weight: 700;
}
.badge-err {
  background: var(--red-100); color: var(--red-600);
  border-radius: var(--r-pill); padding: 2px 10px;
  font-size: .75rem; font-weight: 700;
}
.lang-tag {
  background: var(--purple);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 2px 8px;
  font-size: .71rem;
  font-weight: 700;
  letter-spacing: .3px;
}

/* ─── Toggle Row (tab-switch) ─── */
.toggle-row {
  display: flex;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  overflow: hidden;
  width: fit-content;
}
.toggle-row button {
  padding: 8px 20px;
  border: none;
  background: var(--surface);
  cursor: pointer;
  font-size: .86rem;
  font-weight: 600;
  color: var(--text-3);
  transition: all var(--t);
  font-family: inherit;
}
.toggle-row button + button { border-left: 1px solid var(--border); }
.toggle-row button.active { background: var(--grad-primary); color: #fff; }

/* ─── Misc utilities ─── */
.hidden { display: none !important; }

.hint {
  font-size: .78rem;
  color: var(--text-4);
  margin-top: 6px;
  line-height: 1.55;
}

code {
  background: var(--surface-3);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: .84em;
  color: var(--text-2);
}

.reveal-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--blue-600);
  font-size: .84rem;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
}

.prompt-box {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: .75rem;
  line-height: 1.65;
  max-height: 340px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-2);
  margin-top: 10px;
}

.opt-summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--blue-600);
  font-size: .85rem;
  list-style: none;
  user-select: none;
}
.opt-summary::-webkit-details-marker { display: none; }
.opt-summary::before { content: '▸ '; font-size: .7rem; vertical-align: middle; }
details[open] > .opt-summary::before { content: '▾ '; }

/* ─── Help Tooltip ─── */
.help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: .7rem;
  font-weight: 700;
  cursor: help;
  margin-left: 6px;
  position: relative;
  flex-shrink: 0;
}
.help:hover::after {
  content: attr(data-help);
  position: absolute;
  left: 50%;
  top: 130%;
  transform: translateX(-50%);
  background: var(--text-1);
  color: var(--surface);
  padding: 8px 12px;
  border-radius: var(--r-md);
  font-size: .73rem;
  font-weight: 400;
  line-height: 1.5;
  width: 260px;
  z-index: 30;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

/* ─── Dark-mode script helper (used inline) ─── */
/* JS reads localStorage 'aw-theme' → sets data-theme on <html> */
