/* WaarWasIk — basic flat colours, no gradients, black borders. */

:root {
  --sea: #b8d4e3;
  --land: #e8e6e1;
  --visited: #4a9d5f;
  --stayed: #d9822b;
  --ink: #1c1c1c;
  --muted: #6b6b6b;
  --line: #d8d8d4;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  background: var(--sea);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#map {
  position: absolute;
  inset: 0;
}

/* MapLibre draws its own attribution control; ours is the footer. */
.maplibregl-ctrl-attrib, .maplibregl-ctrl-logo { display: none !important; }

/* ---------- top bar ---------- */

#topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  z-index: 3;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -.01em;
}

.stats {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

#search {
  width: 210px;
  max-width: 45vw;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font: inherit;
  font-size: 14px;
}

#search:focus-visible,
input:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

button {
  font: inherit;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}

button:hover { border-color: #b4b4b0; }

button.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

button.danger {
  background: #fff;
  border-color: #d9b3b3;
  color: #9b2c2c;
}

button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

button.ghost:hover { color: var(--ink); border-color: var(--line); }

/* ---------- messages ---------- */

.banner {
  position: absolute;
  top: 62px; left: 50%;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 28px));
  padding: 10px 14px;
  border: 1px solid #e0c9a0;
  border-radius: var(--radius);
  background: #fdf4e3;
  box-shadow: var(--shadow);
  font-size: 14px;
  z-index: 4;
}

.banner a { color: inherit; }

.hint {
  position: absolute;
  bottom: 46px; left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
  z-index: 2;
  pointer-events: none;
}

/* ---------- panel ---------- */

#panel {
  position: absolute;
  top: 62px; right: 14px;
  width: 310px;
  max-height: calc(100vh - 84px);
  overflow-y: auto;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 3;
}

#panel h2 {
  margin: 0 0 2px;
  font-size: 19px;
  padding-right: 26px;
}

#panel .close {
  position: absolute;
  top: 8px; right: 8px;
  width: 30px; height: 30px;
  padding: 0;
  font-size: 19px;
  line-height: 1;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.muted { color: var(--muted); font-size: 13px; margin: 0; }

.status-group {
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
}

.status-group legend {
  padding: 0 4px;
  font-size: 12.5px;
  color: var(--muted);
}

.status-group label {
  display: flex;
  gap: 8px;
  align-items: center;
  cursor: pointer;
}

.dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.dates label,
label.stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--muted);
}

input[type="date"], textarea {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
}

textarea { resize: vertical; }

.panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

#panel-message { margin-top: 8px; min-height: 1em; }

/* ---------- login ---------- */

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 34, 40, .45);
  z-index: 5;
}

.overlay[hidden] { display: none; }

.card {
  width: 100%;
  max-width: 360px;
  padding: 22px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}

.card h2 { margin: 0; font-size: 22px; }
.card p { margin: 0; font-size: 14px; color: var(--muted); }
.card .primary { justify-self: start; }

/* ---------- footer ---------- */

#attribution {
  position: absolute;
  bottom: 0; left: 0;
  padding: 4px 10px;
  font-size: 11.5px;
  color: #4c6673;
  background: rgba(255, 255, 255, .72);
  border-top-right-radius: 8px;
  z-index: 2;
}

#attribution a { color: inherit; }

/* ---------- small screens: panel becomes a bottom sheet ---------- */

@media (max-width: 640px) {
  #topbar { padding: 8px 10px; gap: 8px; }
  .brand h1 { font-size: 16px; }
  #search { width: 100%; max-width: none; }
  .topbar-actions { flex: 1 1 100%; }

  #panel {
    top: auto;
    left: 0; right: 0; bottom: 0;
    width: auto;
    max-height: 76vh;
    border-radius: 14px 14px 0 0;
    border-bottom: none;
  }

  #attribution { font-size: 10.5px; }
}
