/* ==========================================================================
   GEOSHIFT — LUNAR SITE EPHEMERIS & MISSION NAVIGATOR
   Professional Aerospace Mission Control & Telemetry Dashboard
   ========================================================================== */

:root {
  /* Color Palette - Professional Deep Space Slate (Default Dark) */
  --bg: #070b12;
  --bg-subtle: #0b111e;
  --panel: #0d1424;
  --panel-card: #0f182c;
  --panel-hover: #141f38;
  --panel-active: #192745;
  --ink: #e2e8f0;
  --ink-secondary: #94a3b8;
  --ink-muted: #64748b;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --line-focus: #0284c7;

  /* Ephemeris Data Accents */
  --sun: #d97706;
  --sun-bright: #f59e0b;
  --sun-subtle: rgba(245, 158, 11, 0.12);
  --earth: #0284c7;
  --earth-bright: #38bdf8;
  --earth-subtle: rgba(56, 189, 248, 0.12);
  --good: #059669;
  --good-bright: #10b981;
  --good-subtle: rgba(16, 185, 129, 0.12);
  --mid: #ea580c;
  --bad: #dc2626;

  /* Graphic Colors */
  --night: #060911;
  --sky: #0a1120;

  /* Compact Scale & Radii */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 3px 12px rgba(0, 0, 0, 0.45);

  color-scheme: dark;
  box-sizing: border-box;
}

/* Light Theme (Clean Technical Blueprint) */
:root[data-theme="light"] {
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --panel: #ffffff;
  --panel-card: #ffffff;
  --panel-hover: #f1f5f9;
  --panel-active: #e2e8f0;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --ink-muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --line-focus: #0284c7;

  --sun: #d97706;
  --sun-bright: #b45309;
  --sun-subtle: rgba(217, 119, 6, 0.08);
  --earth: #0284c7;
  --earth-bright: #0369a1;
  --earth-subtle: rgba(2, 132, 199, 0.08);
  --good: #059669;
  --good-bright: #047857;
  --good-subtle: rgba(5, 150, 105, 0.08);
  --mid: #ea580c;
  --bad: #dc2626;

  --night: #e2e8f0;
  --sky: #edf2f7;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.07);

  color-scheme: light;
}

/* Global Reset & Base Typography */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-size: 13px;
  line-height: 1.45;
  overflow-x: hidden;
}

main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 14px 40px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==========================================================================
   TOP BAR & NAVIGATION (SLIM, CLEAN, NO CLUTTER)
   ========================================================================== */

.top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  margin: 0 -14px 4px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.brand-h1 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.brand-geo {
  color: var(--ink);
}

.brand-shift {
  color: var(--earth-bright);
}

.brand-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--earth-subtle);
  color: var(--earth-bright);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.sub {
  margin: 0;
  color: var(--ink-muted);
  font-size: 11px;
}

/* Minimalist Tabs */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.tabs button {
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
}

.tabs button:hover {
  color: var(--ink);
  background: var(--panel-hover);
}

.tabs button[aria-pressed="true"] {
  background: var(--panel-active);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--line-strong);
}

/* Header Action Tools */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--ink-secondary);
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 5px var(--good);
}

.status-dot.loading {
  background: var(--sun);
  box-shadow: 0 0 5px var(--sun);
  animation: pulse 1s infinite ease-in-out;
}

.status-dot.error {
  background: var(--bad);
  box-shadow: 0 0 5px var(--bad);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
}

.icon-btn:hover {
  background: var(--panel-hover);
  color: var(--ink);
  border-color: var(--line-strong);
}

/* ==========================================================================
   TOOLBARS & CONTROL BARS (COMPACT, DENSE, NO FLASHY GRADIENTS)
   ========================================================================== */

.console-bar, .playback-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.console-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.input-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

select,
input[type="date"],
input[type="text"] {
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  background: var(--panel-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  height: 28px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.12s ease;
}

select:hover,
input[type="date"]:hover {
  border-color: var(--ink-muted);
}

select:focus,
input[type="date"]:focus {
  border-color: var(--line-focus);
}

/* Minimalist Button Styling */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0284c7;
  color: #ffffff;
  border: 1px solid #0369a1;
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  height: 28px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease;
}

.btn-primary:hover {
  background: #0369a1;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  height: 28px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-secondary:hover {
  background: var(--panel-hover);
  border-color: var(--line-strong);
}

/* Preset Pills */
.presets-group {
  display: flex;
  align-items: center;
  gap: 3px;
}

.preset-pill {
  font-size: 10px;
  font-weight: 500;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-secondary);
  border: 1px solid var(--line);
  cursor: pointer;
}

.preset-pill:hover {
  background: var(--panel-hover);
  color: var(--ink);
}

/* Transport Controls */
.transport-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  height: 28px;
  background: var(--panel-card);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.play-btn:hover {
  background: var(--panel-hover);
  border-color: var(--ink-secondary);
}

.step-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  cursor: pointer;
  font-size: 11px;
}

.step-btn:hover {
  background: var(--panel-hover);
  color: var(--ink);
  border-color: var(--line-strong);
}

