/* Global reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Design tokens */
:root {
  --bg: #020617;
  --bg-alt: #0b1120;
  --card-bg: #020617;
  --border-subtle: #1f2937;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --accent-strong: #2563eb;
  --danger: #ef4444;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.55);
  --radius-lg: 14px;
  --radius-pill: 999px;
}

/* Page layout */
body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at top left, #1d4ed8 0, transparent 55%),
    radial-gradient(circle at bottom right, #22c55e 0, transparent 55%),
    linear-gradient(135deg, #020617, #020617 45%, #020617 100%);
  color: var(--text-main);
}

/* Wrapper used on all three pages */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  backdrop-filter: blur(18px);
  padding: 12px 20px;
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.55);
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.03em;
}

header .subtitle {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Main content */
main {
  flex: 1;
  padding: 24px 20px 32px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* Card container shared by all pages */
.card {
  width: 100%;
  max-width: 960px;
  background: radial-gradient(circle at top right, #111827 0, #020617 65%);
  border-radius: var(--radius-lg);
  padding: 18px 20px 22px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: var(--shadow-soft);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.card-title {
  margin: 0;
  font-size: 18px;
}

.card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.card-description {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text-muted);
}

/* Reusable pills / tags */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tag {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.85);
}

/* Map containers (Leaflet + OpenLayers) */
#map,
.map {
  margin-top: 8px;
  height: 60vh;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

/* If you embed multiple maps vertically */
.map-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* API page layout */
.api-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: flex-start;
}

.api-layout-narrow {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Form styling (input + button) */
.api-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
  margin-bottom: 10px;
}

.api-form label {
  font-size: 13px;
  color: var(--text-muted);
}

.api-form input[type="text"] {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  font-size: 14px;
  min-width: 160px;
}

.api-form input[type="text"]:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
  border-color: var(--accent);
}

/* Buttons – shared for all pages */
button,
.button {
  border: none;
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #f9fafb;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out,
    filter 0.08s ease-out;
}

button:hover,
.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.55);
  filter: brightness(1.03);
}

button:active,
.button:active {
  transform: translateY(0);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.8);
}

/* Disabled state */
button:disabled,
.button:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

/* API result panel */
#result {
  margin-top: 10px;
  padding: 12px 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.9);
  font-size: 14px;
  color: var(--text-main);
  min-height: 40px;
}

#result strong {
  color: #e5e7eb;
}

#result img {
  max-width: 180px;
  border-radius: 10px;
  margin-top: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

/* Code / inline code */
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Footer */
footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 10px 0 16px;
}

/* Utility classes */
.muted {
  color: var(--text-muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* Responsive tweaks */
@media (max-width: 900px) {
  main {
    padding: 18px 12px 24px;
  }

  .card {
    padding: 14px 14px 18px;
  }

  .api-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  header {
    padding: 10px 14px;
  }

  header h1 {
    font-size: 18px;
  }

  #map,
  .map {
    height: 55vh;
  }

  .api-form {
    align-items: stretch;
  }

  .api-form input[type="text"] {
    flex: 1 1 100%;
  }

  button,
  .button {
    width: 100%;
    justify-content: center;
  }
}
