/* ============================================================
   styles.css — Curious Oxfordshire Map
   MD3-inspired, warm earthy feel. Plus Jakarta Sans.
   ============================================================ */

/* -- CSS custom properties ---------------------------------- */
:root {
  --surface:       #fdf9f4;
  --surface-2:     #f5ede0;
  --border:        #e8d8c0;
  --primary:       #5c3a1e;
  --primary-light: #8b5e3c;
  --text:          #1a0f00;
  --text-muted:    #7a5c3c;
  --green:         #4a7c59;
  --radius-sm:     8px;
  --radius-md:     12px;
  --radius-lg:     20px;
  --radius-pill:   100px;
}

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

/* -- Focus visible ----------------------------------------- */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

body {
  display: flex;
  height: 100vh;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--surface-2);
  color: var(--text);
}

/* -- Sidebar ----------------------------------------------- */
#sidebar {
  width: 310px;
  min-width: 280px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 16px 12px;
  background: var(--surface);
  border-right: none;
  box-shadow: 4px 0 24px rgba(60,40,10,0.08);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  z-index: 1000;
}

#sidebar::-webkit-scrollbar {
  width: 4px;
}
#sidebar::-webkit-scrollbar-track {
  background: transparent;
}
#sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-pill);
}

#sidebar h1 {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* -- Search ------------------------------------------------ */
#search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

#search-icon {
  position: absolute;
  left: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
  flex-shrink: 0;
}

#search-input {
  width: 100%;
  padding: 9px 36px 9px 38px;
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 500;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#search-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(92,58,30,0.08);
}

#search-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
  opacity: 0.75;
}

#search-clear {
  display: none;
  position: absolute;
  right: 10px;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 0.7rem;
  border: none;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

#search-clear:hover {
  background: var(--primary);
  color: #fff;
}

/* -- Filters ----------------------------------------------- */
#filters {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}

#filters::-webkit-scrollbar { display: none; }

.filter-btn {
  padding: 5px 12px;
  font-size: 0.74rem;
  font-family: inherit;
  font-weight: 500;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--primary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.filter-btn:hover {
  background: var(--surface-2);
  border-color: var(--primary-light);
}

.filter-btn.active {
  background: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(92,58,30,0.18);
}

.filter-btn-adventure {
  background: #eaf4ef;
  border-color: #2a7a6a;
  color: #1a5040;
  font-weight: 600;
}

.filter-btn-adventure:hover,
.filter-btn-adventure.active {
  background: #2a7a6a;
  color: #fff;
  border-color: #2a7a6a;
}

.filter-btn-family {
  background: #fef3e2;
  border-color: #d4860a;
  color: #7a4a00;
  font-weight: 600;
}

.filter-btn-family:hover,
.filter-btn-family.active {
  background: #d4860a;
  color: #fff;
  border-color: #d4860a;
}

.filter-btn-saved:hover,
.filter-btn-saved.active {
  background: #e04070;
  color: #fff;
  border-color: #e04070;
}

.filter-btn-lost:hover,
.filter-btn-lost.active {
  background: #7a5838;
  color: #fff;
  border-color: #7a5838;
}

.filter-btn-underground:hover,
.filter-btn-underground.active {
  background: #4a4860;
  color: #fff;
  border-color: #4a4860;
}

.filter-btn-screen:hover,
.filter-btn-screen.active {
  background: #5a3f7a;
  color: #fff;
  border-color: #5a3f7a;
}

.filter-btn-nightsky:hover,
.filter-btn-nightsky.active {
  background: #1e3a6a;
  color: #fff;
  border-color: #1e3a6a;
}

.filter-btn-wartime:hover,
.filter-btn-wartime.active {
  background: #6a7a3a;
  color: #fff;
  border-color: #6a7a3a;
}

.filter-btn-folklore:hover,
.filter-btn-folklore.active {
  background: #3d6654;
  color: #fff;
  border-color: #3d6654;
}

.filter-btn-industrial:hover,
.filter-btn-industrial.active {
  background: #8a5030;
  color: #fff;
  border-color: #8a5030;
}

.filter-btn-eccentric:hover,
.filter-btn-eccentric.active {
  background: #a03068;
  color: #fff;
  border-color: #a03068;
}

.filter-btn-sonic:hover,
.filter-btn-sonic.active {
  background: #2a7a8a;
  color: #fff;
  border-color: #2a7a8a;
}

.filter-btn[data-filter="hidden-places"]:hover,
.filter-btn[data-filter="hidden-places"].active {
  background: #c07030; color: #fff; border-color: #c07030;
}
.filter-btn[data-filter="events"]:hover,
.filter-btn[data-filter="events"].active {
  background: #8b5ea6; color: #fff; border-color: #8b5ea6;
}
.filter-btn[data-filter="nature"]:hover,
.filter-btn[data-filter="nature"].active {
  background: #4a7c59; color: #fff; border-color: #4a7c59;
}
.filter-btn[data-filter="rainy-day"]:hover,
.filter-btn[data-filter="rainy-day"].active {
  background: #4a70a0; color: #fff; border-color: #4a70a0;
}
.filter-btn[data-filter="food-or-treats"]:hover,
.filter-btn[data-filter="food-or-treats"].active {
  background: #c05060; color: #fff; border-color: #c05060;
}
.filter-btn[data-filter="strange-or-historic"]:hover,
.filter-btn[data-filter="strange-or-historic"].active {
  background: #a05030; color: #fff; border-color: #a05030;
}
.filter-btn[data-filter="free-or-cheap"]:hover,
.filter-btn[data-filter="free-or-cheap"].active {
  background: #4a7c59; color: #fff; border-color: #4a7c59;
}

/* -- Random button ----------------------------------------- */
#random-btn {
  width: 100%;
  padding: 11px;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  letter-spacing: 0.1px;
}

