/* ════════════════════════════════════════════════════════════════
   SpotterNetwork Mapper — Main Stylesheet
   Dark / radar-inspired theme
   ════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
  --bg-base:       #0a0e14;
  --bg-surface:    #111827;
  --bg-elevated:   #1a2332;
  --bg-card:       #162032;
  --border:        #1e3048;
  --border-bright: #2a4a6e;

  --text-primary:  #e2e8f0;
  --text-secondary:#94a3b8;
  --text-muted:    #4a6080;

  --accent:        #38bdf8;
  --accent-dim:    #0e4f74;
  --accent-glow:   rgba(56, 189, 248, 0.15);

  --green:         #22c55e;
  --green-dim:     #14532d;
  --yellow:        #f59e0b;
  --red:           #ef4444;
  --purple:        #a855f7;

  --radar-green:   #00ff88;
  --radar-dim:     rgba(0, 255, 136, 0.08);

  --font-mono:     'Courier New', monospace;
  --font-sans:     -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius:        6px;
  --radius-lg:     10px;
  --shadow:        0 4px 20px rgba(0,0,0,0.5);
  --shadow-accent: 0 0 20px rgba(56,189,248,0.2);
}

/* ── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  background: var(--bg-base);
  color: var(--text-primary);
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: #7dd3fc; }

h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; }

/* ── Layout ─────────────────────────────────────────────────────── */
.page-wrapper { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Navbar ─────────────────────────────────────────────────────── */
.navbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.navbar-brand .brand-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-base);
  font-size: 14px;
}

.navbar-brand:hover { text-decoration: none; color: #7dd3fc; }

.version-badge {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  letter-spacing: 0.04em;
  align-self: center;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  flex: 1;
}

.navbar-nav a {
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: color 0.15s, background 0.15s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
  text-decoration: none;
}

.navbar-nav a.active { color: var(--accent); }

.navbar-search {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.2rem 0.5rem;
  gap: 0.4rem;
  width: 220px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.navbar-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.navbar-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  width: 100%;
}

.navbar-search input::placeholder { color: var(--text-muted); }

.navbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }

/* ── Status Pill ────────────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.status-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-live    { background: var(--green-dim);  color: var(--green);  border: 1px solid #166534; }
.status-live .dot { background: var(--green); animation: pulse-dot 1.5s infinite; }
.status-offline { background: #1c1008; color: var(--yellow); border: 1px solid #713f12; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.8); }
}

/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Dashboard Layout ──────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.dashboard-sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dashboard-map {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

/* ── Stats Bar ──────────────────────────────────────────────────── */
.stats-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.stat-item {
  flex: 1;
  padding: 0.6rem 0.75rem;
  text-align: center;
  border-right: 1px solid var(--border);
}

.stat-item:last-child { border-right: none; }

.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
  display: block;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* ── Sidebar Tabs ───────────────────────────────────────────────── */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-tab {
  flex: 1;
  padding: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

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

/* ── Spotter List ───────────────────────────────────────────────── */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-content::-webkit-scrollbar { width: 5px; }
.sidebar-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.spotter-list { list-style: none; }

.spotter-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}

.spotter-item:hover { background: var(--bg-elevated); }
.spotter-item.selected { background: var(--accent-dim); border-left: 3px solid var(--accent); }

.spotter-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.spotter-info { flex: 1; min-width: 0; }

.spotter-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.spotter-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  margin-top: 1px;
}

.spotter-speed {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--green);
  flex-shrink: 0;
  text-align: right;
}

/* ── Map Container ──────────────────────────────────────────────── */
#map {
  position: absolute;
  inset: 0;
  background: #0c1520;
}

/* ── Spotter Detail Panel ───────────────────────────────────────── */
#spotter-detail-panel {
  position: absolute;
  bottom: 30px;
  left: 10px;
  width: 280px;
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), var(--shadow-accent);
  z-index: 500;
  overflow: hidden;
  animation: slideUp 0.15s ease;
}

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

.detail-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.detail-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.detail-title { flex: 1; min-width: 0; }

.detail-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-callsign {
  font-size: 0.7rem;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-top: 1px;
}

.detail-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius);
  flex-shrink: 0;
  line-height: 1;
}
.detail-close:hover { color: var(--text-primary); background: var(--bg-base); }

.detail-stats {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.detail-stat {
  flex: 1;
  text-align: center;
  padding: 0.5rem 0.25rem;
  border-right: 1px solid var(--border);
}
.detail-stat:last-child { border-right: none; }
.detail-stat span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
}
.detail-stat small {
  display: block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 1px;
}

