/* ============================================================================
   TCP Blacklister — agent pages (Number Check, Result, error page)
   Loaded only when <body class="agent">. Admin pages never see these rules.
   ============================================================================ */

/* ---------- Dark theme: follows the device setting ---------- */

@media (prefers-color-scheme: dark) {
  body.agent {
    color-scheme: dark;
    --bg: #0b1017;
    --panel: #121922;
    --panel-2: #1a222d;
    --ink: #e8edf2;
    --muted: #94a0ad;
    --line: #243040;
    --accent: #6ea8ff;
    --accent-bg: #142239;
    --safe: #4ade80;
    --safe-bg: #0f2a1a;
    --bad: #f87171;
    --bad-bg: #331416;
    --warn: #fbbf24;
    --warn-bg: #2d2008;
    --unk: #cbd5e1;
    --unk-bg: #222a33;
    --shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
    --glow: rgba(110, 168, 255, 0.14);
    --grid: rgba(255, 255, 255, 0.035);
  }
}

/* ---------- Base ---------- */

body.agent {
  --glow: rgba(28, 91, 191, 0.10);
  --grid: rgba(20, 26, 33, 0.045);
  --violet: #6d5dfc;

  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  min-height: 100dvh;
  position: relative;
}

/* Layered backdrop: soft glow top-centre and a faint engineering grid that fades out. */
body.agent::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 480px at 50% -120px, var(--glow), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 45%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 45%, transparent 100%);
  pointer-events: none;
}

body.agent :focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

.agent-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 130px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.section-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-note { font-size: 13px; color: var(--muted); }

kbd {
  font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}

/* ---------- Buttons ---------- */

.btn-check {
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  padding: 0 26px;
  height: 56px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent));
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 35%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-check svg { width: 20px; height: 20px; }
.btn-check:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-check:active { transform: translateY(0); filter: brightness(0.96); }
.btn-check.block { display: flex; width: 100%; }

/* ---------- Header ---------- */

.agent-header {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}

.brand-mark svg { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--muted); font-weight: 500; }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse 2s ease-out infinite;
}

.status-live { color: var(--safe); border-color: color-mix(in srgb, var(--safe) 35%, transparent); background: var(--safe-bg); }
.status-mock { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-bg); }

/* ---------- Index: lookup page ---------- */

.lookup-page { max-width: 820px; padding-top: 36px; }

.lookup-hero { text-align: center; margin-bottom: 26px; }

.lookup-title {
  font-size: clamp(34px, 6vw, 52px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 12px;
}

.grad {
  background: linear-gradient(90deg, var(--accent), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lookup-sub {
  color: var(--muted);
  font-size: 17px;
  margin: 0 auto;
  max-width: 520px;
}

.lookup-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 20px;
  animation: rise 0.3s ease-out both;
}

.input-group {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.input-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  color: var(--muted);
  pointer-events: none;
}

.input-icon svg { width: 100%; height: 100%; }

.phone-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 76px;
  font: inherit;
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  padding: 0 18px 0 62px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
  color: var(--ink);
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.phone-input::placeholder { color: var(--muted); opacity: 0.5; font-weight: 400; }

.phone-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--panel);
  box-shadow: 0 0 0 4px var(--accent-bg);
}

.btn-inline { height: 76px; padding: 0 28px; border-radius: 16px; flex: 0 0 auto; }

.hint-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 4px 0;
  font-size: 13px;
  color: var(--muted);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0 28px;
}

.tile {
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: rise 0.3s ease-out both;
  animation-delay: 80ms;
}

.tile-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
}

.tile-icon svg { width: 20px; height: 20px; }
.tile-icon-accent { background: var(--accent-bg); color: var(--accent); }
.tile-icon-safe   { background: var(--safe-bg);   color: var(--safe); }
.tile-icon-warn   { background: var(--warn-bg);   color: var(--warn); }