#random-btn:hover {
  background: #3a6447;
  box-shadow: 0 4px 14px rgba(74,124,89,0.28);
}

/* -- Place count label ------------------------------------- */
#place-count {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* -- Place list -------------------------------------------- */
#place-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;

  /* Thin earthy scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#place-list::-webkit-scrollbar {
  width: 4px;
}
#place-list::-webkit-scrollbar-track {
  background: transparent;
}
#place-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-pill);
}

/* Card-style list items with colour stripe + optional thumbnail */
.place-item {
  display: grid;
  grid-template-columns: 4px 1fr auto;
  column-gap: 0;
  min-height: 64px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}

.place-item:hover {
  border-color: var(--primary-light);
  box-shadow: 0 2px 12px rgba(60,40,10,0.1);
}

.place-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.place-item.highlighted {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(74,124,89,0.2);
}

/* Left colour stripe */
.place-stripe {
  width: 4px;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  flex-shrink: 0;
}

/* Main text content */
.place-body {
  padding: 10px 10px 10px 12px;
  min-width: 0;
}

/* Thumbnail column */
.place-thumb-wrap {
  display: flex;
  align-items: center;
  padding: 8px 10px 8px 4px;
  flex-shrink: 0;
}

.place-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: block;
}

.place-item .place-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-item .place-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-item .place-tags-row {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.place-item .place-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--primary);
}

.list-family-badge {
  font-size: 0.7rem;
  opacity: 0.8;
  vertical-align: middle;
}

.list-adventure-badge {
  color: #2a7a6a;
  font-weight: 700;
  margin-right: 3px;
  font-size: 0.75rem;
}

/* Distance badge in list-item meta line */
.place-distance {
  color: var(--green);
  font-weight: 600;
}

