/* LandAI CSS owner: Floating map controls, coverage menu, state filters, and style rows. */
.map-floating-dock-zoom .map-dock-zoom-in {
  border-radius: 999px 999px 0 0;
  border-bottom: 1px solid var(--border);
}

.map-floating-dock-zoom .map-dock-zoom-out {
  border-radius: 0 0 999px 999px;
}

.map-floating-dock-zoom .map-dock-zoom-in:hover,
.map-floating-dock-zoom .map-dock-zoom-out:hover {
  background: #f8fafc;
}

/* User GPS dot on map (Mapbox Marker) */
.map-user-location-marker {
  position: relative;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.map-user-location-dot {
  position: relative;
  z-index: 2;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2563eb;
  border: 3px solid #fff;
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.45),
    0 2px 10px rgba(0, 0, 0, 0.28);
}

.map-user-location-pulse {
  position: absolute;
  z-index: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.35);
  animation: map-user-location-pulse 2.2s ease-out infinite;
}

@keyframes map-user-location-pulse {
  0% {
    transform: scale(0.45);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.65);
    opacity: 0;
  }
}

.map-loading-overlay {
  position: fixed;
  top: var(--premium-banner-offset);
  right: 0;
  bottom: 0;
  left: var(--left-rail-width);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(241, 245, 249, 0.95);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.map-loading-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.supported-counties-legend {
  position: fixed;
  left: calc(var(--left-rail-width) + 10px);
  bottom: 124px;
  z-index: 8;
  width: min(280px, calc(100vw - var(--left-rail-width) - 36px));
  display: grid;
  gap: 0.48rem;
  padding: 0.72rem 0.8rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
  color: var(--text);
  pointer-events: none;
}

.supported-counties-legend[hidden] {
  display: none;
}

.supported-counties-legend-title {
  font-size: 0.78rem;
  font-weight: 800;
}

.supported-counties-legend-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  font-size: 0.76rem;
  line-height: 1.25;
  color: var(--text-muted);
}

.supported-counties-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.16);
}

.supported-counties-legend-swatch.is-complete {
  background: #34C759;
}

.supported-counties-legend-swatch.is-partial {
  background: #f59e0b;
}

.supported-counties-legend-swatch.is-limited {
  background: #dc2626;
}

.supported-counties-legend-swatch.is-unknown {
  background: #64748b;
}

.supported-counties-legend-swatch.is-premium {
  background: #FF9500;
}

.supported-county-stats-card {
  position: fixed;
  left: calc(var(--left-rail-width) + 18px);
  bottom: 245px;
  z-index: 9;
  width: min(320px, calc(100vw - var(--left-rail-width) - 36px));
  padding: 0.78rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  color: var(--text);
}

.supported-county-stats-card[hidden] {
  display: none;
}

.supported-county-stats-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.supported-county-stats-kicker {
  margin: 0 0 0.15rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--text-muted);
}

.supported-county-stats-header h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.15;
}

.supported-county-stats-close {
  width: 30px;
  height: 30px;
  border: 1px solid #dbe2ea;
  border-radius: 7px;
  background: #f8fafc;
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 900;
  cursor: pointer;
}

.supported-county-stats-close:hover {
  background: #e2e8f0;
}

.supported-county-stats-content {
  display: grid;
  gap: 0.58rem;
}

.supported-county-stats-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid #e2e8f0;
}

.supported-county-status-pill {
  flex: 0 0 auto;
  padding: 0.22rem 0.48rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  color: #fff;
  background: #64748b;
}

.supported-county-status-pill.is-complete {
  background: #16a34a;
}

.supported-county-status-pill.is-partial {
  background: #f59e0b;
}

.supported-county-status-pill.is-limited {
  background: #dc2626;
}

.supported-county-status-pill.is-premium {
  background: #2563eb;
}

.supported-county-stats-active {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.supported-county-stats-meta,
.supported-county-stats-empty {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--text-muted);
}

.supported-county-stats-empty {
  padding: 0.55rem 0.62rem;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #f8fafc;
}

.supported-county-stat-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.9fr) minmax(0, 1.1fr) auto;
  align-items: center;
  gap: 0.55rem;
  min-height: 28px;
  font-size: 0.78rem;
}

.supported-county-stat-label {
  font-weight: 800;
}

.supported-county-stat-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.supported-county-stat-bar > span {
  display: block;
  width: var(--coverage-pct, 0%);
  height: 100%;
  border-radius: inherit;
  background: #64748b;
}

