/* style.css — Deep Space Sci-Fi Theme for Solar System Explorer */

:root {
  --bg-space: #02040a;
  --panel-bg: rgba(15, 23, 42, 0.85);
  --panel-border: rgba(56, 189, 248, 0.25);
  --accent-cyan: #38bdf8;
  --accent-gold: #f59e0b;
  --accent-green: #4ade80;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-space);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

canvas {
  width: 100%;
  height: 100%;
  outline: none;
  display: block;
}

/* ── Back to Home Link (Standard across Science suite) ── */
#homeBtn {
  position: fixed;
  top: 14px;
  left: 16px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 9999px;
  color: #f1f5f9;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
  cursor: pointer;
}

#homeBtn:hover {
  background: rgba(30, 58, 138, 0.9);
  border-color: var(--accent-cyan);
  color: #ffffff;
  transform: translateY(-1px);
}

/* ── Floating Language Switcher ── */
.lang-switch {
  position: fixed;
  top: 14px;
  left: 122px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 2px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.lang-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}

.lang-btn:hover {
  color: #ffffff;
}

.lang-btn.active {
  background: rgba(56, 189, 248, 0.25);
  color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* ── Top Header Bar ── */
#top-header {
  position: absolute;
  top: 14px;
  left: 236px;
  z-index: 20;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 16px;
}

.title-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 8px 18px;
  border-radius: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.title-badge h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff 0%, #38bdf8 60%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title-badge .tag {
  font-size: 11px;
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
}

.date-badge {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 8px 16px;
  border-radius: 12px;
  font-family: monospace;
  font-size: 13px;
  color: var(--accent-cyan);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ── Left Celestial Navigator ── */
#left-panel {
  position: absolute;
  top: 72px;
  left: 16px;
  z-index: 20;
  width: 260px;
  max-height: calc(100vh - 180px);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 12px 16px;
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  gap: 4px;
}

.filter-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-tab:hover {
  color: var(--text-main);
}

.filter-tab.active {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-cyan);
  font-weight: 600;
}

#celestial-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#celestial-list::-webkit-scrollbar {
  width: 5px;
}

#celestial-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.nav-item.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.5);
  color: #ffffff;
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.nav-item.moon {
  padding-left: 22px;
  font-size: 12px;
  opacity: 0.9;
}

/* ── Right Educational Info Card ── */
#right-panel {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 20;
  width: 320px;
  max-height: calc(100vh - 180px);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#right-panel::-webkit-scrollbar {
  width: 5px;
}

#right-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.info-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}

.info-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.info-header p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  padding: 10px;
  border-radius: 10px;
}

.spec-cell {
  display: flex;
  flex-direction: column;
}

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

.spec-val {
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
  font-family: monospace;
}

.facts-box h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.facts-box ul {
  list-style-type: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.facts-box li {
  position: relative;
  padding-left: 14px;
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.5;
}

.facts-box li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-cyan);
}

/* ── Mission Planner Dock (Collapsible at bottom-right or floating) ── */
#mission-panel {
  position: absolute;
  bottom: 84px;
  left: 16px;
  z-index: 20;
  width: 380px;
  background: var(--panel-bg);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 14px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mission-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-gold);
}

.planner-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.select-group label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.select-input {
  width: 100%;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #ffffff;
  padding: 6px 8px;
  font-size: 12px;
  outline: none;
}

.plan-stats {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 12px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.plan-row {
  display: flex;
  justify-content: space-between;
}

.plan-row span:first-child {
  color: var(--text-muted);
}

.plan-row span:last-child {
  font-weight: 600;
  color: var(--accent-cyan);
  font-family: monospace;
}

.mission-actions {
  display: flex;
  gap: 8px;
}

.btn-launch {
  flex: 2;
  background: linear-gradient(135deg, #d97706, #b45309);
  border: 1px solid var(--accent-gold);
  color: #fef08a;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-launch:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.5);
  transform: translateY(-1px);
}

.btn-sec {
  flex: 1;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sec:hover {
  background: #334155;
  border-color: var(--accent-cyan);
}

.btn-sec.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent-cyan);
  color: #38bdf8;
}

/* ── Telemetry Card ── */
#telemetry-card {
  display: none;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-cyan);
  border-radius: 10px;
  padding: 10px 14px;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: #334155;
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #4ade80);
  transition: width 0.2s linear;
}

/* ── Bottom Floating Bar (Time, Presets, Settings) ── */
#bottom-toolbar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 10px 20px;
  border-radius: 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 36px rgba(0,0,0,0.5);
  max-width: 95vw;
  flex-wrap: wrap;
}

.time-ctrls {
  display: flex;
  align-items: center;
  gap: 6px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding-right: 12px;
}

.btn-icon {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: #334155;
  border-color: var(--accent-cyan);
}

.speed-tag {
  font-family: monospace;
  font-weight: 700;
  color: var(--accent-cyan);
  min-width: 50px;
  text-align: center;
}

.presets-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding-right: 12px;
}

.preset-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

.toggles-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: #cbd5e1;
}

.toggle-label input {
  accent-color: var(--accent-cyan);
}

/* ── Loading Overlay ── */
#loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 200;
  background: #02040a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.6s ease;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  font-size: 16px;
  font-weight: 600;
  color: #f0f9ff;
  letter-spacing: 1px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  #top-header {
    left: 140px;
  }
  #mission-panel {
    width: 320px;
    bottom: 90px;
  }
}

@media (max-width: 768px) {
  #left-panel, #right-panel {
    display: none;
  }
  #mission-panel {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: 80px;
  }
  #bottom-toolbar {
    padding: 8px 12px;
    gap: 8px;
  }
  .presets-row {
    display: none;
  }
}
