/* ============================================================
   publicmap.css — Styles for the Public Map page
   Extracted from src/shared/publicmap.html inline <style> block
   ============================================================ */

/* Global Overrides */
body {
  font-family: 'Inter', sans-serif;
  background-color: #0B1120;
  overflow: hidden;
}

/* Scrollbar hiding */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Map Container - Full Screen Background */
#mapContainer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  background: #0B1120;
}

/* UI Overlay — top padding adapts to nav height (56px on web, 0px on mobile) + status bar on mobile */
#mapUiOverlay {
  padding-top: calc(var(--ara-top-nav-height, 0px) + 20px + env(safe-area-inset-top, 0px));
}

.public-map-topbar {
  gap: 0.75rem;
}

.public-map-search {
  width: min(24rem, 100%);
}

.public-map-controls {
  z-index: 2;
}

#layerToggle {
  position: fixed;
  right: calc(20px + env(safe-area-inset-right, 0px));
  bottom: calc(194px + env(safe-area-inset-bottom, 0px));
  z-index: 46;
  width: 44px;
  height: 44px;
}

body[data-always-explorer] .public-map-topbar {
  align-items: center;
}

body[data-always-explorer] .public-map-controls {
  position: absolute;
  pointer-events: none;
}

body[data-always-explorer] .public-map-controls #layerToggle {
  pointer-events: auto;
}

/* --- SIDE PANEL (GLASSMORPHISM) --- */
.side-panel {
  position: fixed;
  z-index: 40;
  background: rgba(21, 30, 50, 0.90);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  display: flex;
  flex-direction: column;
}

.side-panel .flex-1::-webkit-scrollbar {
  display: none;
}

.side-panel .flex-1 {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.map-photo-strip {
  max-width: 100%;
  min-width: 0;
  padding-right: 1rem;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(147, 197, 253, 0.4) rgba(255, 255, 255, 0.06);
}

.map-photo-strip::-webkit-scrollbar {
  display: block;
  height: 8px;
}

.map-photo-strip::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.map-photo-strip::-webkit-scrollbar-thumb {
  background: rgba(147, 197, 253, 0.4);
  border-radius: 999px;
}

.map-photo-strip__end {
  width: max(1rem, env(safe-area-inset-right, 0px));
}

.close-panel-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(0, 0, 0, 0.3);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}

.close-panel-btn:hover {
  background: rgba(0, 0, 0, 0.6);
}

body[data-always-explorer] .close-panel-btn {
  display: none;
}

.panel-scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 12;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(147, 197, 253, 0.38);
  border-radius: 999px;
  background: rgba(22, 35, 59, 0.94);
  color: #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  transition: opacity 0.22s ease, transform 0.22s ease, background 0.2s ease, border-color 0.2s ease;
}

.panel-scroll-cue.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.panel-scroll-cue:hover {
  background: rgba(37, 99, 235, 0.96);
  border-color: rgba(219, 234, 254, 0.7);
  color: #fff;
}

.panel-scroll-cue:active {
  transform: translate(-50%, 2px) scale(0.96);
}

.panel-scroll-cue span {
  font-size: 30px;
  line-height: 1;
}

/* Desktop: Floating Dock Left */
@media (min-width: 768px) {
  body[data-always-explorer] #mapUiOverlay {
    padding-left: calc(420px + 1.5rem);
  }

  body[data-always-explorer] .public-map-topbar {
    width: 100%;
  }

  .side-panel {
    top: calc(var(--ara-top-nav-height, 0px) + 20px);
    bottom: 120px;
    left: 20px;
    width: 400px;
    border-radius: 1.5rem;
    transform: translateX(-120%);
  }

  .side-panel.open {
    transform: translateX(0);
  }
}

@media (min-width: 768px) and (max-width: 1080px) {
  body[data-always-explorer] #mapUiOverlay {
    padding-left: calc(420px + 0.75rem);
    padding-right: 0.75rem;
  }

  body[data-always-explorer] .public-map-search {
    width: min(100%, 22rem);
  }

  body[data-always-explorer] .public-map-controls {
    width: auto;
  }
}

