/*
 * threats-v2.css — design variant v2 of the public threat board
 * (openspec/changes/threat-board task 4.0b; built with the ui-ux-pro-max skill set only).
 *
 * Every color below is var(--token) from the root palette already declared in style.css
 * (#0d1117/#161b22/#1c2128/#30363d/#3fb950 + warning/error/info) — no new hex, no gradient
 * beyond the site's two existing decorative ones, no backdrop-filter, no drop shadow other
 * than the one the design system already names for a floating panel (docs/DESIGN.md
 * "Elevation & Depth"). This file is additive: it styles `.tv2-*` classes only and never
 * touches `.cpage-*`, `.threats-*` base rules or style.css/app.css.
 *
 * "Futuristic, with graphs": the HUD feel comes from corner brackets, dense KPI tiles,
 * monospace tabular numbers and a live pulse — not from glow or glass, which the design
 * language explicitly rules out.
 */

.tv2-wrap {
  --tv2-gap: 16px;
  --tv2-pad: 16px;
}

.tv2-icon { display: inline-block; vertical-align: -2px; color: var(--accent); margin-right: 2px; }

/* Flat panel + corner brackets — the one recurring "console" motif in this variant. Built
   from border segments only (no shadow, no gradient) so it stays inside the system's flat,
   hairline-bordered surface language. */
.tv2-panel {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--tv2-pad);
  margin: 0 0 var(--tv2-gap);
}
.tv2-panel::before,
.tv2-panel::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  pointer-events: none;
  opacity: 0.7;
}
.tv2-panel::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
}
.tv2-panel::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
}
.tv2-panel > h2:first-child,
.tv2-panel > h3:first-child { margin-top: 0; }
.tv2-panel.tv2-empty { text-align: center; padding: 28px var(--tv2-pad); }

/* Status strip: live pulse + time-since-last-attack + KPI tiles */
.tv2-status { margin: 0 0 var(--tv2-gap); }
.tv2-live {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.tv2-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
  animation: tv2-pulse 2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .tv2-live-dot { animation: none; opacity: 1; }
}
@keyframes tv2-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}
.tv2-live-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-size: 11px;
}
.tv2-tsla { margin-left: auto; color: var(--text-primary); display: inline-flex; align-items: center; gap: 4px; }
.tv2-tsla .tv2-icon { color: var(--accent); }

.tv2-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.tv2-kpi-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 10px 12px 12px;
}
.tv2-kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}
.tv2-kpi-row { display: flex; align-items: baseline; gap: 6px; font-family: 'JetBrains Mono', monospace; }
.tv2-kpi-num { font-size: 18px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tv2-kpi-blocked { color: var(--error); }
.tv2-kpi-unit { font-size: 11px; color: var(--text-muted); }

/* Lookup */
.tv2-lookup h2 { margin-top: 0; }

/* Live feed */
.tv2-wire-scroll { max-height: 360px; overflow-y: auto; border: 1px solid var(--border-color); border-radius: var(--radius); }
.tv2-wire-scroll table { margin: 0; }
.tv2-wire-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
tr.tv2-row-new { animation: tv2-row-in 0.6s ease-out; }
@media (prefers-reduced-motion: reduce) {
  tr.tv2-row-new { animation: none; }
}
@keyframes tv2-row-in {
  from { background: color-mix(in srgb, var(--accent) 18%, transparent); }
  to { background: transparent; }
}

/* Charts dashboard */
.tv2-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--tv2-gap);
}
.tv2-chart-card h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  margin: 0 0 10px;
}
.tv2-chart-sub { color: var(--text-muted); text-transform: none; letter-spacing: 0; font-size: 11px; }
.tv2-chart-box { position: relative; height: 220px; width: 100%; max-width: 100%; }
.tv2-chart-box canvas { max-width: 100%; }

/* Most Wanted — bracketed card grid */
.tv2-wanted h2 { display: flex; align-items: center; gap: 6px; }
.tv2-wanted-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.tv2-wanted-card {
  position: relative;
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px;
  text-decoration: none;
  transition: border-color 0.12s;
}
.tv2-wanted-card:hover,
.tv2-wanted-card:focus-visible {
  border-color: var(--accent);
}
.tv2-wanted-ip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-word;
}
.tv2-wanted-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--error);
  font-variant-numeric: tabular-nums;
  margin: 4px 0 6px;
}
.tv2-wanted-org {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tv2-wanted-seen {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* threats_badges_strip() reuses the site's shared .threats-chip tint backgrounds, tuned for
   the table rows they were designed for (sit on var(--bg-secondary)). Measured contrast on
   this card's var(--bg-card) backdrop came in at 4.32:1 for the blocked-tier chip — under
   the 4.5:1 floor — so this card gets a solid, darker chip background instead of the
   shared alpha tint. Scoped to .tv2-wanted-card only; style.css's own chip rule is untouched. */
.tv2-wanted-card .threats-chip {
  background: var(--bg-primary);
}
.tv2-wanted-card .threats-tier-blocked { border-color: var(--error); }
.tv2-wanted-card .threats-tier-listed { border-color: var(--warning); }
.tv2-wanted-card .threats-chip-level { border-color: var(--accent-border); }

@media (max-width: 640px) {
  .tv2-kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .tv2-charts-grid { grid-template-columns: 1fr; }
  .tv2-chart-box { height: 200px; }
  .tv2-tsla { margin-left: 0; width: 100%; }
}