.detail-note {
  padding: 0.6rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
  display: flex;
  gap: 0.4rem;
}

.detail-note-icon { flex-shrink: 0; }

.detail-links {
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.detail-link {
  font-size: 0.73rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-link:hover { text-decoration: underline; }

.detail-actions {
  padding: 0.5rem 0.75rem;
  display: flex;
  gap: 0.4rem;
}
.detail-actions .popup-btn { flex: 1; text-align: center; }

/* ── Reports Sidebar List ───────────────────────────────────────── */
.report-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.report-item:hover { background: var(--bg-elevated); }

.report-type-badge {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.report-info { flex: 1; min-width: 0; }
.report-name { font-size: 0.8rem; color: var(--text-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-meta { font-size: 0.7rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 0.1rem; margin-top: 0.1rem; }
.report-msg  { color: var(--text-secondary); font-style: italic; }

/* ── Map Overlays ───────────────────────────────────────────────── */
.map-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.map-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.map-btn:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border-bright); }
.map-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

.map-info-panel {
  position: absolute;
  bottom: 30px;
  left: 10px;
  z-index: 500;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  min-width: 200px;
  max-width: 300px;
  display: none;
  box-shadow: var(--shadow);
}

.map-info-panel.visible { display: block; }
.map-info-panel h4 { color: var(--accent); font-size: 0.875rem; margin-bottom: 0.4rem; }
.map-info-panel .info-row { display: flex; justify-content: space-between; font-size: 0.75rem; padding: 0.15rem 0; }
.map-info-panel .info-label { color: var(--text-muted); }
.map-info-panel .info-value { color: var(--text-primary); font-family: var(--font-mono); }

/* ── MapLibre GL JS popup overrides ────────────────────────────── */
.maplibregl-popup-content {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-bright) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  padding: 0.75rem !important;
  min-width: 200px;
}

.maplibregl-popup-tip { border-top-color: var(--bg-surface) !important; }
.maplibregl-popup-close-button {
  color: var(--text-muted) !important;
  font-size: 1rem !important;
  line-height: 1 !important;
  right: 6px !important;
  top: 4px !important;
}
.maplibregl-popup-close-button:hover { color: var(--text-primary) !important; background: none !important; }

/* MapLibre attribution + controls */
.maplibregl-ctrl-attrib { background: rgba(10,14,20,0.75) !important; color: var(--text-muted) !important; font-size: 0.65rem !important; }
.maplibregl-ctrl-attrib a { color: var(--accent) !important; }
.maplibregl-ctrl button { background-color: var(--bg-elevated) !important; border-color: var(--border) !important; color: var(--text-primary) !important; }
.maplibregl-ctrl button:hover { background-color: var(--bg-card) !important; }
.maplibregl-ctrl button span { filter: invert(1) brightness(0.8); }

.popup-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  padding: 0.1rem 0;
  gap: 1rem;
}

.popup-label { color: var(--text-muted); }
.popup-value { color: var(--text-primary); font-family: var(--font-mono); }

.popup-actions { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); display: flex; gap: 0.4rem; }
.popup-btn {
  flex: 1;
  text-align: center;
  padding: 0.25rem 0.4rem;
  border-radius: var(--radius);
  font-size: 0.7rem;
  background: var(--bg-elevated);
  color: var(--accent);
  border: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.popup-btn:hover { background: var(--accent-dim); text-decoration: none; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
}

/* ── Trip List ──────────────────────────────────────────────────── */
.trip-list { list-style: none; }

.trip-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}

.trip-item:hover { background: var(--bg-elevated); }

.trip-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.trip-indicator.active  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.trip-indicator.ended   { background: var(--text-muted); }

.trip-info { flex: 1; min-width: 0; }

.trip-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trip-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
}

.trip-distance {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  flex-shrink: 0;
}

/* ── Page Container ─────────────────────────────────────────────── */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 { font-size: 1.5rem; color: var(--text-primary); }
.page-header p  { color: var(--text-secondary); margin-top: 0.25rem; font-size: 0.875rem; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--border-bright); }

/* ── Trip Page ──────────────────────────────────────────────────── */
.trip-page-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1rem;
}

.trip-map-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

#trip-map { height: 520px; width: 100%; position: relative; }

/* ── Playback Controls ──────────────────────────────────────────── */
.playback-controls {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 0.6rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.playback-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.playback-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.15s;
  flex-shrink: 0;
}

.playback-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.playback-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

.playback-scrubber {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.playback-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent);
}

.playback-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  min-width: 80px;
  text-align: right;
  flex-shrink: 0;
}

.speed-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  cursor: pointer;
}

