/* Tri-Watch — Public Safety Intelligence */
:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #242835;
  --border: #2d3141;
  --text: #e4e4e7;
  --text-muted: #9ca3af;
  --accent: #3b82f6;
  --red: #ef4444;
  --orange: #f97316;
  --yellow: #eab308;
  --green: #22c55e;
  --purple: #a855f7;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Header */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.stats-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sep { opacity: 0.4; }

/* Tabs */
.tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  max-width: 1200px;
  margin: 0 auto;
  position: sticky;
  top: 0;
  z-index: 100;
}

.tab {
  flex: 1;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.tab:hover { color: var(--text); background: var(--surface-hover); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.filter-bar select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  flex: 1;
  min-width: 120px;
}

/* Views */
.view { display: none; }
.view.active { display: block; }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  min-height: 60vh;
}

/* Incident List */
.incident-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.incident-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  transition: background 0.2s;
  cursor: default;
}

.incident-card:hover { background: var(--surface-hover); }

.incident-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.incident-type {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.type-Crime { background: rgba(239,68,68,0.15); color: var(--red); }
.type-Traffic { background: rgba(249,115,22,0.15); color: var(--orange); }
.type-Fire\/EMS, .type-Fire-EMS { background: rgba(234,179,8,0.15); color: var(--yellow); }
.type-Suspicious { background: rgba(168,85,247,0.15); color: var(--purple); }
.type-Other { background: rgba(156,163,175,0.15); color: var(--text-muted); }

.incident-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.incident-description {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text);
}

.incident-meta {
  display: flex;
  gap: 1rem;
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.confidence-high { color: var(--green); }
.confidence-medium { color: var(--yellow); }
.confidence-low { color: var(--text-muted); }

.units { color: var(--accent); }

/* Map */
.map-container {
  height: calc(100vh - 240px);
  min-height: 400px;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0.5rem 0;
}

/* Stats */
.stats-content {
  padding: 1rem 0;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 0.75rem;
}

.stat-card h3 {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.stat-item {
  text-align: center;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: var(--radius);
}

.stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Footer */
footer {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.disclaimer { font-size: 0.65rem; opacity: 0.6; margin-top: 0.5rem; }

/* Mobile */
@media (max-width: 640px) {
  header h1 { font-size: 1.25rem; }
  .tab { font-size: 0.8rem; padding: 0.625rem 0.5rem; }
  .filter-bar { flex-direction: column; }
  .filter-bar select { min-width: 100%; }
  .map-container { height: calc(100vh - 280px); }
}
