/* Cooly — civic / utility aesthetic. Map-first. No gradients, no glassmorphism. */
:root {
  --bg: #ffffff;
  --paper: #f6f7f8;
  --ink: #14181d;
  --ink-soft: #5a6470;
  --line: #e2e6ea;
  --accent: #0b5bd3;       /* cool civic blue */
  --accent-ink: #ffffff;
  --free: #0a7d4b;
  --paid: #9a5400;
  --official: #0b5bd3;
  --shadow: 0 2px 10px rgba(20, 24, 29, 0.10);
  --radius: 10px;
  --sheet-h: 42vh;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#map { position: fixed; inset: 0; z-index: 1; background: var(--paper); }

/* ───── Top overlay ───── */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 22px; line-height: 1; }
.brandtext { flex: 1; min-width: 0; }
.brandtext h1 { font-size: 18px; margin: 0; letter-spacing: -0.02em; font-weight: 800; }
.brandtext p { margin: 0; font-size: 12px; color: var(--ink-soft); }
.city-select {
  flex: none; height: 30px; padding: 0 6px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  max-width: 120px;
}
.iconbtn {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink-soft); font-style: italic; font-weight: 700;
  cursor: pointer; flex: none;
}

.searchrow { display: flex; gap: 8px; margin-top: 8px; }
#search {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 15px; background: var(--paper); color: var(--ink);
}
#search:focus { outline: 2px solid var(--accent); border-color: var(--accent); background: #fff; }
.locate {
  flex: none; height: 40px; padding: 0 12px; border: none; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); font-size: 14px; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.locate:active { transform: translateY(1px); }

.chips { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 15px; border: 1px solid var(--line);
  border-radius: 999px; background: #fff; color: var(--ink); font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.chip:active { transform: translateY(1px); }
.chip.active {
  background: #14181d; color: #fff; border-color: #14181d;
  box-shadow: 0 1px 4px rgba(20,24,29,0.18);
}
.chip-count { opacity: 0.5; font-weight: 700; margin-left: 1px; }

/* ───── Bottom sheet ───── */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  height: var(--sheet-h); background: var(--bg);
  border-top: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -3px 14px rgba(20,24,29,0.12);
  display: flex; flex-direction: column;
  transition: height 0.22s ease;
}
.sheet.collapsed { height: 64px; }
.sheet.expanded { height: 80vh; }
.sheet-handle {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 0 6px; cursor: pointer; flex: none;
}
.grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); }
.sheet-count { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

.list { flex: 1; overflow-y: auto; padding: 4px 12px 8px; }
.card {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 15px 16px; margin-bottom: 10px; cursor: pointer; background: var(--bg);
  transition: box-shadow .15s, border-color .15s, transform .1s;
}
.card:active { transform: scale(0.995); }
.card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(11,91,211,0.18), 0 2px 10px rgba(20,24,29,0.08);
}
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card-name { font-size: 17px; font-weight: 800; margin: 0; letter-spacing: -0.015em; line-height: 1.25; }
.card-dist { font-size: 12.5px; color: var(--accent); font-weight: 700; white-space: nowrap; flex: none; text-align: right; }
.card-sub { font-size: 13px; color: var(--ink-soft); margin: 4px 0 0; }
.card-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.maps-cta { display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 700; color: var(--accent); text-decoration: none; }
.maps-cta:hover { text-decoration: underline; }