/* Mobile: Bottom Sheet */
@media (max-width: 767px) {
  #layerToggle {
    top: calc(24px + env(safe-area-inset-top, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    bottom: auto;
  }

  .side-panel {
    left: 0;
    right: 0;
    bottom: 0;
    height: 50vh;
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
    transform: translateY(110%);
    border-bottom: none;
    padding-bottom: 20px;
    z-index: 60;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), height 0.3s ease;
  }

  .side-panel.open {
    transform: translateY(0);
  }

  .side-panel.expanded {
    height: 70vh;
  }

  .panel-scroll-cue {
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }

  .leaflet-control-zoom {
    display: none !important;
  }
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}

/* Filter Checkbox (Glassmorphism) */
.filter-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.filter-checkbox:checked {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
}

.filter-checkbox:checked::after {
  content: 'check';
  font-family: 'Material Symbols Rounded';
  font-size: 16px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: black;
  font-weight: bold;
}

/* Stop propagation helper */
.stop-prop {
  cursor: default;
}

.public-map-explorer-legal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 1.25rem 0.25rem 0.35rem;
  color: rgba(203, 213, 225, 0.62);
  font-size: 0.72rem;
  line-height: 1.4;
  text-align: center;
}

.public-map-explorer-legal__links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.public-map-explorer-legal a {
  color: rgba(219, 234, 254, 0.78);
  text-decoration: none;
  font-weight: 700;
}

.public-map-explorer-legal a:hover {
  color: #fff;
  text-decoration: underline;
}

/* Custom Range Slider */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  margin-top: -6px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.leaflet-popup-content {
  font-size: 0.95rem;
}

.leaflet-popup-content b {
  color: var(--accent-2);
}

a.leaflet-popup-close-button {
  color: var(--muted) !important;
}

.leaflet-popup-content .popup-table {
  margin-top: 8px;
  width: 100%;
  border-collapse: collapse;
}

.leaflet-popup-content .popup-table td {
  padding: 3px 5px;
  font-size: 0.85rem;
}

.leaflet-popup-content .popup-table td:first-child {
  font-weight: 600;
  color: var(--muted);
  text-align: right;
}

.popup-view-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #001528;
  border: 1px solid transparent;
  text-align: center;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.15s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.popup-view-btn:hover {
  background-color: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.home-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}

.home-btn i {
  font-size: 20px;
  line-height: 1;
}

.local-tree-marker {
  background-color: var(--accent-2);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.leaflet-control-layers {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.leaflet-control-layers-base label {
  color: var(--text);
}

/* Marker Cluster Customization for Dark Theme */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: rgba(11, 34, 53, 0.6) !important;
  border: 2px solid var(--accent);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: rgba(11, 34, 53, 0.8) !important;
  color: var(--text) !important;
  font-weight: 700;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-left: 0 !important;
  margin-top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  line-height: normal !important;
  border-radius: 50%;
}

.marker-cluster span {
  line-height: 0 !important;
  display: block !important;
}

.local-tree-marker-cluster .marker-cluster-small,
.local-tree-marker-cluster .marker-cluster-medium,
.local-tree-marker-cluster .marker-cluster-large {
  border-color: var(--accent-2);
}

/* User Avatar in Popup */
.avatar-tiny {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #001528;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.70rem;
  flex-shrink: 0;
}

.popup-submitter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* --- Heritage Pin Marker Style (GPU Accelerated) --- */
.custom-tree-div-icon {
  position: relative;
  background: transparent;
  border: none;
}

.marker-pin {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  background: var(--pin-color);
  border: 2px solid white;
  position: absolute;
  transform: rotate(-45deg) translateZ(0);
  left: 50%;
  top: 50%;
  margin: -14px 0 0 -14px;
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  will-change: transform;
  backface-visibility: hidden;
}

.marker-pin span {
  transform: rotate(45deg);
  color: white;
  font-size: 16px;
  pointer-events: none;
}

.marker-pin.active {
  box-shadow: 0 0 20px 4px var(--pin-color), 0 0 0 4px white;
  z-index: 1000 !important;
  animation: pulse-glow 2s infinite;
  border-color: white;
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7), 0 0 20px 4px var(--pin-color);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0), 0 0 30px 8px var(--pin-color);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0), 0 0 20px 4px var(--pin-color);
  }
}

