/* Interactive Local SEO & Map Section Styles — Fully Responsive & Touch-Optimized */

.local-seo-section {
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  padding: 32px 0;
}
@media (min-width: 768px) {
  .local-seo-section { padding: 64px 0; }
}
.local-seo-section--standalone {
  border-top: none;
}

/* Glass Card Helper */
.glass-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(12px);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
@media (min-width: 768px) {
  .glass-card { border-radius: 20px; }
}

/* Control Bar: Search & Region Filters */
.map-controls-wrapper {
  margin-bottom: 16px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (min-width: 768px) {
  .map-controls-wrapper {
    margin-bottom: 24px;
    padding: 16px 20px;
    gap: 16px;
  }
}
@media (min-width: 900px) {
  .map-controls-wrapper {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.map-search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
}
@media (min-width: 900px) {
  .map-search-box {
    max-width: 420px;
  }
}

.map-search-box .search-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}

.map-search-input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 42px;
  font-size: 14px;
  font-weight: 500;
  color: var(--heading);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
}
.map-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 84, 216, 0.15);
}

.map-search-clear {
  position: absolute;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease, background-color 0.2s ease;
  touch-action: manipulation;
}
.map-search-clear:hover {
  background: var(--border);
  color: var(--heading);
}

/* Region Tabs — Touch Horizontal Scroll on Mobile */
.region-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
  margin-bottom: -4px;
}
.region-filters::-webkit-scrollbar {
  display: none;
}

.region-tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  touch-action: manipulation;
}
.region-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.region-tab.is-active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(27, 84, 216, 0.25);
}

/* Main Layout Grid */
.local-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (min-width: 901px) {
  .local-layout {
    grid-template-columns: 1.3fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
  }
}

/* Map Card & Frame */
.local-map-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 340px;
  height: 340px;
  overflow: hidden;
  padding: 0 !important;
  border-radius: 16px;
}
@media (min-width: 600px) {
  .local-map-card {
    min-height: 420px;
    height: 100%;
    border-radius: 20px;
  }
}

.map-container-header {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
@media (min-width: 768px) {
  .map-container-header {
    top: 14px;
    left: 14px;
    right: 14px;
    padding: 10px 16px;
    border-radius: 14px;
  }
}
[data-theme="dark"] .map-container-header {
  background: rgba(20, 24, 33, 0.88);
}

.map-header-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.live-pulse-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background-color: rgba(16, 185, 129, 0.4);
  animation: pulse-ring 1.8s infinite ease-in-out;
}

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

.map-header-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--heading);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
@media (min-width: 600px) {
  .map-header-title { font-size: 13px; }
}

.map-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid rgba(27, 84, 216, 0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
@media (min-width: 600px) {
  .map-action-btn { padding: 6px 12px; font-size: 12px; gap: 6px; }
}
.map-action-btn:hover {
  background: var(--primary);
  color: #fff;
}

.interactive-map-frame {
  width: 100%;
  height: 100%;
  min-height: 340px;
  border-radius: 16px;
  background: var(--surface-2);
  z-index: 1;
}
@media (min-width: 600px) {
  .interactive-map-frame {
    min-height: 420px;
    border-radius: 20px;
  }
}

.map-loading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  min-height: 340px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

/* Hide Leaflet default zoom (+/-) controls */
.leaflet-control-zoom {
  display: none !important;
}

/* Custom Marker Pins */
.custom-leaflet-marker-wrapper {
  background: none;
  border: none;
}

.custom-map-pin {
  position: relative;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pin-core {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1b54d8;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(27, 84, 216, 0.4);
  border: 2px solid #ffffff;
  transition: transform 0.2s ease, background-color 0.2s ease;
  z-index: 2;
}

.pin-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(27, 84, 216, 0.3);
  z-index: 1;
  animation: marker-pulse 2s infinite ease-out;
}

@keyframes marker-pulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.4); opacity: 0; }
}

.custom-map-pin.is-nrw-hub .pin-core {
  background: #f59e0b;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
}
.custom-map-pin.is-nrw-hub .pin-pulse {
  background: rgba(245, 158, 11, 0.4);
}

.custom-map-pin.is-active .pin-core {
  transform: scale(1.3);
  background: #10b981;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.7);
  border-color: #ffffff;
}
.custom-map-pin.is-active .pin-pulse {
  background: rgba(16, 185, 129, 0.5);
  animation-duration: 1.2s;
}

