:root {
  --bg: #0a0c10;
  --panel: #12151c;
  --panel-2: #171b24;
  --border: #262b36;
  --text: #eef0f3;
  --text-dim: #8b93a3;
  --accent: #4da3ff;
  --accent-2: #7c5cff;
  --danger: #ff4d4f;
  --good: #2fbf71;
  --font-display: "Space Grotesk", -apple-system, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  animation: page-in 0.5s var(--ease);
}

@keyframes page-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#app-header {
  padding: 22px 24px 10px;
  background: radial-gradient(ellipse 800px 200px at 15% 0%, rgba(77, 163, 255, 0.1), transparent);
}

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

.brand-mark {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  animation: seismic-pulse 2.4s var(--ease) infinite;
}

.brand-mark::after {
  animation-delay: 1.2s;
}

@keyframes seismic-pulse {
  from {
    transform: scale(1);
    opacity: 0.9;
  }
  to {
    transform: scale(4.5);
    opacity: 0;
  }
}

#app-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.02em; /* the largest text on the page: more negative tracking than body/caption text */
}

.brand-accent {
  color: var(--accent);
}

.subtitle {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

#controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 18px;
  padding: 14px 24px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

#alert-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  background: var(--panel-2);
}

button {
  font-family: var(--font-body);
  transition: transform 0.15s var(--ease), background-color 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

button:active:not(:disabled) {
  transform: scale(0.97);
}

#pick-zone-btn.active {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#enable-alerts-btn {
  background: var(--good);
  color: #04150c;
  border: none;
  border-radius: 7px;
  padding: 7px 14px;
  font-weight: 600;
  cursor: pointer;
}

#enable-alerts-btn:hover:not(:disabled) {
  box-shadow: 0 4px 14px rgba(47, 191, 113, 0.35);
}

#enable-alerts-btn:disabled {
  background: var(--border);
  color: var(--text-dim);
  cursor: default;
}

#enable-alerts-btn.enabled {
  background: #1e8c56;
}

#pick-zone-btn,
#alert-controls button:not(#enable-alerts-btn) {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 14px;
  cursor: pointer;
}

#pick-zone-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#alert-status {
  color: var(--text-dim);
  transition: color 0.2s var(--ease);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--text-dim);
}

.control-checkbox {
  flex-direction: row;
  align-items: center;
}

select,
input[type="range"] {
  accent-color: var(--accent);
}

#mag-value,
#radius-value {
  font-family: var(--font-mono);
  color: var(--text);
  font-weight: 600;
}

.mono {
  font-family: var(--font-mono);
}

select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 8px;
  transition: border-color 0.2s var(--ease);
}

select:hover,
select:focus {
  border-color: var(--accent);
  outline: none;
}

#refresh-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #050810;
  border: none;
  border-radius: 7px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
}

#refresh-btn:hover {
  box-shadow: 0 6px 20px rgba(77, 163, 255, 0.3);
}

#status-text {
  font-size: 12px;
  color: var(--text-dim);
  align-self: center;
}

main {
  flex: 1;
  display: flex;
  min-height: 0;
}

#map {
  flex: 1;
  min-height: 400px;
}

#sidebar {
  width: 330px;
  overflow-y: auto;
  padding: 16px 18px;
  border-left: 1px solid var(--border);
  background: var(--panel);
}

#sidebar h2 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#quake-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.quake-item {
  padding: 11px 10px;
  margin: 0 -10px;
  border-radius: 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.15s var(--ease), transform 0.15s var(--ease);
  animation: item-in 0.35s var(--ease) backwards;
}

.quake-item:nth-child(n) {
  animation-delay: calc(var(--i, 0) * 25ms);
}

@keyframes item-in {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.quake-item:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}

.quake-mag {
  font-family: var(--font-mono);
  font-weight: 600;
  margin-right: 6px;
}

.quake-place {
  font-size: 13px;
}

.quake-time {
  font-size: 11px;
  letter-spacing: 0.01em; /* texto chico: tracking positivo para legibilidad */
  color: var(--text-dim);
}

footer {
  padding: 12px 24px;
  font-size: 11px;
  letter-spacing: 0.01em;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  main {
    flex-direction: column;
  }
  #sidebar {
    width: 100%;
    max-height: 240px;
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
