/* globe.css — Standalone Chicago Offline Globe */

:root {
  --bg:         #0C0F1A;
  --surface:    #141829;
  --surface-2:  #1c2038;
  --border:     #2a2e45;
  --cyan:       #00E5FF;
  --amber:      #FFB300;
  --green:      #39FF14;
  --text:       #EDF2FF;
  --text-muted: #A0AABF;
  --accent:     #00E5FF;
  --font:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono:       'JetBrains Mono', 'Fira Code', monospace;
  --nav-h:      48px;
}

/* Light mode */
[data-theme="light"] {
  --bg:         #F0F2F5;
  --surface:    #FFFFFF;
  --surface-2:  #E8EBF0;
  --border:     #D0D5DD;
  --cyan:       #0097A7;
  --amber:      #E65100;
  --green:      #2E7D32;
  --text:       #1A1D26;
  --text-muted: #5A6170;
  --accent:     #0097A7;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

/* ── Nav ── */
#topNav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 2000;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo { font-size: 22px; }

.nav-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1.5px;
  color: var(--cyan);
}

.nav-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}

.live-dot.connected {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.live-label {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-muted);
}

/* ── Theme toggle (matches CoreScope) ── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}

.theme-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.theme-toggle-track {
  position: relative;
  width: 46px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
}

.theme-toggle input:checked ~ .theme-toggle-track {
  background: var(--accent);
}

.theme-toggle-thumb {
  position: absolute;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.2s ease;
  z-index: 1;
}

.theme-toggle input:checked ~ .theme-toggle-track .theme-toggle-thumb {
  transform: translateX(22px);
}

.theme-toggle-icon {
  position: absolute;
  font-size: 10px;
  line-height: 1;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  user-select: none;
  transition: opacity 0.2s ease;
}

.theme-toggle-sun { right: 4px; opacity: 1; }
.theme-toggle-moon { left: 4px; opacity: 0; }
.theme-toggle input:checked ~ .theme-toggle-track .theme-toggle-sun { opacity: 0; }
.theme-toggle input:checked ~ .theme-toggle-track .theme-toggle-moon { opacity: 1; }

/* ── Globe container ── */
#globeContainer {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  bottom: 0;
}

/* ── Cesium overrides ── */
.cesium-viewer {
  font-family: var(--font) !important;
}

.cesium-viewer-toolbar {
  top: 12px !important;
  right: 12px !important;
}

.cesium-button {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 4px !important;
}

.cesium-button:hover {
  background: var(--surface-2) !important;
}

/* Cesium toolbar SVG icons — invert for light mode */
[data-theme="light"] .cesium-button svg,
[data-theme="light"] .cesium-button img,
[data-theme="light"] .cesium-button path {
  filter: invert(1);
}

[data-theme="light"] .cesium-button {
  background: #E8EBF0 !important;
  color: #1A1D26 !important;
  border-color: #D0D5DD !important;
}

[data-theme="light"] .cesium-button:hover {
  background: #D0D5DD !important;
}

