/* style.css — CityLap. Mobile-first, works in mobile Safari. */

:root {
  --bg: #f6f7f5;
  --panel: #ffffff;
  --ink: #1d2521;
  --muted: #5d6b63;
  --brand: #1f6f43;
  --brand-dark: #175633;
  --line: #e2e6e2;
  --danger: #b23a1a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  display: flex;
  flex-direction: column;
}

.app-header {
  flex: 0 0 auto;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--brand);
  color: #fff;
}
.app-header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.3px;
}
.tagline {
  margin: 2px 0 0;
  font-size: 13px;
  opacity: 0.9;
}

/* Layout: stacked on phones, side-by-side on wide screens. */
.layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel {
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.map-wrap {
  flex: 1 1 auto;
  min-height: 320px;
}
#map {
  width: 100%;
  height: 100%;
}

@media (min-width: 820px) {
  .layout {
    flex-direction: row;
  }
  .panel {
    width: 360px;
    flex: 0 0 360px;
    border-right: 1px solid var(--line);
    background: var(--panel);
  }
  .map-wrap {
    height: 100%;
  }
}

/* Controls */
.group {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin: 0 0 14px;
  background: var(--panel);
}
.group legend {
  padding: 0 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
}

.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  width: 100%;
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  margin-bottom: 12px;
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: default;
}
.btn-secondary {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}
#geolocate {
  width: 100%;
}

.or {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0;
}
.address-row {
  display: flex;
  gap: 8px;
}
.address-row input {
  flex: 1 1 auto;
  min-width: 0;
}

input,
select {
  font: inherit;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.field {
  display: block;
  margin-top: 10px;
}
.field span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  flex: 1 1 60px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 9px 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

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

/* Status banner */
.status {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 12px;
}
.status-info {
  background: #eef3ef;
  color: var(--muted);
}
.status-loading {
  background: #fff6e0;
  color: #8a6100;
}
.status-error {
  background: #fdeae5;
  color: var(--danger);
}
.status-loading::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid #d8b24a;
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -1px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Results list */
.results {
  list-style: none;
  margin: 0;
  padding: 0;
}
.result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.result-item.is-active {
  background: #eef3ef;
}
.swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex: 0 0 auto;
}
.result-main {
  display: flex;
  flex-direction: column;
}
.result-main small {
  color: var(--muted);
  font-size: 12px;
}

.popup {
  font-size: 14px;
  line-height: 1.5;
}

/* Elevation note under the results list */
#elev-note:empty {
  display: none;
}
.elev-note-loading {
  color: #8a6100;
}
.elev-note-error {
  color: var(--danger);
}
