/* ============================================================
   PHISHGUARD — by Junya Mazibuko
   Themed via CSS variables. Brand = indigo. Red = semantic
   danger only (PHISHING DETECTED, FAIL badges, critical etc.).
   Dark theme is default. Light theme via [data-theme="light"].
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---------- DARK THEME (default) ---------- */
:root {
  /* surface */
  --bg: #0a0a0a;
  --surface: #111111;
  --card: #1a1a1a;
  --border: #2a2a2a;

  /* glass layering — rgba on white for dark, rgba on black for light */
  --layer-0: rgba(255,255,255,0.03);
  --layer-1: rgba(255,255,255,0.05);
  --layer-2: rgba(255,255,255,0.08);
  --layer-input: #0e0e0e;
  --layer-strong: rgba(0,0,0,0.35);

  /* text */
  --text: #e6e6e6;
  --muted: #8a8a8a;
  --muted-2: #5f5f5f;

  /* brand — indigo (pairs with red without overpowering it) */
  --brand: #6366f1;       /* indigo-500 */
  --brand-2: #4f46e5;     /* indigo-600 */
  --brand-soft: rgba(99,102,241,0.14);
  --brand-border: rgba(99,102,241,0.45);
  --brand-glow: rgba(99,102,241,0.35);

  /* semantic colors (same across themes) */
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.15);
  --red-border: rgba(220, 38, 38, 0.45);
  --orange: #ea580c;
  --orange-soft: rgba(234, 88, 12, 0.15);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.15);
  --green: #16a34a;
  --green-soft: rgba(22, 163, 74, 0.15);

  /* level text tints */
  --green-text: #6ee7a7;
  --amber-text: #fbbf24;
  --orange-text: #fdba74;
  --red-text:   #fca5a5;
  --indigo-text: #a5b4fc;

  /* highlight (urgency phrases) — stays red, it IS danger */
  --hl-bg: rgba(220,38,38,0.22);
  --hl-fg: #fecaca;

  /* fonts + radii */
  --font-sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-card: 0 10px 30px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-soft: 0 4px 16px rgba(0,0,0,0.35);

  /* background atmospheric glow — indigo primary, red accent */
  --glow-a: rgba(99,102,241,0.22);
  --glow-b: rgba(220,38,38,0.10);

  /* gradient backgrounds */
  --hero-grad: linear-gradient(135deg, #ffffff, #b8b8b8);

  /* topbar */
  --topbar-bg: rgba(10,10,10,0.7);

  /* grid lines */
  --grid-line: rgba(255,255,255,0.025);
}

/* ---------- LIGHT THEME ---------- */
[data-theme="light"] {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --card: #ffffff;
  --border: #e2e8f0;

  --layer-0: rgba(15,23,42,0.03);
  --layer-1: rgba(15,23,42,0.05);
  --layer-2: rgba(15,23,42,0.07);
  --layer-input: #fbfbfd;
  --layer-strong: rgba(15,23,42,0.05);

  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --brand: #4f46e5;
  --brand-2: #4338ca;
  --brand-soft: rgba(79,70,229,0.10);
  --brand-border: rgba(79,70,229,0.35);
  --brand-glow: rgba(79,70,229,0.25);

  --red-soft: rgba(220,38,38,0.10);
  --orange-soft: rgba(234,88,12,0.10);
  --amber-soft: rgba(217,119,6,0.12);
  --green-soft: rgba(22,163,74,0.12);

  --green-text: #166534;
  --amber-text: #92400e;
  --orange-text: #9a3412;
  --red-text:   #991b1b;
  --indigo-text: #3730a3;

  --hl-bg: rgba(220,38,38,0.16);
  --hl-fg: #7f1d1d;

  --shadow-card: 0 1px 2px rgba(15,23,42,0.04), 0 8px 24px rgba(15,23,42,0.06), 0 0 0 1px rgba(15,23,42,0.04);
  --shadow-soft: 0 4px 12px rgba(15,23,42,0.08);

  --glow-a: rgba(79,70,229,0.18);
  --glow-b: rgba(220,38,38,0.08);

  --hero-grad: linear-gradient(135deg, #0f172a, #475569);

  --topbar-bg: rgba(255,255,255,0.85);
  --grid-line: rgba(15,23,42,0.04);
}

/* ---------- base ---------- */
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  transition: background 0.3s ease, color 0.3s ease;
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: var(--font-sans); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--font-mono); }

