/* ===========================================
   MAP-SPECIFIC STYLES
   =========================================== */

/* ===========================================
   MAP CONTAINER
   =========================================== */
#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-base);
  background: var(--color-surface);
}

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

/* Leaflet overrides */
.leaflet-container {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  background: var(--color-surface);
  z-index: var(--z-base);
}

.leaflet-pane {
  z-index: var(--z-base);
}

.leaflet-tile-pane {
  z-index: var(--z-base);
}

.leaflet-marker-pane {
  z-index: var(--z-dropdown);
}

.leaflet-popup-pane {
  z-index: var(--z-fixed);
}

.leaflet-tooltip-pane {
  z-index: var(--z-tooltip);
}

/* ===========================================
   MAP CONTROLS (Right side floating)
   =========================================== */
.map-controls {
  position: fixed;
  top: 50%;
  right: var(--space-4);
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: var(--z-fixed);
  pointer-events: none;
}

.map-control-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  color: var(--color-on-surface);
  box-shadow: var(--glass-shadow);
  transition: all var(--duration-base) var(--ease-spring);
}

.map-control-btn:hover {
  background: var(--glass-bg-strong);
  border-color: var(--glass-border-strong);
  box-shadow: var(--glass-shadow-strong);
  transform: translateY(-1px) scale(1.05);
}

.map-control-btn:active {
  transform: translateY(0) scale(0.98);
}

.map-control-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-primary);
}

.map-control-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.map-control-btn .tooltip {
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%) translateX(-8px);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-white);
  background: var(--color-on-surface);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.map-control-btn:hover .tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(-4px);
}

/* Locate button active state */
.map-control-btn.locate-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
  animation: pulse-ring 2s ease-out infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(27, 94, 32, 0.4); }
  70% { box-shadow: 0 0 0 12px rgba(27, 94, 32, 0); }
  100% { box-shadow: 0 0 0 0 rgba(27, 94, 32, 0); }
}

/* ===========================================
   CUSTOM MAP MARKERS
   =========================================== */
.park-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform var(--duration-fast) var(--ease-spring);
  cursor: pointer;
}

.park-marker:hover {
  transform: scale(1.2);
  z-index: 1000;
}

.park-marker-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  border: 3px solid var(--color-white);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: var(--shadow-lg);
  transition: all var(--duration-base) var(--ease-spring);
}

.park-marker:hover .park-marker-icon {
  transform: rotate(-45deg) scale(1.15);
  box-shadow: var(--shadow-xl);
}

.park-marker-icon svg {
  width: 20px;
  height: 20px;
  color: var(--color-white);
  transform: rotate(45deg);
  stroke-width: 2.5;
}

.park-marker-icon.sponsored {
  background: linear-gradient(135deg, #FFD700, #FFA500);
}

.park-marker-icon.adopted {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
}

.park-marker-icon.featured {
  background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-light));
}

.park-marker-label {
  margin-top: 4px;
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-on-surface);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-full);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: all var(--duration-base) var(--ease-out);
}

.park-marker:hover .park-marker-label,
.park-marker.selected .park-marker-label {
  opacity: 1;
  transform: translateY(0);
}

.park-marker.selected .park-marker-icon {
  animation: marker-bounce 0.5s var(--ease-bounce);
}

@keyframes marker-bounce {
  0%, 100% { transform: rotate(-45deg) scale(1); }
  50% { transform: rotate(-45deg) scale(1.3); }
}

/* Cluster markers */
.marker-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-weight: var(--font-bold);
  color: var(--color-white);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  box-shadow: var(--shadow-lg);
  border: 3px solid var(--color-white);
  transition: transform var(--duration-fast) var(--ease-spring);
}

.marker-cluster:hover {
  transform: scale(1.15);
}

.marker-cluster-small { width: 36px; height: 36px; font-size: var(--text-sm); }
.marker-cluster-medium { width: 48px; height: 48px; font-size: var(--text-base); }
.marker-cluster-large { width: 60px; height: 60px; font-size: var(--text-lg); }

.marker-cluster div {
  background: transparent !important;
}

/* Spiderfy */
.leaflet-marker-icon.leaflet-spiderfied {
  z-index: 2000 !important;
}

/* ===========================================
   MAP POPUP / INFO CARD
   =========================================== */
.park-info-card {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 70vh;
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-2xl);
  z-index: var(--z-modal);
  transform: translateY(100%);
  transition: transform var(--duration-slower) var(--ease-spring);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.park-info-card.open {
  transform: translateY(0);
}

.park-info-card.dragging {
  transition: none;
}

.park-info-card-handle {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: var(--color-outline);
  border-radius: var(--radius-full);
  cursor: grab;
}

.park-info-card-header {
  position: relative;
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-outline);
}

.park-info-card-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-on-surface-variant);
  transition: all var(--duration-fast);
}

.park-info-card-close:hover {
  background: var(--color-surface-container);
  color: var(--color-on-surface);
}

.park-info-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.park-info-card-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
}

.park-info-card-title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-on-surface);
  margin-bottom: var(--space-1);
}

.park-info-card-location {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
  margin-bottom: var(--space-4);
}

.park-info-card-location svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-primary);
}

.park-info-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-outline);
}

.park-info-stat {
  text-align: center;
}

.park-info-stat-value {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-on-surface);
  line-height: 1.2;
}

