* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

/* ---------------- painel ---------------- */
#panel {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  padding: 14px 16px 12px;
}

#panel h1 { margin: 0; font-size: 20px; }
#panel .subtitle { margin: 2px 0 10px; font-size: 12.5px; color: #555; }
#panel .meta { margin: 8px 0 0; font-size: 11px; color: #777; }
#panel .hint { margin: 4px 0 0; font-size: 11px; color: #777; line-height: 1.35; }

#panel-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: #eee;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 13px;
}

#panel.collapsed > :not(h1):not(#panel-toggle) { display: none; }

/* ---------------- pesquisa ---------------- */
#search-box { position: relative; }

#search {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

#search:focus { outline: 2px solid #2b6cb0; border-color: transparent; }

#search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1100;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  max-height: 320px;
  overflow-y: auto;
}

#search-results li {
  padding: 7px 12px;
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

#search-results li.active,
#search-results li:hover { background: #ebf4ff; }

#search-results .kind { font-size: 11px; color: #888; white-space: nowrap; }
#search-results .price { font-size: 12px; color: #b03a2e; font-weight: 600; white-space: nowrap; }
#search-results li.geocode { color: #2b6cb0; font-style: italic; }
#search-results li.empty { color: #999; cursor: default; }

/* ---------------- slider ---------------- */
#discount-block { margin-top: 12px; }
#discount-block label { font-size: 13px; }
#discount { width: 100%; margin: 6px 0 0; }

/* ---------------- legenda e info (controlos Leaflet) ---------------- */
.legend, .info-box {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
}

.legend h4, .info-box h4 { margin: 0 0 4px; font-size: 12px; }
.legend .row { display: flex; align-items: center; gap: 6px; }
.legend .swatch {
  width: 16px;
  height: 12px;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.info-box { min-width: 170px; max-width: 240px; }
.info-box .val { font-size: 16px; font-weight: 700; }
.info-box .note { color: #777; font-size: 11px; }

/* ---------------- popup ---------------- */
.popup h3 { margin: 0 0 2px; font-size: 15px; }
.popup .crumb { color: #777; font-size: 11.5px; margin: 0 0 6px; }
.popup table { border-collapse: collapse; font-size: 13px; }
.popup td { padding: 2px 0; }
.popup td:first-child { padding-right: 12px; color: #555; }
.popup .big { font-size: 17px; font-weight: 700; }
.popup .up { color: #b03a2e; }
.popup .down { color: #1e7d32; }
.popup .target { color: #2b6cb0; font-weight: 700; }
.popup .note { color: #888; font-size: 11px; margin: 6px 0 0; max-width: 230px; }

#loading {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  background: #333;
  color: #fff;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 16px;
  opacity: 0.9;
}

@media (max-width: 600px) {
  #panel { width: calc(100vw - 24px); }
}