/* ---------- background stack (grid → binary rain → atmospheric glow) ---------- */
.bg-grid {
  position: fixed; inset: 0; z-index: -3;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at top, black 35%, transparent 80%);
  pointer-events: none;
}

/* Falling binary rain canvas. Sits behind content but in front of the grid.
   A gentle radial gradient dims the center so the reading area stays calm,
   but binary stays visible across the entire viewport. */
.bg-binary {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: -2;
  pointer-events: none;
  opacity: 0.9;
  mix-blend-mode: screen;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 50%, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.55) 35%, rgba(0,0,0,0.85) 70%, #000 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 50%, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.55) 35%, rgba(0,0,0,0.85) 70%, #000 100%);
}
[data-theme="light"] .bg-binary {
  opacity: 0.6;
  mix-blend-mode: multiply;
}
@media (prefers-reduced-motion: reduce) {
  .bg-binary { display: none; }
}

.bg-glow {
  position: fixed; inset: -30% -10% auto -10%; height: 70vh; z-index: -1;
  background:
    radial-gradient(60% 50% at 50% 30%, var(--glow-a), transparent 70%),
    radial-gradient(40% 40% at 80% 20%, var(--glow-b), transparent 70%);
  filter: blur(60px);
  pointer-events: none;
}

/* ---------- top bar (image background) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 50;
  isolation: isolate;
  overflow: hidden;
  color: #ffffff;
}
/* image layer */
.topbar-bg {
  position: absolute; inset: 0; z-index: -1;
}
.topbar-bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 38%;
  display: block;
  filter: saturate(1.05);
}
/* readability gradient — dark stays dark, light gets a softer wash */
.topbar-bg-tint {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(10,10,10,0.62), rgba(10,10,10,0.85)),
    linear-gradient(90deg, rgba(10,10,10,0.85) 0%, rgba(10,10,10,0.45) 50%, rgba(10,10,10,0.85) 100%),
    radial-gradient(60% 100% at 50% 50%, rgba(99,102,241,0.18), transparent 70%);
  backdrop-filter: blur(2px);
}
[data-theme="light"] .topbar-bg-tint {
  background:
    linear-gradient(180deg, rgba(15,23,42,0.55), rgba(15,23,42,0.78)),
    linear-gradient(90deg, rgba(15,23,42,0.80) 0%, rgba(15,23,42,0.40) 50%, rgba(15,23,42,0.80) 100%),
    radial-gradient(60% 100% at 50% 50%, rgba(79,70,229,0.22), transparent 70%);
}
/* topbar text + buttons need to stay readable against the image */
.topbar .brand-text h1 { color: #ffffff; }
.topbar .brand-sub { color: rgba(255,255,255,0.72); }
.topbar .ghost-btn {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.22);
  color: #ffffff;
  backdrop-filter: blur(8px);
}
.topbar .ghost-btn:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.35);
}
.topbar .icon-btn { color: rgba(255,255,255,0.78); }
.topbar .icon-btn:hover { color: #ffffff; background: rgba(255,255,255,0.12); }
.topbar .brand-mark {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.30);
  color: #ffffff;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 44px; height: 44px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand-soft), transparent);
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  color: var(--brand);
  position: relative;
  overflow: hidden;
}
/* small red accent dot — keeps the phishing/alert identity */
.brand-mark::after {
  content: '';
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px rgba(220,38,38,0.7);
  animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink { 0%, 60%, 100% { opacity: 1; } 70%, 90% { opacity: 0.25; } }
.brand-mark svg { width: 22px; height: 22px; }
.brand-text h1 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.18em;
}
.brand-sub { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- buttons ---------- */
.primary-btn, .ghost-btn, .icon-btn, .pill {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.primary-btn {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  padding: 12px 18px;
  box-shadow: 0 6px 24px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,0.15);
}
.primary-btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.primary-btn.small { padding: 8px 14px; font-size: 13px; }
.primary-btn svg { width: 16px; height: 16px; }

.ghost-btn {
  background: var(--layer-0);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
}
.ghost-btn.small { padding: 7px 12px; font-size: 12.5px; }
.ghost-btn:hover { background: var(--layer-1); border-color: var(--layer-2); }
.ghost-btn svg { width: 15px; height: 15px; }

.icon-btn {
  background: transparent; border: 1px solid transparent;
  color: var(--muted); width: 36px; height: 36px;
  justify-content: center;
}
.icon-btn:hover { color: var(--text); background: var(--layer-1); }
.icon-btn svg { width: 16px; height: 16px; }

.kbd-hint {
  margin-left: 4px;
  padding: 2px 6px; border-radius: 5px;
  background: rgba(0,0,0,0.35);
  font-family: var(--font-mono);
  font-size: 11px; color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.18);
}
[data-theme="light"] .kbd-hint {
  background: rgba(255,255,255,0.25);
  color: #ffffff;
  border-color: rgba(255,255,255,0.4);
}
kbd {
  padding: 2px 6px; border-radius: 5px;
  background: var(--layer-1);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ---------- container + hero ---------- */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}
