/* Floating map controls: filters, search, zoom, nearby strip, toast */

/* Light mode: search results */
body.light .search-results {
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(0,0,0,0.1);
}
/* Top row: filter (left), wordmark (centre) and zoom/theme (right) share
   the same 44 px height, corner radius and shadow, on one centre line. */
.filter-fab {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 12px); left: 16px;
  z-index: 401;
}
.filter-toggle {
  position: relative;
  width: 44px; height: 44px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 13px; box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding-top: 5px; /* leaves room for the active-filter dots above the icon */
  cursor: pointer; color: var(--text);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, opacity 0.22s ease, transform 0.12s ease;
}
.filter-toggle-label {
  font-size: 7px; font-weight: 700; letter-spacing: 0.8px;
  color: var(--muted); pointer-events: none; line-height: 1;
}
/* Multi-color activity dots — straight line across top of filter button */
.filter-dot-wrap {
  position: absolute; top: 3px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 3px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 1;
}
.filter-dot-wrap.visible { opacity: 1; }
.filter-fab.open .filter-dot-wrap { opacity: 0; }
.filter-dot-mini {
  width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
}
.filter-toggle:active { background: var(--s2); transform: scale(0.93); }
.filter-panel {
  position: absolute; top: 0; left: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  padding: 3px;
  display: grid; gap: 3px;
  grid-template-columns: repeat(3, 36px);
  grid-template-rows: 44px 44px 44px;
  opacity: 0; pointer-events: none;
  transform: scale(0.72);
  transform-origin: top left;
  /* close curve — smooth ease-in-out */
  transition: opacity 0.26s ease,
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.filter-fab.open .filter-panel {
  opacity: 1; pointer-events: auto;
  transform: scale(1);
  /* open curve — spring bounce */
  transition: opacity 0.22s ease,
              transform 0.42s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.filter-fab.open .filter-toggle {
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease;
}
.filter-cell-toggle {
  grid-column: 1 / -1;
  background: var(--surface); border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, transform 0.12s ease;
}
.filter-cell-toggle:active { background: var(--s2); transform: scale(0.88); }
/* Progress badge — lives below filter toggle, plain arc + number */
.filter-progress-badge {
  width: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  margin-top: 8px;
  transition: opacity 0.18s ease;
}
.filter-fab.open .filter-progress-badge { opacity: 0; pointer-events: none; }
.filter-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  background: var(--surface); border: none; border-radius: 0;
  transition: background 0.12s, transform 0.12s ease;
  font-size: 9px; font-weight: 600; color: var(--muted);
  user-select: none;
}
.filter-cell svg { height: 18px; width: auto; flex-shrink: 0; }
.filter-cell:active { background: var(--s2); transform: scale(0.88); }
.filter-cell-outdoor { color: rgba(255,107,0,0.35); }
.filter-cell-bar { color: rgba(124,58,237,0.35); }
.filter-cell-outdoor.active { color: var(--orange); background: transparent;
  text-shadow: 0 0 8px rgba(255,107,0,0.6); }
.filter-cell-outdoor.active svg { stroke: var(--orange); fill: var(--orange); }
.filter-cell-bar.active { color: var(--purple); background: transparent;
  text-shadow: 0 0 8px rgba(124,58,237,0.6); }
.filter-cell-bar.active svg { stroke: var(--purple); fill: rgba(124,58,237,0.22); }
.progress-fraction { font-size: 8px; font-weight: 700; color: var(--muted); letter-spacing: 0.3px; }
.filter-cell-fav { color: rgba(255,59,48,0.35); }
.filter-cell-verified { color: rgba(52,199,89,0.35); font-size: 7.5px; letter-spacing: -0.4px; grid-column: 3; grid-row: 3; }
.filter-cell-roof { color: rgba(100,160,255,0.35); }
.filter-cell-fav.active { color: #ff3b30; background: transparent; text-shadow: 0 0 8px rgba(255,59,48,0.6); }
.filter-cell-fav.active svg { fill: #ff3b30; stroke: #ff3b30; }
.filter-cell-verified.active { color: var(--green); background: transparent; text-shadow: 0 0 8px rgba(52,199,89,0.6); }
.filter-cell-roof.active { color: #64a0ff; background: transparent; text-shadow: 0 0 8px rgba(100,160,255,0.7); }
.filter-cell-light { color: rgba(255,214,0,0.35); }
.filter-cell-light.active { color: #FFD600; background: transparent; text-shadow: 0 0 8px rgba(255,214,0,0.7); }
.filter-cell-light.active svg { stroke: #FFD600; }
/* Nearby strip */
.nearby-container {
  position: fixed; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  left: 0; right: 0; z-index: 299;
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.nearby-container.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.nearby-container { padding-top: 48px; } /* room for the button/search row */
.nearby-profile-btn {
  position: absolute; top: -4px; left: 16px;
}
.nearby-locate-btn {
  position: absolute; top: -4px; right: 16px;
}
.nearby-profile-btn, .nearby-locate-btn {
  width: 48px; height: 48px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s; -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.nearby-profile-btn:active, .nearby-locate-btn:active { transform: scale(0.92); }
.nearby-card-dist.nearest-glow {
  text-shadow: 0 0 6px rgba(255,107,0,0.55), 0 0 12px rgba(255,107,0,0.2);
}
.nearby-divider {
  height: 1px; background: var(--border);
  margin: 0 16px;
}
.nearby-strip {
  display: flex; gap: 9px; padding: 10px 16px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 16px;
}
.nearby-strip::-webkit-scrollbar { display: none; }
.nearby-card {
  flex-shrink: 0; width: calc((100vw - 50px) / 3);
  scroll-snap-align: start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 10px 14px 11px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: transform 0.12s, opacity 0.12s;
  border-left-width: 3px; border-left-style: solid;
  border-right-width: 3px; border-right-style: solid;
}
.nearby-card:active { transform: scale(0.95); opacity: 0.8; }
.nearby-card-dist { font-size: 10px; font-weight: 700; color: var(--orange); letter-spacing: 0.3px; }
.nearby-card-name {
  font-size: 10px; font-weight: 600; color: var(--text);
  margin-top: 3px; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nearby-card-type {
  font-size: 9px; color: var(--muted); margin-top: 3px;
  font-weight: 500; letter-spacing: 0.2px;
}
.nearby-card-check { color: var(--green); margin-left: 2px; }
.fab-stack {
  position: fixed; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 36px); z-index: 300;
  display: flex; flex-direction: row; gap: 10px; align-items: center;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.fab-stack.strip-visible { opacity: 0; pointer-events: none; transform: scale(0.85); }
.fab-locate {
  width: 50px; height: 50px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 50%;
  cursor: pointer; box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s; -webkit-tap-highlight-color: transparent;
}
.fab-locate:active { transform: scale(0.92); }
.nearby-container.sheet-open {
  opacity: 0; pointer-events: none; transform: translateY(12px);
}
.fab-stack.sheet-open { opacity: 0; pointer-events: none; }
/* Search: a rounded box centred between the menu and locate buttons,
   widening into a field (same size as the original search bar) while typing */
.search-wrap {
  position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 76px;
  transition: width 0.22s cubic-bezier(0.28, 0.84, 0.42, 1);
}
.search-wrap.expanded { width: min(200px, calc(100% - 148px)); }
.search-field {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; height: 48px; overflow: hidden; gap: 8px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease;
}
.search-wrap:not(.expanded) .search-field:active { transform: scale(0.95); }
.search-wrap.expanded .search-field { justify-content: flex-start; gap: 0; cursor: text; }
.search-icon-btn {
  width: 22px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--orange); cursor: pointer; background: transparent; border: none; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.search-wrap.expanded .search-icon-btn { width: 44px; color: var(--muted); }
.search-input {
  flex: 1; border: none; background: transparent;
  color: var(--text); font-size: 14px; outline: none;
  padding: 0; min-width: 0;
  display: none;
  -webkit-appearance: none;
}
.search-wrap.expanded .search-input { display: block; }
.search-input::placeholder { color: var(--muted); }
.search-close {
  width: 26px; height: 26px; flex-shrink: 0; margin-right: 11px;
  border-radius: 50%; border: none; background: var(--s2);
  color: var(--muted); cursor: pointer;
  display: none; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.search-wrap.expanded .search-close { display: flex; }
/* Results open upwards; the best match sits right above the field */
.search-results {
  position: absolute; bottom: calc(100% + 8px); left: 0; right: 0;
  flex-direction: column-reverse;
  background: rgba(23,23,28,0.95);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(42,42,53,0.5); border-radius: 14px;
  overflow: hidden; display: none;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.search-result-item {
  padding: 11px 14px; cursor: pointer; font-size: 13px;
  color: var(--text); display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}
.search-result-item:first-child { border-bottom: none; }
.search-result-item:active { background: var(--s2); }
/* While typing on a phone, lift the bottom row above the on-screen keyboard */
.nearby-container.searching {
  transform: translateY(calc(-1 * var(--keyboard, 0px)));
  transition: transform 0.25s ease;
}
/* Location permission toast */
.loc-toast {
  position: fixed; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  left: 50%; transform: translateX(-50%) translateY(120%);
  width: calc(100% - 32px); max-width: 360px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 16px 18px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  z-index: 1500;
  transition: transform 0.38s cubic-bezier(0.22,1,0.36,1);
}
.loc-toast.show { transform: translateX(-50%) translateY(0); }
.loc-toast-icon { font-size: 22px; margin-bottom: 6px; }
.loc-toast-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.loc-toast-body { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 14px; }
.loc-toast-body b { color: var(--text); font-weight: 600; }
.loc-toast-actions { display: flex; gap: 8px; }
.loc-toast-retry {
  flex: 1; padding: 10px; border-radius: 11px; border: none;
  background: var(--blue); color: white;
  font-size: 13px; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.loc-toast-close {
  padding: 10px 14px; border-radius: 11px; border: none;
  background: var(--s2); color: var(--muted);
  font-size: 13px; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.zoom-btns {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 16px; z-index: 400;
  display: flex; flex-direction: column; gap: 8px;
}
.zoom-btn {
  width: 44px; height: 44px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 13px;
  color: var(--text); font-size: 20px; font-weight: 300;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  transition: background 0.12s; -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.zoom-btn:active { background: var(--s2); }
.theme-btn {
  width: 44px; height: 44px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 13px;
  color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  transition: background 0.12s, transform 0.3s ease; -webkit-tap-highlight-color: transparent;
}
.theme-btn:active { background: var(--s2); }
@keyframes theme-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.theme-btn.spin { animation: theme-spin 0.45s cubic-bezier(0.4, 0, 0.2, 1); }
.app-wordmark {
  position: fixed; z-index: 402;
  top: calc(env(safe-area-inset-top, 0px) + 12px); height: 44px;
  display: flex; align-items: center;
  left: 50%; transform: translateX(-50%);
  font-family: 'Russo One', 'Arial Black', sans-serif;
  font-size: 20px; font-weight: 400; letter-spacing: 3px; margin-right: -3px;
  color: var(--orange); pointer-events: none; white-space: nowrap;
  animation: wordmark-glow 3s ease-in-out infinite;
}