.park-info-stat-label {
  font-size: var(--text-xs);
  color: var(--color-on-surface-disabled);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.park-info-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.park-info-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
}

.park-info-tag.sponsored {
  background: var(--color-secondary-50);
  color: var(--color-secondary);
}

.park-info-tag.adopted {
  background: var(--color-primary-50);
  color: var(--color-primary);
}

.park-info-tag.featured {
  background: var(--color-accent-50);
  color: var(--color-accent);
}

.park-info-tag.available {
  background: var(--color-success-50);
  color: var(--color-success);
}

.park-info-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.park-info-card-actions .btn {
  flex: 1;
  min-width: 120px;
}

/* Mobile bottom sheet */
@media (max-width: 767px) {
  .park-info-card {
    max-height: 85vh;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  }

  .park-info-card-content {
    padding: var(--space-4);
  }

  .park-info-card-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
  }

  .park-info-card-actions {
    position: sticky;
    bottom: 0;
    padding: var(--space-4);
    background: var(--color-surface);
    border-top: 1px solid var(--color-outline);
    margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) 0;
    padding-top: var(--space-3);
  }
}

/* ===========================================
   MAP LAYER BAR - Bottom horizontal tiles
   =========================================== */
.map-layer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  opacity: 0;
  visibility: hidden;
  transition: all 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.6) 70%, transparent 100%);
  pointer-events: none;
}

.map-layer-bar.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.map-layer-bar-inner {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  overflow-x: auto;
  padding: var(--space-2) 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.map-layer-bar-inner::-webkit-scrollbar {
  display: none;
}

.map-layer-tile {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease;
}

.map-layer-tile:hover {
  transform: scale(1.05);
}

.map-layer-tile:active {
  transform: scale(0.95);
}

.map-layer-tile-preview {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255,255,255,0.2);
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  overflow: hidden;
  position: relative;
}

.map-layer-tile.active .map-layer-tile-preview {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary), 0 4px 12px rgba(27, 94, 32, 0.4);
}

.map-layer-tile-icon {
  width: 28px;
  height: 28px;
  color: rgba(255,255,255,0.9);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.map-layer-tile-icon svg {
  width: 100%;
  height: 100%;
}

.map-layer-tile-label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  letter-spacing: 0.02em;
}

.map-layer-tile.active .map-layer-tile-label {
  color: var(--color-primary-lighter);
  font-weight: 600;
}

/* Animation for tiles appearing */
@keyframes tile-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.map-layer-bar.open .map-layer-tile {
  animation: tile-slide-up 0.3s cubic-bezier(0.32, 0.72, 0, 1) both;
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .map-layer-bar {
    padding: var(--space-2) var(--space-3) calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
  }

  .map-layer-tile-preview {
    width: 56px;
    height: 56px;
  }

  .map-layer-tile-icon {
    width: 24px;
    height: 24px;
  }

  .map-layer-tile-label {
    font-size: 10px;
  }
}

/* ===========================================
   SEARCH BAR (Top floating)
   =========================================== */
.search-bar {
  position: fixed;
  top: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  z-index: var(--z-fixed);
  pointer-events: none;
}

@media (min-width: 1024px) {
  .search-bar {
    left: calc(50% + 36px);
    max-width: 480px;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  body.sidebar-expanded .search-bar {
    left: calc(50% + 130px);
  }
}

.search-bar-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow);
  transition: all var(--duration-base) var(--ease-out);
}

.search-bar-inner:focus-within {
  background: var(--glass-bg-strong);
  border-color: var(--color-primary);
  box-shadow: var(--glass-shadow-strong), 0 0 0 4px var(--color-primary-100);
}

[data-theme="dark"] .search-bar-inner:focus-within {
  box-shadow: var(--glass-shadow-strong), 0 0 0 4px var(--color-primary-900);
}

.search-icon {
  width: 20px;
  height: 20px;
  color: var(--color-on-surface-disabled);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  min-width: 0;
  padding: var(--space-2) 0;
  font-size: var(--text-base);
  color: var(--color-on-surface);
  background: transparent;
  border: none;
  outline: none;
}

.search-input::placeholder {
  color: var(--color-on-surface-disabled);
}

.search-filter-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-on-surface-variant);
  transition: all var(--duration-fast);
}

.search-filter-btn:hover {
  background: var(--color-surface-container);
  color: var(--color-on-surface);
}

.search-filter-btn svg {
  width: 20px;
  height: 20px;
}

.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: var(--space-2);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow-strong);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--duration-base) var(--ease-out);
  pointer-events: none;
  max-height: 400px;
  overflow-y: auto;
}

.search-bar-inner:focus-within .search-results-dropdown,
.search-results-dropdown:not(:empty) {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--color-on-surface);
  transition: background var(--duration-fast);
}

.search-result-item:hover,
.search-result-item.highlighted {
  background: var(--color-surface-container);
}

.search-result-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-100);
  color: var(--color-primary);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.search-result-icon svg {
  width: 20px;
  height: 20px;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-type {
  font-size: var(--text-xs);
  color: var(--color-on-surface-disabled);
}

.search-result-distance {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-primary);
  white-space: nowrap;
}

.search-result-divider {
  height: 1px;
  background: var(--color-outline);
  margin: var(--space-2) var(--space-4);
}

.search-result-empty {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-on-surface-disabled);
}