.hero { padding: 12px 4px 28px; }
.hero-title { max-width: 720px; }
.hero h2 {
  font-family: var(--font-mono);
  font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 12px 0 10px;
  background: var(--hero-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-stats {
  display: flex; gap: 22px; margin-top: 22px; flex-wrap: wrap;
}
.hero-stat {
  display: flex; flex-direction: column;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--layer-0);
  min-width: 130px;
}
.hero-stat strong {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--brand);
}
[data-theme="light"] .hero-stat strong { color: var(--brand-2); }
.hero-stat span {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--brand-border);
  background: var(--brand-soft);
  color: var(--brand);
  text-transform: uppercase;
}

/* ---------- card / glass ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
}
.glass {
  background: var(--layer-0);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
[data-theme="light"] .glass {
  background: var(--surface);
  border-color: var(--border);
}

.section { margin-top: 18px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-head h3 {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.section-head h3 svg { width: 18px; height: 18px; color: var(--brand); }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sub-head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 10px;
}
.sub-head svg { width: 14px; height: 14px; }

/* ---------- collapsible ---------- */
.collapsible .section-body {
  max-height: 5000px;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 1;
}
.collapsible:not(.open) .section-body {
  max-height: 0;
  opacity: 0;
  margin: 0;
}
.collapsible:not(.open) .section-head { margin-bottom: 0; }
.collapse-toggle { cursor: pointer; user-select: none; }
.chevron { transition: transform 0.25s ease; color: var(--muted); }
.collapsible:not(.open) .chevron { transform: rotate(-90deg); }

/* ---------- input card ---------- */
.input-card { margin-top: 16px; }
.tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px;
  background: var(--layer-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 18px;
}
.tab {
  flex: 1; min-width: 120px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  display: inline-flex; align-items: center; gap: 8px;
  justify-content: center;
  transition: all 0.2s ease;
}
.tab svg { width: 15px; height: 15px; }
.tab:hover { color: var(--text); background: var(--layer-1); }
.tab.active {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand-border);
}
[data-theme="light"] .tab.active { color: var(--brand-2); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.25s ease; }

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.text-input {
  width: 100%;
  background: var(--layer-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--text);
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}
.text-input:focus {
  border-color: var(--brand-border);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* dropzone */
.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 38px 20px;
  text-align: center;
  background: var(--layer-0);
  transition: all 0.2s ease;
}
.dropzone.drag {
  border-color: var(--brand-border);
  background: var(--brand-soft);
}
.dropzone svg { width: 38px; height: 38px; color: var(--muted); margin-bottom: 10px; }
.dropzone p { margin: 4px 0; }

/* input actions */
.input-actions {
  display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap;
}

