/* Solar System 3D - Main Stylesheet */

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

:root {
  --panel-bg: rgba(5, 8, 20, 0.92);
  --panel-border: rgba(80, 120, 255, 0.2);
  --accent: #4a8fff;
  --accent-dim: rgba(74, 143, 255, 0.15);
  --text: #ccd6f6;
  --text-dim: #6a7b99;
  --danger: #ff6060;
  --success: #60ff9a;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #030309;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
}

#canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ─── Side Panel ─────────────────────────────────────────────────────────── */

#panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 300px;
  height: 100vh;
  background: var(--panel-bg);
  border-left: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) transparent;
}

#panel::-webkit-scrollbar {
  width: 4px;
}
#panel::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
  border-radius: 2px;
}

.panel-section {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(80, 120, 255, 0.1);
}

.panel-title {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 10px;
  opacity: 0.8;
}

/* ─── Date Display ───────────────────────────────────────────────────────── */

#date-section {
  background: linear-gradient(135deg, rgba(74, 143, 255, 0.08), rgba(120, 80, 255, 0.05));
  text-align: center;
  padding: 14px 16px;
}

#date-section h2 {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
  opacity: 0.7;
}

#current-date {
  font-size: 14px;
  font-weight: 300;
  color: #e8f0ff;
  letter-spacing: 1px;
  font-family: 'Courier New', monospace;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid rgba(74, 143, 255, 0.3);
  border-radius: 4px;
  background: rgba(74, 143, 255, 0.08);
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  background: rgba(74, 143, 255, 0.2);
  border-color: rgba(74, 143, 255, 0.6);
  color: #fff;
}

.btn.active, .btn:active {
  background: rgba(74, 143, 255, 0.35);
  border-color: var(--accent);
  color: #fff;
}

.btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

/* ─── Speed Controls ─────────────────────────────────────────────────────── */

.speed-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 8px;
}

.speed-btn {
  padding: 5px 4px;
  font-size: 9px;
  letter-spacing: 0.5px;
  text-align: center;
}

/* ─── Scale Buttons ──────────────────────────────────────────────────────── */

.scale-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.scale-btn {
  flex: 1;
}

/* ─── Toggles ────────────────────────────────────────────────────────────── */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}

.toggle-row:hover {
  color: #fff;
}

.toggle-switch {
  position: relative;
  width: 34px;
  height: 18px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 9px;
  transition: 0.2s;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 12px;
  width: 12px;
  left: 2px;
  top: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: 0.2s;
}

input:checked + .toggle-slider {
  background: rgba(74, 143, 255, 0.3);
  border-color: var(--accent);
}

input:checked + .toggle-slider::before {
  background: var(--accent);
  transform: translateX(16px);
}

/* ─── Sliders ────────────────────────────────────────────────────────────── */

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 11px;
}

.slider-label {
  flex: 1;
  color: var(--text-dim);
  font-size: 11px;
}

.slider-val {
  min-width: 36px;
  text-align: right;
  color: var(--accent);
  font-size: 11px;
  font-family: monospace;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: background 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #80b8ff;
}

/* ─── Planet List ────────────────────────────────────────────────────────── */

.planet-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.planet-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.12s;
  border: 1px solid transparent;
}

.planet-item:hover {
  background: var(--accent-dim);
  border-color: rgba(74, 143, 255, 0.2);
}

.planet-item.active {
  background: rgba(74, 143, 255, 0.2);
  border-color: var(--accent);
}

.planet-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── Planet Info Panel ───────────────────────────────────────────────────── */

#planet-info {
  position: fixed;
  bottom: 0;
  left: 0;
  width: calc(100% - 300px);
  max-height: 240px;
  background: var(--panel-bg);
  border-top: 1px solid var(--panel-border);
  border-right: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 16px 20px;
  display: none;
  z-index: 100;
  overflow: hidden;
}

#planet-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#info-name {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 1px;
}

#btn-close-info {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-dim);
  width: 24px;
  height: 24px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

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

#planet-info-body {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 12px;
}

#info-description {
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-dim);
  align-self: start;
}

#info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

#info-table td {
  padding: 3px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

#info-table td:first-child {
  color: var(--text-dim);
  width: 45%;
}

#info-table td:last-child {
  color: #e0eaff;
  font-family: monospace;
  font-size: 10.5px;
}

/* ─── Title / Logo ───────────────────────────────────────────────────────── */

#title-bar {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 100;
  pointer-events: none;
}

#title-bar h1 {
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  text-shadow: 0 0 20px rgba(74, 143, 255, 0.5);
}

#title-bar span {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim);
  display: block;
  margin-top: 2px;
}

/* ─── Hints ──────────────────────────────────────────────────────────────── */

#hints {
  position: fixed;
  bottom: 16px;
  left: 16px;
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  z-index: 100;
  line-height: 1.8;
  pointer-events: none;
}

/* ─── Loading Overlay ────────────────────────────────────────────────────── */

#loading {
  position: fixed;
  inset: 0;
  background: #030309;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: opacity 0.8s ease;
}

#loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-ring {
  width: 60px;
  height: 60px;
  border: 2px solid rgba(74, 143, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

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

#loading p {
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ─── Scrollbar for panel ────────────────────────────────────────────────── */

.panel-section:last-child {
  border-bottom: none;
  flex: 1;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  #panel {
    width: 240px;
  }
  
  #planet-info {
    width: calc(100% - 240px);
    max-height: 200px;
  }
  
  #planet-info-body {
    grid-template-columns: 1fr;
  }
  
  #info-description {
    display: none;
  }
}

@media (max-width: 500px) {
  #panel {
    width: 200px;
    font-size: 11px;
  }
  
  #planet-info {
    width: calc(100% - 200px);
  }
}
