/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.hidden { display: none !important; }

:root {
  --primary: #2d6a4f;
  --primary-light: #40916c;
  --primary-dark: #1b4332;
  --accent: #d4a373;
  --bg: #fefae0;
  --bg-panel: #ffffff;
  --bg-alt: #f1f5f2;
  --text: #2b2d42;
  --text-light: #6c757d;
  --border: #dee2e6;
  --shadow: 0 2px 8px rgba(0,0,0,0.15);
  --radius: 8px;
  --header-height: 52px;
  /* Colorblind-safe status colors */
  --cb-yes: #00897B;
  --cb-no: #E64A19;
  --cb-unknown: #9E9E9E;
  --cb-star: #F9A825;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  overscroll-behavior: none; /* stop Safari pull-to-refresh reloading the app */
  overflow: hidden;
}

/* Pin the whole app to the visual viewport so iOS Safari's collapsing address
   bar can't scroll the fixed header off-screen. All UI lives in fixed children
   (header, map, panels) that scroll internally. */
body {
  position: fixed;
  inset: 0;
  width: 100%;
}

/* === Splash === */
#splash {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 0.4s ease;
}
#splash img { width: 110px; animation: splashPop 0.5s ease; }
.splash-name {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-dark);
}
.splash-tag { font-size: 0.9rem; color: var(--text-light); }
#splash.splash-done { opacity: 0; pointer-events: none; }
@keyframes splashPop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.header-logo { height: 34px; margin-right: 8px; }

/* === Header === */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 1000;
  box-shadow: var(--shadow);
}

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

.header-left h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 0.8rem;
  opacity: 0.8;
}

.header-right {
  display: flex;
  gap: 4px;
}

.header-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.header-btn:hover {
  background: rgba(255,255,255,0.25);
}

/* === Map === */
#map {
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
}

/* === Panels === */
.panel {
  position: fixed;
  background: var(--bg-panel);
  z-index: 900;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.panel.hidden {
  display: none;
}

#filter-panel, #list-panel {
  top: var(--header-height);
  left: 0;
  width: 320px;
  max-width: 85vw;
  bottom: 0;
  overflow-y: auto;
}

#detail-panel {
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 60dvh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  transition: max-height 0.3s ease, border-radius 0.3s ease;
  overscroll-behavior: contain;
}

/* Dragged up (or button) → fill everything below the app header
   (stops the sheet sliding under the header and hiding the title/X) */
#detail-panel.fullscreen {
  max-height: calc(100vh - var(--header-height));
  max-height: calc(100dvh - var(--header-height));
  border-radius: 0;
}

/* Grab bar on the detail sheet header */
#detail-panel .panel-header {
  cursor: grab;
  touch-action: none;
  padding-top: 18px;
  user-select: none;
}
#detail-panel .panel-header:active { cursor: grabbing; }

.panel-grip {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

/* "Return to map" — inline pill in the header, only visible in fullscreen */
.btn-return-map {
  display: none;
  align-items: center;
  gap: 4px;
  margin-right: 10px;
  flex: 0 0 auto;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
#detail-panel.fullscreen .btn-return-map { display: inline-flex; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-panel);
  z-index: 10;
}

.panel-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  padding: 0 4px;
  line-height: 1;
}

.panel-body {
  padding: 16px;
}

/* === Filters === */
.filter-section {
  margin-bottom: 16px;
}

.filter-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.filter-section label {
  display: block;
  padding: 6px 0;
  cursor: pointer;
  font-size: 0.95rem;
}

.filter-section label input[type="checkbox"] {
  margin-right: 8px;
  accent-color: var(--primary);
}

#search-input, #region-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  outline: none;
}

#search-input:focus, #region-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(45,106,79,0.2);
}

/* === Rating Slider === */
.rating-slider-wrap {
  padding: 4px 0;
}

#rating-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

#rating-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

#rating-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.rating-slider-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 0.9rem;
}

#rating-slider-value {
  font-weight: 600;
  color: var(--primary);
}

#rating-slider-stars {
  color: var(--cb-star);
  letter-spacing: 1px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-primary, .btn-secondary {
  flex: 1;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: #ccc;
}