.search-result-ai {
  padding: var(--space-8) var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
  animation: ai-fade-up 0.3s ease-out both;
}
.search-result-ai p {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--color-on-surface);
}
.search-result-ai-sub {
  display: block;
  font-size: 11px;
  color: var(--color-on-surface-disabled);
  margin-top: var(--space-1);
}
.search-result-ai small {
  display: block;
  margin-top: var(--space-2);
  font-size: 11px;
  color: var(--color-primary);
}
.search-result-ai.found {
  animation: ai-found-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.search-result-ai.found svg {
  animation: ai-check-draw 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
}
.search-result-ai.found p {
  color: #2E7D32;
  font-weight: 500;
  animation: ai-fade-up 0.4s ease-out 0.3s both;
}
.search-result-ai.found .search-result-ai-sub {
  animation: ai-fade-up 0.4s ease-out 0.45s both;
}
.search-result-ai.found small {
  animation: ai-fade-up 0.4s ease-out 0.6s both;
}
@keyframes ai-found-pop {
  0% { opacity: 0; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes ai-check-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes ai-fade-up {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
.ai-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border: 3px solid var(--color-outline);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
}
@keyframes ai-spin {
  to { transform: rotate(360deg); }
}

/* ===========================================
   BOTTOM INFO CARD
   =========================================== */
.bottom-card {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-card-height-collapsed);
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-xl);
  z-index: var(--z-sticky);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: height var(--duration-slower) var(--ease-spring);
}

.bottom-card.expanded {
  height: var(--bottom-card-height-expanded);
}

.bottom-card-handle {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: var(--color-outline);
  border-radius: var(--radius-full);
  cursor: grab;
}

.bottom-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bottom-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-outline);
}

.bottom-card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-on-surface);
}

.bottom-card-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-on-surface-variant);
  transition: all var(--duration-fast);
}

.bottom-card-toggle:hover {
  background: var(--color-surface-container);
  color: var(--color-on-surface);
}

.bottom-card-toggle svg {
  width: 20px;
  height: 20px;
  transition: transform var(--duration-base) var(--ease-spring);
}

.bottom-card.expanded .bottom-card-toggle svg {
  transform: rotate(180deg);
}

.bottom-card-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
}

.bottom-card-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.bottom-stat {
  text-align: center;
}

.bottom-stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--color-on-surface);
  line-height: 1.2;
}

.bottom-stat-label {
  font-size: var(--text-xs);
  color: var(--color-on-surface-disabled);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-1);
}

.bottom-card-tabs {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-5);
  border-bottom: 1px solid var(--color-outline);
  padding-bottom: var(--space-3);
}

.bottom-card-tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-on-surface-variant);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast);
}

.bottom-card-tab:hover,
.bottom-card-tab.active {
  color: var(--color-primary);
  background: var(--color-primary-50);
}

.bottom-card-panel {
  display: none;
  padding-top: var(--space-5);
  animation: fade-in var(--duration-normal) var(--ease-out);
}

.bottom-card-panel.active {
  display: block;
}

.park-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-outline-variant);
}

.park-list-item:last-child {
  border-bottom: none;
}

.park-list-image {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.park-list-info {
  flex: 1;
  min-width: 0;
}

.park-list-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.park-list-location {
  font-size: var(--text-xs);
  color: var(--color-on-surface-disabled);
  margin-top: var(--space-1);
}

.park-list-details {
  font-size: var(--text-xs);
  color: var(--color-on-surface-disabled);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.park-list-distance {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-primary);
  white-space: nowrap;
}

/* Sidebar styles moved to sidebar.css */

/* User Location Marker - Google Maps style blue dot */
.user-location-marker {
  position: relative;
  width: 40px;
  height: 40px;
}

.user-marker-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(66, 133, 244, 0.15);
  border: 2px solid rgba(66, 133, 244, 0.25);
}

.user-marker-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4285F4;
  border: 3px solid white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.user-marker-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
}

@keyframes user-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(3); opacity: 0; }
}

/* ===========================================
   ROUTE WEB (nearby-parks road lines)
   =========================================== */
/* Origin hub — start point of every road line (clicked park or user) */
.route-origin-marker { position: relative; }

.route-origin-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(22, 163, 74, 0.25);
  border: 2px solid rgba(22, 163, 74, 0.4);
  animation: route-origin-pulse 1.8s ease-out infinite;
}

.route-origin-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #16a34a;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

@keyframes route-origin-pulse {
  0%   { transform: translate(-50%, -50%) scale(0.7); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(2.6); opacity: 0; }
}

/* The road polylines themselves (rendered via dedicated SVG layer) */
.route-line {
  filter: drop-shadow(0 1px 3px rgba(22, 163, 74, 0.45));
}
.route-line-multi {
  filter: drop-shadow(0 1px 2px rgba(22, 163, 74, 0.35));
}

/* Park markers that are currently connected by a route line */
.park-marker.marker-connected {
  animation: marker-connected-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  z-index: 650 !important;
}
.park-marker.marker-connected .park-marker-icon,
.park-marker.marker-connected svg {
  filter: drop-shadow(0 0 6px rgba(22, 163, 74, 0.9));
}

@keyframes marker-connected-pop {
  0%   { transform: scale(1); }
  55%  { transform: scale(1.35) translateY(-3px); }
  100% { transform: scale(1.12) translateY(0); }
}

