/* === Mapstein — Futuristic Dark Theme === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #060a10;
  --surface: rgba(10, 18, 30, 0.92);
  --surface-solid: #0a121e;
  --border: rgba(0, 204, 255, 0.12);
  --border-bright: rgba(0, 204, 255, 0.3);
  --text: #d0e8ff;
  --text-muted: #5a7a99;
  --accent: #00ccff;
  --accent-dim: rgba(0, 204, 255, 0.15);
  --red: #ff0033;
  --green: #00ff66;
  --purple: #9944ff;
  --radius: 4px;
  --glow: 0 0 20px rgba(0, 204, 255, 0.08);
  --font: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

#sigma-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse at center, #0a1420 0%, #060a10 70%);
}

/* === Search === */
#search-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: min(400px, calc(100vw - 32px));
}

#search-input {
  width: 100%;
  padding: 10px 16px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 204, 255, 0.15);
}

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

#search-results {
  margin-top: 2px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

#search-results.active {
  display: block;
}

.search-result-item {
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover,
.search-result-item.selected {
  background: var(--accent-dim);
}

.search-result-name {
  font-weight: 600;
  font-size: 13px;
}

.search-result-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* === Filter Panel === */
#filter-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
}

#filter-toggle {
  width: 36px;
  height: 36px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#filter-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#filter-dropdown {
  position: absolute;
  top: 44px;
  right: 0;
  width: 220px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--glow);
}

#filter-dropdown.hidden { display: none; }

.filter-section { margin-bottom: 12px; }

.filter-section h4 {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.filter-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-muted);
}

.filter-check input[type="checkbox"] {
  accent-color: var(--accent);
}

.filter-btn {
  width: 100%;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 10px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* === Info Panel === */
#info-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(340px, 85vw);
  height: 100vh;
  background: var(--surface-solid);
  border-left: 1px solid var(--border);
  padding: 24px 20px;
  overflow-y: auto;
  z-index: 200;
  transform: translateX(0);
  transition: transform 0.2s ease;
}

#info-panel.hidden {
  transform: translateX(100%);
  pointer-events: none;
}

#info-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#info-close:hover {
  border-color: var(--red);
  color: var(--red);
}

#info-photo-wrap {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
}

#info-photo-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 4px;
  background: rgba(0, 204, 255, 0.08);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font);
}

#info-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 2px;
}

#info-role {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 2px;
}

#info-location {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

#info-bio {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 12px;
}

#info-link {
  display: inline-block;
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 12px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

#info-link:hover { opacity: 1; }

#info-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
}

.info-tag {
  padding: 2px 8px;
  background: var(--accent-dim);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 9px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
}

#info-panel h3 {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 8px;
  margin-top: 4px;
}

/* === Role History === */
#info-roles { margin-bottom: 16px; }

.role-item {
  padding: 4px 0;
  border-bottom: 1px solid rgba(0,204,255,0.05);
  font-size: 11px;
}

.role-item:last-child { border-bottom: none; }
.role-title { font-weight: 600; color: var(--text); }
.role-org { color: var(--text-muted); }

.role-years {
  font-size: 9px;
  color: var(--text-muted);
  margin-left: 4px;
  opacity: 0.6;
}

.role-active {
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
  margin-left: 6px;
  letter-spacing: 1px;
}

/* === Connections === */
#info-connections { list-style: none; }

#info-connections li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(0,204,255,0.05);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s;
}

#info-connections li:hover { color: var(--accent); }

.conn-name { font-weight: 600; }

.conn-label {
  color: var(--text-muted);
  font-size: 10px;
}

.conn-type {
  display: inline-block;
  padding: 1px 5px;
  background: rgba(0,204,255,0.06);
  border-radius: 2px;
  font-size: 9px;
  color: var(--text-muted);
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.conn-years {
  font-size: 9px;
  color: var(--text-muted);
  margin-left: 4px;
  opacity: 0.6;
}

/* === Timeline === */
#timeline-bar {
  position: fixed;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  min-width: 300px;
  max-width: min(500px, calc(100vw - 200px));
}

#timeline-label {
  font-size: 12px;
  font-weight: 700;
  min-width: 55px;
  text-align: center;
  white-space: nowrap;
  color: var(--accent);
  font-family: var(--font);
}

#timeline-slider {
  flex: 1;
  height: 2px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-bright);
  border-radius: 1px;
  outline: none;
  cursor: pointer;
}

#timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--accent);
  cursor: grab;
  border: none;
  box-shadow: 0 0 8px rgba(0, 204, 255, 0.4);
}

#timeline-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--accent);
  cursor: grab;
  border: none;
  box-shadow: 0 0 8px rgba(0, 204, 255, 0.4);
}

#timeline-toggle {
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 10px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s;
}

#timeline-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#timeline-toggle.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* === Zoom Controls === */
#zoom-controls {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
}

#zoom-controls button {
  width: 32px;
  height: 32px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 16px;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#zoom-controls button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* === Legend === */
#legend {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  z-index: 100;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 10px;
  font-family: var(--font);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
  box-shadow: 0 0 6px currentColor;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }

/* === Mobile === */
@media (max-width: 640px) {
  #search-container {
    top: 8px;
    width: calc(100vw - 56px);
    left: 8px;
    transform: none;
  }
  #filter-panel { top: 8px; right: 8px; }
  #info-panel { width: 100vw; }
  #legend {
    bottom: 8px;
    left: 8px;
    right: 72px;
    font-size: 8px;
    gap: 6px;
    padding: 4px 8px;
  }
  #zoom-controls { bottom: 8px; right: 8px; }
  #zoom-controls button { width: 28px; height: 28px; font-size: 14px; }
  #timeline-bar {
    bottom: 40px;
    min-width: 0;
    max-width: calc(100vw - 32px);
    padding: 4px 8px;
    gap: 6px;
  }
  #timeline-label { font-size: 10px; min-width: 44px; }
}