/* scanner */
.scanner {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--brand-border);
  background: var(--brand-soft);
  border-radius: 12px;
  text-align: center;
}
.scanner p {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--brand);
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 10px;
}
[data-theme="light"] .scanner p { color: var(--brand-2); }
.scanner p svg { width: 14px; height: 14px; animation: spin 1.4s linear infinite; }
.scan-bar {
  height: 4px;
  background: var(--layer-1);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}
.scan-bar::after {
  content: '';
  position: absolute; top: 0; left: -40%;
  height: 100%; width: 40%;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  animation: scan 1.2s ease-in-out infinite;
}
@keyframes scan { 0% { left: -40%; } 100% { left: 100%; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- score dial ---------- */
.score-grid {
  display: grid;
  grid-template-columns: minmax(220px, 260px) 1fr;
  gap: 32px;
  align-items: center;
}
@media (max-width: 720px) {
  .score-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; }
}

.score-dial-wrap { display: grid; place-items: center; }
.score-dial { width: 220px; height: 220px; transform: rotate(-90deg); }
.dial-track {
  fill: none; stroke: var(--layer-2); stroke-width: 16;
}
.dial-fill {
  fill: none;
  stroke: var(--green);
  stroke-width: 16;
  stroke-linecap: round;
  stroke-dasharray: 540;
  stroke-dashoffset: 540;
  transition: stroke-dashoffset 1.2s cubic-bezier(.2,.8,.2,1), stroke 0.5s ease;
}
.dial-score, .dial-out-of {
  transform: rotate(90deg);
  transform-origin: 100px 100px;
  text-anchor: middle;
  fill: var(--text);
  font-family: var(--font-mono);
  font-weight: 700;
}
.dial-score { font-size: 42px; }
.dial-out-of { font-size: 13px; fill: var(--muted); font-weight: 400; }

.score-meta { display: flex; flex-direction: column; gap: 12px; }

.level-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.18em;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--layer-1);
  border: 1px solid var(--border);
  align-self: flex-start;
}
.level-badge.safe { background: var(--green-soft); border-color: rgba(22,163,74,0.4); color: var(--green-text); }
.level-badge.warn { background: var(--amber-soft); border-color: rgba(217,119,6,0.4); color: var(--amber-text); }
.level-badge.high { background: var(--orange-soft); border-color: rgba(234,88,12,0.4); color: var(--orange-text); }
.level-badge.danger {
  background: var(--red-soft);
  border-color: var(--red-border);
  color: var(--red-text);
  animation: pulse-red 1.8s ease-in-out infinite;
}
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
  50%      { box-shadow: 0 0 0 14px rgba(220,38,38,0); }
}

.summary-line { font-size: 14.5px; color: var(--text); }
.counts {
  display: flex; gap: 18px; flex-wrap: wrap;
  list-style: none; font-size: 13px; color: var(--muted);
}
.counts li { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-red { background: var(--red); }
.dot-amber { background: var(--amber); }
.dot-green { background: var(--green); }

/* ---------- auth badges ---------- */
.auth-badges {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 560px) { .auth-badges { grid-template-columns: 1fr; } }
.auth-badge {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--layer-0);
  font-family: var(--font-mono);
}
.auth-badge .auth-name { font-size: 13px; letter-spacing: 0.14em; color: var(--muted); }
.auth-badge .auth-state {
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em;
  padding: 4px 10px; border-radius: 999px;
  background: var(--layer-1);
  color: var(--muted);
}
.auth-badge.pass .auth-state { background: var(--green-soft); color: var(--green-text); }
.auth-badge.pass { border-color: rgba(22,163,74,0.35); }
.auth-badge.fail .auth-state { background: var(--red-soft); color: var(--red-text); }
.auth-badge.fail { border-color: var(--red-border); }
.auth-badge.none .auth-state { background: var(--amber-soft); color: var(--amber-text); }
.auth-badge.none { border-color: rgba(217,119,6,0.35); }

/* ---------- mismatches ---------- */
.mismatch-list { display: flex; flex-direction: column; gap: 8px; }
.mismatch-list:empty { display: none; }
.mismatch {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px;
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  border-radius: 10px;
  font-size: 13.5px;
}
.mismatch svg { width: 16px; height: 16px; color: var(--red); flex-shrink: 0; }

