:root {
  --accent: #ffb801;
  --accent-strong: #d9970a;
  --bg: #071022;
  --panel: #0f1722;
  --muted: #9fb3c8;
  --text: #e6eef6;
  --border: #1f2a37;
  --radius: 10px;
  --shadow: 0 8px 30px rgba(2, 6, 23, 0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  color: var(--text);
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}
@media (min-width: 768px) {
  .app-container {
    flex-direction: row;
  }
}

.sidebar {
  background: var(--panel);
  color: var(--text);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 1000;
  max-height: 46vh;
  overflow: auto;
}
@media (min-width: 768px) {
  .sidebar {
    width: 340px;
    max-height: none;
    height: 100%;
  }
}

.volver {
  display: inline-block;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
  margin-bottom: 10px;
}
.volver:hover {
  color: var(--text);
}

.sidebar-header h1 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}
.sidebar-header p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.aviso-privacidad {
  background: rgba(255, 184, 1, 0.1);
  border: 1px solid rgba(255, 184, 1, 0.35);
  color: #ffd77a;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.4;
}

.filter-section h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 600;
}

.layer-toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.layer-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #071624;
  cursor: pointer;
  border: 1px solid transparent;
}
.layer-toggle:hover {
  background: #0b1a24;
}
.layer-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
  font-size: 0.88rem;
}
.layer-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.layer-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.rango-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.rango-control label {
  width: 84px;
  font-size: 0.82rem;
  color: var(--muted);
}
.rango-control input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.sidebar-info {
  margin-top: auto;
  background: transparent;
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 10px;
}
.info-content p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.map-wrapper {
  flex: 1;
  position: relative;
  background: var(--bg);
}
#map {
  width: 100%;
  height: 100%;
}
.tiles-dark {
  filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%) saturate(85%);
}

.nota-precision {
  position: absolute;
  left: 12px;
  bottom: 12px;
  right: 12px;
  max-width: 460px;
  background: rgba(7, 16, 34, 0.9);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.4;
  z-index: 800;
}
.nota-precision strong {
  color: var(--text);
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-overlay p {
  color: var(--muted);
  font-weight: 600;
}

@media (max-width: 767px) {
  .sidebar {
    max-height: 42vh;
    padding: 16px;
  }
  .nota-precision {
    max-width: none;
  }
}
