/* ============================================================
   Agent Detection Dashboard — Tactical Ops Theme
   ============================================================
   Aesthetic: Precision-engineered security operations interface.
   Deep slate base, sharp geometry, distinctive typography.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=DM+Sans:wght@400;500;600;700&display=swap');

/* ---------- Reset & Variables ----------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Core palette — deep blue-black */
  --bg:          #0b0d11;
  --bg-raised:   #0f1117;
  --bg-card:     #111318;
  --bg-row-alt:  #10121a;
  --bg-hover:    #171a22;
  --bg-surface:  #1a1d25;

  /* Borders — layered depth */
  --border:      rgba(255,255,255,0.08);
  --border-soft: rgba(255,255,255,0.05);
  --border-hard: rgba(255,255,255,0.12);

  /* Text hierarchy */
  --text:        #e0e0e0;
  --text-bright: #f5f5f5;
  --text-dim:    #888;
  --text-muted:  #666;
  --text-head:   #fff;

  /* Accent — electric blue */
  --accent:      #3b82f6;
  --accent-soft: rgba(59,130,246,0.12);
  --accent-glow: rgba(59,130,246,0.25);

  /* Signal colors — vivid, intentional */
  --green:  #34d399;
  --red:    #f87171;
  --orange: #fb923c;
  --yellow: #fbbf24;
  --gray:   #6b7280;
  --purple: #a78bfa;
  --pink:   #f472b6;
  --cyan:   #22d3ee;

  /* Typography */
  --font-display: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:    'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:         'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  --radius:    8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
}

/* ---------- Base ------------------------------------------ */
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Noise texture overlay removed — caused fuzzy/washed-out backgrounds */

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: #60a5fa; text-decoration: none; }

::selection { background: var(--accent-soft); color: var(--text-bright); }

/* ---------- Header & Nav ---------------------------------- */
header {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.75rem 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: #12151a;
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-head);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

nav {
  display: flex;
  gap: 0.25rem;
}

nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

nav a:hover { color: var(--text-bright); background: var(--bg-surface); text-decoration: none; }
nav a.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
}

/* ---------- Main layout ----------------------------------- */
main {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-head);
  letter-spacing: -0.01em;
}

h3 {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- Placeholder ----------------------------------- */
.placeholder { color: var(--text-muted); font-style: italic; }

/* ---------- Signal match/mismatch ------------------------- */
.match    { color: var(--green); }
.mismatch { color: var(--red); }
.unknown  { color: var(--text-dim); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  font-family: var(--font-display);
}

.badge-browser {
  background: rgba(52, 211, 153, 0.10);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.20);
}

.badge-bot {
  background: rgba(251, 146, 60, 0.10);
  color: var(--orange);
  border: 1px solid rgba(251, 146, 60, 0.20);
}

.badge-unknown {
  background: rgba(107, 114, 128, 0.10);
  color: var(--gray);
  border: 1px solid rgba(107, 114, 128, 0.20);
}

.badge-warn {
  background: rgba(251, 191, 36, 0.10);
  color: var(--yellow);
  border: 1px solid rgba(251, 191, 36, 0.20);
}

/* ============================================================
   TABLES — generic .table class
   ============================================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.table thead {
  position: sticky;
  top: 49px;
  z-index: 10;
}

.table th {
  background: var(--bg-raised);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.875rem;
  border-bottom: 1px solid var(--border-hard);
  white-space: nowrap;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.table td {
  padding: 0.5rem 0.875rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.table tbody tr:nth-child(even) td { background: var(--bg-row-alt); }
.table tbody tr:hover td          { background: var(--bg-hover); cursor: pointer; }
.table tbody tr:last-child td     { border-bottom: none; }

/* ── Session table ─────────────────────────────────────────── */
.session-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.session-table th {
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-hard);
  font-family: var(--font-display);
}
.session-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Verdict pill ──────────────────────────────────────────── */
.verdict-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 700;
  white-space: nowrap;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}
.verdict-human      { background: rgba(52,211,153,0.12); color: var(--green); border: 1px solid rgba(52,211,153,0.25); }
.verdict-likely     { background: rgba(52,211,153,0.07); color: #6ee7b7; border: 1px solid rgba(52,211,153,0.15); }
.verdict-mixed      { background: rgba(251,191,36,0.10); color: var(--yellow); border: 1px solid rgba(251,191,36,0.25); }
.verdict-likely-bot { background: rgba(251,146,60,0.12); color: var(--orange); border: 1px solid rgba(251,146,60,0.25); }
.verdict-bot        { background: rgba(248,113,113,0.12); color: var(--red); border: 1px solid rgba(248,113,113,0.25); }

.session-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.session-id-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.625rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.session-table tr.clickable { cursor: pointer; }
.session-table tr.clickable:hover td { background: var(--bg-hover); }
.session-table tr.suspicious td { background: rgba(248, 113, 113, 0.04); }
.session-table tr.suspicious:hover td { background: rgba(248, 113, 113, 0.08); }

/* Column widths */
.col-source   { width: 20%; white-space: normal; }
.col-verdict  { width: 9%; white-space: nowrap; }
.col-score    { width: 7%; white-space: nowrap; }
.col-type     { width: 12%; white-space: nowrap; }
.col-label    { width: 12%; white-space: nowrap; }
.col-ja4      { width: 20%; }
.col-time     { width: 8%; }
.col-reqs     { width: 6%; text-align: right; }

/* ============================================================
   SIGNAL ROWS
   ============================================================ */
.signal-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.45rem 0.75rem;
  border-left: 3px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 2px;
  font-size: 0.8125rem;
}

