/* ═══════════════════════════════════════
   DESIGN TOKENS — Light Theme
═══════════════════════════════════════ */
:root {
  --bg:          #f4f6f9;
  --surface:     #ffffff;
  --surface-2:   #f0f2f7;
  --border:      rgba(0,0,0,0.08);
  --border-h:    rgba(0,0,0,0.14);
  --primary:     #00A34F;
  --primary-d:   #00823F;
  --text:        #1a1d2e;
  --muted:       #6b7280;
  --gold:        #d97706;
  --green:       #16a34a;
  --red:         #dc2626;

  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  18px;
  --r-xl:  28px;

  --shadow-sm:  0 1px 4px rgba(0,0,0,0.08), 0 2px 12px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  --ease:       0.2s cubic-bezier(0.4,0,0.2,1);
  --font:       'Inter', system-ui, sans-serif;

  /* Header height — used to offset the map */
  --header-h: 108px;
}

/* ═══════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

/* ═══════════════════════════════════════
   MAP
═══════════════════════════════════════ */
#map {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

/* ═══════════════════════════════════════
   UI OVERLAY
═══════════════════════════════════════ */
#ui-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
#ui-overlay > * { pointer-events: auto; }

/* ═══════════════════════════════════════
   HEADER — Floating collapsible card
   Desktop: fixed top-left floating card
   Mobile: full-width bar at top
═══════════════════════════════════════ */
#search-header {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  width: calc(100% - 24px);
  max-width: 580px;
  overflow: hidden;
  /* Form collapse/expand transition */
  transition: box-shadow var(--ease);
  pointer-events: auto;
}

/* Always-visible top strip */
#header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  gap: 12px;
}

/* ── Logo ── */
#logo {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  user-select: none;
}
#logo-img {
  height: 28px;
  width: auto;
  display: block;
}
#logo span {
  font-size: 1.0rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

/* Right-side controls: badge + toggle button */
#right-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Green count badge — hidden until there are results */
#results-count-badge {
  display: none; /* shown by JS when results exist */
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 30px;
  min-width: 30px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,163,79,0.3);
  transition: transform var(--ease), box-shadow var(--ease);
  border: none;
  font-family: var(--font);
  pointer-events: auto;
}
#results-count-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(0,163,79,0.4);
}
#results-count-badge:active { transform: scale(0.97); }

/* Toggle button ("Buscar lugares" / "Fechar") */
#toggle-search-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-h);
  border-radius: 30px;
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
  white-space: nowrap;
  flex-shrink: 0;
}
#toggle-search-btn svg {
  width: 13px; height: 13px;
  stroke: var(--primary);
  flex-shrink: 0;
}
#toggle-search-btn:hover {
  background: var(--border);
  border-color: var(--primary);
}
#toggle-search-btn:active { transform: scale(0.97); }

/* ── Collapsible form area ── */
#search-form {
  border-top: 1px solid var(--border);
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Smooth collapse via max-height */
  max-height: 400px;
  overflow: hidden;
  transition: max-height 0.32s cubic-bezier(0.4,0,0.2,1),
              padding 0.32s cubic-bezier(0.4,0,0.2,1),
              opacity 0.22s ease;
  opacity: 1;
}

/* Collapsed state — JS adds .minimized to #search-header */
#search-header.minimized #search-form {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  border-top-color: transparent;
  pointer-events: none;
}

/* ── Collapsed Info (Breadcrumbs) ── */
#collapsed-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 10px;
  gap: 12px;
  overflow: hidden;
}

#search-header:not(.minimized) #collapsed-info,
#collapsed-info.hidden {
  display: none;
}

#breadcrumbs {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
#breadcrumbs strong {
  color: var(--text);
  font-weight: 600;
}


/* ── Location Row ── */
#location-row {
  display: flex;
  align-items: flex-end;
  gap: 0;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--ease), box-shadow var(--ease);
}

#location-row:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,163,79,0.12);
}

.field-divider {
  display: flex;
  align-items: center;
  color: var(--border-h);
  padding: 0 2px;
  flex-shrink: 0;
  align-self: center;
  margin-top: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 16px;
  flex: 1;
  min-width: 0;
  position: relative;
  background: var(--bg);
}

.field-group + .field-divider + .field-group {
  border-left: 1px solid var(--border);
}

.field-group:focus-within label { color: var(--primary); }

label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color var(--ease);
  white-space: nowrap;
  flex-shrink: 0;
}
label svg { flex-shrink: 0; }

.optional-badge {
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0;
  background: rgba(0,0,0,0.05);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 2px;
}

.field-group input {
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  caret-color: var(--primary);
  width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  overflow: hidden;
}
.field-group input::placeholder { color: rgba(107,114,128,0.55); font-weight: 400; text-overflow: ellipsis; }

