/**
 * Map page styles
 * Popups, menu drawer, layer bar, and UI components
 */

/* Utility classes */
.hidden {
  display: none !important;
}

/* ==========================================================================
   Popup Styles (MapLibre GL)
   "Wayfinder's Companion" - Bold, high-contrast popups for pilgrims
   ========================================================================== */

.maplibregl-popup-content,
.leaflet-popup-content-wrapper {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  padding: 0;
  border-radius: 16px;
  border: none;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  min-width: 200px;
}

.leaflet-popup-content {
  margin: 0;
  width: auto !important;
}

/* Override Leaflet default link color in popup buttons */
.leaflet-popup-content .fountain-popup__btn {
  color: #374151;
}

.leaflet-popup-content .albergue-popup__btn--primary {
  color: black;
}

.leaflet-popup-content .albergue-popup__btn--secondary {
  color: #374151;
}

.leaflet-popup-content .poi-popup__btn--primary {
  color: white;
}

.leaflet-popup-content .poi-popup__btn--secondary {
  color: #4b5563;
}

.maplibregl-popup-close-button,
.leaflet-popup-close-button {
  display: none;
}

.maplibregl-popup-tip,
.leaflet-popup-tip {
  border-top-color: white;
}

/* ==========================================================================
   Fountain Popup - Water is Life
   ========================================================================== */

.fountain-popup {
  text-align: center;
}

.fountain-popup__header {
  padding: 20px 24px 16px;
  position: relative;
}

.fountain-popup__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.fountain-popup__icon svg {
  width: 28px;
  height: 28px;
}

.fountain-popup__status {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.fountain-popup__subtitle {
  font-size: 13px;
  color: #4b5563;
  margin-top: 4px;
}

/* Potable - Green with confidence */
.fountain-popup--potable .fountain-popup__header {
  background: #f0fdf4;
}

.fountain-popup--potable .fountain-popup__icon {
  background: #16a34a;
  color: white;
}

.fountain-popup--potable .fountain-popup__status {
  color: #15803d;
}

/* Not Potable - Red warning */
.fountain-popup--not-potable .fountain-popup__header {
  background: #fef2f2;
}

.fountain-popup--not-potable .fountain-popup__icon {
  background: #dc2626;
  color: white;
}

.fountain-popup--not-potable .fountain-popup__status {
  color: #b91c1c;
}

/* Unknown - Neutral caution */
.fountain-popup--unknown .fountain-popup__header {
  background: #f9fafb;
}

.fountain-popup--unknown .fountain-popup__icon {
  background: #6b7280;
  color: white;
}

.fountain-popup--unknown .fountain-popup__status {
  color: #374151;
}

.fountain-popup__actions {
  display: flex;
  border-top: 1px solid #e5e7eb;
}

.fountain-popup__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 16px;
  background: white;
  color: #374151;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
  min-height: 48px;
}

.fountain-popup__btn:hover {
  background: #f3f4f6;
}

.fountain-popup__btn + .fountain-popup__btn {
  border-left: 1px solid #e5e7eb;
}

.fountain-popup__btn svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

/* ==========================================================================
   Albergue Popup - Rest for the Weary
   ========================================================================== */

.albergue-popup {
  min-width: 240px;
}

.albergue-popup__image {
  width: 100%;
  height: 100px;
  overflow: hidden;
  background: #f3f4f6;
}

.albergue-popup__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.albergue-popup__header {
  background: #fffbeb;
  padding: 16px 18px;
  border-bottom: 3px solid #d97706;
  position: relative;
}

.albergue-popup__header--leafshell {
  background: #ecfdf5;
  border-bottom-color: #10b981;
}