.signal-row .sig-label {
  color: var(--text-dim);
  min-width: 160px;
  flex-shrink: 0;
  font-size: 0.8125rem;
}

.signal-row .sig-value {
  color: var(--text);
  flex: 1;
}

.signal-row .sig-detail {
  color: var(--text-dim);
  font-size: 0.8125rem;
}

.sig-pass {
  border-left-color: var(--green);
  background: rgba(52, 211, 153, 0.04);
}

.sig-fail {
  border-left-color: var(--red);
  background: rgba(248, 113, 113, 0.04);
}

/* ============================================================
   CARD / PANEL
   ============================================================ */
.card {
  background: #151820;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.card h3 { margin-bottom: 0.875rem; }

/* ============================================================
   MONO & DIM HELPERS
   ============================================================ */
.mono {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: #93a8f4;
}

.dim {
  color: var(--text-dim);
  font-size: 0.8125rem;
}

/* ============================================================
   DETAIL GRID (session detail two-column)
   ============================================================ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .detail-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   TAG INPUT (inline session rename)
   ============================================================ */
.tag-input {
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  outline: none;
  padding: 1px 4px;
  width: 200px;
  transition: border-color 0.15s;
}

.tag-input:focus { border-bottom-color: var(--accent); }
.tag-input::placeholder { color: var(--text-muted); }

/* ============================================================
   TIMELINE BAR (event density chart)
   ============================================================ */
.timeline-bar {
  display: flex;
  height: 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--border);
  width: 100%;
  gap: 1px;
}

.timeline-bar .tl-seg {
  flex: 1;
  height: 100%;
  transition: opacity 0.15s;
}

.timeline-bar .tl-seg:hover { opacity: 0.65; cursor: pointer; }

/* segment color variants */
.tl-seg-move   { background: var(--accent); }
.tl-seg-click  { background: var(--green); }
.tl-seg-key    { background: var(--yellow); }
.tl-seg-idle   { background: var(--border); }
.tl-seg-scroll { background: var(--purple); }

/* ============================================================
   PILLS
   ============================================================ */
.pill {
  display: inline-block;
  padding: 0.15em 0.55em;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
  gap: 0.5rem;
  font-size: 0.875rem;
}

.empty-state .empty-icon {
  font-size: 2rem;
  margin-bottom: 0.25rem;
  opacity: 0.3;
}

.empty-state p { font-size: 0.875rem; }

/* ============================================================
   BACK LINK
   ============================================================ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-dim);
  font-size: 0.8125rem;
  text-decoration: none;
  margin-bottom: 1.25rem;
  transition: color 0.15s;
}

.back-link::before { content: "\2190"; }
.back-link:hover { color: var(--text-head); text-decoration: none; }

/* ============================================================
   SPINNER
   ============================================================ */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 3rem auto;
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.filter-bar input {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.8125rem;
  padding: 7px 12px;
  width: 260px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: var(--font-body);
}

.filter-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.filter-bar button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 5px 10px;
  transition: border-color 0.15s, color 0.15s;
  display: none;
  font-family: var(--font-body);
}

.filter-bar button.visible { display: inline-block; }
.filter-bar button:hover   { border-color: var(--accent); color: var(--text); }

/* ============================================================
   YOU BAR — current session info, right-aligned in header
   ============================================================ */
#you-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
  font-size: 0.6875rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
  flex-shrink: 1;
}

#you-bar .you-sid {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.02em;
}
#you-bar .you-sid:hover { text-decoration: underline; }
#you-bar .you-sid-none {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-muted);
}

#you-bar .you-name {
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

#you-bar .you-sep { color: var(--border-hard); user-select: none; }
#you-bar .you-field { display: flex; align-items: center; gap: 0.3rem; }
#you-bar .you-label { color: var(--text-muted); }
#you-bar .you-val { color: var(--text-dim); }
#you-bar .you-verdict { margin-left: auto; font-size: 0.65rem; }

/* ============================================================
   UTILITY
   ============================================================ */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.nowrap      { white-space: nowrap; }
.full-width  { width: 100%; }