/* ===========================================
   LIVE NAVIGATION (turn-by-turn)
   =========================================== */
/* Google-style instruction banner */
.nav-panel {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translate(-50%, -140%);
  width: min(440px, calc(100vw - 24px));
  background: var(--color-primary-900, #1B5E20);
  color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  z-index: 1200;
  opacity: 0;
  transition: transform 0.4s var(--ease-spring, cubic-bezier(0.34,1.56,0.64,1)), opacity 0.3s ease;
  overflow: hidden;
}
.nav-panel.visible { transform: translate(-50%, 0); opacity: 1; }

.nav-banner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
}
.nav-turn-icon {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.16);
  border-radius: var(--radius-md);
}
.nav-turn-icon svg { width: 30px; height: 30px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.nav-turn-text { min-width: 0; }
.nav-turn-dist { font-size: var(--text-2xl); font-weight: var(--font-extrabold); line-height: 1.1; }
.nav-turn-instr { font-size: var(--text-sm); opacity: 0.92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-5);
  background: rgba(0,0,0,0.18);
}
.nav-eta { flex: 1; font-size: var(--text-sm); font-weight: var(--font-semibold); }
.nav-recenter {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: var(--radius-full);
  background: rgba(255,255,255,0.15); color: #fff; border: none; cursor: pointer;
  transition: background 0.2s ease;
}
.nav-recenter:hover { background: rgba(255,255,255,0.3); }
.nav-stop {
  background: #fff; color: var(--color-primary-900, #1B5E20);
  border: none; border-radius: var(--radius-full);
  padding: 6px 18px; font-weight: var(--font-bold); font-size: var(--text-sm);
  cursor: pointer; transition: transform 0.15s ease;
}
.nav-stop:hover { transform: scale(1.05); }

/* Live "you are here" arrow (rotates to heading) */
.nav-live-marker { position: relative; }
.nav-live-arrow {
  position: absolute; top: 50%; left: 50%;
  width: 0; height: 0;
  margin: -11px 0 0 -9px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 22px solid #1A73E8;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
  transform-origin: 50% 70%;
  transition: transform 0.4s ease;
  z-index: 2;
}
.nav-live-pulse {
  position: absolute; top: 50%; left: 50%;
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border-radius: 50%;
  background: rgba(26,115,232,0.25);
  animation: user-pulse 1.8s ease-out infinite;
}

/* "Start Navigation" button on the small park map */
.park-nav-btn {
  position: absolute;
  bottom: 12px; left: 12px;
  z-index: 500;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--color-primary-light,#2E7D32), var(--color-primary,#1B5E20));
  color: #fff; border: none; border-radius: var(--radius-full);
  font-size: var(--text-sm); font-weight: var(--font-semibold);
  box-shadow: 0 4px 14px rgba(27,94,32,0.4);
  cursor: pointer;
  transition: transform 0.15s var(--ease-spring, ease), box-shadow 0.2s ease;
}
.park-nav-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(27,94,32,0.5); }
.park-nav-btn svg { stroke: #fff; }

@media (max-width: 480px) {
  .nav-turn-dist { font-size: var(--text-xl); }
  .park-nav-btn span { display: none; }
}

/* Creator credit badge (top of map): PFP + name + blue verified tick */
.map-credit-badge {
  position: fixed;
  top: 14px;
  left: 88px;
  z-index: 1050;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 5px;
  background: var(--glass-bg-strong, rgba(255, 255, 255, 0.95));
  backdrop-filter: var(--glass-blur, blur(20px));
  -webkit-backdrop-filter: var(--glass-blur, blur(20px));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.4));
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  /* Simple, robust entrance: hidden during load, drops into place after.
     Only px translateY + opacity (these always interpolate; % / vw / WAAPI don't
     reliably here). */
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.6s cubic-bezier(0.34, 1.4, 0.5, 1),
              opacity 0.5s ease,
              left 0.5s cubic-bezier(0.32, 0.72, 0, 1),
              box-shadow 0.3s ease;
}
.map-credit-badge:hover { box-shadow: var(--shadow-lg); }

/* During load: the badge is transformed to screen-centre (over the loading
   screen). Removing is-loading on map-ready glides it back to its top-left home. */
body.is-loading .map-credit-badge {
  opacity: 0;
  transform: translateY(-26px);
  pointer-events: none;
}

/* Remove the duplicate "Parks.net" wordmark that the navbar leaks behind the
   badge on the fullscreen map page (sidebar logo is the brand there). */