.albergue-popup__top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.albergue-popup__ls-badge {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.albergue-popup__info {
  flex: 1;
  min-width: 0;
}

.albergue-popup__name {
  font-size: 17px;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.albergue-popup__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.albergue-popup__stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: white;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.albergue-popup__stat svg {
  width: 14px;
  height: 14px;
  color: #9ca3af;
}

.albergue-popup__stat--price {
  background: #d97706;
  color: white;
}

.albergue-popup__stat--price svg {
  color: rgba(255, 255, 255, 0.8);
}

.albergue-popup__actions {
  display: flex;
  background: white;
}

.albergue-popup__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
  min-height: 48px;
}

.albergue-popup__btn--primary {
  background: #d97706;
  color: white;
}

.albergue-popup__btn--primary:hover {
  background: #b45309;
}

.albergue-popup__btn--secondary {
  background: #f3f4f6;
  color: #374151;
}

.albergue-popup__btn--secondary:hover {
  background: #e5e7eb;
}

.albergue-popup__btn svg {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   POI Popup - Points of Discovery
   ========================================================================== */

.poi-popup {
  min-width: 220px;
}

.poi-popup__image {
  width: 100%;
  height: 100px;
  overflow: hidden;
  background: #f3f4f6;
}

.poi-popup__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.poi-popup__header {
  padding: 16px 18px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
}

.poi-popup__top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.poi-popup__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.poi-popup__icon svg {
  width: 22px;
  height: 22px;
  color: white;
}

.poi-popup__ls-badge {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.poi-popup__info {
  flex: 1;
  min-width: 0;
}

.poi-popup__name {
  font-size: 17px;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.poi-popup__type {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  margin-top: 6px;
}

.poi-popup__diet-pill,
.albergue-popup__diet-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  margin-top: 6px;
  margin-left: 4px;
  background: #dcfce7;
  color: #15803d;
}

.poi-popup__description {
  margin: 10px 0 0;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #374151;
  background: #f3f4f6;
  border-radius: 6px;
}

.poi-popup__meta {
  margin-top: 10px;
  font-size: 13px;
  color: #4b5563;
  line-height: 1.4;
}

.poi-popup__meta-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 4px;
}

.poi-popup__meta-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
  color: #9ca3af;
}

.poi-popup__actions {
  display: flex;
  background: #f9fafb;
}

.poi-popup__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
  min-height: 48px;
}

.poi-popup__btn--primary {
  background: #374151;
  color: white;
}

.poi-popup__btn--primary:hover {
  background: #1f2937;
}

.poi-popup__btn--secondary {
  background: transparent;
  color: #4b5563;
}

.poi-popup__btn--secondary:hover {
  background: #e5e7eb;
}

.poi-popup__btn svg {
  width: 16px;
  height: 16px;
}

/* POI Type Colors */
.poi-popup__icon--monument {
  background: #2563eb;
}
.poi-popup__type--monument {
  background: #dbeafe;
  color: #1e40af;
}

.poi-popup__icon--shop {
  background: #9333ea;
}
.poi-popup__type--shop {
  background: #f3e8ff;
  color: #7e22ce;
}

.poi-popup__icon--food_and_drink {
  background: #ea580c;
}
.poi-popup__type--food_and_drink {
  background: #ffedd5;
  color: #c2410c;
}

.poi-popup__icon--stamp {
  background: #92400e;
}
.poi-popup__type--stamp {
  background: #fef3c7;
  color: #92400e;
}

.poi-popup__icon--museum {
  background: #0d9488;
}
.poi-popup__type--museum {
  background: #ccfbf1;
  color: #0f766e;
}

.poi-popup__icon--church {
  background: #4f46e5;
}
.poi-popup__type--church {
  background: #e0e7ff;
  color: #4338ca;
}

.poi-popup__icon--historical {
  background: #d97706;
}
.poi-popup__type--historical {
  background: #fef3c7;
  color: #b45309;
}

.poi-popup__icon--vista {
  background: #16a34a;
}
.poi-popup__type--vista {
  background: #dcfce7;
  color: #15803d;
}

