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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #000;
  color: #fff;
  overflow: hidden;
  transition: all 0.3s ease;
}

body.light-theme {
  background: #f0f8ff;
  color: #333;
}

#container {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#solar-system-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Enhanced Loading Screen */
#loading-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 50%, #16213e 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity 0.8s ease;
}

.loading-container {
  text-align: center;
  max-width: 400px;
  padding: 40px;
}

.loading-spinner {
  width: 80px;
  height: 80px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top: 4px solid #4caf50;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 30px;
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
}

.loading-text h2 {
  font-size: 24px;
  margin-bottom: 15px;
  background: linear-gradient(45deg, #4caf50, #81c784);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.loading-text p {
  font-size: 16px;
  margin-bottom: 20px;
  opacity: 0.8;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #81c784);
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Enhanced UI Panel */
.ui-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 380px;
  max-height: 85vh;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 15px;
  padding: 0;
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  z-index: 100;
  overflow: hidden;
}

body.light-theme .ui-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.ui-panel.collapsed .panel-content {
  display: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(129, 199, 132, 0.1));
}

body.light-theme .panel-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(129, 199, 132, 0.1));
}

.panel-header h2 {
  font-size: 18px;
  font-weight: 600;
  background: linear-gradient(45deg, #4caf50, #81c784);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.toggle-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: inherit;
  font-size: 20px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.toggle-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.panel-content {
  padding: 25px;
  max-height: 65vh;
  overflow-y: auto;
}

.control-section {
  margin-bottom: 30px;
}

.control-section h3 {
  font-size: 16px;
  margin-bottom: 18px;
  color: #4caf50;
  border-bottom: 2px solid rgba(76, 175, 80, 0.3);
  padding-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.light-theme .control-section h3 {
  color: #2e7d32;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.control-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-group label {
  font-size: 14px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-group input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #333, #555);
  outline: none;
  -webkit-appearance: none;
  transition: all 0.2s ease;
}

body.light-theme .control-group input[type="range"] {
  background: linear-gradient(90deg, #ddd, #bbb);
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4caf50, #81c784);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.5);
}

.control-btn {
  background: linear-gradient(135deg, #4caf50, #45a049);
  border: none;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.control-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

.control-btn:active {
  transform: translateY(0);
}

.control-btn.primary {
  background: linear-gradient(135deg, #2196f3, #1976d2);
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.control-btn.primary:hover {
  box-shadow: 0 6px 16px rgba(33, 150, 243, 0.4);
}

/* Checkbox Styling */
.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  gap: 12px;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid #4caf50;
  border-radius: 4px;
  position: relative;
  transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
  background: linear-gradient(135deg, #4caf50, #81c784);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.planet-control {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

body.light-theme .planet-control {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.planet-control:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.planet-control h4 {
  font-size: 15px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.planet-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* Statistics */
.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-label {
  font-size: 14px;
  opacity: 0.8;
}

/* Enhanced Tooltip */
.tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.95);
  color: white;
  padding: 15px 20px;
  border-radius: 10px;
  font-size: 14px;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  max-width: 300px;
}

body.light-theme .tooltip {
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.tooltip.visible {
  opacity: 1;
  transform: translateY(-5px);
}

.tooltip h4 {
  margin-bottom: 8px;
  color: #4caf50;
  font-size: 16px;
}

.tooltip .tooltip-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.tooltip .tooltip-stat {
  font-size: 12px;
  opacity: 0.9;
}

/* Instructions */
.instructions {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.85);
  padding: 25px;
  border-radius: 15px;
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 350px;
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body.light-theme .instructions {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.instructions h3 {
  margin-bottom: 15px;
  color: #4caf50;
  font-size: 18px;
}

.instructions ul {
  list-style: none;
  padding: 0;
}

.instructions li {
  margin-bottom: 10px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.instructions strong {
  color: #4caf50;
  min-width: 80px;
}

#close-instructions {
  position: absolute;
  top: 15px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: inherit;
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

#close-instructions:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Quality Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.modal.visible {
  display: flex;
}

.modal-content {
  background: rgba(0, 0, 0, 0.9);
  padding: 30px;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(15px);
  text-align: center;
  max-width: 500px;
  width: 90%;
}

.modal-content h3 {
  margin-bottom: 25px;
  color: #4caf50;
  font-size: 20px;
}

.quality-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

.quality-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 15px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.quality-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.quality-btn.active {
  background: linear-gradient(135deg, #4caf50, #81c784);
  border-color: #4caf50;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .ui-panel {
    width: calc(100vw - 20px);
    max-width: 400px;
    top: 10px;
    right: 10px;
    left: 10px;
  }

  .instructions {
    bottom: 10px;
    left: 10px;
    right: 10px;
    max-width: none;
  }

  .control-grid {
    grid-template-columns: 1fr;
  }

  .quality-options {
    grid-template-columns: 1fr;
  }

  .panel-content {
    max-height: 60vh;
  }
}

@media (max-width: 480px) {
  .ui-panel {
    width: calc(100vw - 10px);
    top: 5px;
    right: 5px;
    left: 5px;
  }

  .instructions {
    bottom: 5px;
    left: 5px;
    right: 5px;
    padding: 20px;
  }

  .control-btn {
    padding: 10px 14px;
    font-size: 13px;
  }

  .panel-header h2 {
    font-size: 16px;
  }

  .modal-content {
    padding: 20px;
    margin: 10px;
  }
}

/* Scrollbar Styling */
.panel-content::-webkit-scrollbar {
  width: 8px;
}

.panel-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.panel-content::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #4caf50, #81c784);
  border-radius: 4px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #81c784, #4caf50);
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.8s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in {
  animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.glow {
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.2);
  }
  to {
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.4);
  }
}