body.map-page .navbar-brand { display: none; }
/* When the sidebar expands/hovers, slide the badge forward so it clears the panel */
body.sidebar-expanded .map-credit-badge,
body.sidebar-hover .map-credit-badge { left: 300px; }
/* Only ONE banner on the load screen: hide the fixed top badge while loading */
body:has(#mapLoading:not(.hidden)) .map-credit-badge { opacity: 0; pointer-events: none; }

/* Sidebar brand logo — fixed size so it never shrinks to 0 in collapsed rail */
.sidebar-brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  flex: 0 0 40px;
}
.sidebar-brand-logo img {
  width: 36px;
  height: 36px;
  min-width: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

/* Bottom project credit */
.map-project-credit {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px 5px 6px;
  background: var(--glass-bg-strong, rgba(255,255,255,0.95));
  backdrop-filter: var(--glass-blur, blur(20px));
  -webkit-backdrop-filter: var(--glass-blur, blur(20px));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.4));
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-on-surface-variant);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  /* keep translateX(-50%) centering — use a dedicated keyframe (badge-pop would
     overwrite the transform and knock it off-centre) */
  animation: credit-rise 0.6s var(--smooth, cubic-bezier(0.32,0.72,0,1)) both;
  pointer-events: none;
}
.map-project-credit strong { color: var(--color-primary); font-weight: var(--font-semibold); }
@keyframes credit-rise {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.mpc-logo {
  width: 24px; height: 24px;
  border-radius: 6px;
  object-fit: cover;
  flex: 0 0 auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ---- Add Place: floating button + submission modal ---------------------- */
.addplace-fab {
  position: fixed;
  left: 88px;
  bottom: 20px;
  z-index: 1050;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px 11px 15px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--color-surface, #fff);
  color: var(--color-primary, #1B5E20);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring, ease), box-shadow 0.2s ease,
              left 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}
/* Clear the expanded sidebar so the button never overlaps the user panel */
body.sidebar-expanded .addplace-fab,
body.sidebar-hover .addplace-fab { left: 300px; }
.addplace-fab svg { stroke: var(--color-primary, #1B5E20); }
.addplace-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,0.25); }
.addplace-fab:active { transform: scale(0.97); }

.addplace-overlay {
  position: fixed; inset: 0;
  z-index: var(--z-modal, 1200);
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.addplace-overlay.open { opacity: 1; visibility: visible; }

.addplace-modal {
  width: 100%; max-width: 460px;
  max-height: 90vh; overflow-y: auto;
  background: var(--color-surface, #fff);
  border-radius: var(--radius-xl, 18px);
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
  transform: scale(0.92) translateY(20px);
  transition: transform 0.45s var(--ease-spring, cubic-bezier(0.34,1.56,0.64,1));
}
.addplace-overlay.open .addplace-modal { transform: scale(1) translateY(0); }

.addplace-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-5) var(--space-5) var(--space-3);
}
.addplace-head h2 { font-size: var(--text-xl); font-weight: var(--font-bold); color: var(--color-on-surface); }
.addplace-close { background: none; border: none; font-size: 28px; line-height: 1; color: var(--color-on-surface-variant); cursor: pointer; }

.addplace-form { padding: 0 var(--space-5) var(--space-5); display: flex; flex-direction: column; }
.ap-label { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--color-on-surface); margin: var(--space-3) 0 6px; }
.ap-hint { font-weight: 400; color: var(--color-on-surface-variant); font-size: var(--text-xs); }
.ap-input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--color-outline-variant, #d0d5d0);
  border-radius: var(--radius-md, 10px);
  background: var(--color-surface-container, #f4f6f4);
  color: var(--color-on-surface); font-size: var(--text-sm); font-family: inherit;
}
.ap-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-50, rgba(27,94,32,.12)); }
.ap-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

/* Custom-styled native selects (arrow, hover, focus) */
.ap-select-wrap { position: relative; }
.ap-select-wrap::after {
  content: ''; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px;
  border-right: 2px solid var(--color-on-surface-variant); border-bottom: 2px solid var(--color-on-surface-variant);
  transform: translateY(-70%) rotate(45deg); pointer-events: none; transition: transform 0.2s ease;
}
.ap-select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 34px; cursor: pointer; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.ap-select-wrap:focus-within::after { transform: translateY(-30%) rotate(-135deg); border-color: var(--color-primary); }