/* Heart / fav button on list items */
.place-fav-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.82);
  color: var(--border);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
  padding: 0;
}
.place-fav-btn:hover   { background: #fff; color: #e04070; }
.place-fav-btn.fav-active { color: #e04070; background: #fff; }

/* Save button inside popup / detail panel */
.popup-fav-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  margin-left: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
}
.popup-fav-btn:hover    { background: var(--surface-2); color: #e04070; border-color: #e04070; }
.popup-fav-btn.fav-active { color: #e04070; border-color: #e04070; }

/* -- Empty state ------------------------------------------- */
.place-list-empty {
  list-style: none;
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
}

.place-list-empty p {
  font-size: 0.84rem;
  line-height: 1.5;
  margin-bottom: 12px;
}

.empty-clear-btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.empty-clear-btn:hover { background: var(--border); }

/* -- Sidebar footer ---------------------------------------- */
.sidebar-footer {
  font-size: 0.72rem;
  color: #6a4e2e;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* -- Map --------------------------------------------------- */
#map {
  flex: 1;
  height: 100vh;
  position: relative;
}

/* -- Loading overlay --------------------------------------- */
#map-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--surface-2);
  z-index: 900;
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 600;
}
.map-loader-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -- Map empty toast --------------------------------------- */
#map-empty-toast {
  display: none;
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(92,58,30,0.9);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  z-index: 900;
  pointer-events: none;
  white-space: nowrap;
}

/* -- Leaflet popup customisation --------------------------- */
.leaflet-popup-content-wrapper {
  border-radius: 16px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: #fff;
  border: none;
  box-shadow: 0 16px 48px rgba(60,40,10,0.22), 0 2px 10px rgba(60,40,10,0.08);
  padding: 0;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0;
  width: auto !important;
  max-height: 72vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.leaflet-popup-content::-webkit-scrollbar       { width: 4px; }
.leaflet-popup-content::-webkit-scrollbar-track  { background: transparent; }
.leaflet-popup-content::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 4px; }

.leaflet-popup-tip {
  background: #fff;
}

/* -- Popup photo ------------------------------------------- */
.popup-photo-wrap { width: 100%; }

.popup-photo {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}

.popup-photo-placeholder {
  width: 100%;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: var(--surface-2);
  color: var(--border);
}

/* -- Popup inner content ----------------------------------- */
.popup-content {
  padding: 20px;
}

.popup-content h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.3;
}

/* Type badge pill */
.popup-type {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--primary);
  margin-bottom: 12px;
  font-style: normal;
  letter-spacing: 0.2px;
}

.popup-description {
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 12px;
  color: var(--text);
}

.popup-curious {
  background: #fffbf3;
  border-left: 3px solid #c49a30;
  padding: 9px 20px 9px 17px;
  font-size: 0.81rem;
  font-style: italic;
  margin-bottom: 14px;
  margin-left: -20px;
  margin-right: -20px;
  border-radius: 0;
  color: var(--primary);
  line-height: 1.5;
}

/* Info cards grid */
.popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.popup-grid-cell {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
}

.popup-grid-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.popup-grid-value {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.popup-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}

.popup-tag {
  font-size: 0.68rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--primary);
}

.popup-tag.weather-indoor  { background: #dce8f5; color: #2a4a6e; }
.popup-tag.weather-outdoor { background: #ddf0d0; color: #2a5a20; }

.popup-verified {
  font-size: 0.76rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 6px;
}

.popup-date {
  font-size: 0.74rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 6px;
}

.popup-family {
  font-size: 0.7rem;
  color: #7a4a00;
  background: #fef3e2;
  border: 1px solid #e8c078;
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  margin-bottom: 8px;
  display: inline-block;
  font-weight: 500;
}

.popup-adventure-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: #2a7a6a;
  color: #fff;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 8px;
}

.popup-adventure h3 {
  color: #1a5040;
}

/* ── Voice assistant ──────────────────────────────────────── */

#voice-btn {
  position: fixed;
  bottom: 60px;
  right: 24px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(60,40,10,0.38);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}

#voice-btn:hover {
  background: var(--primary-light);
  transform: scale(1.06);
}

#voice-panel {
  position: fixed;
  bottom: 0;
  left: 310px;
  right: 0;
  height: 290px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(60,40,10,0.12);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

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

#voice-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#voice-panel-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--primary);
  flex: 1;
}

#voice-status {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  min-width: 80px;
  text-align: right;
}

#voice-key-btn,
#voice-reset,
#voice-close {
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

#voice-key-btn:hover,
#voice-reset:hover,
#voice-close:hover {
  background: var(--surface-2);
}

#voice-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.voice-msg {
  max-width: 78%;
  padding: 8px 12px;
  font-size: 0.82rem;
  line-height: 1.45;
  border-radius: 14px;
}

.voice-msg-user {
  background: var(--primary);
  color: var(--surface);
  align-self: flex-end;
  border-radius: 14px 14px 4px 14px;
}

.voice-msg-assistant {
  background: var(--surface-2);
  color: var(--text);
  align-self: flex-start;
  border-radius: 14px 14px 14px 4px;
  border: 1px solid var(--border);
}

