/* Map page: tighter nav + full-viewport layout */
:root {
  --nav-h:     60px;
  --nav-pad-x: 32px;
  --sidebar-w: 284px;
}

html, body { overflow: hidden; }
body { display: flex; flex-direction: column; }

/* Slightly stronger nav bg for the map page */
nav { background: rgba(247, 243, 235, 0.96); flex-shrink: 0; }
.nav-logo { font-size: 1.4rem; }
.nav-links { gap: 32px; }

/* ── Map layout ── */
.map-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 20px;
  gap: 16px;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--white);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: relative;
  z-index: var(--z-sidebar);
}
.sidebar.collapsed { width: 44px; min-width: 44px; }

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--cream-dark);
  flex-shrink: 0;
  gap: 10px;
  overflow: hidden;
}

.sidebar-toggle {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--cream-dark);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-mid);
  transition: background 0.15s, color 0.15s;
  font-size: 1rem;
  line-height: 1;
}
.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  background: var(--cream-warm);
  color: var(--forest);
}

.sidebar-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}

#sidebar-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-controls {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--cream-dark);
  flex-shrink: 0;
}

.ctrl-btn {
  flex: 1;
  padding: 7px 12px;
  background: var(--cream-warm);
  border: 1px solid var(--cream-dark);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-mid);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ctrl-btn:hover,
.ctrl-btn:focus-visible {
  background: var(--cream-dark);
  color: var(--forest);
}
.ctrl-btn.primary {
  background: var(--forest-bg);
  border-color: var(--forest-bg);
  color: var(--cream);
}
.ctrl-btn.primary:hover,
.ctrl-btn.primary:focus-visible { background: var(--forest-bg-hover); border-color: var(--forest-bg-hover); }

.sidebar-count {
  padding: 8px 14px 4px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 8px 16px;
}
.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-track { background: transparent; }
.sidebar-body::-webkit-scrollbar-thumb { background: var(--cream-dark); border-radius: 2px; }

/* Category items */
.cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s, opacity 0.2s;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.cat-item:hover,
.cat-item:focus-visible { background: var(--cream-warm); }
.cat-item.active   { opacity: 1; }
.cat-item.inactive { opacity: 0.38; }

.cat-emoji {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}
.cat-emoji img { width: 18px; height: 18px; vertical-align: -2px; }

.cat-name {
  flex: 1;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-count { font-size: 13px; color: var(--text-muted); flex-shrink: 0; }

.cat-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid currentColor;
  transition: background 0.15s;
}
.cat-item.active   .cat-indicator { background: currentColor; }
.cat-item.inactive .cat-indicator { background: transparent; }

/* ── Error overlay ── */
#error-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(247, 243, 235, 0.95);
  z-index: var(--z-error-overlay);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding: 32px;
  text-align: center;
  border-radius: 10px;
}
#error-overlay.visible { display: flex; }
#error-overlay h3 { font-family: 'Cormorant Garamond', serif; font-size: 1.3rem; color: var(--forest); }
#error-overlay p  { font-size: 0.82rem; color: var(--text-muted); max-width: 360px; line-height: 1.6; }
#error-overlay code {
  background: var(--cream-dark);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
}

/* ── Map area ── */
.map-area {
  flex: 1;
  min-width: 0;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
#map { position: absolute; inset: 0; }

/* ── Leaflet overrides ── */
.leaflet-popup-content-wrapper {
  border-radius: 10px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12) !important;
  padding: 0 !important;
  overflow: hidden !important;
  font-family: 'DM Sans', system-ui, sans-serif !important;
}
.leaflet-popup-content {
  margin: 0 !important;
  width: auto !important;
  min-width: 300px;
  max-width: 340px;
}
.leaflet-popup-close-button {
  color: var(--text-muted) !important;
  font-size: 1.1rem !important;
  padding: 6px 8px !important;
}

/* ── Popup inner ── */
.popup-inner { padding: 16px 18px 18px; }
.popup-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--forest);
  line-height: 1.3;
  margin-bottom: 10px;
  padding-right: 16px;
}

.popup-cats { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.popup-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
}
.popup-chip img { width: 13px; height: 13px; vertical-align: -1px; }

.popup-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-mid);
  margin-bottom: 12px;
  border-top: 1px solid var(--cream-dark);
  padding-top: 10px;
}
.popup-desc-full { display: none; }
.popup-read-more {
  display: inline;
  margin-left: 4px;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  color: var(--sage-dark);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.popup-read-more:hover,
.popup-read-more:focus-visible { color: var(--forest); }

.popup-hours {
  margin-bottom: 10px;
  border-top: 1px solid var(--cream-dark);
  padding-top: 10px;
}
.popup-hours-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.popup-hours-note { font-size: 14px; color: var(--text-mid); font-style: italic; }
.popup-hours-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.popup-hours-table td { padding: 1px 0; color: var(--text-mid); }
.popup-hours-day { width: 32px; font-weight: 500; color: var(--text); }

.popup-fields {
  border-top: 1px solid var(--cream-dark);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.popup-field {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.45;
}
.popup-field-icon { flex-shrink: 0; opacity: 0.6; margin-top: 3px; }
.popup-field-icon img { width: 12px; height: 12px; }

.popup-field-body { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.popup-field-label {
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.popup-field-value { font-size: 14px; color: var(--text-mid); word-break: break-word; }

.popup-field a { color: var(--sage-dark); text-decoration: none; word-break: break-all; }
.popup-field a:hover,
.popup-field a:focus-visible { text-decoration: underline; }

/* ── Emoji markers ── */
.emoji-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f7f3eb;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.06);
  cursor: pointer;
}
.emoji-marker img { width: 20px; height: 20px; display: block; }

/* ── Contact bar — compact on map page ── */
.contact-bar { padding: 10px var(--nav-pad-x); flex-shrink: 0; }
.contact-bar p,
.contact-bar a { font-size: 0.82rem; }

/* ── Map search bar ── */
.map-search {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-search-input);
  display: flex;
  align-items: center;
  background: rgba(247, 243, 235, 0.97);
  border: 1px solid var(--cream-dark);
  border-radius: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  padding: 0 6px 0 14px;
  gap: 4px;
  width: 280px;
  transition: width 0.2s, box-shadow 0.2s;
}
.map-search:focus-within {
  width: 320px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.16);
  border-color: var(--sage);
}