.tile-text { display: flex; flex-direction: column; gap: 2px; }
.tile-value { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.tile-label { font-size: 13px; color: var(--muted); }

.recent { animation: rise 0.3s ease-out both; animation-delay: 140ms; }

.recent-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.recent-list li + li { border-top: 1px solid var(--line); }
.recent-list form { margin: 0; }

.recent-row {
  width: 100%;
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.recent-row:hover { background: var(--panel-2); }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-safe { background: var(--safe); box-shadow: 0 0 0 3px var(--safe-bg); }
.dot-bad  { background: var(--bad);  box-shadow: 0 0 0 3px var(--bad-bg); }
.dot-warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }

.recent-number { font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.recent-verdict { font-size: 13px; font-weight: 600; color: var(--muted); }
.recent-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Result: hero verdict ---------- */

.hero {
  border-radius: 26px;
  padding: 40px 28px 36px;
  text-align: center;
  color: #fff;
  box-shadow: var(--shadow);
  animation: rise 0.3s ease-out both;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(520px 260px at 20% 0%, rgba(255, 255, 255, 0.22), transparent 70%),
    radial-gradient(420px 240px at 100% 100%, rgba(0, 0, 0, 0.18), transparent 70%);
  pointer-events: none;
}

.hero > * { position: relative; }

.hero-safe { background: linear-gradient(140deg, #16a34a, #15803d 55%, #166534); }
.hero-bad  { background: linear-gradient(140deg, #dc2626, #b91c1c 55%, #991b1b); }
.hero-warn { background: linear-gradient(140deg, #d97706, #b45309 55%, #92400e); }
.hero-unk  { background: linear-gradient(140deg, #64748b, #4b5563 55%, #374151); }

.hero-glyph {
  width: 88px;
  height: 88px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 10px 30px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(6px);
}

.hero-glyph svg { width: 46px; height: 46px; }

.hero-headline {
  font-size: clamp(38px, 8vw, 64px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.hero-tag {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  line-height: 1;
  text-shadow: none;
}

.hero-number {
  font-size: clamp(26px, 5.6vw, 40px);
  font-weight: 600;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  margin-top: 12px;
}

.hero-note { margin-top: 8px; font-size: 16px; opacity: 0.9; }

.hero-guide {
  display: inline-block;
  margin-top: 18px;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ---------- Result: stat tiles ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0 22px;
}

.stat-tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: rise 0.3s ease-out both;
  animation-delay: 60ms;
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-value small { font-size: 13px; font-weight: 600; margin-left: 3px; color: var(--muted); }
.stat-value.small { font-size: 17px; }
.stat-sub { font-size: 12px; color: var(--muted); }

.tone-safe   .stat-value { color: var(--safe); }
.tone-accent .stat-value { color: var(--accent); }
.tone-warn   .stat-value { color: var(--warn); }
.tone-unk    .stat-value { color: var(--unk); }

/* ---------- Result: callout ---------- */

.callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 16px;
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.45;
}

.callout svg { flex: 0 0 20px; width: 20px; height: 20px; margin-top: 1px; }
.callout-warn { background: var(--warn-bg); color: var(--warn); }
.callout-info { background: var(--accent-bg); color: var(--accent); }

/* ---------- Result: provider cards ---------- */

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.provider-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  animation: rise 0.3s ease-out both;
  animation-delay: calc(var(--i, 0) * 60ms + 120ms);
  position: relative;
  overflow: hidden;
}

.provider-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--line);
}

.provider-card.is-safe::before { background: var(--safe); }
.provider-card.is-bad::before  { background: var(--bad); }
.provider-card.is-err::before  { background: var(--warn); }

.provider-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: var(--panel-2);
  color: var(--muted);
}

.avatar-safe { background: var(--safe-bg); color: var(--safe); }
.avatar-bad  { background: var(--bad-bg);  color: var(--bad); }
.avatar-err  { background: var(--warn-bg); color: var(--warn); }

.provider-title { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.provider-name { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }

.provider-meta {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.provider-meta .err-text { font-weight: 600; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-left: 54px; }

.tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
}

.tag-bad  { background: var(--bad-bg);  color: var(--bad); }
.tag-safe { background: var(--safe-bg); color: var(--safe); }

/* ---------- Result: sticky "check another" bar ---------- */

.again-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

.again-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.again-inner .btn-check { flex: 1; }
.again-hint { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ---------- Error page ---------- */

.error-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.3s ease-out both;
}

.error-head {
  background: linear-gradient(140deg, #64748b, #4b5563 55%, #374151);
  color: #fff;
  padding: 28px 24px;
  text-align: center;
}

.error-head svg { width: 48px; height: 48px; display: block; margin: 0 auto 10px; }
.error-head h1 { margin: 0; font-size: 28px; font-weight: 800; }

.error-body { padding: 22px 24px 24px; }
.error-body p { margin: 0 0 18px; color: var(--muted); }

/* ---------- Motion ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

@media (prefers-reduced-motion: reduce) {
  body.agent *, body.agent *::before, body.agent *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Small screens ---------- */

@media (max-width: 680px) {
  .agent-header { padding: 14px 16px; }
  .brand-sub { display: none; }
  .agent-shell { padding: 16px 16px 130px; }
  .lookup-page { padding-top: 20px; }
  .lookup-card { padding: 14px; border-radius: 20px; }
  .input-group { flex-direction: column; }
  .input-icon { top: 36px; left: 18px; }
  .phone-input { height: 72px; padding-left: 56px; }
  .btn-inline { height: 60px; width: 100%; }
  .hint-row { flex-direction: column; gap: 4px; align-items: center; }
  .tiles { grid-template-columns: 1fr; gap: 10px; }
  .tile { flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; }
  .tile-icon { margin: 0; flex: 0 0 36px; }
  .tile-value { font-size: 15px; }
  .tile-label { font-size: 12px; }
  .recent-row { grid-template-columns: 12px 1fr auto; }
  .recent-time { display: none; }
  .hero { padding: 30px 18px 28px; border-radius: 20px; }
  .hero-glyph { width: 72px; height: 72px; }
  .hero-glyph svg { width: 38px; height: 38px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .provider-grid { grid-template-columns: 1fr; }
  .tag-row { padding-left: 0; }
  .again-bar { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .again-hint { display: none; }
}