.voice-msg-error {
  background: #fde8e8;
  color: #b03030;
  align-self: center;
  font-size: 0.75rem;
  font-style: italic;
  border-radius: var(--radius-sm);
  max-width: 90%;
}

#voice-input-row {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

#voice-tap-btn {
  flex: 1;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 0.88rem;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  font-weight: 700;
  letter-spacing: 0.2px;
}

#voice-tap-btn.vtap-idle {
  background: var(--primary);
  color: var(--surface);
}

#voice-tap-btn.vtap-idle:hover {
  background: var(--primary-light);
}

#voice-tap-btn.vtap-listening {
  background: #c04040;
  color: #fff;
  animation: vtap-pulse 1.1s ease-in-out infinite;
}

#voice-tap-btn.vtap-thinking {
  background: var(--border);
  color: var(--text-muted);
  cursor: default;
}

#voice-tap-btn.vtap-speaking {
  background: var(--green);
  color: #fff;
}

#voice-tap-btn.vtap-speaking:hover {
  background: #3a6447;
}

@keyframes vtap-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,64,64,0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(192,64,64,0); }
}

/* ── Mobile layout (≤ 767px) ─────────────────────────────── */

/* Elements hidden by default */
#mobile-header  { display: none; }
#sheet-handle   { display: none; }
#detail-panel   { display: none; }
#sheet-back     { display: none; }

/* -- Back button base styles (shown in both desktop-detail and sheet-detail) -- */
#sheet-back {
  display: none;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--primary);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0 4px;
  flex-shrink: 0;
  text-align: left;
}

#sheet-back:hover { opacity: 0.7; }

/* ── Desktop detail mode ─────────────────────────────────────── */
body.desktop-detail #place-list,
body.desktop-detail #place-count,
body.desktop-detail #filters,
body.desktop-detail #random-btn,
body.desktop-detail .sidebar-footer { display: none; }

body.desktop-detail #sheet-back { display: flex; }

body.desktop-detail #detail-panel {
  display: block;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  animation: detailFadeIn 0.15s ease;
}

@keyframes detailFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Tighten popup content sizing inside the narrow sidebar */
body.desktop-detail .popup-photo  { aspect-ratio: 16/9; height: auto; }
body.desktop-detail .popup-content { padding: 14px 16px; }