.map-search-icon { flex-shrink: 0; color: var(--text-muted); display: flex; align-items: center; }
.map-search-icon svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

.map-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text);
  padding: 9px 4px;
  outline: none;
  min-width: 0;
}
.map-search input::placeholder { color: var(--text-muted); }

.map-search-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--forest-bg);
  color: var(--cream);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.map-search-btn:hover,
.map-search-btn:focus-visible { background: var(--forest-bg-hover); }
.map-search-btn svg {
  width: 13px; height: 13px;
  fill: none; stroke: currentColor; stroke-width: 2.5;
  stroke-linecap: round; stroke-linejoin: round;
}

.map-search-error {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-search-input);
  background: rgba(247, 243, 235, 0.97);
  border: 1px solid var(--cream-dark);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.78rem;
  color: var(--text-mid);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: none;
}
.map-search-error.visible { display: block; }

/* Custom gradient cluster bubbles */
.custom-cluster {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  opacity: 0.92;
  transition: opacity 0.15s;
}
.custom-cluster:hover { opacity: 1; }

/* ── Mobile category bar ── */
.mobile-cat-bar {
  display: none;
  flex-shrink: 0;
  padding: 8px 12px;
  background: var(--cream);
  border-bottom: 1px solid var(--cream-dark);
  gap: 8px;
  align-items: center;
}
.mobile-cat-dropdown { flex: 1; position: relative; }

.mobile-cat-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  gap: 8px;
  text-align: left;
}
.mobile-cat-trigger svg {
  width: 14px; height: 14px;
  flex-shrink: 0;
  transition: transform 0.2s;
  fill: none; stroke: var(--text-muted); stroke-width: 2.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.mobile-cat-dropdown.open .mobile-cat-trigger svg { transform: rotate(180deg); }

.mobile-cat-list {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.14);
  z-index: var(--z-search-dropdown);
  max-height: 50vh;
  overflow-y: auto;
}
.mobile-cat-dropdown.open .mobile-cat-list { display: block; }

.mobile-cat-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--cream-dark);
  font-size: 0.85rem;
  color: var(--text);
  min-height: 44px;
}
.mobile-cat-option:last-child { border-bottom: none; }
.mobile-cat-option:hover { background: var(--cream-warm); }
.mobile-cat-option img { width: 20px; height: 20px; flex-shrink: 0; }

.mobile-show-all-btn {
  flex-shrink: 0;
  padding: 10px 14px;
  background: var(--forest-bg);
  color: var(--cream);
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
}
.mobile-show-all-btn:hover,
.mobile-show-all-btn:focus-visible { background: var(--forest-bg-hover); }

/* ── Mobile filter FAB ── */
.mobile-filter-btn {
  display: none;
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-error-overlay);
  align-items: center;
  gap: 8px;
  padding: 0 22px;
  height: 48px;
  background: var(--forest-bg);
  color: var(--cream);
  border: none;
  border-radius: 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.28);
  white-space: nowrap;
}
.mobile-filter-btn:hover,
.mobile-filter-btn:focus-visible { background: var(--forest-bg-hover); }
.mobile-filter-btn svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }

/* ── Sidebar backdrop (mobile only) ── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: var(--z-mobile-overlay);
  opacity: 0;
  transition: opacity 0.3s;
}
.sidebar-backdrop.visible { opacity: 1; }

/* ── Mobile ── */
@media (max-width: 768px) {
  /* Map layout — edge-to-edge */
  .map-layout { padding: 0; gap: 0; }
  .map-area { border-radius: 0; }
  .contact-bar { display: none; }

  /* Hide sidebar on mobile (use the dropdown bar + FAB instead) */
  .sidebar { display: none !important; }
  .mobile-cat-bar { display: flex; }

  /* Search bar full-width */
  .map-search { left: 12px; right: 12px; top: 12px; transform: none; width: auto; }
  .map-search:focus-within { width: auto; }

  /* Touch targets */
  .ctrl-btn { min-height: 44px; }
  .cat-item { min-height: 44px; }
}
@media (max-width: 480px) {
  .map-search input { font-size: 1rem; }
}

/* ── Search autocomplete dropdown ── */
.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #f7f3eb;
  border: 1px solid var(--cream-dark);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: var(--z-search-dropdown);
  overflow: hidden;
  display: none;
}
.search-suggestions.visible { display: block; }

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--cream-dark);
  transition: background 0.12s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--sage-light); }

.suggestion-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.suggestion-icon img { width: 18px; height: 18px; display: block; }

.suggestion-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.suggestion-name   {
  font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.suggestion-region {
  font-size: 13px; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