/* ---------- IPs ---------- */
.ip-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.ip-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: var(--layer-0);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.ip-list .copy-ip {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; padding: 4px;
}
.ip-list .copy-ip:hover { color: var(--text); }
.ip-list .copy-ip svg { width: 14px; height: 14px; }

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  background: var(--layer-0);
}
.data-table th, .data-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table thead th {
  background: var(--layer-1);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--layer-1); }
.data-table td.field-name { font-family: var(--font-mono); color: var(--muted); white-space: nowrap; }
.data-table td.field-value { font-family: var(--font-mono); word-break: break-all; }

.row-danger { background: var(--red-soft) !important; }
.row-warn   { background: var(--amber-soft) !important; }

.risk-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 9px;
  border-radius: 999px;
}
.risk-low      { background: var(--green-soft);  color: var(--green-text); }
.risk-medium   { background: var(--amber-soft);  color: var(--amber-text); }
.risk-high     { background: var(--orange-soft); color: var(--orange-text); }
.risk-critical { background: var(--red-soft);    color: var(--red-text); }

/* ---------- indicators ---------- */
.indicator-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.indicator {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  background: var(--layer-0);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.indicator.critical { background: var(--red-soft);    border-color: var(--red-border); }
.indicator.high     { background: var(--orange-soft); border-color: rgba(234,88,12,0.35); }
.indicator.warning  { background: var(--amber-soft);  border-color: rgba(217,119,6,0.35); }
.indicator.info     { background: var(--brand-soft);  border-color: var(--brand-border); }

.indicator .ind-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--layer-strong);
}
.indicator .ind-icon svg { width: 16px; height: 16px; }
.indicator.critical .ind-icon svg { color: var(--red); }
.indicator.high .ind-icon svg     { color: var(--orange); }
.indicator.warning .ind-icon svg  { color: var(--amber); }
.indicator.info .ind-icon svg     { color: var(--brand); }

.ind-body { display: flex; flex-direction: column; gap: 4px; }
.ind-title { display: flex; align-items: center; gap: 10px; }
.ind-name { font-weight: 600; font-size: 14px; }
.ind-sev {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--layer-2);
  color: var(--text);
}
.ind-explain { font-size: 13px; color: var(--muted); }

/* ---------- body preview ---------- */
.view-toggle {
  display: inline-flex;
  background: var(--layer-strong);
  padding: 4px; border-radius: 999px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}
.pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12.5px;
}
.pill.active { background: var(--brand-soft); color: var(--brand); }
[data-theme="light"] .pill.active { color: var(--brand-2); }

.body-preview {
  background: var(--layer-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  max-height: 460px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.body-preview .hl {
  background: var(--hl-bg);
  color: var(--hl-fg);
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 600;
}

/* ---------- recommendations (red is intentional — these are danger responses) ---------- */
.rec-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.rec-list li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px;
  background: var(--layer-0);
  border-left: 3px solid var(--red);
  border-radius: 6px;
  font-size: 13.5px;
}
.rec-list li svg { width: 16px; height: 16px; color: var(--red); flex-shrink: 0; margin-top: 2px; }

/* ---------- attachments ---------- */
.attachment-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.attachment {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--layer-0);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
}
.attachment.danger { background: var(--red-soft); border-color: var(--red-border); }
.attachment .att-meta { font-family: var(--font-mono); color: var(--muted); font-size: 12px; }

/* ---------- history ---------- */
.history-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: grid;
  grid-template-columns: 70px 1fr auto auto;
  gap: 12px; align-items: center;
  padding: 10px 14px;
  background: var(--layer-0);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.history-item:hover { background: var(--layer-1); border-color: var(--layer-2); }