/* ── Select (State Dropdown) ── */
.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.select-wrapper select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  padding-right: 20px;
}

.select-wrapper select option {
  background: #ffffff;
  color: var(--text);
  font-size: 0.88rem;
}

.select-wrapper select option[value=""] { color: rgba(107,114,128,0.6); }

.select-chevron {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  transition: color var(--ease), transform var(--ease);
  flex-shrink: 0;
}
.select-wrapper:focus-within .select-chevron {
  color: var(--primary);
  transform: translateY(-50%) rotate(180deg);
}

#field-state { min-width: 160px; flex: 0 1 auto; }

/* ── Query Row ── */
#query-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

#field-query {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color var(--ease), box-shadow var(--ease);
}
#field-query:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,163,79,0.12);
}
#field-query:focus-within label { color: var(--primary); }

/* Search Button */
#search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 24px;
  height: 50px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--r-lg);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
  box-shadow: 0 2px 12px rgba(0,163,79,0.3);
  flex-shrink: 0;
  white-space: nowrap;
}
#search-btn:hover {
  background: var(--primary-d);
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(0,163,79,0.4);
}
#search-btn:active { transform: translateY(0); }

/* ═══════════════════════════════════════
   RESULTS PANEL
═══════════════════════════════════════ */
#results-panel {
  position: fixed;
  /* Collapsed header is ~52px + 12px top + 12px gap = 76px */
  top: 76px;
  left: 12px;
  width: 340px;
  /* max-height is now managed by JS updateResultsPanelTop() */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideIn 0.28s cubic-bezier(0.4,0,0.2,1);
  /* Smooth repositioning when header expands/collapses */
  transition: top 0.32s cubic-bezier(0.4,0,0.2,1), max-height 0.32s cubic-bezier(0.4,0,0.2,1);
  /* Explicit reset — prevents mobile inline style leaking to desktop */
  transform: none;
  z-index: 20;
}
#results-panel.hidden { display: none; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-14px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* Used by mobile bottom sheet and detail card */
@keyframes sheetUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

#results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}

#mobile-pragma-badge {
  display: none;
}

#results-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

#results-query-tag {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#results-location-tag {
  font-size: 0.73rem;
  color: var(--primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#results-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#results-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(0,163,79,0.08);
  border: 1px solid rgba(0,163,79,0.18);
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

#close-panel {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  line-height: 0;
  transition: all var(--ease);
}
#close-panel:hover { color: var(--text); background: var(--surface-2); }

#results-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-h) transparent;
}
#results-list::-webkit-scrollbar { width: 4px; }
#results-list::-webkit-scrollbar-thumb { background: var(--border-h); border-radius: 4px; }

/* ── Result Item ── */
.result-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  border: 1px solid transparent;
  animation: fadeUp 0.22s ease forwards;
  opacity: 0;
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}
.result-item:hover {
  background: var(--surface-2);
  border-color: var(--border);
  transform: translateX(2px);
}
.result-item.active {
  background: rgba(0,163,79,0.06);
  border-color: rgba(0,163,79,0.2);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.result-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: white;
  flex-shrink: 0; margin-top: 1px;
}

.result-info { flex: 1; min-width: 0; }

.result-name {
  font-size: 0.87rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.result-address {
  font-size: 0.73rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 5px;
}
.result-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.result-rating {
  display: flex; align-items: center; gap: 3px;
  font-size: 0.73rem; color: var(--gold); font-weight: 500;
}
.result-type {
  font-size: 0.68rem; color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 7px; border-radius: 10px;
}
.result-open {
  font-size: 0.68rem; font-weight: 600; padding: 1px 7px; border-radius: 10px; border: 1px solid;
}
.result-open.open   { color: var(--green); border-color: rgba(22,163,74,0.3);  background: rgba(22,163,74,0.07);  }
.result-open.closed { color: var(--red);   border-color: rgba(220,38,38,0.3);  background: rgba(220,38,38,0.07); }

/* ═══════════════════════════════════════
   LOADING
═══════════════════════════════════════ */
#loading-overlay {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px 44px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
}
#loading-overlay.hidden { display: none; }

#spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(0,163,79,0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#loading-text { font-size: 0.87rem; color: var(--muted); font-weight: 500; }

#cancel-search-btn {
  margin-top: 2px;
  background: none;
  border: 1px solid var(--border-h);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 18px;
  border-radius: var(--r-xl);
  cursor: pointer;
  transition: all var(--ease);
}
#cancel-search-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(0,163,79,0.05);
}