.poi-popup__icon--camping {
  background: #166534;
}
.poi-popup__type--camping {
  background: #dcfce7;
  color: #166534;
}

/* ==========================================================================
   Menu Overlay & Drawer
   ========================================================================== */

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1100;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.menu-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.menu-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85vh;
  background: #f5f5f4;
  z-index: 1101;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  border-radius: 20px 20px 0 0;
  transform: translateY(0);
  transition: transform 0.3s ease;
}

.menu-drawer.hidden {
  transform: translateY(100%);
}

/* Header */
.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: white;
  border-radius: 20px 20px 0 0;
  flex-shrink: 0;
}

.menu-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-header__logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.menu-header__title {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #1f2937;
}

.menu-close {
  width: 36px;
  height: 36px;
  background: #f3f4f6;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 300;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.menu-close:active {
  background: #e5e7eb;
}

/* Content */
.menu-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Sections */
.menu-section {
  padding: 16px 16px 0;
}

.menu-section__label {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding-left: 4px;
}

/* Primary Action Cards */
.menu-primary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.menu-primary__card {
  background: white;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.menu-primary__card--route {
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  color: white;
}

.menu-primary__card--route .menu-primary__label {
  color: white;
}

.menu-primary__card--leafshell {
  background: linear-gradient(135deg, #84cc16 0%, #a3e635 100%);
}

.menu-primary__header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.menu-primary__icon {
  width: 28px;
  height: 28px;
  color: rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
}

.menu-primary__img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.menu-primary__label {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #1f2937;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.menu-primary__select {
  width: 100%;
  padding: 8px 10px;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #0d9488;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: auto;
}

.menu-primary__select:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
}

.menu-primary__buttons {
  display: flex;
  gap: 6px;
  margin-top: auto;
}

.menu-primary__btn {
  flex: 1;
  padding: 8px 6px;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #365314;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 6px;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s;
}

.menu-primary__btn:active {
  background: rgba(255, 255, 255, 1);
}

.menu-primary__btn--alt {
  background: rgba(255, 255, 255, 0.6);
}

/* Secondary Grid */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

@media (min-width: 480px) {
  .menu-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.menu-grid__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  background: white;
  border-radius: 10px;
  text-decoration: none;
  transition:
    background 0.15s,
    transform 0.1s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.menu-grid__item:active {
  transform: scale(0.97);
  background: #f9fafb;
}

.menu-grid__icon {
  width: 18px;
  height: 18px;
  color: #6b7280;
}

.menu-grid__item span {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #4b5563;
  text-align: center;
}

.menu-grid__item--amber {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.menu-grid__item--amber .menu-grid__icon {
  color: #d97706;
}

.menu-grid__item--amber span {
  color: #92400e;
}

/* Footer */
.menu-footer {
  margin-top: auto;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: white;
  border-top: 1px solid #e5e7eb;
}

.menu-footer__cache {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 10px;
}

.menu-footer__actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.menu-footer__btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 13px;
  color: #4b5563;
  cursor: pointer;
}

.menu-footer__btn:active {
  background: #f3f4f6;
}

.menu-footer__btn--danger {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}

.menu-footer__updates {
  margin-bottom: 0.75rem;
}

.menu-footer__btn--update {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: #16a34a;
  border-color: #86efac;
  background: #f0fdf4;
  font-weight: 500;
}

.menu-footer__coffee {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.menu-footer__coffee:hover {
  background: #fef3c7;
}

.menu-footer__coffee:active {
  background: #fde68a;
}

.menu-footer__version {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 11px;
  color: #9ca3af;
  text-align: center;
}

/* ==========================================================================
   Layer Bar
   ========================================================================== */

.layer-bar {
  position: absolute;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 12px;
  border-radius: 24px;
  display: flex;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

/* Browser mode - safe area works correctly */
@media (display-mode: browser) {
  .layer-bar {
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
}

/* PWA standalone mode - safe-area already handled by iOS, just use fixed offset */
@media (display-mode: standalone) {
  .layer-bar {
    bottom: 20px;
  }
}

.layer-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.layer-btn.active {
  border-color: #d97706;
  background: #fef3c7;
}

.layer-btn.disabled {
  opacity: 0.5;
}

.layer-icon-svg {
  width: 24px;
  height: 24px;
  color: #374151;
}

.layer-btn.active .layer-icon-svg {
  color: #d97706;
}

.layer-icon-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  opacity: 0.7;
}

.layer-btn.active .layer-icon-img {
  opacity: 1;
}

.layer-bar__divider {
  width: 1px;
  height: 28px;
  background: rgba(0, 0, 0, 0.15);
  margin: 0 4px;
  align-self: center;
}

.layer-btn--menu {
  background: rgba(255, 255, 255, 0.95);
}

.layer-btn--menu .layer-icon-img {
  width: 32px;
  height: 32px;
  opacity: 1;
  border-radius: 50%;
}

.layer-btn--menu {
  position: relative;
}

.update-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #16a34a;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.update-dot.hidden {
  display: none;
}

/* ==========================================================================
   Status Indicators
   ========================================================================== */

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

.status-dot.offline {
  background: #f59e0b;
}

.sw-badge {
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 4px;
  background: #ef4444;
  color: white;
  font-weight: 500;
}

.sw-badge.active {
  background: #22c55e;
}

/* ==========================================================================
   Toast Messages
   ========================================================================== */

.map-toast {
  position: fixed;
  top: 50%;
  left: 16px;
  right: 16px;
  max-width: 400px;
  margin: 0 auto;
  background: #1f2937;
  color: white;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 2000;
  opacity: 0;
  transform: translateY(-50%) scale(0.95);
  transition:
    opacity 0.3s,
    transform 0.3s;
}

.map-toast--visible {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.map-toast__icon {
  width: 48px;
  height: 48px;
  background: rgba(251, 191, 36, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fbbf24;
}

.map-toast__icon svg {
  width: 28px;
  height: 28px;
}

.map-toast__content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-toast__content strong {
  font-size: 17px;
  font-weight: 600;
}

.map-toast__content p {
  margin: 0;
  font-size: 14px;
  color: #9ca3af;
  line-height: 1.4;
}

.map-toast__actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.map-toast__btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.1s;
}

.map-toast__btn:active {
  transform: scale(0.97);
}

.map-toast__btn--primary {
  background: #d97706;
  color: white;
}

.map-toast__btn--primary:hover {
  background: #b45309;
}

.map-toast__btn--secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #d1d5db;
}

.map-toast__btn--secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Layer switch toast - lightweight notification */
.layer-toast {
  position: fixed;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(31, 41, 55, 0.95);
  color: white;
  padding: 10px 18px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}

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

.layer-toast__icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layer-toast__icon svg {
  width: 20px;
  height: 20px;
}

.layer-toast__icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

@media (display-mode: standalone) {
  .layer-toast {
    bottom: 90px;
  }
}

/* ==========================================================================
   Leaflet Marker Cluster Styles
   ========================================================================== */

.cluster-marker {
  background: transparent;
}

.cluster-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #1a1a1a;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.cluster-icon--fountain {
  background: rgba(37, 99, 235, 0.75);
  color: white;
}

.cluster-icon--albergue {
  background: rgba(245, 158, 11, 0.75);
  color: #1a1a1a;
}

.cluster-icon--poi {
  background: rgba(107, 114, 128, 0.75);
  color: white;
}

.cluster-icon--leafshell {
  background: rgba(22, 163, 74, 0.75);
  color: white;
}

.cluster-icon--camping {
  background: rgba(22, 101, 52, 0.75);
  color: white;
}

/* ==========================================================================
   Map Markers - CSS-based with mask icons
   ========================================================================== */

/* Base marker reset for Leaflet */
.fountain-marker,
.albergue-marker,
.poi-marker {
  background: transparent !important;
  border: none !important;
}

/* --------------------------------------------------------------------------
   Albergue Markers - Squircle shape
   -------------------------------------------------------------------------- */
.albergue-marker__box {
  width: 32px;
  height: 32px;
  border-radius: 30%;
  background: #fde68a; /* pastel amber */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.albergue-marker__box::after {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  background-color: #374151;
  /* Bunkbed icon - same as layer bar */
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M1 2V23H3V21H21V23H23V7C23 4.79 21.21 3 19 3H10V8H3V2M6.5 2A2.5 2.5 0 0 0 4 4.5A2.5 2.5 0 0 0 6.5 7A2.5 2.5 0 0 0 9 4.5A2.5 2.5 0 0 0 6.5 2M3 11H21V13.56C20.41 13.21 19.73 13 19 13H10V18H3M6.5 12A2.5 2.5 0 0 0 4 14.5A2.5 2.5 0 0 0 6.5 17A2.5 2.5 0 0 0 9 14.5A2.5 2.5 0 0 0 6.5 12Z'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

/* Leaf & Shell albergue - dark green with white icon */
.albergue-marker__box--leafshell {
  background: #166534;
}

.albergue-marker__box--leafshell::after {
  background-color: #ffffff;
}

/* VIP badge */
.albergue-marker__vip {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  background: #facc15;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.albergue-marker__vip::after {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  background-color: #92400e;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolygon points='12,2 15,9 22,9.5 17,14 18.5,22 12,18 5.5,22 7,14 2,9.5 9,9'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

/* Camping badge */
.albergue-marker__camping {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 16px;
  height: 16px;
  background: #166534;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.albergue-marker__camping::after {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  background-color: #fff;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2,21V19H4.76L12,4.78L19.24,19H22V21H2M12,9.19L7,19H17L12,9.19Z'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

/* --------------------------------------------------------------------------
   Fountain Markers - Teardrop shape
   -------------------------------------------------------------------------- */
.fountain-marker__box {
  width: 24px;
  height: 30px;
  background: #71717a; /* default gray */
  clip-path: path(
    "M12 0C12 0 2 10 2 18c0 5 4.5 10 10 10s10-5 10-10C22 10 12 0 12 0z"
  );
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 8px;
  opacity: 0.85;
}

.fountain-marker__box::after {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  background-color: #fff;
  border-radius: 50%;
}

.fountain-marker__box--potable {
  background: #2563eb;
}

.fountain-marker__box--not-potable {
  background: #dc2626;
}

.fountain-marker__box--unknown {
  background: #71717a;
}

/* --------------------------------------------------------------------------
   POI Markers - Hexagon shape
   -------------------------------------------------------------------------- */
.poi-marker__box {
  width: 32px;
  height: 32px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e5e7eb; /* default gray */
}

.poi-marker__box::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  background-color: #1f2937;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

/* Leaf & Shell POI - dark green with white icon */
.poi-marker__box--leafshell {
  background: #166534;
}

.poi-marker__box--leafshell::after {
  background-color: #ffffff;
}

/* POI type colors */
.poi-marker__box--monument {
  background: #93c5fd;
}
.poi-marker__box--shop {
  background: #c4b5fd;
}
.poi-marker__box--food-and-drink {
  background: #fdba74;
}
.poi-marker__box--stamp {
  background: #fcd34d;
}
.poi-marker__box--museum {
  background: #5eead4;
}
.poi-marker__box--church {
  background: #a5b4fc;
}
.poi-marker__box--historical {
  background: #fbbf24;
}
.poi-marker__box--vista {
  background: #86efac;
}
.poi-marker__box--curiosity {
  background: #c4b5fd;
}
.poi-marker__box--camping {
  background: #4ade80;
}

/* POI type icons */
.poi-marker__box--monument::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20,6H4V3A1,1,0,0,1,5,2H19a1,1,0,0,1,1,1Zm0,14h2v2H2V20H4V8H20Zm-4-4a4,4,0,0,0-8,0v4h8Z'/%3E%3C/svg%3E");
}

.poi-marker__box--shop::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6h-2c0-2.76-2.24-5-5-5S7 3.24 7 6H5c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-7-3c1.66 0 3 1.34 3 3H9c0-1.66 1.34-3 3-3zm7 17H5V8h14v12z'/%3E%3C/svg%3E");
}

.poi-marker__box--food-and-drink::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 9H9V2H7v7H5V2H3v7c0 2.12 1.66 3.84 3.75 3.97V22h2.5v-9.03C11.34 12.84 13 11.12 13 9V2h-2v7zm5-3v8h2.5v8H21V2c-2.76 0-5 2.24-5 4z'/%3E%3C/svg%3E");
}

.poi-marker__box--stamp::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 178.905 178.905'%3E%3Cpath d='M160.389,178.905H18.516c-1.381,0-2.5-1.119-2.5-2.5v-7.645H10.6c-1.381,0-2.5-1.119-2.5-2.5v-25.628c0-1.381,1.119-2.5,2.5-2.5h1.592c0.221-2.584,1.083-6.524,4.044-9.813c3.353-3.725,8.422-5.613,15.067-5.613c16.925,0,43.776-11.664,43.776-42.964c0-16.663-9.949-36.425-10.05-36.623c-0.031-0.062-0.06-0.123-0.085-0.187c-2.599-4.396-3.971-9.385-3.971-14.454C60.973,12.775,73.749,0,89.452,0c15.704,0,28.479,12.775,28.479,28.479c0,5.072-1.373,10.063-3.974,14.459c-0.025,0.062-0.053,0.122-0.083,0.182c-0.101,0.197-10.05,19.986-10.05,36.623c0,31.3,26.852,42.964,43.776,42.964c6.645,0,11.714,1.889,15.066,5.613c2.961,3.288,3.823,7.228,4.044,9.813h1.593c1.381,0,2.5,1.119,2.5,2.5v25.628c0,1.381-1.119,2.5-2.5,2.5h-5.416v7.645C162.889,177.786,161.77,178.905,160.389,178.905z M21.016,173.905h136.873v-3.81H21.016V173.905z M13.1,163.761h152.705v-20.628H13.1V163.761z M17.218,138.133h144.469c-0.21-1.817-0.862-4.408-2.767-6.503c-2.366-2.603-6.175-3.923-11.318-3.923c-10.921,0-22.71-4.146-31.534-11.089c-7.866-6.189-17.242-17.611-17.242-36.875c0-16.774,8.975-35.617,10.413-38.53c0.059-0.184,0.14-0.362,0.242-0.53c2.258-3.696,3.451-7.916,3.451-12.203C112.932,15.533,102.399,5,89.452,5C76.506,5,65.973,15.533,65.973,28.479c0,4.286,1.193,8.506,3.451,12.203c0.106,0.173,0.189,0.356,0.249,0.546c1.462,2.962,10.406,21.769,10.406,38.515c0,19.264-9.376,30.686-17.242,36.875c-8.824,6.943-20.613,11.089-31.534,11.089c-5.144,0-8.952,1.32-11.319,3.923C18.08,133.725,17.428,136.315,17.218,138.133z'/%3E%3C/svg%3E");
}

.poi-marker__box--museum::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3L2 8v2h20V8L12 3zm0 2.5L17.5 8h-11L12 5.5zM4 12v7h3v-7H4zm6 0v7h4v-7h-4zm6 0v7h3v-7h-3zM2 21h20v2H2v-2z'/%3E%3C/svg%3E");
}

