/* Map tab (js/screens/map*.js): the full-screen map with the chip row, hints and buttons floating
   above it, the «Рядом с тобой» list view and the filters sheet. The sheet listing several
   hangouts at one spot is in hangouts-sheet.css; engine canvases, pins and the point picker are
   in map-engine.css and map-picker.css. Every control is at least 44×44 px. */

/* The `hidden` attribute loses to any author `display` rule, so the map screens restate it. */
.map-screen [hidden] {
  display: none !important;
}

.map-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg2);
}

/* Its own stacking context: Leaflet panes carry z-index 400..1000 and would cover the overlays. */
.map-box {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.map-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--hint);
  font-size: 14px;
}

.map-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--separator);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: map-spin 0.8s linear infinite;
}

@keyframes map-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Overlays let the map take every touch outside their own boxes. */
.map-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  pointer-events: none;
}

.map-top > * {
  pointer-events: auto;
}

/* Over the list the chip row needs a background of its own. */
.map-list-on .map-top {
  background: var(--bg2);
}

.map-list-on .map-hint {
  display: none;
}

.map-top .banner {
  margin: 0 var(--gap);
  background-color: var(--bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.map-top .banner-warn {
  background-image: linear-gradient(rgba(255, 179, 0, 0.2), rgba(255, 179, 0, 0.2));
}

.map-top .banner-error {
  background-image: linear-gradient(rgba(229, 57, 53, 0.16), rgba(229, 57, 53, 0.16));
}

.map-offline:empty {
  display: none;
}

/* One row: four time chips that scroll sideways on narrow screens, and «⚙ Фильтры» that stays in
   view at the end. The scroller pads its chips so their shadows are not clipped. */
.map-chips {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  padding-right: var(--gap);
  pointer-events: none;
}

/* A chip cut at the right edge fades out, so the row reads as one that scrolls; the scroller takes
   touches itself, or a swipe across the chips would pan the map instead of the row. */
.map-times {
  flex: 1;
  min-width: 0;
  padding: 2px 20px 8px var(--gap);
  pointer-events: auto;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
}

.map-chip-filters {
  flex-shrink: 0;
  margin-top: 2px;
  font-weight: 600;
}

.map-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-color: transparent;
  border-radius: 22px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
  font-size: 14px;
  pointer-events: auto;
}

.map-chip.chip-on {
  border-color: var(--accent);
}

.map-hint {
  align-self: center;
  max-width: calc(100% - 2 * var(--gap));
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.82);
  color: #ffffff;
  font-size: 13px;
  text-align: center;
}

/* Bottom overlays sit above the always-visible map attribution. */
.map-fab,
.map-locate,
.map-pill {
  position: absolute;
  z-index: 6;
  border: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  font: inherit;
  cursor: pointer;
}

.map-fab {
  right: 12px;
  bottom: 40px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 30px;
  line-height: 56px;
}

.map-locate {
  right: 18px;
  bottom: 108px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  font-size: 22px;
  line-height: 44px;
}

.map-locate:disabled {
  opacity: 0.6;
}

.map-pill {
  left: 50%;
  bottom: 46px;
  min-height: 44px;
  padding: 0 18px;
  transform: translateX(-50%);
  border-radius: 22px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.map-empty {
  position: absolute;
  left: 12px;
  right: 72px;
  bottom: 100px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.map-empty p {
  margin: 0;
  font-size: 14px;
  text-wrap: balance;
}

.map-empty .btn {
  min-height: 44px;
}

/* «Рядом с тобой»: covers the map under the chip row (--map-top-h is measured by map.js). */
.map-listview {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--map-top-h, 64px) + 4px) 0 120px;
  background: var(--bg2);
}

.nl-title {
  margin: 4px var(--gap) 0;
  font-size: 20px;
}

.map-listview .empty .btn {
  min-height: 44px;
  margin-top: 12px;
}

/* The filters sheet (js/screens/map-filter-sheet.js): «Сбросить» is a text button in the header. */
.mf-sheet .sheet-action {
  width: auto;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 22px;
  color: var(--link);
  font-size: 15px;
  font-weight: 600;
}

.mf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px 0 8px;
}

.mf-chip {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 12px;
  text-align: left;
  white-space: normal;
}
