html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#page {
  min-height: 0;
}

.map-page {
  height: 100%;
  position: relative;
  width: 100%;
}

#map {
  height: 100%;
  width: 100%;
}

.content-page {
  height: 100%;
  overflow: auto;
}

.directory-toolbar {
  align-items: end;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.directory-filter {
  min-width: min(22rem, 100%);
}

.domain-filter-group {
  flex-wrap: wrap;
}

.domain-filter-group .btn {
  min-width: 8.5rem;
}

.directory-status {
  min-height: 1.5rem;
}

.councillor-directory-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  padding-bottom: 2rem;
}

.kent-councillor-card {
  align-items: center;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  display: flex;
  gap: 0.85rem;
  min-width: 0;
  padding: 0.85rem;
}

.kent-councillor-card-body {
  min-width: 0;
}

.kent-councillor-heading {
  align-items: flex-start;
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
}

.kent-councillor-heading .badge {
  flex: 0 0 auto;
  margin-top: 0.05rem;
}

.kent-councillor-name {
  color: #212529;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
}

.kent-councillor-party {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 0.2rem;
}

.kent-councillor-meta {
  color: #6c757d;
  font-size: 0.82rem;
  line-height: 1.35;
  margin-top: 0.3rem;
}

.kent-councillor-meta-list {
  margin-top: 0.3rem;
}

.kent-councillor-meta-list .kent-councillor-meta {
  margin-top: 0.12rem;
}

.directory-photo {
  flex-basis: 4.5rem;
  height: 5.6rem;
}

.empty-directory-message {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  color: #6c757d;
  padding: 1rem;
}

@media (max-width: 700px) {
  .directory-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .domain-filter-group {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: 1fr 1fr;
  }

  .domain-filter-group .btn {
    border-radius: 0.375rem !important;
    min-width: 0;
  }
}

.boundary-toggle {
  position: absolute;
  right: 1rem;
  top: calc(2rem - 10px);
  z-index: 500;
}

.boundary-toggle .btn {
  min-width: 5.25rem;
}

.seat-label-toggle {
  bottom: 1rem;
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
  z-index: 500;
}

.seat-label-toggle .btn {
  min-width: 6.75rem;
}

.tile-selector {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(33, 37, 41, 0.18);
  border-radius: 0.375rem;
  bottom: 1rem;
  color: #212529;
  left: 1rem;
  min-width: 12rem;
  padding: 0.65rem 0.75rem;
  position: absolute;
  z-index: 500;
}

.tile-selector .form-label {
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
}

.tile-selector-note {
  color: #b02a37;
  font-size: 0.75rem;
  margin-top: 0.35rem;
}

.map-legend {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(33, 37, 41, 0.18);
  border-radius: 0.375rem;
  bottom: 1rem;
  color: #212529;
  font-size: 0.875rem;
  line-height: 1.55;
  padding: 0.65rem 0.75rem;
  position: absolute;
  right: 1rem;
  z-index: 500;
}

.legend-line {
  border-top: 3px solid;
  display: inline-block;
  margin-right: 0.45rem;
  transform: translateY(-0.2rem);
  width: 1.4rem;
}

.legend-line-blue {
  border-color: #0b4f9c;
}

.legend-line-green {
  border-color: #116530;
}

.legend-line-red {
  border-color: #b02a37;
}

.leaflet-control-attribution {
  font-size: 0.7rem;
}

.navbar-admin-switch {
  min-height: 2.5rem;
  padding-top: 0.5rem;
}

.leaflet-interactive:focus {
  outline: none;
}

.councillor-card {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
}

.councillor-card-body {
  flex: 1 1 auto;
  min-width: 0;
}

.councillor-name {
  color: #212529;
  font-weight: 700;
  line-height: 1.25;
}

.councillor-party {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 0.15rem;
}

.councillor-photo-preview {
  align-items: center;
  background: #f1f3f5;
  border: 5px solid var(--party-border-colour, #dee2e6);
  border-radius: 0.375rem;
  display: flex;
  flex: 0 0 4rem;
  height: 5rem;
  justify-content: center;
  overflow: hidden;
}

.councillor-photo-preview img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.seat-label-marker {
  align-items: center;
  background: #000;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  color: #fff;
  display: flex;
  font-size: 0.85rem;
  font-weight: 700;
  height: 30px;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  width: 30px;
}
