/* dedugan-gps — single shared stylesheet for the web frontend.
   Design tokens at the top; everything below uses them. */

:root {
  --bg: #0f172a;
  --bg-elev: #1e293b;
  --fg: #e2e8f0;
  --muted: #94a3b8;
  --border: #334155;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #dc2626;
  --warn: #eab308;
  --success: #16a34a;

  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: .25rem;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
  --header-h: 3rem;
  --footer-h: 2.25rem;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --bg-elev: #ffffff;
    --fg: #0f172a;
    --muted: #64748b;
    --border: #cbd5e1;
    --shadow: 0 1px 2px rgba(0,0,0,.06);
  }
}

*,*::before,*::after { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .9em; }

/* ---- header / footer chrome ---- */

header.app {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex; align-items: center; gap: .75rem;
  padding: 0 1rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}
header.app h1 {
  margin: 0; font-size: .85rem; font-weight: 600;
  font-family: var(--mono); letter-spacing: -.02em;
}
header.app .spacer { flex: 1; }

footer.app {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: var(--footer-h);
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  padding: 0 1rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  font-size: .75rem;
  color: var(--muted);
  z-index: 999;
}
footer.app a { color: var(--muted); }
footer.app a:hover { color: var(--fg); }
footer.app .badges {
  display: inline-flex; gap: .35rem; flex-wrap: wrap;
}
.badge {
  display: inline-flex; align-items: center;
  padding: 0 .5rem; height: 1.25rem;
  border-radius: 1rem;
  font-family: var(--mono); font-size: .65rem;
  background: var(--bg-elev); border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.badge:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---- controls ---- */

.ctrl {
  padding: .35rem .6rem;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: var(--radius);
  color: var(--fg);
}
button.ctrl { cursor: pointer; }
button.ctrl:hover { background: var(--border); }
button.ctrl:active { transform: translateY(1px); }
button.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger {
  background: transparent; border-color: var(--danger); color: var(--danger);
}
button.danger:hover { background: var(--danger); color: #fff; }

select.ctrl { padding-right: 1.5rem; }

/* ---- map ---- */

#map {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  bottom: var(--footer-h);
  background: var(--bg-elev);
}
.leaflet-container { background: var(--bg-elev) !important; }

/* ---- empty / about / error pages ---- */

.page {
  position: absolute;
  top: var(--header-h); left: 0; right: 0; bottom: var(--footer-h);
  overflow: auto;
}
.page-inner {
  max-width: 36rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.page h1 {
  font-family: var(--mono); font-weight: 600;
  margin: 0 0 1rem; font-size: 1.25rem;
}
.page h2 {
  font-size: 1rem; font-family: var(--mono); margin: 1.5rem 0 .5rem;
}
.page p, .page li { margin: 0 0 .5rem; }
.page ul { padding-left: 1.25rem; }
.page .meta { color: var(--muted); font-size: .8rem; }

/* ---- modal & toast ---- */

.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; padding: 1rem;
}
.modal[hidden] { display: none; }
.modal-body {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: .5rem; padding: 1.25rem;
  max-width: 32rem; width: 100%; max-height: 80vh; overflow: auto;
  box-shadow: var(--shadow);
}
.modal-body h2 {
  margin: 0 0 1rem; font-size: 1rem; font-family: var(--mono);
}
.row {
  display: flex; gap: .5rem; align-items: center;
  padding: .6rem 0; border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; }
.row code {
  flex: 1; font-size: .75rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  opacity: .85;
}
.row.revoked { opacity: .45; }
.row.revoked .meta { text-decoration: line-through; }
.meta {
  font-size: .7rem; color: var(--muted);
  font-family: var(--mono);
}

.toast {
  position: fixed; bottom: calc(var(--footer-h) + .5rem);
  left: 50%; transform: translateX(-50%);
  background: var(--bg-elev); border: 1px solid var(--border);
  padding: .5rem 1rem; border-radius: var(--radius);
  z-index: 3000; font-size: .85rem;
  animation: fade .2s;
  box-shadow: var(--shadow);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---- mobile tweaks ---- */

@media (max-width: 600px) {
  header.app { flex-wrap: wrap; height: auto; padding: .5rem .75rem; }
  #map { top: auto; }
  .ctrl { padding: .3rem .5rem; font-size: .85rem; }
  footer.app { font-size: .7rem; gap: .5rem; }
}