/* Location picker trigger (full-width button) */
.ap-loc {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px 14px; background: var(--color-primary-50, #e8f5e9);
  border: 1px dashed var(--color-primary); border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--color-primary);
  cursor: pointer; text-align: left; transition: background 0.2s ease, transform 0.15s ease;
}
.ap-loc:hover { background: var(--color-primary-100, #d7efd8); transform: translateY(-1px); }
.ap-loc:active { transform: scale(0.99); }
.ap-loc-pin { font-size: 16px; flex-shrink: 0; }
.ap-loc-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-loc-cta { flex-shrink: 0; background: var(--color-primary); color: #fff; padding: 5px 12px; border-radius: var(--radius-full); font-size: var(--text-xs); }

/* ===== Immersive location picker (over the live map) ===== */
.appick-overlay { position: fixed; inset: 0; z-index: 4000; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0.25s ease; }
.appick-overlay.open { opacity: 1; visibility: visible; }
.appick-top {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100vw - 24px)); display: flex; align-items: center; gap: 10px; pointer-events: auto;
}
.appick-back {
  width: 44px; height: 44px; flex-shrink: 0; border: none; border-radius: 50%;
  background: var(--color-surface); box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  font-size: 22px; cursor: pointer; color: var(--color-on-surface);
}
.appick-searchwrap { position: relative; flex: 1; }
.appick-search {
  width: 100%; height: 44px; padding: 0 16px; border: none; border-radius: 22px;
  background: var(--color-surface); box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  font-size: var(--text-sm); color: var(--color-on-surface);
}
.appick-search:focus { outline: 2px solid var(--color-primary); }
.appick-results {
  position: absolute; top: 50px; left: 0; right: 0; background: var(--color-surface);
  border-radius: 14px; box-shadow: 0 10px 34px rgba(0,0,0,0.22); overflow: hidden; max-height: 46vh; overflow-y: auto;
}
.appick-result {
  display: block; width: 100%; text-align: left; padding: 11px 16px; border: none; background: none;
  font-size: var(--text-sm); color: var(--color-on-surface); cursor: pointer; border-bottom: 1px solid var(--color-outline-variant);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.appick-result:hover { background: var(--color-primary-50); }
.appick-mylocation {
  position: absolute; right: 16px; bottom: 128px; width: 48px; height: 48px; border: none; border-radius: 50%;
  background: var(--color-surface); box-shadow: 0 4px 16px rgba(0,0,0,0.22); color: var(--color-primary);
  cursor: pointer; pointer-events: auto; display: grid; place-items: center;
}
.appick-mylocation:hover { background: var(--color-primary-50); }
/* Fixed center pin (points at the map centre) */
.appick-pin {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%);
  pointer-events: none; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); animation: appick-drop 0.3s ease;
}
.appick-pin-shadow {
  position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%);
  width: 14px; height: 5px; border-radius: 50%; background: rgba(0,0,0,0.25);
}
@keyframes appick-drop { from { transform: translate(-50%, -130%); opacity: 0; } to { transform: translate(-50%, -100%); opacity: 1; } }
.appick-bar {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  width: min(560px, calc(100vw - 24px)); background: var(--color-surface);
  border-radius: 18px; box-shadow: 0 12px 40px rgba(0,0,0,0.28); padding: 16px 18px;
  display: flex; align-items: center; gap: 14px; pointer-events: auto;
}
.appick-addr { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.appick-addr strong { font-size: var(--text-base); color: var(--color-on-surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appick-addr span { font-size: var(--text-xs); color: var(--color-on-surface-variant); }
.appick-confirm {
  flex-shrink: 0; border: none; border-radius: var(--radius-full); padding: 12px 22px;
  background: linear-gradient(135deg, var(--color-primary-light,#2E7D32), var(--color-primary,#1B5E20));
  color: #fff; font-weight: var(--font-semibold); font-size: var(--text-sm); cursor: pointer;
}
.appick-hint {
  position: absolute; top: 74px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.72); color: #fff; padding: 7px 14px; border-radius: 999px;
  font-size: var(--text-xs); pointer-events: none; white-space: nowrap;
}
/* Draggable picker marker */
.appick-marker-pin {
  position: relative; width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: linear-gradient(135deg, #2E7D32, #1B5E20); border: 3px solid #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.35); margin: 0 auto;
}
.appick-marker-pin::after { content: ''; position: absolute; top: 8px; left: 8px; width: 7px; height: 7px; background: #fff; border-radius: 50%; }

/* ===== Custom dropdowns (Add Park) ===== */
.ap-dd { position: relative; }
.ap-dd-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 12px; border: 1px solid var(--color-outline-variant, #d0d5d0);
  border-radius: var(--radius-md, 10px); background: var(--color-surface-container, #f4f6f4);
  color: var(--color-on-surface); font-size: var(--text-sm); font-family: inherit; cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.ap-dd-btn.is-placeholder { color: var(--color-on-surface-variant); }
.ap-dd-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-dd-btn svg { flex-shrink: 0; transition: transform 0.25s ease; color: var(--color-on-surface-variant); }
.ap-dd.open .ap-dd-btn { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-50, rgba(27,94,32,.12)); }
.ap-dd.open .ap-dd-btn svg { transform: rotate(180deg); }
.ap-dd-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
  background: var(--color-surface); border: 1px solid var(--color-outline-variant);
  border-radius: 12px; box-shadow: 0 12px 34px rgba(0,0,0,0.18); padding: 6px; max-height: 240px; overflow-y: auto;
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.ap-dd.open .ap-dd-list { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.ap-dd-opt {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border: none; background: none;
  border-radius: 8px; font-size: var(--text-sm); color: var(--color-on-surface); cursor: pointer; font-family: inherit;
}
.ap-dd-opt:hover { background: var(--color-primary-50); }
.ap-dd-opt.sel { background: var(--color-primary-50); color: var(--color-primary); font-weight: var(--font-semibold); }
.ap-dd-empty { padding: 10px 12px; font-size: var(--text-sm); color: var(--color-on-surface-variant); }

/* Hide the bottom credit + FAB while the Add-Park sheet / picker is open */
body.addpark-open .map-project-credit,
body.appick-open .map-project-credit,
body.appick-open .map-credit-badge { opacity: 0 !important; pointer-events: none; }
body.addpark-open .addplace-fab { opacity: 0; pointer-events: none; }
.ap-submit {
  margin-top: var(--space-4); padding: 13px;
  border: none; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary-light,#2E7D32), var(--color-primary,#1B5E20));
  color: #fff; font-size: var(--text-base); font-weight: var(--font-semibold);
  cursor: pointer; box-shadow: 0 4px 14px rgba(27,94,32,.3);
}
.ap-submit:disabled { opacity: 0.6; cursor: default; }
.ap-note { margin-top: var(--space-2); font-size: var(--text-xs); color: var(--color-on-surface-variant); text-align: center; }

@media (max-width: 768px) {
  .addplace-fab { left: 12px; bottom: 16px; padding: 10px 14px 10px 12px; }
}

/* Credit banner on the loading screen */
.map-loading-credit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-5);
  padding: 6px 16px 6px 6px;
  background: var(--glass-bg-strong, rgba(255,255,255,0.95));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.4));
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  animation: badge-pop 0.7s var(--ease-spring, cubic-bezier(0.34,1.56,0.64,1)) 0.15s both;
}

@media (max-width: 640px) {
  .map-project-credit { font-size: 10px; padding: 5px 10px; white-space: normal; text-align: center; max-width: 90vw; }
}
.map-credit-pfp {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  flex: 0 0 auto;
}
.map-credit-text {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-on-surface);
  white-space: nowrap;
}
.map-credit-verified { width: 17px; height: 17px; flex: 0 0 auto; }

@keyframes badge-pop {
  from { opacity: 0; transform: translateY(-10px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 768px) {
  .map-credit-badge { top: auto; bottom: 148px; left: 12px; padding: 4px 12px 4px 4px; }
  .map-credit-pfp { width: 26px; height: 26px; }
  .map-credit-text { font-size: var(--text-xs); }
}

/* Floating "Start Navigation" launcher (appears with the route web) */
.nav-launcher {
  position: fixed;
  left: 50%;
  bottom: 140px;
  transform: translate(-50%, 24px);
  z-index: 1150;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary-light, #2E7D32), var(--color-primary, #1B5E20));
  color: #fff;
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  box-shadow: 0 8px 26px rgba(27, 94, 32, 0.45);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s var(--ease-spring, cubic-bezier(0.34,1.56,0.64,1)), opacity 0.3s ease;
}
.nav-launcher.visible { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.nav-launcher:hover { box-shadow: 0 12px 32px rgba(27, 94, 32, 0.55); }
.nav-launcher svg { stroke: #fff; }

/* Park picker popup (opens above the launcher) */
.nav-picker {
  position: fixed;
  left: 50%;
  bottom: 200px;
  transform: translate(-50%, 16px) scale(0.96);
  z-index: 1160;
  width: min(380px, calc(100vw - 32px));
  max-height: 46vh;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s var(--ease-spring, cubic-bezier(0.34,1.56,0.64,1)), opacity 0.25s ease;
}
.nav-picker.visible { transform: translate(-50%, 0) scale(1); opacity: 1; pointer-events: auto; }

.nav-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  font-weight: var(--font-bold);
  font-size: var(--text-base);
  color: var(--color-on-surface);
  border-bottom: 1px solid var(--color-outline-variant);
}
.nav-picker-close {
  background: none; border: none; cursor: pointer;
  font-size: 24px; line-height: 1; color: var(--color-on-surface-variant);
}
.nav-picker-list { overflow-y: auto; }
.nav-picker-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-outline-variant);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}
.nav-picker-item:hover { background: var(--color-primary-50); }
.nav-picker-item:last-child { border-bottom: none; }
.nav-picker-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nav-picker-name { font-weight: var(--font-semibold); color: var(--color-on-surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-picker-city { font-size: var(--text-xs); color: var(--color-on-surface-variant); }
.nav-picker-dist { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--color-primary); flex: 0 0 auto; }
.nav-picker-item svg { color: var(--color-on-surface-variant); flex: 0 0 auto; }

@media (max-width: 480px) {
  .nav-launcher { bottom: 132px; }
  .nav-picker { bottom: 192px; }
}

/* ===========================================
   NAVBAR (Top transparent)
   =========================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  background: transparent;
  z-index: var(--z-fixed);
  transition: all var(--duration-base) var(--ease-out);
}

.navbar.scrolled {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-primary);
}

.navbar-brand svg {
  width: 28px;
  height: 28px;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.navbar-link {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-on-surface-variant);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast);
}

.navbar-link:hover {
  color: var(--color-on-surface);
  background: var(--color-surface-container);
}

.navbar-link.active {
  color: var(--color-primary);
  background: var(--color-primary-50);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.navbar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-on-surface);
}

@media (max-width: 1023px) {
  .navbar-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-6);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--glass-border);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-base) var(--ease-out);
    gap: var(--space-2);
  }

  .navbar-menu.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .navbar-link {
    justify-content: center;
    padding: var(--space-3);
  }

  .navbar-toggle {
    display: flex;
    z-index: var(--z-fixed + 1);
  }
}

/* ===========================================
   FIND NEARBY PARK POPUP
   =========================================== */
.nearby-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-base) var(--ease-out);
}

.nearby-popup-overlay.open {
  opacity: 1;
  visibility: visible;
}

.nearby-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 100%;
  max-width: 420px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow-strong);
  z-index: var(--z-modal);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-slower) var(--ease-spring);
}

