* {
  box-sizing: border-box;
}

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

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 16px;
  background: #1a1a1a;
  color: #fff;
  flex-wrap: wrap;
}

#topbar h1 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
}

#topbar label {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#province-select {
  font-size: 13px;
  padding: 4px 8px;
}

#layer-toggles {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-left: auto;
}

#map {
  flex: 1;
  width: 100%;
}

/* Popup content */
.popup-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.popup-section-title {
  font-weight: 600;
  font-size: 12px;
  margin-top: 8px;
  color: #444;
}

.popup-row {
  font-size: 13px;
  margin: 2px 0;
}

.speed-toggle {
  display: flex;
  gap: 6px;
  margin: 6px 0;
  flex-wrap: wrap;
}

.speed-toggle button {
  font-size: 11px;
  padding: 2px 6px;
  cursor: pointer;
}

.speed-toggle button.active {
  background: #1a1a1a;
  color: #fff;
}
.leaflet-popup-content {
  width: auto !important;
}

.popup-links {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.tier-context {
  color: #555;
  font-style: italic;
  font-size: 12px;
}

.tier-columns {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}

.tier-table-col {
  flex: 1;
  min-width: 0;
}

.tier-chart-col {
  flex-shrink: 0;
}

.tier-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}

.tier-table td {
  padding: 3px 4px;
}

.tier-table td:last-child {
  text-align: right;
  font-weight: 600;
}

/*Hex*/
.hex-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
  margin: 4px 0 8px;
}

.hex-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  color: #888;
  padding: 2px 8px 4px 0;
  border-bottom: 1px solid #ddd;
}

.hex-table td {
  padding: 3px 8px 3px 0;
  border-bottom: 1px solid #f0f0f0;
}

/*Pie chart*/
.pie-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

.pie-chart {
  width: 90px;
  height: 90px;
  border-radius: 50%;
}

.pie-note {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

/* badges */
.flag-row {
  display: flex;
  gap: 8px;
  margin: 6px 0 10px;
}

.flag-badge {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: center;
}

.flag-label {
  font-size: 11px;
  opacity: 0.85;
  margin-bottom: 2px;
}

.flag-value {
  font-size: 15px;
  font-weight: 700;
}

.flag-good {
  background: #dceee6;
  color: #0f6e56;
}

.flag-bad {
  background: #fbe1da;
  color: #b23b12;
}

.flag-unknown {
  background: #eee;
  color: #666;
}

/* divIcon */
.community-house-icon {
  background: none;
  border: none;
}

/* towers */
.tower-marker {
  background: none;
  border: none;
}

.tower-popup-toggle {
  cursor: default;
}

.tower-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 6px 0;
}

.tower-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  color: #888;
  padding: 2px 8px 4px 0;
  border-bottom: 1px solid #ddd;
}

.tower-table td {
  padding: 4px 8px 4px 0;
  border-bottom: 1px solid #f0f0f0;
}

.tower-detail-btn {
  margin-top: 8px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background: #1a1a1a;
  color: #fff;
  cursor: pointer;
}

.tower-detail-btn:hover {
  opacity: 0.85;
}

.tower-cards {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tower-card {
  flex: 1 1 220px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 8px 10px;
}

.tower-card-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 8px;
  font-size: 12px;
  margin-top: 4px;
}

.tower-card-label {
  color: #888;
}

/*Drawer*/
#filter-drawer {
  position: absolute;
  top: 60px;
  right: 0;
  width: 280px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: #fff;
  border-left: 1px solid #ddd;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.08);
  padding: 16px;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  z-index: 1000;
}

#filter-drawer.open {
  transform: translateX(0);
}

.filter-field {
  margin-bottom: 14px;
}

.filter-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #444;
}

.filter-field input,
.filter-field select {
  width: 100%;
  font-size: 13px;
  padding: 5px 6px;
}

.filter-range-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-range-row input {
  width: 0;
  flex: 1;
}

#filter-reset-btn {
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}

#filter-count {
  font-size: 12px;
  color: #666;
  margin-left: 8px;
}