/* Segmented Control */
.seg {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.seg button {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.seg button:hover {
  color: var(--ink);
}

.seg button[aria-pressed="true"] {
  background: var(--panel-card);
  color: var(--ink);
  font-weight: 600;
}

.telemetry-meta {
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.35;
}

.bad {
  color: var(--bad);
}

/* ==========================================================================
   PANELS & CARDS (SUBTLE, DENSE, NO GIANT SHADOWS)
   ========================================================================== */

.tab {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.tab.on {
  display: flex;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  min-width: 0;
  position: relative;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}

h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  letter-spacing: 0.01em;
}

.panel-action-btn {
  display: inline-flex;
  align-items: center;
  background: var(--panel-card);
  color: var(--ink-secondary);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
}

.panel-action-btn:hover {
  background: var(--panel-hover);
  color: var(--ink);
  border-color: var(--line-strong);
}

/* ==========================================================================
   KPI TELEMETRY METRIC TILES (CLEAN DATA TILES, ZERO EMOJIS)
   ========================================================================== */

.site-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2px;
}

.sname {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sname small {
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-muted);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.kpi {
  position: relative;
  overflow: hidden;
  padding: 10px 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--panel-card);
  border: 1px solid var(--line);
}

.kpi-title {
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.kpi b {
  font-size: 20px;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
  color: var(--ink);
  display: block;
  line-height: 1.2;
}

.kpi-sub {
  color: var(--ink-muted);
  font-size: 10px;
  margin-top: 2px;
  display: block;
}

.kpi-progress-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2.5px;
}

/* ==========================================================================
   VISUALIZATIONS (PANORAMA & SKY VIEW)
   ========================================================================== */

.stage {
  perspective: 1200px;
}

.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 10px;
}

@media (max-width: 860px) {
  .grid2 {
    grid-template-columns: 1fr;
  }
}

.sky-card {
  cursor: pointer;
}

.sky-card:hover {
  border-color: var(--line-strong);
}

.sky-canvas-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sky-expand-prompt {
  position: absolute;
  bottom: 8px;
  background: rgba(13, 20, 36, 0.9);
  color: var(--earth-bright);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  opacity: 0.85;
  pointer-events: none;
}

svg {
  display: block;
  width: 100%;
  height: auto;
}

.note {
  font-size: 11px;
  color: var(--ink-muted);
  margin: 6px 0 0;
  line-height: 1.4;
}

.now-cockpit {
  font-size: 12px;
  min-height: 3em;
  margin: 8px 0 0;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  line-height: 1.5;
}

.k {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.sunk {
  background: var(--sun-bright);
}

.earthk {
  background: var(--earth-bright);
}

/* Sliders */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--earth-bright);
  border: 1px solid #ffffff;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--earth-bright);
  border: 1px solid #ffffff;
  cursor: pointer;
}

/* ==========================================================================
   FULLSCREEN OBSERVATORY (CLEAN, TECHNICAL, HIGH PRECISION)
   ========================================================================== */

.sky-fullscreen-overlay {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  background: #060a12;
  flex-direction: column;
  overflow: hidden;
}

.sky-fullscreen-overlay.active {
  display: flex;
}

.fs-top-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #090e1a;
  border-bottom: 1px solid var(--line);
  z-index: 10;
  flex-wrap: wrap;
  gap: 10px;
}

.fs-site-info {
  display: flex;
  flex-direction: column;
}

.fs-site-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.fs-site-coords {
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--ink-muted);
}

.fs-telemetry-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fs-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
}

.fs-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fs-minimize-btn {
  display: inline-flex;
  align-items: center;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid var(--line-strong);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.fs-minimize-btn:hover {
  background: var(--bad);
  color: #ffffff;
}

.fs-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px;
}

.fs-svg-container {
  width: 100%;
  height: 100%;
  max-width: min(82vh, 82vw);
  max-height: min(82vh, 82vw);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#fsSkySvg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.fs-reticle {
  position: absolute;
  pointer-events: none;
  font-size: 10px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--earth-bright);
  background: rgba(9, 14, 26, 0.9);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  transform: translate(10px, -50%);
  display: none;
  white-space: nowrap;
  z-index: 20;
}

.fs-bottom-dock {
  background: #090e1a;
  border-top: 1px solid var(--line);
  padding: 8px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}

.fs-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fs-slider-row input[type="range"] {
  flex: 1;
}

.fs-time-display {
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--ink);
  min-width: 160px;
  text-align: right;
}

.fs-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.fs-controls-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fs-controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--ink-muted);
}

/* ==========================================================================
   TABLES & RANKING MATRIX
   ========================================================================== */

.scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th, td {
  text-align: left;
  padding: 7px 9px;
  border-top: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.15);
}

tr[data-i], tr[data-b] {
  cursor: pointer;
}

tr[data-i]:hover, tr[data-b]:hover {
  background: var(--panel-hover);
}

tr.sel {
  background: rgba(56, 189, 248, 0.12);
  font-weight: 600;
}

.th {
  border: 0;
  background: none;
  padding: 0;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  cursor: pointer;
}

.th:hover {
  color: var(--ink);
}

.th.on {
  color: var(--earth-bright);
}

.win {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding: 8px 10px;
  margin-top: 6px;
  background: var(--panel-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.win b {
  color: var(--earth-bright);
}

.ctl {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
  margin-bottom: 8px;
}

.crow {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.crow svg {
  height: 28px;
  background: var(--night);
  border-radius: 4px;
}

.tl text {
  fill: var(--ink-muted);
  font-size: 10px;
}

/* ==========================================================================
   ABOUT & BRIEFING
   ========================================================================== */

.about-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 820px;
  line-height: 1.6;
}

.about-content h2 {
  font-size: 14px;
  color: var(--earth-bright);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  margin-top: 14px;
}

.about-content h2:first-child {
  margin-top: 0;
}

.shortcut-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  font-size: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  color: var(--ink);
}

/* Modal */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-box {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 18px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-md);
}

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

.modal-close {
  background: none;
  border: 0;
  font-size: 14px;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 2px 6px;
}

@media (max-width: 768px) {
  main {
    padding: 0 8px 30px;
  }
  .top {
    margin: 0 -8px 4px;
    padding: 6px 10px;
  }
}