/* ═══════════════════════════════════════
   TOAST
═══════════════════════════════════════ */
#toast {
  position: fixed;
  bottom: 48px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  border: 1px solid var(--border-h);
  color: var(--text);
  font-size: 0.84rem; font-weight: 500;
  padding: 11px 22px;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
  opacity: 0;
  z-index: 999;
  max-width: 90vw;
  text-align: center;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.error   { border-color: rgba(220,38,38,0.35);    color: var(--red); }
#toast.success { border-color: rgba(22,163,74,0.35);    color: var(--green); }
#toast.info    { border-color: rgba(0,163,79,0.25);     color: var(--primary); }

/* ═══════════════════════════════════════
   FOOTER
═══════════════════════════════════════ */
#site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 0 16px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  pointer-events: none;
}

#footer-logo {
  height: 14px;
  width: auto;
  opacity: 0.7;
}

#footer-text {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════
   DETAIL CARD
═══════════════════════════════════════ */
#detail-card {
  position: fixed;
  bottom: 44px;
  right: 28px;
  width: 306px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 20px 20px 16px;
  z-index: 30;
  animation: popIn 0.28s cubic-bezier(0.34,1.56,0.64,1);
}
#detail-card.hidden { display: none; }

@keyframes popIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to   { opacity: 1; transform: none; }
}

#detail-close {
  position: absolute; top: 13px; right: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; padding: 5px;
  border-radius: 7px; line-height: 0;
  transition: all var(--ease);
}
#detail-close:hover { background: var(--border); color: var(--text); }

#detail-badge {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 12px rgba(0,163,79,0.3);
  margin-bottom: 12px;
}

#detail-name {
  font-size: 0.97rem; font-weight: 700; color: var(--text);
  margin-bottom: 4px; line-height: 1.3; padding-right: 22px;
}
#detail-address { font-size: 0.75rem; color: var(--muted); margin-bottom: 10px; line-height: 1.5; }

#detail-rating-row {
  display: flex; align-items: center; gap: 6px; margin-bottom: 10px;
}
#detail-stars        { color: var(--gold); font-size: 0.84rem; }
#detail-rating-value { font-size: 0.82rem; font-weight: 600; color: var(--text); }
#detail-reviews      { font-size: 0.73rem; color: var(--muted); }

#detail-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.detail-tag {
  font-size: 0.68rem; color: var(--primary);
  background: rgba(0,163,79,0.07);
  border: 1px solid rgba(0,163,79,0.18);
  padding: 2px 9px; border-radius: 20px; text-transform: capitalize;
}

#detail-actions { display: flex; gap: 8px; }
#detail-actions a {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 9px 12px; border-radius: var(--r-sm);
  font-size: 0.79rem; font-weight: 600; text-decoration: none;
  transition: all var(--ease);
}
#detail-directions {
  background: var(--primary);
  color: white !important;
  box-shadow: 0 2px 10px rgba(0,163,79,0.3);
}
#detail-directions:hover {
  background: var(--primary-d);
  box-shadow: 0 4px 16px rgba(0,163,79,0.4);
  transform: translateY(-1px);
}
#detail-gmaps {
  background: var(--surface-2);
  color: var(--text) !important;
  border: 1px solid var(--border-h);
}
#detail-gmaps:hover { background: var(--border); }