.poi-marker__box--church::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 12.22V9l-5-2.5V5h2V3h-2V1h-2v2H9v2h2v1.5L6 9v3.22L2 14v8h8v-4c0-1.1.9-2 2-2s2 .9 2 2v4h8v-8l-4-1.78zM11 4h2v1h-2V4z'/%3E%3C/svg%3E");
}

.poi-marker__box--historical::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M7 7H17V9H7V7M7 11H17V13H7V11M7 15H14V17H7V15Z'/%3E%3C/svg%3E");
}

.poi-marker__box--vista::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z'/%3E%3C/svg%3E");
}

.poi-marker__box--curiosity::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 6h-2V4h-4v2H10V4H6v2H4c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h2v2h4v-2h4v2h4v-2h2c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zM4 14V8h4v6H4zm8 0c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm8 0h-4V8h4v6z'/%3E%3C/svg%3E");
}

.poi-marker__box--camping::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2,21V19H4.76L12,4.78L19.24,19H22V21H2M12,9.19L7,19H17L12,9.19Z'/%3E%3C/svg%3E");
}

/* Camping POI uses triangle shape instead of hexagon */
.poi-marker__box--camping-shape {
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  width: 32px;
  height: 28px;
  padding-top: 6px;
}

/* Override default Leaflet marker cluster styles */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: transparent !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: transparent !important;
}