@media (max-width: 767px) {

  /* Full-viewport map underneath everything */
  body {
    display: block;
    position: relative;
  }

  #map {
    position: fixed;
    inset: 0;
    height: 100%;
    width: 100%;
    z-index: 0;
  }

  /* Floating app-name pill in the top-left corner */
  #mobile-header {
    display: flex;
    align-items: center;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 500;
    background: var(--surface);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    box-shadow: 0 2px 12px rgba(60,40,10,0.18);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary);
    pointer-events: none;
  }

  /* Bottom sheet */
  #sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 92dvh;
    min-width: 0;
    z-index: 1000;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 32px rgba(60,40,10,0.22);
    padding: 0 14px max(14px, env(safe-area-inset-bottom));
    gap: 10px;
    overflow: hidden;
    transform: translateY(var(--sheet-offset, calc(100% - 72px)));
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
  }

  /* Suppress sidebar heading and subtitle (shown in mobile-header overlay) */
  #sidebar h1,
  #sidebar .subtitle {
    display: none;
  }

  /* Drag handle */
  #sheet-handle {
    display: block;
    position: relative;
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-pill);
    margin: 12px auto 2px;
    flex-shrink: 0;
    cursor: grab;
    touch-action: none;
  }

  /* Extend tap target to ≥ 44px without changing visual */
  #sheet-handle::before {
    content: '';
    position: absolute;
    inset: -20px -40px;
  }

  #sheet-handle:active {
    cursor: grabbing;
  }

  /* Filter chips already horizontal-scroll from base styles */
  .filter-btn {
    flex-shrink: 0;
    min-height: 44px;
    padding: 8px 14px;
  }

  /* Random button */
  #random-btn {
    flex-shrink: 0;
  }

  /* Place count */
  #place-count {
    flex-shrink: 0;
  }

  /* List */
  #place-list {
    min-height: 0;
  }

  /* Detail panel — scrollable, fills remaining sidebar height */
  #detail-panel {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }

  /* Peek (marker tap) and full-detail: hide list and controls, show detail panel */
  body.sheet-peek #place-list,
  body.sheet-peek #filters,
  body.sheet-peek #search-wrap,
  body.sheet-peek #random-btn,
  body.sheet-peek #place-count,
  body.sheet-peek #date-filter-wrap,
  body.sheet-peek #chat-sidebar-btn,
  body.sheet-full-detail #place-list,
  body.sheet-full-detail #filters,
  body.sheet-full-detail #search-wrap,
  body.sheet-full-detail #random-btn,
  body.sheet-full-detail #place-count,
  body.sheet-full-detail #date-filter-wrap,
  body.sheet-full-detail #chat-sidebar-btn {
    display: none;
  }

  body.sheet-peek #detail-panel,
  body.sheet-full-detail #detail-panel {
    display: block;
  }

  body.sheet-peek .sidebar-footer,
  body.sheet-full-detail .sidebar-footer {
    display: none;
  }

  /* Peek: show the sheet-back button ("← Back to list") */
  body.sheet-peek #sheet-back {
    display: flex;
  }

  /* Full detail: detail-nav (inside the panel) replaces sheet-back */
  body.sheet-full-detail #sheet-back {
    display: none;
  }

  /* Hide mobile search bar in both peek and full-detail states */
  body.sheet-peek #mobile-search-bar,
  body.sheet-full-detail #mobile-search-bar {
    display: none;
  }

  /* Popup sizing inside the mobile detail panel */
  body.sheet-full-detail #detail-panel .popup-content {
    padding: 12px 16px max(32px, env(safe-area-inset-bottom) + 16px);
  }

  body.sheet-full-detail #detail-panel .popup-photo {
    height: 200px;
  }

  /* Slightly tighten popup headings on small screens */
  body.sheet-full-detail #detail-panel .popup-content h3 {
    font-size: 1rem;
  }

  /* Leaflet popups suppressed on mobile — we use the detail panel */
  .leaflet-popup-pane {
    display: none;
  }

  /* Press feedback on list items */
  .place-item:active {
    background: var(--surface-2);
    transform: scale(0.985);
  }

  /* Larger markers for touch targets — handled in app.js */

  /* Locate button: fixed so it stays above the bottom sheet */
  #locate-btn {
    position: fixed;
    bottom: 110px;
    right: 12px;
  }

  /* Voice button repositioned above sheet handle area */
  #voice-btn {
    bottom: auto;
    top: 16px;
    right: 14px;
    width: 46px;
    height: 46px;
    font-size: 1.1rem;
  }

  /* Voice panel full width on mobile */
  #voice-panel {
    left: 0;
    bottom: 0;
    z-index: 2100;
  }

  /* Footer hidden on mobile */
  .sidebar-footer {
    display: none;
  }

  /* Popup photo full width */
  .popup-photo {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }
}

/* ── Mobile floating search bar ─────────────────────────── */
#mobile-search-bar {
  display: none;  /* hidden on desktop */
}

@media (max-width: 767px) {
  #mobile-search-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    position: fixed;
    top: 66px;
    left: 12px;
    right: 12px;
    height: 40px;
    z-index: 500;
    background: var(--surface);
    border-radius: var(--radius-pill);
    box-shadow: 0 2px 14px rgba(60,40,10,0.16);
    padding: 0 12px;
    border: 1px solid var(--border);
  }

  #mobile-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text);
    outline: none;
    min-width: 0;
  }
  #mobile-search-input::placeholder { color: var(--text-muted); }

  #mobile-search-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    padding: 2px 4px;
    flex-shrink: 0;
  }
}

/* ── Marker cluster overrides ────────────────────────────────  */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: rgba(92,58,30,0.18);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: var(--primary);
  color: #fff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

/* ── List virtualisation sentinel ────────────────────────────  */
.list-sentinel {
  height: 1px;
  list-style: none;
  pointer-events: none;
}

/* ── Marker hover scale (desktop list → map sync) ─────────── */
.leaflet-marker-icon > div {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* ── Directions link inside popups / detail panel ────────────  */
.popup-directions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  transition: background 0.15s, border-color 0.15s;
}

.popup-directions:hover {
  background: var(--surface-2);
  border-color: var(--primary-light);
}

.popup-directions:active {
  background: var(--surface-2);
  border-color: var(--primary);
}