.supported-county-stat-row.is-complete .supported-county-stat-bar > span {
  background: #16a34a;
}

.supported-county-stat-row.is-partial .supported-county-stat-bar > span {
  background: #f59e0b;
}

.supported-county-stat-row.is-limited .supported-county-stat-bar > span {
  background: #dc2626;
}

.supported-county-stat-value {
  min-width: 92px;
  text-align: right;
  color: var(--text-muted);
  white-space: nowrap;
}

.map-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: map-loading-spin 0.8s linear infinite;
}

.map-loading-text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

@keyframes map-loading-spin {
  to { transform: rotate(360deg); }
}

.map-controls {
  position: fixed;
  top: calc(var(--premium-banner-offset) + 76px);
  left: calc(var(--left-rail-width) + 12px);
  right: auto;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 400px;
  width: min(400px, calc(100vw - var(--left-rail-width) - 24px));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  /* Allow coverage dropdown + state picker to extend below the card (was clipping) */
  overflow: visible;
  transform: translateX(0);
  transform-origin: top left;
  transition: opacity 0.16s ease, visibility 0.16s ease, transform 0.16s ease;
}

.map-controls.is-closed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-8px);
}

.map-controls.is-minimized .controls-body {
  display: none;
}

.controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.controls-header h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.controls-header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.controls-body {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.menu-toggle-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.menu-toggle-btn:hover {
  background: #f8fafc;
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 170px;
  min-width: 170px;
  max-height: min(85vh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  display: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.35rem;
  z-index: 20;
}

/* Globe (coverage) menu — wider than the generic ☰ dropdown */
#coverage-dropdown {
  width: min(92vw, 300px);
  min-width: min(92vw, 300px);
  padding: 0.5rem 0.45rem;
}

#coverage-dropdown.state-picker-open {
  width: min(92vw, 380px);
  min-width: min(92vw, 380px);
}

#coverage-dropdown .menu-item-btn {
  font-size: 0.9rem;
  padding: 0.55rem 0.55rem;
}

.menu-dropdown.is-open {
  display: grid;
  gap: 0.2rem;
}

.app-menu {
  position: relative;
}

.menu-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  text-align: left;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.86rem;
  color: var(--text);
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}

.menu-item-btn span {
  min-width: 0;
}

.menu-item-btn-with-icon .menu-item-main {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.46rem;
}

.menu-item-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: currentColor;
}

.menu-item-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.menu-shortcut {
  flex: 0 0 auto;
  padding: 0.12rem 0.28rem;
  border: 1px solid #dbe2ea;
  border-radius: 4px;
  background: #f8fafc;
  color: #64748b;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}

.menu-item-btn.is-active .menu-shortcut {
  border-color: rgba(21, 128, 61, 0.22);
  background: rgba(255, 255, 255, 0.72);
  color: #15803d;
}

.menu-item-btn:hover {
  background: #f1f5f9;
}

.menu-item-btn.is-active {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
  font-weight: 600;
}

.state-outline-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.1rem;
  min-width: 0;
}

.state-outline-row .state-outline-toggle-btn {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.state-outline-color-input {
  width: 40px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
  flex-shrink: 0;
}

.state-filter-section {
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.state-filter-toggle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.state-filter-toggle:hover {
  color: var(--text);
}

.state-picker-panel {
  margin-top: 0.35rem;
  padding: 0.5rem;
  background: #f8fafc;
  border-radius: 6px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease;
}

.state-picker-panel.is-open {
  max-height: min(48vh, 420px);
}

.state-picker-actions {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.state-picker-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-family: inherit;
  background: #e2e8f0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text);
}

.state-picker-btn:hover {
  background: #cbd5e1;
}

.state-checkbox-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.28rem;
  max-height: min(36vh, 320px);
  overflow-y: auto;
}

.state-checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.2rem 0;
}

.state-checkbox-item:hover {
  color: var(--accent);
}

.state-checkbox-item input {
  margin: 0;
  cursor: pointer;
}

.style-row {
  display: grid;
  gap: 0.35rem;
}

.style-row label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.style-row select {
  width: 100%;
  padding: 0.45rem 0.6rem;
  font-size: 0.875rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.style-row select:focus {
  outline: none;
  border-color: var(--accent);
}

.wayback-release-row {
  margin-top: -0.2rem;
}

.wayback-release-row[hidden] {
  display: none;
}

.wayback-release-status {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--text-muted);
}

.wayback-release-status.is-error {
  color: #b91c1c;
}