/* ── Stats Grid ─────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stats-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
}

.stats-box .val {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
}

.stats-box .lbl {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

/* ── Search Page ────────────────────────────────────────────────── */
.search-input-wrapper {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input-wrapper input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 1rem;
  padding: 0.75rem 1rem;
}

.search-input-wrapper input::placeholder { color: var(--text-muted); }

.search-submit-btn {
  background: var(--accent);
  border: none;
  color: var(--bg-base);
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.search-submit-btn:hover { background: #7dd3fc; }

.search-results { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }

.search-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

.search-result-card:hover {
  border-color: var(--border-bright);
  background: var(--bg-elevated);
}

.result-avatar {
  width: 44px;
  height: 44px;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.result-info { flex: 1; min-width: 0; }
.result-name { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.result-sub  { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.result-stats { text-align: right; flex-shrink: 0; }
.result-stat-val { font-family: var(--font-mono); font-size: 0.9rem; font-weight: 700; color: var(--accent); }
.result-stat-lbl { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; }

/* ── Spotter Profile ────────────────────────────────────────────── */
.profile-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.profile-avatar {
  width: 68px;
  height: 68px;
  background: var(--accent-dim);
  border: 3px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.profile-name { font-size: 1.4rem; font-weight: 700; }
.profile-callsign { color: var(--accent); font-family: var(--font-mono); font-size: 1rem; margin-top: 0.15rem; }
.profile-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.profile-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: center;
}

.profile-stat-card .val {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
  display: block;
}

.profile-stat-card .lbl {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

#profile-map { height: 300px; width: 100%; border-radius: var(--radius-lg); overflow: hidden; }

/* ── Tables ─────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.data-table th {
  text-align: left;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.data-table tr:hover td { background: var(--bg-elevated); }
.data-table td .mono { font-family: var(--font-mono); color: var(--accent); }
.data-table td a { color: var(--accent); }

.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-active  { background: var(--green-dim);  color: var(--green);  border: 1px solid #166534; }
.badge-ended   { background: #1c1c2e;            color: var(--text-muted); border: 1px solid var(--border); }
.badge-warning { background: #1c1008;            color: var(--yellow); border: 1px solid #713f12; }

/* ── Admin Panel ────────────────────────────────────────────────── */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}

.admin-stat .val { font-size: 1.8rem; font-weight: 700; font-family: var(--font-mono); color: var(--accent); }
.admin-stat .lbl { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.admin-stat .sub { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.2rem; }

.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.3rem; }

.form-input,
.form-select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-base);
  border-color: var(--accent);
}

.btn-primary:hover { background: #7dd3fc; text-decoration: none; }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-secondary:hover { background: var(--bg-card); color: var(--text-primary); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}

.btn-danger:hover { background: rgba(239,68,68,0.15); }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.75rem; }

/* ── Alert ──────────────────────────────────────────────────────── */
.alert {
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.alert-success { background: var(--green-dim);  color: var(--green);  border: 1px solid #166534; }
.alert-error   { background: #1c0808;            color: var(--red);    border: 1px solid #7f1d1d; }
.alert-info    { background: var(--accent-dim);  color: var(--accent); border: 1px solid #0e4f74; }

/* ── Pagination ─────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1.5rem;
}

.page-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
  text-decoration: none;
}

.page-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.page-btn.active { background: var(--accent); color: var(--bg-base); border-color: var(--accent); }
.page-btn:disabled, .page-btn.disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Loading ────────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10,14,20,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  border-radius: var(--radius-lg);
}

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

.empty-state .icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state h3    { font-size: 1rem; color: var(--text-secondary); }
.empty-state p     { font-size: 0.8rem; margin-top: 0.25rem; }

/* ── MapLibre tile dark-mode filter ────────────────────────────── */
.maplibregl-map canvas { filter: brightness(0.65) saturate(0.8) hue-rotate(180deg) invert(1); }
.maplibregl-map { background: #0c1520; }

/* ── Footer ─────────────────────────────────────────────────────── */
.footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 240px 1fr;
    height: auto;
    min-height: calc(100vh - 52px);
  }

  .dashboard-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    height: 240px;
  }

  .dashboard-map { min-height: calc(100vh - 52px - 240px); }

  .trip-page-grid { grid-template-columns: 1fr; }

  .profile-stats-grid { grid-template-columns: repeat(2, 1fr); }

  .admin-grid { grid-template-columns: repeat(2, 1fr); }

  .navbar-search { display: none; }
}

@media (max-width: 600px) {
  .stats-bar .stat-item:nth-child(n+4) { display: none; }
  .profile-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
}
