/* ── Reset & base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
  background: white;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Page card ───────────────────────────────────────────────────── */
.page {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  height: 100vh;
  background: white;
  overflow: hidden;
}

/* ── Map panel (left) ────────────────────────────────────────────── */
.map-panel {
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  border-right: 1.5px solid #d0d0d0;
  display: flex;
}

/* ── SVG map ─────────────────────────────────────────────────────── */
#map-svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#map-svg:active {
  cursor: grabbing;
}

/* ── Marker fade transition ──────────────────────────────────────── */
.marker { transition: opacity 0.18s ease; }

/* ── District fills + boundary lines ────────────────────────────── */
.district-boundary {
  stroke: rgba(60,60,60,0.4);
  stroke-width: 0.5;
  stroke-linejoin: round;
}

/* ── District labels ─────────────────────────────────────────────── */
.district-label-group { cursor: default; }
.district-label {
  font-size: 6.5px;
  font-weight: 500;
  fill: rgba(0,0,0,0.5);
  stroke: white;
  stroke-width: 2px;
  paint-order: stroke fill;
  letter-spacing: 0.02em;
  font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
}

/* ── Province labels ─────────────────────────────────────────────── */
.province-label-group { cursor: default; }
.province-label {
  font-size: 8.5px;
  font-weight: 700;
  fill: rgba(0,0,0,0.6);
  stroke: white;
  stroke-width: 2.5px;
  paint-order: stroke fill;
  letter-spacing: 0.05em;
  font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
}

/* ── Project tooltip ─────────────────────────────────────────────── */
#map-tooltip {
  position: fixed;
  display: none;
  background: rgba(16,16,16,0.93);
  color: white;
  font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
  border-radius: 6px;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(0,0,0,0.45);
  border-left: 3px solid #888;
  max-width: 230px;
  min-width: 140px;
}

.tt-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  padding: 8px 11px 5px;
  color: white;
}

.tt-sector {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 0 11px 5px;
  color: rgba(255,255,255,0.8);
}

.tt-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tt-dot i {
  font-size: 7.5px;
  color: white;
}

.tt-location {
  font-size: 10px;
  padding: 4px 11px 7px;
  color: rgba(255,255,255,0.5);
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ── Side panel (right) ──────────────────────────────────────────── */
/* font-size uses the smaller of vw/vh so content always fits the panel height */
.side-panel {
  width: clamp(180px, 16vw, 320px);
  font-size: clamp(8px, min(0.85vw, 1.35vh), 15px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: hidden;
}

/* ── Legend boxes ────────────────────────────────────────────────── */
.legend-box {
  padding: 1.2em 1.2em 1em;
  border-bottom: 1.5px solid #d0d0d0;
}

.legend-box:last-child {
  border-bottom: none;
}

.legend-title {
  font-size: 1em;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #1a1a1a;
  text-transform: uppercase;
  margin-bottom: 0.9em;
  padding-bottom: 0.5em;
  border-bottom: 1.5px solid #1a1a1a;
}

/* ── Sector legend items ─────────────────────────────────────────── */
#sector-legend-items {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

#clear-sector-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.3em 0.6em;
  margin-top: 0.25em;
  font-family: inherit;
  font-size: 0.82em;
  color: #555;
  background: #efefef;
  border: 1px solid #d8d8d8;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
#clear-sector-btn:hover { background: #e0e0e0; color: #111; }

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.7em;
  cursor: pointer;
  border-radius: 4px;
  padding: 0.18em 0.3em;
  margin: 0 -0.3em;
  transition: opacity 0.18s ease;
}
.legend-item:hover { background: rgba(0,0,0,0.04); }
.legend-item.active { background: rgba(0,0,0,0.06); }
.legend-item.dimmed { opacity: 0.3; }

.legend-icon {
  width: 1.9em;
  height: 1.9em;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(255,255,255,0.7);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.legend-icon i {
  font-size: 0.85em;
  color: white;
}

.legend-label {
  font-size: 1em;
  color: #333;
  line-height: 1.2;
}

/* ── Province count table ────────────────────────────────────────── */
#province-count-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1em;
}

#province-count-table tbody tr {
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s ease;
}
#province-count-table tbody tr:hover { background: rgba(0,0,0,0.04); }
#province-count-table tbody tr.active { background: rgba(0,0,0,0.08); }

#province-count-table td {
  padding: 0.3em 0.3em;
  color: #333;
  vertical-align: middle;
}

.province-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9em;
  height: 1.9em;
  border-radius: 50%;
  border: 0.8px solid rgba(0,0,0,0.2);
  margin-right: 0.5em;
  vertical-align: middle;
  flex-shrink: 0;
  font-size: 0.85em;
  font-weight: 700;
  color: white;
  line-height: 1;
}

#province-count-table .count-cell {
  text-align: right;
  font-weight: 700;
  color: #1a1a1a;
  width: 2.8em;
}

.province-total {
  margin-top: 0.55em;
  padding-top: 0.45em;
  border-top: 1.5px solid #333;
  display: flex;
  justify-content: space-between;
  font-size: 1.05em;
  font-weight: 800;
  color: #1a1a1a;
}

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-notice {
  font-size: 0.9em;
  color: #888;
  font-style: italic;
  padding: 0.6em 0;
}

