/**
 * Shelter Map VE
 *
 * Deliberately unopinionated: inherits the theme's typography and colours and
 * only lays things out. Colours come from custom properties so a theme can
 * override them without fighting specificity.
 */

.smve-map {
  --smve-border: #d8d8d8;
  --smve-accent: #1f51a1;
  --smve-muted: #6a6a6a;
  --smve-surface: #f6f6f6;
  margin: 0 0 1.5em;
}

/* --------------------------------------------------------------------------
   CONTROLS
   -------------------------------------------------------------------------- */

.smve-total {
  margin: 0 0 0.75em;
}

.smve-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75em;
  align-items: flex-end;
  margin: 0 0 0.75em;
}

.smve-field {
  display: flex;
  flex-direction: column;
  gap: 0.25em;
  flex: 1 1 12em;
  min-width: 0;
  font-size: 0.875em;
}

.smve-field--search {
  flex: 2 1 16em;
}

.smve-field > span {
  color: var(--smve-muted);
}

.smve-field select,
.smve-field input {
  width: 100%;
  padding: 0.5em;
  border: 1px solid var(--smve-border);
  border-radius: 3px;
  background: #fff;
  font: inherit;
  font-size: 1em;
  color: inherit;
}

.smve-button {
  flex: 0 0 auto;
  padding: 0.6em 1.1em;
  border: 0;
  border-radius: 3px;
  background: var(--smve-accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.smve-button:hover,
.smve-button:focus-visible {
  filter: brightness(1.1);
}

.smve-button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* --------------------------------------------------------------------------
   MAP
   -------------------------------------------------------------------------- */

.smve-canvas {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--smve-border);
  background: var(--smve-surface);
}

.smve-placeholder {
  margin: 0;
  padding: 1em;
  color: var(--smve-muted);
  text-align: center;
}

.smve-status {
  margin: 0.6em 0 0;
  min-height: 1.5em;
  color: var(--smve-muted);
  font-size: 0.875em;
}

/* Leaflet sets its own font; keep the theme's instead. */
.smve-canvas .leaflet-container {
  font: inherit;
  width: 100%;
  height: 100%;
}

.smve-popup strong,
.smve-popup span,
.smve-popup a {
  display: block;
}

.smve-popup strong {
  margin-bottom: 0.25em;
}

.smve-popup-place,
.smve-popup-distance {
  color: var(--smve-muted);
  font-size: 0.875em;
}

.smve-navigate {
  margin-top: 0.5em;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   SERVER-RENDERED LIST
   -------------------------------------------------------------------------- */

.smve-server-list {
  margin-top: 1.5em;
}

.smve-county-title {
  margin: 0 0 0.6em;
}

.smve-counties {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11em, 1fr));
  gap: 0.4em;
  margin: 0;
  padding: 0;
  list-style: none;
}

.smve-counties a {
  display: flex;
  justify-content: space-between;
  gap: 0.5em;
  padding: 0.5em 0.7em;
  border: 1px solid var(--smve-border);
  border-radius: 3px;
  text-decoration: none;
}

.smve-counties a:hover,
.smve-counties a:focus-visible {
  border-color: var(--smve-accent);
}

.smve-count {
  color: var(--smve-muted);
  font-variant-numeric: tabular-nums;
}

.smve-list {
  margin: 0;
  padding-left: 1.4em;
}

.smve-list li {
  margin-bottom: 0.4em;
}

.smve-list .smve-name {
  margin-right: 0.5em;
}

.smve-list .smve-navigate {
  margin-top: 0;
  display: inline;
  font-size: 0.875em;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .smve-controls {
    gap: 0.5em;
  }

  .smve-button {
    width: 100%;
  }
}