.history-score {
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: center;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
}
.history-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.history-sender {
  font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-date { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }
.history-level {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 999px;
}
@media (max-width: 560px) {
  .history-item { grid-template-columns: 60px 1fr; grid-template-rows: auto auto; }
  .history-level { grid-column: 2; }
}

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
[data-theme="light"] .modal-backdrop { background: rgba(15,23,42,0.45); }
.modal {
  max-width: 520px; width: 100%;
  padding: 28px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-head h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}
.modal-head h2 svg { width: 18px; height: 18px; color: var(--brand); }
.howto-list { padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.howto-list li { line-height: 1.5; }
.checkbox {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 14px; cursor: pointer; font-size: 13px; color: var(--muted);
}
.checkbox input { accent-color: var(--brand); }

/* ---------- footer (dual-image background) ---------- */
.footer {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-top: 1px solid var(--border);
  padding: 36px 24px;
  text-align: center;
  font-size: 13px;
  color: #ffffff;
  background: #0a0a0a;
}
.footer-bg { position: absolute; inset: 0; z-index: -1; display: flex; }
.footer-bg img {
  width: 50%; height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  filter: saturate(1.05);
}
.footer-bg .footer-bg-right { object-position: center 40%; }
.footer-bg-tint {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(10,10,10,0.55), rgba(10,10,10,0.85)),
    linear-gradient(90deg, rgba(10,10,10,0.55), rgba(10,10,10,0.10) 30%, rgba(10,10,10,0.10) 70%, rgba(10,10,10,0.55)),
    radial-gradient(70% 100% at 50% 50%, rgba(99,102,241,0.15), transparent 70%);
}
[data-theme="light"] .footer-bg-tint {
  background:
    linear-gradient(180deg, rgba(15,23,42,0.62), rgba(15,23,42,0.86)),
    linear-gradient(90deg, rgba(15,23,42,0.55), rgba(15,23,42,0.10) 30%, rgba(15,23,42,0.10) 70%, rgba(15,23,42,0.55)),
    radial-gradient(70% 100% at 50% 50%, rgba(79,70,229,0.20), transparent 70%);
}
.footer-content { position: relative; max-width: 900px; margin: 0 auto; }
.footer p { margin: 4px 0; color: rgba(255,255,255,0.90); }
.footer .small { color: rgba(255,255,255,0.62); }
.footer strong {
  color: #ffffff;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

/* ---------- toast ---------- */
.toast-host {
  position: fixed; bottom: 22px; right: 22px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13.5px;
  box-shadow: var(--shadow-soft);
  animation: slideIn 0.25s ease;
  min-width: 220px;
}
.toast svg { width: 16px; height: 16px; }
.toast.ok    svg { color: var(--green); }
.toast.error svg { color: var(--red); }
.toast.info  svg { color: var(--brand); }
.toast.leaving { animation: slideOut 0.2s ease forwards; }
@keyframes slideIn  { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideOut { to { transform: translateX(40px); opacity: 0; } }

/* ---------- theme toggle button ---------- */
.theme-toggle { position: relative; }
.theme-toggle .sun, .theme-toggle .moon { transition: opacity 0.25s ease, transform 0.25s ease; }
.theme-toggle .sun  { position: absolute; opacity: 0; transform: rotate(-30deg) scale(0.7); }
[data-theme="light"] .theme-toggle .sun  { opacity: 1; transform: none; }
[data-theme="light"] .theme-toggle .moon { opacity: 0; transform: rotate(30deg) scale(0.7); }

/* ---------- animations ---------- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.results > .section { animation: fadeUp 0.5s cubic-bezier(.2,.8,.2,1) both; }
.results > .section:nth-child(1) { animation-delay: 0.00s; }
.results > .section:nth-child(2) { animation-delay: 0.07s; }
.results > .section:nth-child(3) { animation-delay: 0.14s; }
.results > .section:nth-child(4) { animation-delay: 0.21s; }
.results > .section:nth-child(5) { animation-delay: 0.28s; }
.results > .section:nth-child(6) { animation-delay: 0.35s; }
.results > .section:nth-child(7) { animation-delay: 0.42s; }
.results > .section:nth-child(8) { animation-delay: 0.49s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------- responsive ---------- */
@media (max-width: 600px) {
  .topbar { padding: 14px 18px; flex-wrap: wrap; gap: 10px; }
  .topbar-actions span { display: none; }
  .container { padding: 24px 14px 60px; }
  .card { padding: 18px; }
  .brand-text h1 { font-size: 17px; }
}
