/* Карта садоводства. Подключается только на /karta.html.
   Аудитория та же, что и у сайта, — садоводы старшего возраста:
   крупные подписи на карте, большие зоны нажатия, никакого мелкого текста. */

.map-wrap { margin: 28px 0 36px; }

/* ---------- Поиск ---------- */
.map-search { display: block; margin-bottom: 14px; }
.map-search label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}
.map-search input {
  width: 100%;
  max-width: 340px;
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}
.map-search input:focus-visible {
  outline: 2px solid var(--green-600);
  outline-offset: 2px;
}
.map-search__hint {
  margin: 6px 0 0;
  min-height: 1.5em;
  color: var(--muted);
  font-size: .95rem;
}
.map-search__hint--miss { color: var(--danger); }

/* ---------- Раскладка «карта + панель» ---------- */
.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: stretch;
}
.map {
  height: min(80vh, 760px);
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  z-index: 0;                      /* держим ниже выпадающего меню шапки */
}
.map-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 16px;
  overflow-y: auto;
  max-height: min(80vh, 760px);
}
.map-panel__empty { margin: 0; color: var(--muted); }
.map-panel h2 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  line-height: 1.2;
}
.map-panel__sub { margin: 0 0 14px; color: var(--muted); font-size: .95rem; }
.map-panel dl { margin: 0; }
.map-panel dt {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  margin-top: 12px;
}
.map-panel dd {
  margin: 2px 0 0;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}
.map-panel__note {
  margin: 14px 0 0;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  color: var(--muted);
}
.map-panel .btn { margin-top: 16px; width: 100%; }

/* ---------- Слои ---------- */
.map-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 32px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.map-modes {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 22px;
}
.map-modes legend {
  padding: 0 10px 0 0;
  font-weight: 600;
  float: left;              /* legend не участвует во flex — выводим в строку */
}
.map-modes input[type="radio"] { width: 20px; height: 20px; accent-color: var(--green-700); }
.map-tools__extra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 28px;
  flex: 1 1 340px;
}
.map-tools__extra[hidden], .map-tools__row[hidden] { display: none; }
.map-tools__row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 1rem;
}
.map-tools__row input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--green-700); }
.map-tools__row--range { flex: 1 1 260px; cursor: default; }
.map-tools__row--range input { flex: 1; min-width: 120px; accent-color: var(--green-700); }

/* ---------- Подписи номеров на карте ---------- */
.map-label {
  font: 600 13px/1 var(--font);
  color: #14361f;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff;
  pointer-events: none;
}
.map-label--none { color: var(--danger); }

/* Leaflet рисует всплывающие подписи как самостоятельные блоки —
   у нас они только текст, поэтому убираем его собственный фон и рамку. */
.leaflet-tooltip.map-label {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
}
.leaflet-tooltip.map-label::before { display: none; }

.leaflet-container { font: inherit; border-radius: var(--radius); }

@media (max-width: 860px) {
  .map-layout { grid-template-columns: 1fr; }
  .map { height: 62vh; }
  .map-panel { max-height: none; }

  /* Пока карта не активирована тапом, она не тянется пальцем — показываем,
     что по ней надо нажать, иначе поведение выглядит поломкой. */
  .map::after {
    content: 'Нажмите на карту, чтобы двигать её';
    position: absolute;
    inset-inline: 12px;
    bottom: 12px;
    z-index: 500;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: rgba(29, 37, 32, .82);
    color: #fff;
    font-size: .95rem;
    text-align: center;
    pointer-events: none;
  }
  .map--active::after { display: none; }
  .map-layout { position: relative; }
  .map { position: relative; }
}

@media (prefers-reduced-motion: reduce) {
  .leaflet-fade-anim .leaflet-popup,
  .leaflet-zoom-anim .leaflet-zoom-animated { transition: none !important; }
}