.filter-count {
  text-align: center;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-light);
}

/* === Pin Markers === */
.pin-marker {
  background: transparent !important;
  border: none !important;
}

/* === Cluster Icons (pill-shaped) === */
.marker-cluster-custom {
  background: transparent !important;
  border: none !important;
}

.cluster-icon {
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  border: 3px solid rgba(255,255,255,0.85);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.cluster-count {
  font-size: 13px;
  line-height: 1;
}

.cluster-rating {
  font-size: 9px;
  line-height: 1;
  opacity: 0.95;
  margin-top: 1px;
}

/* === Score Badges === */
.score-badge {
  display: inline-block;
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1.2;
}

.score-badge-lg {
  font-size: 1.1rem;
  padding: 4px 10px;
  border-radius: 6px;
}

.score-stars {
  color: var(--cb-star);
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.score-stars-lg {
  color: var(--cb-star);
  font-size: 1.1rem;
  letter-spacing: 1px;
  margin-left: 6px;
}

.popup-score {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.detail-score {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.list-score {
  display: inline-block;
  color: white;
  font-weight: 700;
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}

/* === Place List === */
#place-list {
  list-style: none;
}

#place-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

#place-list li:hover {
  background: #f8f9fa;
  margin: 0 -16px;
  padding: 10px 16px;
}

#place-list li .list-item-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.list-item-text {
  flex: 1;
  min-width: 0;
}

.list-hero {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.list-place-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.list-place-location {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 2px;
}

.list-place-amenities {
  margin-top: 4px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* === Detail Panel === */
.detail-location {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

/* === Colorblind-Safe Amenity Grid === */
.amenity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.amenity-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  border-left: 4px solid transparent;
}

.amenity-item.amenity-yes {
  background: #e8f5e9;
  border-left-color: var(--cb-yes);
}

.amenity-item.amenity-no {
  background: #fbe9e7;
  border-left-color: var(--cb-no);
}

.amenity-item.amenity-unknown {
  background: #f5f5f5;
  border-left-color: var(--cb-unknown);
}

.amenity-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  font-weight: 700;
}

.amenity-item.amenity-yes .amenity-icon { color: var(--cb-yes); }
.amenity-item.amenity-no .amenity-icon { color: var(--cb-no); }
.amenity-item.amenity-unknown .amenity-icon { color: var(--cb-unknown); }

.amenity-label {
  flex: 1;
}

.rating-stars {
  color: var(--cb-star);
  letter-spacing: 1px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.tag-yes {
  background: #d8f3dc;
  color: var(--primary-dark);
}

.tag-no {
  background: #fbe9e7;
  color: var(--cb-no);
}

.tag-fav {
  background: #fff3cd;
  color: #664d03;
}

.tag-unavail {
  background: #fbe9e7;
  color: var(--cb-no);
}

/* === Smart Amenity Summary === */
.highlights-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.highlight-item {
  background: #e8f5e9;
  border-left: 4px solid var(--cb-yes);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 8px 12px;
}

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

.highlight-check {
  color: var(--cb-yes);
  font-weight: 700;
  font-size: 1rem;
}

.highlight-name {
  font-weight: 600;
  font-size: 0.9rem;
  flex: 1;
}

.highlight-comment {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-top: 4px;
  line-height: 1.4;
  padding-left: 24px;
}

.available-tags, .unavailable-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.no-data-prompt {
  text-align: center;
  padding: 20px 16px;
  color: var(--text-light);
  background: #f5f5f5;
  border-radius: var(--radius);
}

.no-data-prompt p {
  margin: 0;
  font-style: italic;
}

/* === Directions === */
.detail-directions-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.detail-directions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  color: white;
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.detail-directions:hover {
  filter: brightness(0.9);
}

.detail-directions-google {
  background: #4285f4;
}

.detail-directions-apple {
  background: var(--text);
}

.detail-comments {
  background: #f0f7f4;
  border-left: 3px solid var(--primary);
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 16px;
}

.detail-comments p {
  margin: 0;
  font-style: italic;
  line-height: 1.5;
}

.ratings-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rating-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.amenity-comment {
  width: 100%;
  font-size: 0.82rem;
  color: var(--text-light);
  margin-top: 4px;
  line-height: 1.4;
  padding-left: 30px;
}

.approach-details {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fff8f0;
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}

.approach-details p {
  margin: 0 0 8px 0;
  font-size: 0.88rem;
  line-height: 1.4;
}

.approach-details p:last-child {
  margin-bottom: 0;
}

.size-info {
  font-size: 0.88rem;
  color: var(--text-light);
  margin-top: 8px;
}

.restriction-warning {
  color: #842029;
  font-weight: 600;
  background: #f8d7da;
  padding: 6px 12px;
  border-radius: var(--radius);
  display: inline-block;
  margin-bottom: 8px;
}

.popup-comment {
  font-size: 0.82rem;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 8px;
  line-height: 1.3;
}

/* === Photo Gallery === */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}

.gallery-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 0;
  cursor: pointer;
  transition: transform 0.15s;
  display: block;
}

.gallery-thumb:hover {
  transform: scale(1.05);
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
}

.gallery-hero-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  pointer-events: none;
}