.cesium-infoBox {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

.cesium-infoBox-title {
  background: var(--surface-2) !important;
  color: var(--text) !important;
}

.cesium-infoBox iframe {
  background: var(--surface) !important;
}

/* Hide Cesium credit bar */
.cesium-credit-logoContainer,
.cesium-credit-expand-link {
  display: none !important;
}

/* ── Overlay panels ── */
.globe-overlay {
  position: fixed;
  background: rgba(20, 24, 41, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  z-index: 1500;
}

[data-theme="light"] .globe-overlay {
  background: rgba(255, 255, 255, 0.92);
}

/* Stats — top left */
.globe-stats {
  top: calc(var(--nav-h) + 12px);
  left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-value {
  color: var(--cyan);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 14px;
  min-width: 20px;
}

/* Layers toggle button */
.layers-toggle-btn {
  position: fixed;
  top: calc(var(--nav-h) + 60px);
  left: 12px;
  z-index: 1600;
  background: rgba(20, 24, 41, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 18px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

[data-theme="light"] .layers-toggle-btn {
  background: rgba(255, 255, 255, 0.92);
}

.layers-toggle-btn:hover {
  background: var(--surface-2);
  border-color: var(--cyan);
}

.layers-toggle-btn.hidden { display: none; }

/* Controls panel — left side, collapsible */
.globe-controls {
  top: calc(var(--nav-h) + 60px);
  left: 12px;
  display: none;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  max-height: calc(100vh - var(--nav-h) - 140px);
  overflow-y: auto;
}

.globe-controls.open {
  display: flex;
}

.controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.controls-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.controls-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.controls-close:hover { color: var(--text); background: var(--surface-2); }

.controls-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.controls-section-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
  margin-bottom: 2px;
  opacity: 0.7;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
}

.toggle-label input[type="checkbox"] {
  accent-color: var(--cyan);
  width: 14px;
  height: 14px;
}

.toggle-label:hover { color: var(--text); }

.ctrl-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
  width: 100%;
  text-align: left;
}

.ctrl-btn:hover {
  color: var(--text);
  border-color: var(--cyan);
  background: rgba(0, 229, 255, 0.08);
}

/* ── VCR bar ── */
.globe-vcr {
  position: fixed;
  bottom: 16px;
  left: 12px;
  right: 12px;
  background: rgba(20, 24, 41, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1500;
  font-family: var(--mono);
  font-size: 13px;
}

[data-theme="light"] .globe-vcr {
  background: rgba(255, 255, 255, 0.92);
}

/* VCR LCD */
.vcr-lcd {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  min-width: 110px;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.3), 0 0 8px rgba(0,229,255,0.1);
  gap: 1px;
}

[data-theme="light"] .vcr-lcd {
  background: rgba(255,255,255,0.6);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.vcr-lcd-row {
  font-family: 'Courier New', 'Consolas', monospace;
  letter-spacing: 2px;
  line-height: 1.1;
  text-align: right;
  white-space: nowrap;
}

.vcr-lcd-mode {
  font-size: 10px;
  color: var(--green);
  text-shadow: 0 0 6px rgba(57, 255, 20, 0.6);
  font-weight: 700;
}

.vcr-lcd-mode.replay {
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.6);
}

.vcr-lcd-mode.paused {
  color: var(--amber);
  text-shadow: 0 0 6px rgba(255, 179, 0, 0.6);
}

.vcr-lcd-clock {
  font-size: 16px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
  font-weight: 700;
}

.vcr-lcd-events {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 600;
}

/* VCR controls */
.vcr-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}

.vcr-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
}

.vcr-btn:hover {
  background: var(--surface);
  border-color: var(--cyan);
}

.vcr-play  { color: var(--green); }
.vcr-pause { color: var(--amber); }
.vcr-speed { font-family: var(--mono); font-size: 11px; min-width: 30px; text-align: center; }

.vcr-live-btn {
  color: var(--green);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.vcr-scope-btns {
  display: flex;
  gap: 2px;
}

.vcr-scope-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mono);
  transition: all 0.15s;
}

.vcr-scope-btn.active {
  background: rgba(0, 229, 255, 0.15);
  color: var(--cyan);
  border-color: rgba(0, 229, 255, 0.3);
}

.vcr-scope-btn:hover {
  border-color: var(--cyan);
}

/* VCR Timeline */
.vcr-timeline-container {
  flex: 1;
  position: relative;
  height: 28px;
  min-width: 120px;
}

.vcr-timeline {
  width: 100%;
  height: 100%;
  cursor: grab;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  touch-action: none;
}

[data-theme="light"] .vcr-timeline {
  background: rgba(0, 0, 0, 0.04);
}

.vcr-timeline:active, .vcr-timeline.dragging {
  cursor: grabbing;
}

.vcr-playhead {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: #f87171;
  border-radius: 1px;
  pointer-events: none;
  box-shadow: 0 0 4px rgba(248, 113, 113, 0.5);
  right: 0;
}

/* ── Camera debug bar ── */
.camera-debug {
  position: fixed;
  bottom: 52px;
  left: 12px;
  right: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1400;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  background: rgba(20, 24, 41, 0.6);
  padding: 4px 10px;
  border-radius: 6px;
  width: fit-content;
}

[data-theme="light"] .camera-debug {
  background: rgba(255, 255, 255, 0.7);
}

.camera-debug span {
  white-space: nowrap;
}

.camera-debug .cd-label {
  color: var(--text-muted);
  opacity: 0.6;
}

.camera-debug .cd-val {
  color: var(--cyan);
}

/* ── Mobile ── */
@media (max-width: 640px) {
  .globe-stats { font-size: 11px; padding: 6px 10px; }
  .globe-vcr { font-size: 11px; padding: 6px 10px; gap: 6px; flex-wrap: wrap; justify-content: center; }
  .vcr-scope-btns { order: 3; width: 100%; justify-content: center; }
  .vcr-timeline-container { order: 4; width: 100%; flex: none; height: 20px; }
  .layers-toggle-btn { top: calc(var(--nav-h) + 8px); left: auto; right: 12px; }
  .globe-controls.open { left: 12px; right: 12px; min-width: auto; }
  .camera-debug { font-size: 9px; gap: 8px; }
}
