/* Deep Space Design System & Theme Variables */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Orbitron:wght@400;600;700;900&display=swap');

:root {
  --bg-space: #030611;
  --bg-panel: rgba(12, 19, 36, 0.75);
  --bg-panel-solid: #0c1324;
  --bg-card: rgba(18, 28, 54, 0.6);
  --border-glass: rgba(0, 240, 255, 0.18);
  --border-glass-hover: rgba(0, 240, 255, 0.45);
  
  --accent-cyan: #00f0ff;
  --accent-magenta: #ff00aa;
  --accent-gold: #ffcc00;
  --accent-blue: #4361ee;
  
  --text-main: #f0f4f8;
  --text-muted: #8a99ad;
  --text-bright: #ffffff;
  
  --shadow-glow-cyan: 0 0 20px rgba(0, 240, 255, 0.35);
  --shadow-glow-magenta: 0 0 20px rgba(ff, 0, 170, 0.35);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-space);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

/* Canvas Container */
#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  cursor: grab;
}

#canvas-container:active {
  cursor: grabbing;
}

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

/* Glassmorphism Panel Base */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-panel:hover {
  border-color: var(--border-glass-hover);
}

/* Top Navigation Bar */
.navbar {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  height: 64px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffcc00 0%, #ff7700 70%, #d03000 100%);
  box-shadow: 0 0 15px rgba(255, 204, 0, 0.6);
  animation: pulse-glow 3s infinite alternate ease-in-out;
}

@keyframes pulse-glow {
  0% { transform: scale(0.98); box-shadow: 0 0 12px rgba(255, 204, 0, 0.4); }
  100% { transform: scale(1.04); box-shadow: 0 0 22px rgba(255, 204, 0, 0.8); }
}

.brand-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

/* Buttons & Controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
  transform: translateY(-1px);
}

.btn-active {
  background: rgba(0, 240, 255, 0.25) !important;
  border-color: var(--accent-cyan) !important;
  color: var(--accent-cyan) !important;
  box-shadow: var(--shadow-glow-cyan);
}

.btn-icon-only {
  padding: 8px;
  width: 38px;
  height: 38px;
}

/* Time & Date HUD Overlay */
.hud-time-panel {
  position: absolute;
  bottom: 105px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
}

.date-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 140px;
}

.date-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.date-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.time-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-picker-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.date-picker-input:focus {
  border-color: var(--accent-cyan);
}

/* Speed Multiplier Select */
.speed-select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

/* Floating Quick View Selector (Left Side) */
.quick-view-panel {
  position: absolute;
  left: 20px;
  top: 96px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.quick-view-panel::-webkit-scrollbar {
  width: 4px;
}
.quick-view-panel::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.3);
  border-radius: 4px;
}

.planet-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.85rem;
}

.planet-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.15);
}

.planet-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}

/* Planet Inspector Sidebar (Right Side) */
.inspector-sidebar {
  position: absolute;
  top: 96px;
  right: -420px;
  width: 380px;
  bottom: 24px;
  z-index: 10;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.inspector-sidebar.open {
  right: 20px;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
}

.inspector-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.inspector-badge {
  font-size: 0.7rem;
  font-family: 'Orbitron', sans-serif;
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
  text-transform: uppercase;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.close-btn:hover {
  color: var(--text-bright);
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 14px;
  border-radius: var(--radius-md);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-bright);
}

.moons-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 6px;
}

.moon-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.8rem;
}

.moon-name {
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

/* Distance Matrix Drawer (Bottom Slider) */
.distance-drawer {
  position: absolute;
  bottom: -450px;
  left: 20px;
  right: 20px;
  height: 400px;
  z-index: 20;
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.distance-drawer.open {
  bottom: 24px;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.matrix-table-wrapper {
  flex: 1;
  overflow: auto;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.matrix-table th, .matrix-table td {
  padding: 8px 12px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.matrix-table th {
  background: rgba(0, 240, 255, 0.1);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  color: var(--accent-cyan);
  position: sticky;
  top: 0;
  z-index: 2;
}

.matrix-table td.highlight-cell {
  background: rgba(0, 240, 255, 0.2);
  color: var(--accent-cyan);
  font-weight: bold;
}

.matrix-table td.self-cell {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

/* Modal Overlay for Milky Way Context & Search */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 6, 17, 0.85);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 90%;
  max-width: 650px;
  padding: 32px;
  max-height: 85vh;
  overflow-y: auto;
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .quick-view-panel {
    display: none;
  }
  .hud-time-panel {
    width: 95%;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px 14px;
  }
  .inspector-sidebar {
    width: 90%;
    right: -100%;
  }
  .app-footer {
    padding: 6px 12px;
    font-size: 0.7rem;
    bottom: 6px;
  }
}

/* Application Footer */
.app-footer {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  padding: 8px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  max-width: 95%;
  color: var(--text-muted);
  pointer-events: auto;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.footer-author {
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 500;
}

.footer-author a, .footer-links a {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast), text-shadow var(--transition-fast);
}

.footer-author a:hover, .footer-links a:hover {
  color: #ffffff;
  text-shadow: 0 0 8px var(--accent-cyan);
  text-decoration: underline;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.78rem;
}

.footer-links .dot {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.footer-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 3px 0;
}

.footer-tags .tag {
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.25);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.5px;
}

.footer-copyright {
  font-size: 0.72rem;
  color: var(--text-muted);
}