.gallery-set-hero {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0,0,0,0.7);
  color: white;
  border: none;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 2;
}

.gallery-item:hover .gallery-set-hero {
  opacity: 1;
}

.gallery-set-hero:hover {
  background: var(--primary);
}

/* === Hero Images === */
.popup-hero {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
  display: block;
}

.detail-hero-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 360px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  cursor: pointer;
  background: #1b4332;
}

.detail-hero-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.detail-hero-wrap:hover img {
  transform: scale(1.03);
}

.hero-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 12px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.5));
  color: white;
  font-size: 0.8rem;
  pointer-events: none;
}

/* === Quick-glance amenity icon strip (above hero) === */
.detail-icon-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.detail-icon-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 54px;
  padding: 7px 8px;
  background: var(--bg-alt, #f1f5f2);
  border: 1px solid var(--border);
  border-radius: 10px;
  line-height: 1.1;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, transform 0.1s ease;
}

.detail-icon-chip:active { transform: scale(0.94); }

.detail-icon-glyph {
  display: flex;
  color: var(--primary);
}
.detail-icon-glyph svg { width: 24px; height: 24px; }

.detail-icon-label {
  font-size: 0.66rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Flash the target amenity when its icon chip is tapped */
@keyframes amenityFlash {
  0%   { background: rgba(45,106,79,0.28); }
  100% { background: transparent; }
}
.amenity-flash { animation: amenityFlash 1.3s ease; border-radius: var(--radius); }

/* iOS: inputs under 16px trigger Safari's page auto-zoom on focus — keep ALL
   form controls at 16px so the page never zooms while filling in forms. */
input, select, textarea { font-size: 16px; }

/* Community submissions */
.community-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.community-buttons .btn-secondary { flex: 1; min-width: 140px; }
.community-form {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.community-hint { font-size: 0.78rem; color: var(--text-light); }

/* Add-place hint bar */
#add-hint {
  position: fixed;
  top: calc(var(--header-height) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 950;
  background: var(--primary-dark);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
}
#add-hint button {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
}

/* Lightbox: floating admin set-hero button */
.lb-set-hero {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.lb-set-hero:disabled { opacity: 0.6; }

/* Admin login toast (pending items waiting) */
.admin-toast {
  position: fixed;
  top: calc(var(--header-height) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  background: #b45309;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  cursor: pointer;
}

/* === Driving mode === */
.btn-rest-here {
  width: 100%;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn-rest-here:active { background: var(--primary-dark); }

.popup-rest-here { font-weight: 700; }

#drive-hud {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 960;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drive-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--primary-dark);
  color: #fff;
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.drive-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}
.drive-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drive-dist {
  font-size: 1.5rem;
  font-weight: 800;
  white-space: nowrap;
}
#drive-end {
  flex: 0 0 auto;
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
#drive-approach {
  background: var(--bg-panel);
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow);
  max-height: 40vh;
  overflow-y: auto;
}
#drive-approach img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 8px;
}
#drive-approach p { font-size: 0.9rem; margin: 4px 0; }