/* ── Locate-me button ───────────────────────────────────────  */
#locate-btn {
  position: absolute;
  bottom: 108px;
  right: 10px;
  z-index: 800;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 2px solid rgba(0,0,0,0.18);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  color: #333;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
#locate-btn:hover { background: var(--surface-2); color: var(--primary); }
#locate-btn.locating { color: #4285F4; border-color: #4285F4; }

/* ── Marker active / selected states ─────────────────────────  */

/* Allow ripple rings to bleed outside the Leaflet icon bounding box */
.leaflet-marker-icon {
  overflow: visible !important;
}

/* All pins in the current filtered result set — subtly larger so the
   full result set is legible on the map at a glance */
.marker-active {
  transform: scale(1.18);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55), 0 2px 6px rgba(0,0,0,0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

/* ── Selected pin (the one whose card is open) ─────────────── */

/* Bounce animation draws the eye; fill-mode:both holds scale(1.75) afterwards */
.marker-selected {
  animation: markerBounce 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both !important;
  /* Persistent selected halo — clearly visible on any map background */
  outline: 3px solid #fff;
  outline-offset: 3px;
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.65),
    0 0 0 9px rgba(92, 58, 30, 0.35),
    0 6px 22px rgba(0, 0, 0, 0.55) !important;
  z-index: 9999 !important;
  position: relative;
}

/* Override the active-scale so selected always wins */
.marker-active.marker-selected {
  transition: none;
}

@keyframes markerBounce {
  0%   { transform: scale(0.9); }
  50%  { transform: scale(2.1); }
  72%  { transform: scale(1.55); }
  88%  { transform: scale(1.85); }
  100% { transform: scale(1.75); }
}

/* Expanding ripple rings — 3 rings, 2 cycles each, then removed by JS */
.marker-ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  margin-top: -13px;
  margin-left: -13px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  pointer-events: none;
  animation: markerRippleOut 1.8s ease-out 2;  /* 2 cycles, then JS removes the element */
  animation-fill-mode: forwards;
  z-index: -1;
}

@keyframes markerRippleOut {
  0%   { transform: scale(1);    opacity: 0.9; }
  55%  { opacity: 0.3; }
  100% { transform: scale(4.5);  opacity: 0; }
}

/* ── Filter count badges ────────────────────────────────────  */
.filter-count {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.85;
  vertical-align: middle;
}

/* ── Share button in popup/detail ───────────────────────────  */
.popup-share {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  margin-left: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
}
.popup-share:hover { background: var(--surface-2); color: var(--primary); border-color: var(--primary-light); }
.popup-share.copied { color: var(--green); border-color: var(--green); }

/* ═══════════════════════════════════════════════════════════
   AI CHATBOT
   ═══════════════════════════════════════════════════════════ */

/* Sidebar "Ask AI" button (desktop) */
#chat-sidebar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #5c3a1e 0%, #8b5e3c 100%);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: opacity 0.15s, transform 0.12s;
  box-shadow: 0 2px 12px rgba(92,58,30,0.35);
  flex-shrink: 0;
}
#chat-sidebar-btn:hover { opacity: 0.9; transform: translateY(-1px); }
#chat-sidebar-btn svg { flex-shrink: 0; }

/* On mobile the sidebar button lives in the raised sheet; keep it visible there */
@media (max-width: 767px) {
  #chat-sidebar-btn {
    display: flex;
  }
}

/* Floating chat FAB (mobile) */
#chat-fab {
  position: absolute;
  bottom: 160px;
  left: 16px;
  z-index: 800;
  display: none;              /* shown only on mobile via media query */
  align-items: center;
  gap: 7px;
  padding: 10px 18px 10px 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #5c3a1e 0%, #8b5e3c 100%);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(92,58,30,0.40);
  transition: transform 0.15s, box-shadow 0.15s;
  animation: fabPulse 3s ease-in-out infinite;
}
#chat-fab:hover { transform: scale(1.04); }
@media (max-width: 767px) {
  #chat-fab { display: flex; }
  /* Hide FAB when the sheet is raised — AI chat is accessible via the sidebar button */
  body.sheet-up #chat-fab { display: none; }
}

@keyframes fabPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(92,58,30,0.40); }
  50%       { box-shadow: 0 4px 24px rgba(92,58,30,0.65); }
}

