/* Availability categories and the separate Dallas / DFW practice marker. */
.state-availability-map {
  --state-available: #d1e5db;
  --state-restricted: #e6c7ce;
  --state-base: #f2d89a;
  --state-outline: #fffdf8;
  --state-selected: #18496a;
  --state-panel: #f4f1ea;
  --state-border: #d4d8d8;
  max-width: 820px;
  margin: 14px auto 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: #123555;
}
html[data-theme="dark"] .state-availability-map {
  --state-available: #c8ded4;
  --state-restricted: #debdc7;
  --state-base: #eacb82;
  --state-outline: #f8fbfd;
  --state-panel: #eef3f7;
  --state-border: #c9d6df;
}
.state-map-canvas { order: 0; width: 100%; min-width: 0; margin-inline: auto; }
.state-map-svg { display: block; width: 100%; height: auto; aspect-ratio: 980 / 615; overflow: visible; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.state-map-shapes path {
  fill: var(--state-available);
  stroke: var(--state-outline);
  stroke-width: 1.3;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill .12s;
}
.state-map-shapes path[data-status="restricted"] { fill: var(--state-restricted); }
.state-map-shapes path[data-status="base"] { fill: var(--state-base); }
.state-map-selection { pointer-events: none; }
.state-map-selection path {
  fill: none;
  stroke: var(--state-selected);
  stroke-width: 1.15;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
@media (min-width: 821px) and (hover: hover) and (pointer: fine) {
  .state-map-selection path { stroke-width: 1.3; }
}
.state-map-city-marker { pointer-events: none; }
.state-map-city-marker path,
.state-map-base-symbol path { fill: var(--state-base); stroke: var(--state-selected); stroke-width: 1; stroke-linejoin: round; }
.state-map-labels { pointer-events: none; }
.state-map-labels text { fill: #123555; font: 600 12px system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; }
.state-map-controls { position: relative; order: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.state-map-control { display: flex; align-items: center; gap: 12px; }
.state-map-select-row { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
.state-map-control label { flex: 0 0 auto; font-weight: 650; }
#details-modal .state-map-control select,
#details-modal .state-map-control .state-map-picker-toggle {
  width: 100%; min-width: 0; max-width: 330px; min-height: 36px; height: 36px;
  background: var(--state-panel); color: #123555;
  border: 1px solid var(--state-border); border-radius: 12px;
  padding: 5px 12px; font: inherit; line-height: 1.25;
}
/* The current choice uses the same category colors as the map legend. */
#details-modal .state-map-control select[data-status="available"],
#details-modal .state-map-control .state-map-picker-toggle[data-status="available"] { background: var(--state-available); }
#details-modal .state-map-control select[data-status="restricted"],
#details-modal .state-map-control .state-map-picker-toggle[data-status="restricted"] { background: var(--state-restricted); }
#details-modal .state-map-control select[data-status="base"],
#details-modal .state-map-control .state-map-picker-toggle[data-status="base"] { background: var(--state-base); }
/* Each native list item carries its own category instead of inheriting the current choice. */
#details-modal .state-map-control option { background: var(--state-panel); color: #123555; }
#details-modal .state-map-control option[data-status="available"] { background: var(--state-available); }
#details-modal .state-map-control option[data-status="restricted"] { background: var(--state-restricted); }
#details-modal .state-map-control option[data-status="base"] { background: var(--state-base); }
#details-modal .state-map-control select:focus-visible { outline: 3px solid #245b83; outline-offset: -3px; }
#details-modal .state-map-control select[hidden] { display: none !important; }
#details-modal .state-map-control .state-map-picker-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  text-align: left; cursor: pointer; box-shadow: none; transform: none;
  -webkit-tap-highlight-color: transparent;
}
.state-map-picker-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#details-modal .state-map-picker-toggle::after {
  content: ""; flex: 0 0 auto; width: 7px; height: 7px;
  border-right: 1px solid currentColor; border-bottom: 1px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
#details-modal .state-map-picker-toggle:focus-visible { outline: 2px solid #245b83; outline-offset: -2px; }
.state-picker-popup.state-availability-map {
  position: fixed; z-index: 3; display: block; box-sizing: border-box;
  max-width: none; margin: 0; padding: 4px; gap: 0;
  overflow: auto; overscroll-behavior: contain; touch-action: pan-y;
  border: 1px solid var(--state-border); border-radius: 12px;
  background: var(--state-panel); color: #123555;
  box-shadow: 0 10px 28px rgba(18,53,85,.18);
  scrollbar-width: thin; scrollbar-color: #9baeb8 var(--state-panel);
}
.state-picker-popup[hidden] { display: none !important; }
.state-picker-option {
  position: relative; min-height: 32px; box-sizing: border-box;
  padding: 6px 30px 6px 10px; border-radius: 5px;
  color: #123555; line-height: 1.4; cursor: pointer;
  overflow-wrap: anywhere; background: var(--state-available);
  -webkit-tap-highlight-color: transparent;
}
.state-picker-option[data-status="restricted"] { background: var(--state-restricted); }
.state-picker-option[data-status="base"] { background: var(--state-base); }
/* Active/selected indicators never replace a state's category background. */
.state-picker-option.is-active { outline: 1.3px solid var(--state-selected); outline-offset: -3px; }
.state-picker-option[aria-selected="true"]::after {
  content: "✓"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-weight: 700; color: var(--state-selected);
}
/* The legend explains category colors; changes are still announced to screen readers. */
.state-map-detail {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; background: transparent;
}
.state-availability-map .us-map-legend { order: 3; width: 100%; margin: 0; }
.state-availability-map .state-availability-footnote { order: 4; margin: 0; }
#details-modal .state-availability-map .legend-available { background: var(--state-available) !important; border-color: #87af99 !important; }
#details-modal .state-availability-map .legend-restricted { background: var(--state-restricted) !important; border-color: #b88091 !important; }
#details-modal .state-availability-map .legend-base {
  width: 15px; height: 15px; flex: 0 0 15px; display: inline-block;
  background: none !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
}
@media (max-width: 600px) {
  .state-map-controls { order: -1; }
  .state-map-control { flex-direction: column; align-items: stretch; gap: 5px; }
  #details-modal .state-map-control select,
  #details-modal .state-map-control .state-map-picker-toggle { max-width: none; font-size: 16px; }
  .state-availability-map { gap: 10px; }
}
@media (hover: none), (pointer: coarse), (max-width: 820px) {
  .state-picker-option { min-height: 44px; padding-top: 11px; padding-bottom: 11px; }
}
@media (prefers-reduced-motion: reduce) { .state-map-shapes path { transition: none; } }

.state-map-pin { flex: 0 0 auto; border: 1px solid var(--state-selected); border-radius: 999px; padding: 1px 7px; font: 600 11px/1.4 system-ui, sans-serif; color: var(--state-selected); background: transparent; cursor: pointer; }
.state-map-pin[hidden] { display: none !important; }
.state-map-pin:focus-visible { outline: 2px solid var(--state-selected); outline-offset: 2px; }