/* Live status banner (roadworks / access closed) */
.status-banner {
  background: #c62828;
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 12px;
}
.popup-content .status-banner {
  margin: 0 0 8px;
  font-size: 0.8rem;
}

/* Compact icon strip (inside map popups): icon-only, tighter */
.detail-icon-strip.compact { gap: 6px; margin: 6px 0 2px; }
.detail-icon-chip.compact {
  min-width: 0;
  padding: 5px;
  border-radius: 8px;
}
.detail-icon-chip.compact .detail-icon-glyph svg { width: 20px; height: 20px; }

/* List: sort bar + distance label */
.list-sort-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.list-sort-bar label {
  font-size: 0.8rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.list-sort-bar select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text);
  font: inherit;
}
.list-dist {
  margin-left: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}
.list-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-light);
}

/* === Lightbox === */
#lightbox {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

#lightbox:focus {
  outline: none;
}

#lightbox.active {
  display: flex;
}

.lb-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9);
}

.lb-img {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius);
  z-index: 1;
}

.lb-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  z-index: 2;
  line-height: 1;
}

.lb-prev, .lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 3rem;
  cursor: pointer;
  z-index: 2;
  padding: 8px 14px;
  border-radius: var(--radius);
  line-height: 1;
}

.lb-prev { left: 12px; }
.lb-next { right: 12px; }

.lb-prev:hover, .lb-next:hover {
  background: rgba(255,255,255,0.3);
}

.lb-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 0.9rem;
  z-index: 2;
}

/* === Leaflet Popup Overrides === */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  min-width: 200px;
}

.popup-content {
  padding: 12px 14px;
}

.popup-content h3 {
  font-size: 1rem;
  margin-bottom: 4px;
  color: var(--primary-dark);
}

.popup-content .popup-location {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 8px;
}

.popup-content .popup-amenities {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.popup-content .popup-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
}

/* === Auth Modal === */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
}

.modal-content {
  position: relative;
  background: var(--bg-panel);
  border-radius: 12px;
  padding: 28px 24px;
  width: 340px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
}

/* Auth Form */
.auth-view h2, #auth-profile h2 {
  margin-bottom: 16px;
  font-size: 1.2rem;
}

#auth-signin input[type="email"],
#auth-signin input[type="password"],
#auth-signup input[type="email"],
#auth-signup input[type="password"],
#auth-signup input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  outline: none;
  margin-bottom: 10px;
  box-sizing: border-box;
}

#auth-signin input:focus,
#auth-signup input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(45,106,79,0.2);
}

#auth-signin .btn-primary,
#auth-signup .btn-primary {
  width: 100%;
  padding: 10px;
  font-size: 1rem;
  margin-top: 4px;
}

.auth-error {
  background: #fbe9e7;
  color: var(--cb-no);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.auth-switch {
  text-align: center;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-light);
}

.auth-switch a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

/* Profile */
.profile-header {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 20px;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  flex-shrink: 0;
}

#profile-name {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.text-light {
  color: var(--text-light);
  font-size: 0.85rem;
}

#profile-badge {
  margin-top: 4px;
}

/* Account Settings */
.account-settings {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-bottom: 16px;
}

.account-settings h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.account-field {
  margin-bottom: 12px;
}

.account-field label {
  font-size: 0.85rem;
  font-weight: 500;
  display: block;
  margin-bottom: 4px;
}

.account-field-row {
  display: flex;
  gap: 8px;
}

.account-field-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  outline: none;
}

.account-field-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(45,106,79,0.2);
}

.btn-small {
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
}

.account-status {
  font-size: 0.8rem;
  margin-top: 4px;
  min-height: 1.2em;
}

.profile-actions {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}

.profile-actions .btn-secondary {
  width: 100%;
}

#admin-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

#admin-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

#admin-section .btn-secondary {
  width: 100%;
  margin-bottom: 8px;
  text-align: left;
}

/* Logged-in indicator on account button */
.header-btn.logged-in {
  background: rgba(255,255,255,0.3);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}

