/* PURSUE Research UI — shared styles */

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

:root {
  --bg:        #0f172a;
  --bg-card:   #1e293b;
  --bg-hover:  #293548;
  --border:    #334155;
  --text:      #e2e8f0;
  --text-muted:#94a3b8;
  --accent:    #38bdf8;

  /* tag type colors */
  --tag-entity:     #6366f1;
  --tag-location:   #10b981;
  --tag-date:       #f59e0b;
  --tag-agency:     #3b82f6;
  --tag-phenomenon: #ec4899;
  --tag-sensor:     #8b5cf6;
  --tag-document:   #64748b;
  --tag-claim:      #ef4444;
  --tag-name:       #f97316;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* Layout */
.nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand { font-weight: 700; font-size: 16px; color: var(--accent); text-decoration: none; }
.nav a { color: var(--text-muted); text-decoration: none; font-size: 13px; }
.nav a:hover { color: var(--text); }

.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 24px; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}
.card:hover { background: var(--bg-hover); cursor: pointer; }
.card-title { font-weight: 600; margin-bottom: 6px; }
.card-meta { font-size: 12px; color: var(--text-muted); }

/* Stats bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Tags */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin: 2px;
  cursor: pointer;
  color: #fff;
  text-decoration: none;
  opacity: 0.9;
}
.tag:hover { opacity: 1; }
.tag-entity     { background: var(--tag-entity); }
.tag-location   { background: var(--tag-location); }
.tag-date       { background: var(--tag-date); color: #000; }
.tag-agency     { background: var(--tag-agency); }
.tag-phenomenon { background: var(--tag-phenomenon); }
.tag-sensor     { background: var(--tag-sensor); }
.tag-document   { background: var(--tag-document); }
.tag-claim      { background: var(--tag-claim); }
.tag-name       { background: var(--tag-name); }

/* Thread type badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid currentColor;
}
.badge-chronological  { color: #f59e0b; }
.badge-corroboration  { color: #10b981; }
.badge-contradiction  { color: #ef4444; }
.badge-entity         { color: #6366f1; }
.badge-escalation     { color: #8b5cf6; }
.badge-person         { color: #f97316; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  color: var(--text-muted); padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.data-table tr:hover td { background: var(--bg-hover); cursor: pointer; }

/* Agency badges */
.agency {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  background: var(--border);
  color: var(--text-muted);
}

/* Two-panel layout (document reader) */
.two-panel { display: grid; grid-template-columns: 60% 40%; gap: 16px; height: calc(100vh - 100px); }
.panel-left { overflow: hidden; border-radius: 8px; border: 1px solid var(--border); }
.panel-right { overflow-y: auto; }

/* Section headers */
.section-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 16px 0 8px;
  font-weight: 600;
}

/* Loading + error states */
.loading { color: var(--text-muted); padding: 40px; text-align: center; }
.error   { color: #ef4444; padding: 16px; background: #1e1010; border-radius: 8px; }

/* Person role badges */
.role { font-size: 10px; padding: 1px 6px; border-radius: 3px; font-weight: 600; }
.role-author    { background: #1d4ed8; color: #fff; }
.role-subject   { background: #7c3aed; color: #fff; }
.role-witness   { background: #065f46; color: #fff; }
.role-signatory { background: #92400e; color: #fff; }
.role-mentioned { background: #374151; color: #9ca3af; }

/* Thread chain */
.thread-chain { position: relative; }
.thread-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 8px;
  cursor: pointer;
}
.thread-step:hover { background: var(--bg-hover); }
.thread-connector {
  text-align: center;
  color: var(--text-muted);
  font-size: 18px;
  margin: -4px 0;
  position: relative;
  z-index: 1;
}
.step-number {
  display: inline-block;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 24px;
  margin-right: 8px;
}
.link-explanation {
  font-size: 12px;
  color: var(--text-muted);
  border-left: 2px solid var(--border);
  padding-left: 12px;
  margin-top: 8px;
  font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
  .two-panel { grid-template-columns: 1fr; height: auto; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
}
