* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #1a1a1a; background: #0f0f0f; }

#topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: #0f0f0f;
  color: #fff;
  border-bottom: 1px solid #222;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 240px; }
.logo { color: #006fcf; font-size: 24px; }
.title { font-weight: 600; font-size: 16px; letter-spacing: 0.3px; }

.mode-toggle {
  display: flex;
  gap: 0;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 3px;
}
.mode-toggle button {
  background: transparent;
  border: none;
  color: #aaa;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.15s;
  font-family: inherit;
}
.mode-toggle button:hover { color: #fff; }
.mode-toggle button.active {
  background: #006fcf;
  color: #fff;
}

.filters { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.filters select, .filters input[type="search"] {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #fff;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  min-width: 130px;
}
.filters input[type="search"] { flex: 1; min-width: 180px; }
.new-toggle { display: flex; align-items: center; gap: 6px; color: #ccc; font-size: 13px; cursor: pointer; }
.new-toggle input { cursor: pointer; }

.count {
  font-size: 13px;
  color: #aaa;
  padding: 6px 12px;
  background: #1a1a1a;
  border-radius: 6px;
  white-space: nowrap;
}
.count #count-visible { color: #006fcf; font-weight: 600; }

main {
  display: flex;
  height: calc(100vh - 56px);
}

#map { flex: 1; background: #1a1a1a; }

#sidebar {
  width: 220px;
  background: #f4f4f0;
  border-left: 1px solid #ddd;
  padding: 16px;
  overflow-y: auto;
}

.legend h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: #666; margin-bottom: 10px; }
.legend ul { list-style: none; }
.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  padding: 4px 6px;
  transition: background 0.15s;
}
.legend li:hover { background: rgba(0,111,207,0.08); }
.legend li.muted { opacity: 0.35; }
.legend .swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #999;
  flex-shrink: 0;
}
.legend .label { flex: 1; }
.legend .count-cat { color: #999; font-size: 11px; }

.leaflet-popup-content-wrapper { border-radius: 8px; }
.leaflet-popup-content { margin: 12px 14px; min-width: 200px; font-size: 13px; }
.popup-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.popup-new { display: inline-block; background: #006fcf; color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 3px; margin-left: 6px; letter-spacing: 0.5px; }
.popup-address { color: #555; margin-bottom: 6px; line-height: 1.4; }
.popup-category { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; color: #fff; margin-bottom: 8px; }
.popup-actions { display: flex; gap: 6px; margin-top: 8px; }
.popup-actions a { flex: 1; text-align: center; padding: 6px 8px; background: #006fcf; color: #fff; text-decoration: none; border-radius: 4px; font-size: 12px; font-weight: 500; }
.popup-actions a:hover { background: #005a9c; }

.marker-pin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.marker-pin.is-new::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  background: #ff3b30;
  border: 2px solid #fff;
  border-radius: 50%;
}

@media (max-width: 768px) {
  #topbar { padding: 8px 10px; }
  .brand { min-width: auto; }
  .title { font-size: 14px; }
  .filters select { min-width: 110px; }
  .count { font-size: 12px; }
  #sidebar { display: none; }
}