.badge {
  font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  display: inline-flex; align-items: center; white-space: nowrap;
}
.badge.type { color: var(--ink); background: #f3f4f6; border-color: #e7eaee; font-weight: 700; }
.badge.free { color: var(--free); border-color: #bfe3cf; background: #eefaf2; }
.badge.paid { color: var(--paid); border-color: #f0dcb8; background: #fdf5e6; }
.badge.ac { color: var(--accent); border-color: #bcd6f5; background: #eef4fd; }
.badge.laptop { color: #0e7490; border-color: #b9e2ec; background: #ecf9fc; }
.badge.toilets { color: var(--ink-soft); background: #f3f4f6; border-color: #e7eaee; }
.badge.shade { color: var(--free); border-color: #bfe3cf; background: #eefaf2; }
.badge.confirmed { color: #fff; background: var(--free); border-color: var(--free); }
.badge.confirmed { color: #fff; background: #0a7d4b; border-color: #0a7d4b; font-weight: 700; }

.trust { font-size: 11px; color: var(--ink-soft); padding: 0 12px calc(env(safe-area-inset-bottom) + 8px); margin: 0; line-height: 1.4; flex: none; }

/* ───── Add a spot FAB ───── */
.add-fab {
  position: fixed; left: 12px; z-index: 1100;
  bottom: calc(var(--sheet-h) + 12px);
  height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow);
}
.add-fab:active { transform: translateY(1px); }

/* ───── Add-a-spot form ───── */
.addform { display: flex; flex-direction: column; gap: 11px; }
.addform label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink); }
.addform .opt { color: var(--ink-soft); font-weight: 400; }
.addform input[type=text], .addform select, .addform textarea {
  font: inherit; font-weight: 400; font-size: 15px; padding: 10px 11px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink);
}
.addform input:focus, .addform select:focus, .addform textarea:focus {
  outline: 2px solid var(--accent); border-color: var(--accent); background: #fff;
}
.addform textarea { resize: vertical; }
.addform-row { display: flex; gap: 12px; }
.addform .inline { flex: 1; }
.addform .checkbox { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
.addform .checkbox input { width: 18px; height: 18px; }
.addform .hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.addform .btn-primary { border: none; cursor: pointer; font: inherit; font-weight: 700; margin-top: 2px; }
.addstatus { font-size: 13px; text-align: center; margin: 4px 0 0; font-weight: 600; }
.addstatus.ok { color: var(--free); }
.addstatus.err { color: #b91c1c; }
.addstatus[hidden] { display: none; }

/* ───── Premium ───── */
.premium-fab {
  position: fixed; right: 12px; z-index: 1100;
  bottom: calc(var(--sheet-h) + 12px);
  height: 40px; padding: 0 14px; border: none; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow);
}

.modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: flex-end; justify-content: center; background: rgba(20,24,29,0.45); }
.modal[hidden] { display: none; }
.modal-card {
  background: var(--bg); width: 100%; max-width: 460px;
  border-radius: 16px 16px 0 0; padding: 20px 18px calc(env(safe-area-inset-bottom) + 20px);
  position: relative;
}
@media (min-width: 480px) { .modal { align-items: center; } .modal-card { border-radius: 16px; } }
.modal-close { position: absolute; top: 10px; right: 12px; border: none; background: none; font-size: 26px; line-height: 1; color: var(--ink-soft); cursor: pointer; }
.modal-card h2 { margin: 0 30px 4px 0; font-size: 19px; }
.modal-sub { margin: 0 0 12px; color: var(--ink-soft); font-size: 14px; }
.features { list-style: none; padding: 0; margin: 0 0 16px; }
.features li { padding: 7px 0 7px 26px; position: relative; font-size: 14px; border-bottom: 1px solid var(--line); }
.features li::before { content: "❄"; position: absolute; left: 0; color: var(--accent); }
.btn-primary { display: block; text-align: center; background: var(--accent); color: #fff; text-decoration: none; font-weight: 700; padding: 13px; border-radius: var(--radius); }
.modal-note { font-size: 12px; color: var(--ink-soft); margin: 10px 0 0; text-align: center; }
.modal-foot { font-size: 12px; color: var(--ink-soft); margin: 12px 0 0; text-align: center; }
.modal-card a { color: var(--accent); }

.toast {
  position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 1600;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 13px;
  box-shadow: var(--shadow); white-space: nowrap;
}
.toast[hidden] { display: none; }

.loading {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 1500;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px;
}
.loading[hidden] { display: none; }

/* Category pins — strip Leaflet's default white div-icon box */
.cooly-pin { background: transparent !important; border: none !important; }
.cooly-pin svg { display: block; filter: drop-shadow(0 2px 3px rgba(20,24,29,0.35)); }
.cooly-pin.selected svg { filter: drop-shadow(0 0 6px rgba(11,91,211,0.55)) drop-shadow(0 3px 5px rgba(20,24,29,0.4)); }

/* Cluster bubbles — one consistent neutral style, count in the middle */
.cooly-cluster { background: transparent; }
.cooly-cluster .cl-inner {
  width: 100%; height: 100%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #2b3440; color: #fff; font-weight: 800; font-size: 13px;
  border: 2.5px solid #fff; box-shadow: 0 2px 5px rgba(20,24,29,0.35);
}
.cooly-cluster.m .cl-inner { font-size: 14px; }
.cooly-cluster.l .cl-inner { font-size: 15px; }

/* Leaflet popup tweaks */
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; }
.leaflet-popup-content .pop-name { font-weight: 800; font-size: 15px; display: block; margin-bottom: 2px; letter-spacing: -0.01em; }
.leaflet-popup-content .pop-sub { color: var(--ink-soft); font-size: 12.5px; display: block; }
.leaflet-popup-content .pop-meta { color: var(--ink-soft); display: block; margin-top: 3px; }
.leaflet-popup-content .pop-badges { margin: 7px 0; display: flex; gap: 5px; flex-wrap: wrap; }
.leaflet-popup-content a.pop-dir { color: var(--accent); font-weight: 700; text-decoration: none; }
.pop-vote { margin: 9px 0 4px; padding-top: 9px; border-top: 1px solid var(--line); }
.pop-vote-label { font-size: 11.5px; color: var(--ink-soft); font-weight: 600; display: block; margin-bottom: 6px; }
.pop-vote-btns { display: flex; gap: 6px; }
.vote-btn { flex: 1; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.vote-btn:active { transform: translateY(1px); }
.pop-vote-thanks { font-size: 12.5px; color: var(--free); font-weight: 700; }
