:root {
  --solar-bg: #090d16;
  --solar-surface: #111827;
  --solar-card: rgba(17, 24, 39, 0.85);
  --solar-border: rgba(255, 255, 255, 0.1);
  --solar-accent: #f59e0b;
  --solar-accent-glow: rgba(245, 158, 11, 0.35);
  --solar-accent-sub: #10b981;
  --solar-text: #f3f4f6;
  --solar-muted: #9ca3af;
}

[data-theme="light"] {
  --solar-bg: #f0f4f8;
  --solar-surface: #ffffff;
  --solar-card: rgba(255, 255, 255, 0.92);
  --solar-border: rgba(0, 0, 0, 0.1);
  --solar-accent: #d97706;
  --solar-accent-glow: rgba(217, 119, 6, 0.25);
  --solar-accent-sub: #059669;
  --solar-text: #1e293b;
  --solar-muted: #64748b;
}

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

body {
  background-color: var(--solar-bg);
  color: var(--solar-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand-logo-box {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.solar-app-layout {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1rem;
}

.solar-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 1.25rem;
}

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

/* Visor de Mapa y 3D */
.solar-main-stage {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.map-wrapper {
  position: relative;
  background: #030712;
  border-radius: 16px;
  border: 1px solid var(--solar-border);
  overflow: hidden;
  height: 520px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

#solar-map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Superposición del mapa */
.map-top-bar {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  z-index: 1000;
  pointer-events: none;
}

.map-top-bar > * {
  pointer-events: auto;
}

.search-box-wrap {
  position: relative;
  width: 100%;
  max-width: 360px;
}

.search-input {
  width: 100%;
  background: var(--solar-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--solar-border);
  border-radius: 9999px;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  color: var(--solar-text);
  font-size: 0.875rem;
  outline: none;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.search-input:focus {
  border-color: var(--solar-accent);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--solar-muted);
  pointer-events: none;
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--solar-surface);
  border: 1px solid var(--solar-border);
  border-radius: 12px;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  z-index: 2000;
}

.search-result-item {
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid var(--solar-border);
}

.search-result-item:hover {
  background: rgba(245, 158, 11, 0.15);
  color: var(--solar-accent);
}

.map-draw-toolbar {
  display: flex;
  gap: 0.5rem;
}

.btn-map-tool {
  background: var(--solar-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--solar-border);
  color: var(--solar-text);
  padding: 0.5rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
}

.btn-map-tool:hover, .btn-map-tool.active {
  background: var(--solar-accent);
  color: #fff;
  border-color: var(--solar-accent);
}

/* Indicador de ayuda sobre el mapa */
.map-instructions-tag {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background: var(--solar-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--solar-border);
  border-radius: 10px;
  padding: 0.5rem 0.85rem;
  font-size: 0.8rem;
  color: var(--solar-text);
  z-index: 1000;
  pointer-events: none;
}

/* Visor 3D de Sombras y Bóveda Celeste */
.solar-3d-box {
  background: var(--solar-surface);
  border: 1px solid var(--solar-border);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--solar-accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#solar-3d-viewport {
  width: 100%;
  height: 240px;
  background: #030712;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--solar-border);
}

.solar-time-slider-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
}

/* Panel Lateral de Configuración y Resultados */
.solar-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.calc-card {
  background: var(--solar-surface);
  border: 1px solid var(--solar-border);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.inputs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.input-label {
  font-size: 0.75rem;
  color: var(--solar-muted);
  font-weight: 500;
}

.input-control {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--solar-border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: var(--solar-text);
  font-size: 0.875rem;
  outline: none;
}

.input-control:focus {
  border-color: var(--solar-accent);
}

/* Tarjetas de Métricas de Rendimiento */
.results-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.kpi-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--solar-border);
  border-radius: 12px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpi-box.highlight {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.06);
}

.kpi-box.highlight-green {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.06);
}

.kpi-title {
  font-size: 0.72rem;
  color: var(--solar-muted);
  text-transform: uppercase;
}

.kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--solar-text);
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--solar-muted);
}

/* Gráfico */
.chart-container {
  position: relative;
  height: 200px;
  margin-top: 1rem;
}

/* Botón principal */
.btn-action-solar {
  width: 100%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: opacity 0.2s;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.btn-action-solar:hover {
  opacity: 0.92;
}

/* Modal */
.solar-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 1rem;
}

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

.solar-modal-content {
  background: var(--solar-surface);
  border: 1px solid var(--solar-border);
  border-radius: 18px;
  max-width: 600px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--solar-muted);
  cursor: pointer;
}
