/* 色板喺 theme.css，呢度只寫版面。地圖頁（首頁）專用 */
#map-page { position: relative; height: calc(100vh - 52px); height: calc(100dvh - 52px); }
#map-wrap { position: relative; width: 100%; height: 100%; }
#map { width: 100%; height: 100%; }

.floating-btn {
  position: absolute; top: 10px; right: 10px; z-index: 1000;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 14px; font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 1px 4px rgba(58,46,32,.20);
}

.control-panel {
  position: absolute; top: 54px; right: 10px; z-index: 1000;
  width: min(280px, 78vw); max-height: calc(100% - 64px); overflow-y: auto;
  background: var(--panel); border-radius: 12px; padding: 12px;
  box-shadow: 0 2px 12px rgba(58,46,32,.22);
  display: flex; flex-direction: column; gap: 12px;
}
.control-panel.collapsed { display: none; }

.control-section { }
.control-title { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }

.mode-row { display: flex; gap: 6px; }
.mode-btn {
  flex: 1 1 0; font-size: 12px; font-weight: 700; padding: 8px 4px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer;
}
.mode-btn.active { background: var(--accent); color: var(--on-solid); border-color: var(--accent); }

.street-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.street-chip {
  font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer;
}
.street-chip.active { background: var(--accent); color: var(--on-solid); border-color: var(--accent); font-weight: 700; }

.select-input {
  width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; color: var(--text); font-size: 13px;
}

.legend { display: flex; flex-direction: column; gap: 5px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; border: 1px solid rgba(58,46,32,.35); }
.legend-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-count { color: var(--muted); font-variant-numeric: tabular-nums; flex: 0 0 auto; }

.control-count { font-size: 12px; color: var(--muted); text-align: right; border-top: 1px solid var(--line); padding-top: 8px; }

/* ---------- marker popup 內容 ---------- */
.leaflet-popup-content-wrapper { background: var(--card); color: var(--text); border-radius: 12px; }
.leaflet-popup-tip { background: var(--card); }
.leaflet-popup-content { margin: 12px 14px; }
.popup-card { min-width: 200px; max-width: 260px; }
.popup-code { font-size: 15px; font-weight: 800; color: var(--accent); }
.popup-street { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.popup-name { font-size: 15px; font-weight: 700; margin: 4px 0 2px; }
.popup-row { font-size: 12px; margin: 2px 0; }
.popup-tag {
  display: inline-block; background: var(--panel); border-radius: 999px; padding: 2px 8px;
  font-size: 11px; margin: 2px 4px 0 0; color: var(--text); border: 1px solid var(--line);
}
.popup-photo { max-width: 100%; max-height: 120px; border-radius: 8px; margin-top: 6px; display: block; }
.popup-link {
  display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 700;
  color: var(--on-solid); background: var(--accent); padding: 6px 12px; border-radius: 999px;
  text-decoration: none;
}

#toast {
  position: absolute; left: 50%; bottom: 24px; transform: translate(-50%, 12px);
  z-index: 1002; background: var(--green); color: var(--on-solid); font-size: 14px; font-weight: 700;
  padding: 10px 16px; border-radius: 999px; box-shadow: 0 2px 10px rgba(58,46,32,.25);
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
  max-width: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--red); }

@media (max-width: 480px) {
  .control-panel { top: 54px; right: 8px; left: 8px; width: auto; max-width: none; }
}