/* Chat panel */
#chat-panel {
  position: fixed;
  z-index: 2000;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Desktop: right-side drawer */
  top: 0;
  right: 0;
  width: 400px;
  height: 100vh;
  box-shadow: -6px 0 40px rgba(0,0,0,0.18);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
#chat-panel.open { transform: translateX(0); }

/* Mobile: full-screen sheet from bottom */
@media (max-width: 767px) {
  #chat-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 92dvh;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.2);
    transform: translateY(100%);
  }
  #chat-panel.open { transform: translateY(0); }
}

/* Dimming overlay when chat is open */
body.chat-open::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 1999;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Setup screen ─────────────────────────────────────────── */
#chat-setup {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 32px 24px;
}

.chat-setup-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 340px;
  text-align: center;
}

.chat-setup-emoji { font-size: 2.5rem; }

.chat-setup-inner h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.chat-setup-inner p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.chat-key-note { font-size: 0.78rem !important; }
.chat-key-note a { color: var(--primary); }

#api-key-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.82rem;
  font-family: monospace;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
#api-key-input:focus { border-color: var(--primary); }
#api-key-input.error { border-color: #c0392b; }

#api-key-save {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #5c3a1e, #8b5e3c);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}
#api-key-save:hover { opacity: 0.88; }

/* ── Chat header ──────────────────────────────────────────── */
#chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.chat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.chat-header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf50;
  box-shadow: 0 0 0 2px rgba(76,175,80,0.25);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(76,175,80,0.25); }
  50%       { box-shadow: 0 0 0 4px rgba(76,175,80,0.15); }
}

.chat-header-actions { display: flex; gap: 6px; }
.chat-header-actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: background 0.15s;
}
.chat-header-actions button:hover { background: var(--surface-2); }

/* ── Messages ─────────────────────────────────────────────── */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.chat-msg { max-width: 88%; }
.chat-msg-user { align-self: flex-end; }
.chat-msg-ai   { align-self: flex-start; }

.chat-msg-user .chat-bubble {
  background: linear-gradient(135deg, #5c3a1e, #8b5e3c);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  padding: 10px 14px;
  font-size: 0.86rem;
  line-height: 1.5;
}

.chat-msg-ai .chat-bubble {
  background: var(--surface-2);
  color: var(--text);
  border-radius: 4px 18px 18px 18px;
  padding: 12px 14px;
  font-size: 0.85rem;
  line-height: 1.6;
  border: 1px solid var(--border);
}

.chat-msg-ai .chat-bubble p { margin: 0 0 6px; }
.chat-msg-ai .chat-bubble p:last-child { margin-bottom: 0; }
.chat-msg-ai .chat-bubble strong { color: var(--primary); font-weight: 700; }
.chat-msg-ai .chat-bubble em { font-style: italic; }
.chat-msg-ai .chat-bubble ul { margin: 6px 0; padding-left: 16px; }
.chat-msg-ai .chat-bubble li { margin-bottom: 3px; }
.chat-msg-ai .chat-bubble br { line-height: 1.8; }

/* Loading dots */
.chat-msg.loading .chat-bubble::after {
  content: '●●●';
  display: inline-block;
  animation: blink 1.2s steps(3, end) infinite;
  letter-spacing: 2px;
  font-size: 0.7rem;
  color: var(--text-muted);
}
@keyframes blink {
  0%   { opacity: 0.2; }
  50%  { opacity: 1; }
  100% { opacity: 0.2; }
}

/* Place link buttons under AI response */
.chat-place-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.chat-place-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.chat-place-link:hover { background: var(--surface-2); border-color: var(--primary-light); }

/* ── Suggestion chips ─────────────────────────────────────── */
#chat-suggestions {
  padding: 4px 16px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  flex-shrink: 0;
}

.chat-sugg {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.chat-sugg:hover { background: var(--surface-2); color: var(--primary); border-color: var(--primary-light); }
#chat-suggestions.hidden { display: none; }

/* ── Input bar ────────────────────────────────────────────── */
#chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 16px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  font-size: 0.86rem;
  font-family: inherit;
  color: var(--text);
  resize: none;
  outline: none;
  line-height: 1.4;
  overflow-y: auto;
  transition: border-color 0.15s;
}
#chat-input:focus { border-color: var(--primary); }
#chat-input::placeholder { color: var(--text-muted); }