/* === User Rating Widget === */
.user-rating-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.user-rating-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-rating-label {
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 90px;
}

.star-picker {
  display: flex;
  gap: 2px;
}

.star-pick {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--border);
  transition: color 0.15s, transform 0.1s;
  user-select: none;
  line-height: 1;
}

.star-pick:hover,
.star-pick.active {
  color: var(--cb-star);
}

.star-pick:hover {
  transform: scale(1.15);
}

.user-rating-comment {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  margin-top: 4px;
}

.user-rating-comment:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(45,106,79,0.2);
}

.user-rating-submit {
  margin-top: 4px;
}

.user-rating-status {
  font-size: 0.85rem;
  margin-top: 6px;
  text-align: center;
  min-height: 1.2em;
}

.status-error {
  color: var(--cb-no);
}

.status-success {
  color: var(--cb-yes);
  font-weight: 600;
}

/* === Admin Edit Section === */
.admin-edit-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.admin-edit-toggle {
  width: 100%;
  margin-bottom: 12px;
}

.admin-edit-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.admin-field label {
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.admin-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}

.admin-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(45,106,79,0.2);
}

textarea.admin-input {
  resize: vertical;
}

.admin-edit-status {
  font-size: 0.85rem;
  margin-top: 6px;
  text-align: center;
  min-height: 1.2em;
}

/* === Admin Review Panel === */
.admin-review-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-card {
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.review-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.review-card-place {
  font-weight: 600;
  color: var(--primary-dark);
  font-size: 0.95rem;
}

.review-card-user {
  font-size: 0.8rem;
  color: var(--text-light);
}

.review-card-body {
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.review-card-field {
  font-weight: 500;
}

.review-card-value {
  background: #e8f5e9;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
}

.review-card-actions {
  display: flex;
  gap: 8px;
}

.btn-approve {
  background: var(--cb-yes);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

.btn-reject {
  background: var(--cb-no);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

.btn-approve:hover { filter: brightness(0.9); }
.btn-reject:hover { filter: brightness(0.9); }

.review-photo-thumb {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 8px;
}

.review-empty {
  text-align: center;
  color: var(--text-light);
  font-style: italic;
  padding: 20px;
}

/* === Mobile === */
@media (max-width: 600px) {
  .subtitle { display: none; }

  #filter-panel, #list-panel {
    width: 100%;
    max-width: 100vw;
  }

  .header-btn span {
    display: none;
  }

  /* Icon-only Filters button (font-size:0 hides its text node, svg keeps its
     attribute size) and tighter buttons so the title has breathing room */
  #btn-filters { font-size: 0; gap: 0; }
  .header-btn { padding: 6px 8px; }
  .header-left { gap: 6px; margin-right: 10px; min-width: 0; }
  .header-left h1 { font-size: 1.15rem; white-space: nowrap; }
  .header-logo { height: 30px; margin-right: 0; }

  .amenity-grid {
    grid-template-columns: 1fr;
  }

  .detail-directions-wrap {
    flex-direction: column;
  }

  .detail-directions {
    justify-content: center;
  }
}

/* Desktop / widescreen: dock the detail panel to the right as a fixed-width
   side panel instead of a full-width bottom sheet. On wide screens the full-width
   sheet clamped the 16:9 hero to a short, very wide box — cropping the photo to a
   blurry upscaled strip. A ~440px column shows the hero near its native size. */
@media (min-width: 700px) {
  #detail-panel {
    left: auto;
    right: 0;
    width: 440px;
    max-width: 42vw;
    top: var(--header-height);
    bottom: 0;
    max-height: none;
    border-radius: 0;
    border-left: 1px solid var(--border);
  }
  #detail-panel.fullscreen { max-height: none; } /* already full height when docked */
  #detail-panel .panel-grip { display: none; }   /* drag-to-fullscreen is mobile-only */
  #detail-panel .panel-header { cursor: default; }
  .btn-return-map { display: none !important; }   /* not needed when side-docked */

  /* Slightly taller ratio shows more of the landscape photo, less crop */
  .detail-hero-wrap {
    aspect-ratio: 3 / 2;
    max-height: 300px;
  }
}
