/* ═══════════════════════════════════════════════════════════════════════════
   Accessibility Scanner — Web UI Stylesheet
   Design tokens match the existing HTML report aesthetic.
═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --primary:        #0f1b35;
  --primary-mid:    #1a2d5a;
  --accent:         #3b82f6;
  --accent-hover:   #2563eb;
  --bg:             #f0f4f8;
  --surface:        #ffffff;
  --border:         #e2e8f0;
  --text:           #1e293b;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;

  /* Impact palette — mirrors the HTML reporters */
  --critical:       #dc2626;
  --critical-light: #fef2f2;
  --serious:        #ea580c;
  --serious-light:  #fff7ed;
  --moderate:       #d97706;
  --moderate-light: #fffbeb;
  --minor:          #ca8a04;
  --minor-light:    #fefce8;

  /* Status */
  --pass:           #16a34a;
  --pass-light:     #f0fdf4;
  --fail:           #dc2626;
  --fail-light:     #fef2f2;
  --warn:           #d97706;

  /* Grade colours (A–F) */
  --grade-a: #2e7d32;
  --grade-b: #558b2f;
  --grade-c: #f9a825;
  --grade-d: #ef6c00;
  --grade-f: #c62828;

  /* Geometry */
  --radius:    12px;
  --radius-sm: 6px;
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html                   { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Site Header ─────────────────────────────────────────────────────────── */
.site-header {
  background: var(--primary);
  color: #fff;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}
.header-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.header-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,.45);
  margin-left: 6px;
}