#chat-send {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #5c3a1e, #8b5e3c);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, transform 0.12s;
}
#chat-send:hover { opacity: 0.88; transform: scale(1.06); }
#chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ═══════════════════════════════════════════════════════════
   END AI CHATBOT
   ═══════════════════════════════════════════════════════════ */

/* ── Date / period filter ────────────────────────────────────  */
#date-filter-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#date-toggle {
  display: none; /* shown only on mobile */
}

/* Desktop: always show the date filter inner content regardless of hidden attr */
@media (min-width: 768px) {
  #date-filter-inner[hidden] {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 767px) {
  #date-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    cursor: pointer;
    width: fit-content;
    transition: color 0.15s, border-color 0.15s;
  }
  #date-toggle[aria-expanded="true"] {
    color: var(--primary);
    border-color: var(--primary-light);
  }
  #date-toggle[aria-expanded="true"] #date-toggle-arrow {
    transform: rotate(90deg);
  }
  #date-toggle-arrow {
    display: inline-block;
    transition: transform 0.2s;
  }
  #date-filter-inner:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
}

/* Preset chips row */
#date-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.date-preset {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  padding: 5px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.date-preset:hover { border-color: var(--primary-light); color: var(--primary); }
.date-preset.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Custom from/to row */
#date-custom-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-range-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

#date-from, #date-to {
  flex: 1;
  min-width: 0;
  font-size: 0.74rem;
  font-family: inherit;
  min-height: 44px;
  padding: 9px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s;
}
#date-from:focus, #date-to:focus { outline: none; border-color: var(--primary); }
#date-from.active, #date-to.active { border-color: var(--primary); }

/* Active period bar */
#date-active-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

#date-clear-btn {
  font-size: 0.73rem;
  font-weight: 700;
  padding: 2px 8px;
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: var(--radius-pill);
  background: none;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
}
#date-clear-btn:hover { background: rgba(255,255,255,0.2); }

/* ── Handle count (visible when sheet is collapsed) ─────────  */
#handle-count {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  margin-top: 5px;
  letter-spacing: 0.01em;
  pointer-events: none;
  transition: opacity 0.2s;
}

/* ── Compact "peek" card (mobile marker tap) ────────────────  */
/* ── Mobile detail nav bar ──────────────────────────────────  */
.detail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.detail-nav-back {
  background: none;
  border: none;
  color: var(--primary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 0;
  min-width: 70px;
  min-height: 44px;
  text-align: left;
}

.detail-nav-pos {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.detail-nav-arrows {
  display: flex;
  gap: 6px;
  min-width: 70px;
  justify-content: flex-end;
}

.detail-nav-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--primary);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1;
  padding: 0;
  font-family: inherit;
}

.detail-nav-arrow:disabled { opacity: 0.25; cursor: default; }
.detail-nav-arrow:not(:disabled):active { background: var(--surface-2); border-color: var(--primary-light); }

@media (max-width: 767px) {
  .detail-nav-arrow {
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
  }
  .detail-nav {
    padding: 8px 12px;
  }
}

/* ── Swipe hint toast ───────────────────────────────────────── */
.swipe-hint {
  position: sticky;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-block;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  margin: 0 auto 8px;
  text-align: center;
  pointer-events: none;
  animation: swipeHintFade 2.2s ease forwards;
  z-index: 20;
}

@keyframes swipeHintFade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(4px); }
  20%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Peek card (mobile marker tap) ─────────────────────────── */
.peek-card {
  padding: 16px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.peek-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.peek-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: system-ui, sans-serif;
}

.peek-header-text { flex: 1; min-width: 0; }

.peek-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.peek-type {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 3px;
}

.peek-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.peek-tag {
  font-size: 0.73rem;
  font-weight: 500;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: 3px 9px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.peek-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.peek-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.peek-expand-btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
  letter-spacing: 0.01em;
}
.peek-expand-btn:active { opacity: 0.82; }

.peek-directions {
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--primary);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
.peek-directions:active { background: var(--surface-2); }

/* ── User location dot ──────────────────────────────────────  */
.user-location-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4285F4;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(66,133,244,0.35), 0 2px 6px rgba(0,0,0,0.25);
}