/* Custom Leaflet Popup */
.leaflet-popup-content-wrapper {
  background: var(--background) !important;
  color: var(--heading) !important;
  border-radius: 14px !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2) !important;
  padding: 4px !important;
  border: 1px solid var(--border);
}
.leaflet-popup-tip {
  background: var(--background) !important;
}

.map-popup-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
}
.popup-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--heading);
}
.popup-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}
.popup-select-btn {
  margin-top: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.popup-select-btn:hover {
  opacity: 0.9;
}

/* Live Estimator Card */
.local-estimator-card {
  padding: 16px !important;
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: space-between;
}
@media (min-width: 768px) {
  .local-estimator-card {
    padding: 24px !important;
    gap: 20px;
  }
}

.estimator-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.estimator-badge {
  align-self: flex-start;
  padding: 4px 10px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 9999px;
}

.estimator-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--heading);
  line-height: 1.25;
}
@media (min-width: 768px) {
  .estimator-title { font-size: 1.35rem; }
}

.estimator-subtitle {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: #10b981;
}

.estimator-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 420px) {
  .estimator-metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

.metric-box {
  padding: 10px 12px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.metric-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  flex-shrink: 0;
}
[data-theme="dark"] .metric-icon {
  background: rgba(37, 99, 235, 0.25);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.metric-content {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 500;
}

.metric-value {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--heading);
}

.estimator-subdistricts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subdistricts-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.subdistricts-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sub-chip {
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--heading);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.estimator-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.estimator-actions .btn {
  width: 100%;
  justify-content: center;
}

/* District Chip Grid */
.local-districts-card {
  padding: 16px !important;
  margin-bottom: 20px;
}
@media (min-width: 768px) {
  .local-districts-card {
    padding: 24px !important;
    margin-bottom: 24px;
  }
}

.districts-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
@media (min-width: 768px) {
  .districts-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
  }
}

.local-districts-label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.districts-hint {
  font-size: 11.5px;
  color: var(--text);
  opacity: 0.8;
}

.district-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}
@media (min-width: 540px) {
  .district-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
}
@media (min-width: 840px) {
  .district-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1140px) {
  .district-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.district-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 8px 12px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 6px;
  touch-action: manipulation;
}
@media (min-width: 768px) {
  .district-chip {
    min-height: 48px;
    padding: 10px 14px;
  }
}

.chip-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* High Contrast Readable Time Badge */
.chip-time {
  font-size: 11px;
  font-weight: 700;
  color: #1d4ed8;
  background: rgba(27, 84, 216, 0.1);
  border: 1px solid rgba(27, 84, 216, 0.22);
  padding: 3px 8px;
  border-radius: 8px;
  flex-shrink: 0;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: all 0.2s ease;
}

/* High Contrast Dark Mode Badge Rules */
[data-theme="dark"] .district-chip:not(.is-active) .chip-time {
  color: #60a5fa !important;
  background: rgba(37, 99, 235, 0.2) !important;
  border-color: rgba(96, 165, 250, 0.35) !important;
}

[data-theme="dark"] .district-chip:not(.is-active) {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.12);
}

.district-chip:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
}

.district-chip:focus-visible,
.district-chip.is-active {
  border-color: #2563eb;
  background: #1d4ed8 !important;
  outline: none;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.35);
}

.district-chip.is-active .chip-name {
  color: #ffffff !important;
}

.district-chip.is-active .chip-time {
  background: #ffffff !important;
  color: #1d4ed8 !important;
  border-color: #ffffff !important;
}

.no-cities-found {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

/* Umland Bar */
.local-umland-bar {
  padding: 14px 16px !important;
  margin-bottom: 20px;
}
@media (min-width: 768px) {
  .local-umland-bar {
    padding: 18px 24px !important;
    margin-bottom: 24px;
  }
}

.local-umland-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.umland-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
@media (min-width: 768px) {
  .umland-grid { gap: 8px; }
}

.umland-chip {
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 9999px;
}
@media (min-width: 768px) {
  .umland-chip { padding: 6px 12px; font-size: 12px; }
}

.umland-chip--more {
  font-weight: 600;
  color: var(--primary);
  border-style: dashed;
}

/* Contact Prompt */
.local-contact-prompt {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
@media (min-width: 768px) {
  .local-contact-prompt {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 32px;
    padding-top: 32px;
  }
}

.local-contact-text {
  margin: 0;
  font-size: var(--fs-body, 1rem);
  line-height: 1.6;
  color: var(--text);
  font-weight: 500;
}

.local-contact-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}
@media (min-width: 768px) {
  .local-contact-actions {
    flex-direction: row;
    gap: 12px;
  }
}