/* ==========================================================================
   Route Selector Control (Leaflet)
   ========================================================================== */

.route-control {
  position: relative;
}

.route-control__btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 30px !important;
  height: 30px !important;
  background: white;
  color: #333;
  text-decoration: none;
  line-height: 30px !important;
  padding: 0 !important;
  box-sizing: border-box;
}

.route-control__btn svg {
  width: 18px !important;
  height: 18px !important;
  max-width: none !important;
  display: block;
  flex-shrink: 0;
  margin: 0;
}

.route-control__btn:hover {
  background: #f4f4f4;
}

.route-control__panel {
  display: none;
  position: absolute;
  top: 0;
  right: 36px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  min-width: 180px;
  overflow: hidden;
  z-index: 1000;
}

.route-control.expanded .route-control__panel {
  display: block;
}

.route-control__header {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}

.route-control__list {
  max-height: 300px;
  overflow-y: auto;
}

.route-control__option {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: white;
  text-align: left;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  transition: background 0.15s;
}

.route-control__option:hover {
  background: #f5f5f5;
}

.route-control__option.active {
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}

.route-control__option + .route-control__option {
  border-top: 1px solid #eee;
}

/* ==========================================================================
   Help Control (Icon Legend)
   ========================================================================== */

.help-control__btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 30px !important;
  height: 30px !important;
  background: white;
  color: #666;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  line-height: 30px !important;
  padding: 0 !important;
  box-sizing: border-box;
}

.help-control__btn:hover {
  background: #f4f4f4;
  color: #333;
}

/* Help Modal Overlay */
.help-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.help-modal-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.help-modal {
  width: 80%;
  max-width: 500px;
  height: 80%;
  max-height: 600px;
  background: white;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.help-modal-overlay--visible .help-modal {
  transform: scale(1);
}

.help-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.help-modal__title {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

.help-modal__close {
  width: 32px;
  height: 32px;
  background: #f3f4f6;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.help-modal__close:hover {
  background: #e5e7eb;
}

.help-modal__content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  -webkit-overflow-scrolling: touch;
}

.help-modal__section {
  margin-bottom: 24px;
}

.help-modal__section:last-child {
  margin-bottom: 0;
}

.help-modal__section-title {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 12px 0;
}

.help-modal__item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}

.help-modal__item:last-child {
  border-bottom: none;
}

.help-modal__icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.help-modal__icon svg {
  width: 28px;
  height: 28px;
}

.help-modal__icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.help-modal__icon--small svg {
  width: 24px;
  height: 24px;
}

.help-modal__text {
  flex: 1;
  min-width: 0;
}

.help-modal__label {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 2px 0;
}

.help-modal__desc {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
  margin: 0;
}