/* ═══════════════════════════════════════
   GOOGLE MAPS INFO WINDOW OVERRIDE
═══════════════════════════════════════ */
.gm-style .gm-style-iw-c {
  background: #ffffff !important;
  border-radius: 12px !important;
  padding: 0 !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.14) !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
}
.gm-style .gm-style-iw-d { overflow: hidden !important; padding: 13px 15px !important; }
.gm-style .gm-style-iw-t::after { background: #ffffff !important; }
.iw-title   { font-family: var(--font); font-size: 0.86rem; font-weight: 600; color: #1a1d2e; margin-bottom: 3px; }
.iw-address { font-family: var(--font); font-size: 0.73rem; color: #6b7280; }

/* ── Mobile form toggle (hidden on desktop) ── */
#mobile-form-toggle {
  display: none;
}

/* ═══════════════════════════════════════
   RESPONSIVE — Wrap fields inside the floating card on smaller desktops
═══════════════════════════════════════ */
@media (min-width: 601px) and (max-width: 850px) {
  /* The floating card is max 500px wide so location-row will wrap */
  #location-row { flex-wrap: wrap; }
  .field-divider { display: none; }
  .field-group + .field-divider + .field-group { border-left: none; }

  #field-state {
    flex: 1 1 45%; min-width: 0;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  #field-city {
    flex: 1 1 45%; min-width: 0;
    border-bottom: 1px solid var(--border);
  }
  #field-neighborhood { flex: 1 1 100%; }
}

/* ═══════════════════════════════════════
   RESPONSIVE — Mobile ≤ 600px
   Vertical layout: compact header → map → draggable bottom sheet
═══════════════════════════════════════ */
@media (max-width: 600px) {

  /* ── Hide desktop footer — "Powered by Pragma" lives inside the sheet handle ── */
  #site-footer { display: none; }

  /* ── Mobile: header goes full-width across the top ── */
  #search-header {
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
  }

  #logo-img { height: 24px; }

  /* ── Location row: 2-col grid ── */
  #location-row { flex-wrap: wrap; border-radius: var(--r-md); }
  .field-divider { display: none; }

  #field-state {
    flex: 1 1 45%; min-width: 0; padding: 6px 10px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  #field-city {
    flex: 1 1 45%; min-width: 0; padding: 6px 10px;
    border-bottom: 1px solid var(--border);
  }
  #field-neighborhood { flex: 1 1 100%; padding: 6px 10px; }

  label { font-size: 0.6rem; letter-spacing: 0.05em; }
  label svg { display: none; }
  .field-group input, .select-wrapper select { font-size: 0.82rem; }

  /* ── Query row: input + icon-only button ── */
  #query-row { gap: 8px; }
  #field-query { border-radius: var(--r-md); padding: 6px 10px; }

  #search-btn {
    height: 44px; width: 44px; padding: 0;
    border-radius: var(--r-md); flex-shrink: 0;
  }
  #search-btn span { display: none; }

  /* ══════════════════════════════════════
     DRAGGABLE BOTTOM SHEET
     Uses transform: translateY driven by JS.
     translateY(0)          = fully open (SNAP_FULL)
     translateY(peek offset) = peek (SNAP_PEEK)
     The sheet is always 92vh tall, positioned at bottom:0
     so translateY controls how much is visible.
  ══════════════════════════════════════ */
  #results-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: 92vh;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: 0 -6px 32px rgba(0,0,0,0.18);
    transform: translateY(calc(92vh - 72px));
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
    overflow: hidden;
    animation: none;
    z-index: 30;
    pointer-events: none;
    background: var(--surface); /* Ensure solid background on mobile */
  }

  /* When JS is dragging, disable transition */
  #results-panel.is-dragging {
    transition: none;
  }

  /* List always rendered — sheet transform controls visibility */
  #results-list {
    display: block;
    max-height: calc(92vh - 130px);
    pointer-events: auto; /* restore: parent has none */
  }

  /* ── Sheet handle area ── */
  #results-header {
    position: relative;
    padding: 20px 14px 10px;
    cursor: grab;
    pointer-events: auto; /* restore: parent has none */
    touch-action: none; /* let JS own the touch */
    user-select: none;
    -webkit-user-select: none;
    border-bottom: 1px solid var(--border);
  }

  #results-header:active { cursor: grabbing; }

  /* ── Drag handle pill ── */
  #results-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--border-h);
    border-radius: 4px;
    transition: background var(--ease), width var(--ease);
  }

  /* Pill widens & darkens while dragging */
  #results-panel.is-dragging #results-header::before {
    width: 56px;
    background: rgba(0,163,79,0.35);
  }

  /* ── Powered by Pragma — inside the sheet handle ── */
  #mobile-pragma-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    position: absolute;
    top: 8px;
    right: 14px;
    pointer-events: none;
  }
  #mobile-pragma-badge img {
    height: 12px;
    width: auto;
    opacity: 0.7;
  }
  #mobile-pragma-badge span {
    font-size: 0.6rem;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.03em;
  }

  #results-query-tag { font-size: 0.84rem; }
  #results-location-tag { font-size: 0.69rem; }

  /* ── Detail card: full-width bottom sheet ── */
  #detail-card {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 24px 20px 32px;
    z-index: 45;
    box-shadow: 0 -6px 32px rgba(0,0,0,0.18);
    animation: sheetUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 70vh;
    overflow-y: auto;
  }

  /* Dim results panel behind detail card */
  #results-panel.behind-detail {
    z-index: 20;
    filter: brightness(0.92);
  }

  /* Toast floats above any open sheet */
  #toast {
    bottom: 16px;
    font-size: 0.8rem;
    padding: 10px 20px;
    z-index: 999;
  }
}

/* ═══════════════════════════════════════
   RESPONSIVE — Very small ≤ 380px
═══════════════════════════════════════ */
@media (max-width: 380px) {
  #field-state, #field-city {
    flex: 1 1 100%;
    border-right: none;
  }
  #field-state { border-bottom: 1px solid var(--border); }
  
  #logo span {
    font-size: 0.82rem;
  }
  #toggle-search-btn span {
    display: none;
  }
  #toggle-search-btn {
    padding: 6px 10px;
  }
}