/* ── Page Layout ─────────────────────────────────────────────────────────── */
.page-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-header {
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header-icon { font-size: 17px; }
.card-body        { padding: 24px; }

/* ── Form ────────────────────────────────────────────────────────────────── */
.form-group   { margin-bottom: 24px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-input.is-error {
  border-color: var(--critical);
  box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}
.form-hint  { margin-top: 6px; font-size: 13px; color: var(--text-secondary); }
.form-error {
  margin-top: 6px;
  font-size: 13px;
  color: var(--critical);
  display: none;
}
.form-error.visible { display: block; }

/* ── Scan-type selection cards ───────────────────────────────────────────── */
.scan-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 700px) {
  .scan-type-grid { grid-template-columns: 1fr; }
}
.scan-type-card           { position: relative; cursor: pointer; }
.scan-type-card input     { position: absolute; opacity: 0; width: 0; height: 0; }
.scan-type-label {
  display: block;
  padding: 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
  background: var(--surface);
  height: 100%;
  user-select: none;
}
.scan-type-card input:checked + .scan-type-label {
  border-color: var(--accent);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.scan-type-label:hover { border-color: #93c5fd; }
.scan-type-icon {
  font-size: 30px;
  margin-bottom: 10px;
  display: block;
}
.scan-type-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.scan-type-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}
.scan-type-meta  { display: flex; gap: 8px; flex-wrap: wrap; }
.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  background: #f1f5f9;
  color: var(--text-secondary);
}
.meta-badge.fast   { background: #f0fdf4; color: #15803d; }
.meta-badge.medium { background: #fffbeb; color: #b45309; }
.meta-badge.slow   { background: #fff7ed; color: #c2410c; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(59,130,246,.4);
  transform: translateY(-1px);
}
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); border-color: #94a3b8; }
.btn-success {
  background: var(--pass);
  color: #fff;
}
.btn-success:hover {
  background: #15803d;
  box-shadow: 0 4px 12px rgba(22,163,74,.35);
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}
.btn-outline:hover { background: #eff6ff; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: 1px solid;
}
.alert-error   { background: var(--fail-light);    border-color: #fca5a5; color: var(--critical); }
.alert-warning { background: var(--moderate-light); border-color: #fcd34d; color: var(--moderate); }
.alert-info    { background: #eff6ff;               border-color: #bfdbfe; color: #1d4ed8; }

/* ── Progress / Spinner ──────────────────────────────────────────────────── */
.progress-section { text-align: center; padding: 56px 24px; }
.spinner {
  width: 52px;
  height: 52px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
  margin: 0 auto 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-title    { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.progress-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }

.progress-bar-track {
  width: 100%;
  max-width: 420px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 20px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  animation: indeterminate 1.6s ease-in-out infinite;
  transform-origin: left;
}
@keyframes indeterminate {
  0%   { transform: scaleX(0) translateX(0%); }
  50%  { transform: scaleX(.4) translateX(120%); }
  100% { transform: scaleX(0) translateX(600%); }
}

.elapsed-time { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

.log-output {
  background: #0f172a;
  color: #64748b;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  max-height: 200px;
  overflow-y: auto;
  text-align: left;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto;
}
.log-line        { color: #475569; }
.log-line.recent { color: #94a3b8; }
.log-line.latest { color: #e2e8f0; font-weight: 500; }

/* ── Score gauge ─────────────────────────────────────────────────────────── */
.score-gauge-wrap { display: flex; flex-direction: column; align-items: center; }
.score-gauge      { position: relative; width: 140px; height: 140px; }
.score-value {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.score-number { display: block; font-size: 34px; font-weight: 800; line-height: 1; }
.score-grade  { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-top: 2px; }
.score-label  { font-size: 12px; color: var(--text-secondary); margin-top: 6px; text-align: center; }

/* ── Stats grid ──────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--text);
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.stat-card.critical .stat-value { color: var(--critical); }
.stat-card.serious  .stat-value { color: var(--serious); }
.stat-card.moderate .stat-value { color: var(--moderate); }
.stat-card.minor    .stat-value { color: var(--minor); }
.stat-card.info     .stat-value { color: var(--accent); }
.stat-card.muted    .stat-value { color: var(--text-secondary); }

/* ── Jurisdiction cards ──────────────────────────────────────────────────── */
.jurisdiction-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.jurisdiction-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface);
  border-left: 4px solid transparent;
  box-shadow: var(--shadow);
}
/* .jurisdiction-card.status-pass    { border-left-color: var(--pass); }
.jurisdiction-card.status-partial { border-left-color: var(--warn); }
.jurisdiction-card.status-fail    { border-left-color: var(--fail); } */
.jurisdiction-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 0;
}
.jurisdiction-flag   { font-size: 24px; flex-shrink: 0; margin-top: 2px; }
.jurisdiction-name   { font-size: 13px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jurisdiction-law    { font-size: 11px; color: var(--text-secondary); margin-top: 1px; line-height: 1.3; }
.jurisdiction-std-pill {
  display: inline-block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  letter-spacing: .02em;
}
.jurisdiction-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.jurisdiction-badge-pass    { background: #dcfce7; color: #15803d; }
.jurisdiction-badge-partial { background: #fff7ed; color: #c2410c; }
.jurisdiction-badge-fail    { background: #fee2e2; color: #b91c1c; }
.jurisdiction-score  { font-size: 2rem; font-weight: 800; line-height: 1; }
.jurisdiction-score-detail { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-secondary);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td       { border-bottom: none; }
tbody tr:hover td      { background: #f8fafc; }
.page-url {
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
.page-url:hover { text-decoration: underline; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.badge-critical { background: var(--critical); color: #fff; }
.badge-serious  { background: var(--serious);  color: #fff; }
.badge-moderate { background: var(--moderate); color: #fff; }
.badge-minor    { background: var(--minor);    color: #fff; }
.badge-pass     { background: var(--pass);     color: #fff; }
.badge-fail     { background: var(--fail);     color: #fff; }
.badge-error    { background: #6b7280;         color: #fff; }
.badge-warn     { background: var(--warn);     color: #fff; }

/* ── Impact dots ─────────────────────────────────────────────────────────── */
.impact-counts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.impact-dot {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
}
.impact-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.impact-dot.critical::before { background: var(--critical); }
.impact-dot.serious::before  { background: var(--serious); }
.impact-dot.moderate::before { background: var(--moderate); }
.impact-dot.minor::before    { background: var(--minor); }

/* ── Tag pills ───────────────────────────────────────────────────────────── */
.tag-pill {
  display: inline-flex;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  background: #e2e8f0;
  color: var(--text-secondary);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ── Export bar ──────────────────────────────────────────────────────────── */
.export-bar       { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.export-bar-label { font-size: 14px; color: var(--text-secondary); font-weight: 500; }

/* ── Error / empty state ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}
.empty-icon  { font-size: 48px; margin-bottom: 16px; }
.empty-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.empty-desc  { font-size: 14px; color: var(--text-secondary); max-width: 400px; margin: 0 auto 24px; }

/* ── Info banner ─────────────────────────────────────────────────────────── */
.info-banner {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  color: #0369a1;
  line-height: 1.5;
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden           { display: none !important; }
.text-muted       { color: var(--text-secondary); font-size: 13px; }
.flex             { display: flex; }
.items-center     { align-items: center; }
.justify-between  { justify-content: space-between; }
.gap-3            { gap: 12px; }
.w-full           { width: 100%; }
.mt-4             { margin-top: 16px; }
.mt-5             { margin-top: 20px; }
.mt-6             { margin-top: 24px; }
.mt-8             { margin-top: 32px; }
.mb-6             { margin-bottom: 24px; }

@media (max-width: 768px) {
  .page-content { padding: 20px 16px 48px; }
  .stats-grid   { grid-template-columns: repeat(2, 1fr); }
}