.nearby-popup-overlay.open .nearby-popup {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.nearby-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  border-bottom: 1px solid var(--glass-border);
}

.nearby-popup-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-on-surface);
}

.nearby-popup-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-on-surface-variant);
  transition: all var(--duration-fast);
}

.nearby-popup-close:hover {
  background: var(--color-surface-container);
  color: var(--color-on-surface);
}

.nearby-popup-body {
  padding: var(--space-5);
}

.nearby-popup-message {
  text-align: center;
  margin-bottom: var(--space-6);
}

.nearby-popup-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-100);
  color: var(--color-primary);
  border-radius: var(--radius-full);
}

.nearby-popup-icon svg {
  width: 40px;
  height: 40px;
}

.nearby-popup-message h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-on-surface);
  margin-bottom: var(--space-2);
}

.nearby-popup-message p {
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
  line-height: var(--leading-relaxed);
}

.nearby-popup-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.nearby-popup-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  border-radius: var(--radius-md);
  transition: all var(--duration-base) var(--ease-out);
}

.nearby-popup-btn svg {
  width: 20px;
  height: 20px;
}

.nearby-popup-btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
}

.nearby-popup-btn-primary:hover {
  background: var(--color-primary-hover);
}

.nearby-popup-btn-secondary {
  background: var(--color-surface-container);
  color: var(--color-on-surface);
  border: 1px solid var(--color-outline);
}