/* --- Locate Me Button --- */
.locate-me-btn {
  position: fixed;
  z-index: 45;
  bottom: calc(170px + env(safe-area-inset-bottom, 0px));
  right: calc(10px + env(safe-area-inset-right, 0px));
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(21, 30, 50, 0.90);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.locate-me-btn:hover {
  background: rgba(21, 30, 50, 1);
  color: #fff;
  border-color: rgba(59, 130, 246, 0.5);
}

.locate-me-btn:active {
  transform: scale(0.95);
}

.locate-me-btn.active {
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.locate-me-btn.locating {
  animation: locating-pulse 1.5s infinite;
}

@keyframes locating-pulse {
  0%, 100% { color: #9ca3af; }
  50% { color: #3b82f6; }
}

@media (min-width: 768px) {
  .locate-me-btn {
    bottom: calc(140px + env(safe-area-inset-bottom, 0px));
    right: calc(20px + env(safe-area-inset-right, 0px));
  }
}

@media (max-width: 767px) {
  #locateMeBtn {
    top: calc(76px + env(safe-area-inset-top, 0px)) !important;
    right: calc(10px + env(safe-area-inset-right, 0px)) !important;
    bottom: auto !important;
    left: auto !important;
  }

  #demoHelpBtn {
    top: calc(128px + env(safe-area-inset-top, 0px)) !important;
    right: calc(10px + env(safe-area-inset-right, 0px)) !important;
    bottom: auto !important;
    left: auto !important;
  }

  .side-panel.open ~ .locate-me-btn {
    opacity: 0;
    pointer-events: none;
  }
}

/* --- User Location Blue Dot --- */
.user-location-dot {
  width: 16px;
  height: 16px;
  background: #3b82f6;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
  position: relative;
}

.user-location-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  background: rgba(59, 130, 246, 0.15);
  border-radius: 50%;
  animation: location-ring 2s ease-out infinite;
}

@keyframes location-ring {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.2); opacity: 0; }
}

/* --- Nearby Panel Styles --- */
.nearby-tree-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nearby-tree-row:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nearby-tree-row:active {
  background: rgba(255, 255, 255, 0.12);
}

.nearby-distance-badge {
  font-size: 11px;
  font-weight: 700;
  font-family: 'Inter', monospace;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.nearby-distance-badge.green {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.nearby-distance-badge.amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.nearby-distance-badge.gray {
  background: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
}

/* --- Toast Notification --- */
.ara-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(21, 30, 50, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.ara-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Photo Lightbox */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-counter {
  margin-top: 12px;
  color: #9caac3;
  font-size: 0.9rem;
  font-weight: 600;
}

.lightbox-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 0.75rem;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 10000;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-close__label {
  font-size: 0.78rem;
  font-weight: 800;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  font-size: 28px;
}

.lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.lightbox-prev {
  left: 16px;
}

.lightbox-next {
  right: 16px;
}

@media (max-width: 520px) {
  .lightbox-close {
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: 12px;
    height: 42px;
  }

  .lightbox-close__label {
    display: none;
  }
}

/* Demo-only one-shot pulse applied to #demoSurveyFab after the welcome modal
   is dismissed, so first-time visitors notice the floating survey button.
   Runs exactly once (no `infinite`); the JS handler also removes the class
   on animationend or first click so returning visitors never see it. */
@keyframes araDemoFabPulse {
  0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.55); transform: scale(1); }
  50%  { box-shadow: 0 0 0 14px rgba(59, 130, 246, 0);   transform: scale(1.06); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);      transform: scale(1); }
}
.ara-demo-fab-pulse {
  animation: araDemoFabPulse 1.1s ease-out 2;
}