.nearby-popup-btn-secondary:hover {
  background: var(--color-surface-container-high);
}

.nearby-popup-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--glass-border);
  text-align: center;
}

.nearby-popup-footer p {
  font-size: var(--text-xs);
  color: var(--color-on-surface-disabled);
}

.nearby-popup-footer a {
  color: var(--color-primary);
  font-weight: var(--font-medium);
}

.nearby-popup-footer a:hover {
  text-decoration: underline;
}

/* ===========================================
   LOADING STATES
   =========================================== */
.map-loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background: var(--color-surface);
  z-index: var(--z-toast);
  transition: opacity var(--duration-slow), visibility var(--duration-slow);
}

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

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

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

.map-loading-text {
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 767px) {
  .map-controls {
    top: auto;
    bottom: var(--space-4);
    right: var(--space-3);
    left: auto;
    transform: none;
    flex-direction: column;
    gap: var(--space-2);
  }

  .map-control-btn {
    width: 44px;
    height: 44px;
  }

  .map-control-btn .tooltip {
    display: none;
  }

  .search-bar {
    top: var(--space-3);
    left: var(--space-3);
    right: var(--space-3);
    max-width: none;
  }

  .bottom-card-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 479px) {
  .park-info-card-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .bottom-card-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===========================================
   MAP PAGE ENTRANCE ANIMATIONS
   =========================================== */
body.map-page .sidebar {
  animation: slide-right 0.4s var(--ease-spring) forwards;
}

body.map-page .search-bar {
  animation: fade-in-down 0.5s var(--ease-out) 0.2s both;
}

body.map-page .map-controls {
  animation: fade-in-right 0.5s var(--ease-out) 0.3s both;
}

body.map-page .theme-toggle-floating {
  animation: scale-in 0.4s var(--ease-spring) 0.4s both;
}

/* ===========================================
   MAP PAGE - Hide redundant navbar menu
   Sidebar provides navigation on map page
   =========================================== */
body.map-page .navbar-menu {
  display: none !important;
}

body.map-page .navbar-actions {
  display: none !important;
}

body.map-page .navbar-toggle {
  display: none !important;
}

body.map-page .navbar {
  justify-content: flex-start;
  gap: var(--space-4);
  padding-left: 88px;
}

/* Hide bottom card on map page */
body.map-page .bottom-card {
  display: none !important;
}

/* Map controls - move up since no bottom card */
body.map-page .map-controls {
  bottom: var(--space-6) !important;
}

@media (max-width: 1023px) {
  body.map-page .navbar {
    padding-left: var(--space-4);
  }
}

/* Print styles for map */
@media print {
  .map-controls,
  .search-bar,
  .sidebar,
  .navbar,
  .bottom-card,
  .park-info-card,
  .nearby-popup-overlay {
    display: none !important;
  }

  #map {
    position: absolute !important;
    height: 100vh !important;
  }
}

/* ===========================================
   PREMIUM PARK MARKER POPUP
   =========================================== */
.leaflet-popup.park-popup-wrapper {
  margin-bottom: 12px;
}

.leaflet-popup.park-popup-wrapper .leaflet-popup-content-wrapper {
  background: var(--color-surface);
  color: var(--color-on-surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 45px -15px rgba(15, 23, 42, 0.35), 0 0 0 1px var(--color-outline-variant);
  padding: 0;
  overflow: hidden;
  animation: parkPopupIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes parkPopupIn {
  from { opacity: 0; transform: translateY(10px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.leaflet-popup.park-popup-wrapper .leaflet-popup-content {
  margin: 0;
  width: 260px !important;
}

.leaflet-popup.park-popup-wrapper .leaflet-popup-tip {
  background: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-outline-variant);
}

.leaflet-popup.park-popup-wrapper a.leaflet-popup-close-button {
  display: none;
}

/* Popup inner content */
.park-popup {
  padding: var(--space-5);
}

.park-popup-name {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-on-surface);
  margin: 0 0 var(--space-1);
  line-height: 1.3;
}

.park-popup-location {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
  margin: 0 0 var(--space-3);
}

.park-popup-location svg { flex-shrink: 0; color: var(--color-primary); }

.park-popup-area,
.park-popup-trees {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
  margin: 0 0 var(--space-1);
}

.park-popup-area .popup-ico,
.park-popup-trees .popup-ico {
  color: var(--color-primary);
  flex-shrink: 0;
}

.park-popup-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-4);
  width: 100%;
  justify-content: center;
  border: 1px solid #EA580C;
  border-radius: var(--radius-lg);
  background: rgba(234, 88, 12, 0.08);
  color: #EA580C;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.park-popup-link:hover {
  background: #EA580C;
  color: #fff;
  transform: translateY(-1px);
}