/* packages/ui/disposal_map.css
 *
 * Вкладка «Карта» сервиса «Управление сливами» (блок disposal-console-map,
 * Шаг 4) — вся разметка `disposal_map_views.js`, включая диалог координатного
 * инструмента «Указать на карте» (сам диалог строит Шаг 5, стили под его
 * классы — здесь, F-4 плана этого блока их фиксирует за этим файлом).
 *
 * Только токены из packages/theme/tokens.css (N-6 плана: НИ ОДНОГО буквального
 * цвета в шестнадцатеричной записи, даже белого — маркерная рамка берёт
 * var(--surface), у которого то же самое белое значение). Ни одной строки
 * prefers-color-scheme (единый светлый вид всей консоли,
 * tests/test_ui_assets.py::test_no_dark_theme_mechanism...).
 */

/* ADR-0225 (06.10): the tab is the reference map's layout — a LEFT panel of
   filters + legend (search, waste chips, working/idle, region, price legend,
   barrel volume, status flags, reset; NOT a point list) beside the map. The root
   stays a column (panel+map body, then the one-line footnote). The panel is as
   tall as the map canvas and scrolls inside itself; on a narrow screen it
   collapses above the map behind the «Фильтры» button, so the page never
   scrolls sideways. */
.disposal-map {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.disposal-map-body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.disposal-map-filters {
  min-width: 0;
  height: clamp(420px, 70vh, 820px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.disposal-map-filters-body {
  display: flex;
  flex-direction: column;
}

.disposal-map-filters-toggle {
  display: none;
  align-self: stretch;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 40px;
  text-align: left;
  cursor: pointer;
}

.disposal-map-filters-toggle[aria-expanded="true"] {
  background: var(--blue-wash);
  border-color: var(--blue);
}

.disposal-map-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--border);
}

.disposal-map-status:empty {
  display: none;
}

.disposal-map-status-text {
  color: var(--ink-2);
}

/* One section of the panel: heading + wrapping row of controls. */
.disposal-map-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.disposal-map-group h3 {
  flex: 0 0 100%;
  margin: 0 0 1px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 600;
}

.disposal-map-query,
.disposal-map-volume-input {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 0;
}

.disposal-map-query {
  flex: 1 1 100%;
}

.disposal-map-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
}

.disposal-map-chip[aria-pressed="true"] {
  color: var(--blue-deep);
  background: var(--blue-wash);
  border-color: var(--blue);
}

.disposal-map-chip-count {
  color: var(--ink-2);
  font-size: 12px;
}

.disposal-map-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border-2);
  flex: none;
}

/* «Рабочие» carries a check in a coloured disc, «Не рабочие» a dot — the same
   two glyphs the map pins use. */
.disposal-map-state-mark {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--blue);
  flex: none;
}

.disposal-map-state-mark.is-idle {
  background: var(--ink-3);
}

.disposal-map-state-mark.is-working::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 2px;
  width: 3px;
  height: 6px;
  border: solid var(--surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.disposal-map-state-mark.is-idle::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--surface);
}

.disposal-map-hint-text {
  flex: 0 0 100%;
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.35;
}

/* Region: one segmented control, four equal cells. */
.disposal-map-segments {
  display: flex;
  flex: 0 0 100%;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  overflow: hidden;
}

.disposal-map-segment {
  flex: 1 1 0;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  border-left: 1px solid var(--border-2);
  padding: 7px 4px;
  cursor: pointer;
}

.disposal-map-segment:first-child {
  border-left: 0;
}

.disposal-map-segment[aria-pressed="true"] {
  color: var(--surface);
  background: var(--blue);
}

.disposal-map-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 100%;
  font-size: 13px;
  color: var(--ink);
}

.disposal-map-volume-input {
  width: 72px;
}

.disposal-map-flags {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  flex: 0 0 100%;
}

.disposal-map-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 8px;
  color: var(--ink);
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.25;
  cursor: pointer;
}

.disposal-map-reset {
  align-self: flex-start;
  margin: 10px 12px 4px;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--warn);
  background: none;
  border: 0;
  cursor: pointer;
}

.disposal-map-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  padding: 4px 12px 12px;
}

.disposal-map-count {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
}

/* Small one-paragraph footer under the map (11px/1.3). */
.disposal-map-legend {
  margin: 0;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.3;
  flex: none;
}

.disposal-map-refresh-note {
  color: var(--warn);
  font-size: 13px;
}

.disposal-map-main {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.disposal-map-note {
  margin: 0 0 8px;
  padding: 8px 12px;
  color: var(--warn);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  font-size: 13px;
}

.disposal-map-note[hidden] {
  display: none;
}

/* `isolation` keeps Leaflet's/Yandex's own z-indexes (400-1000) inside the
   canvas, so the price key below always stays on top of the map. */
.disposal-map-canvas {
  position: relative;
  isolation: isolate;
  min-height: 320px;
  height: clamp(420px, 70vh, 820px);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
}

/* Small price legend, bottom-left of the map, like «Цена приёма» on the
   reference map; clicks pass through the gaps, it is not a control. */
.disposal-map-pricekey {
  position: absolute;
  left: 10px;
  bottom: 28px;
  z-index: 5;
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 12px;
  pointer-events: none;
}

.disposal-map-pricekey-title {
  margin: 0 0 2px;
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.disposal-map-pricekey-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.disposal-map-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 10;
}

.disposal-map-state:empty {
  display: none;
}

.disposal-map-state .state {
  pointer-events: auto;
}

.disposal-map-state-message {
  margin: 0;
  padding: 8px 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 13px;
  pointer-events: auto;
}

/* Метки, подсказка и балун (Yandex/Leaflet layouts, Шаг 2/6) ------------- */

/* Round pin coloured by price band (inline background-color from the tier),
   white ring, white check inside for working points and a white dot for the
   others — like the reference map (ADR-0225). No text node: both glyphs are
   ::after. Unconfirmed coordinates: the whole disc at reduced opacity —
   no outline variations, every pin keeps the same solid ring. */
.disposal-map-mark {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow);
  box-sizing: border-box;
}

.disposal-map-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--surface);
}

.disposal-map-mark.is-active::after {
  width: 5px;
  height: 9px;
  margin: -6px 0 0 -2px;
  border-radius: 0;
  background: none;
  border: solid var(--surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.disposal-map-mark.is-unconfirmed {
  opacity: 0.55;
}

/* .disposal-map-layout — корень шаблона Yandex JS API (build()/getParentElement()
   у иконки/подсказки/балуна, Шаг 2). Пустое правило нужно ровно по одной
   причине: Шаг 8 гоняет статический гейт «у каждого класса F-4 есть хотя бы
   одно правило», а сам класс — только точка монтирования для узла, который
   строит buildMarkerElement/buildHint/buildBalloon, своего вида не несёт. */
.disposal-map-layout {
  display: block;
}

.disposal-map-hint {
  padding: 4px 8px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-size: 12px;
  white-space: nowrap;
  /* Same Leaflet font-family leak as .disposal-map-balloon above. */
  font-family: var(--sans);
}

.disposal-map-balloon {
  display: grid;
  gap: 10px;
  max-width: 320px;
  color: var(--ink);
  font-size: 13px;
  /* Leaflet's `.leaflet-container` sets its own font-family ("Helvetica Neue", Arial, ...),
     which otherwise leaks into the popup/tooltip content this file builds. */
  font-family: var(--sans);
}

.disposal-map-balloon-head {
  padding: 8px 10px;
  background: var(--surface-2);
  border-left: 6px solid var(--border-2);
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
}

.disposal-map-balloon-body {
  display: grid;
  gap: 8px;
}

/* Leaflet's `.leaflet-popup-content p { margin: 1.3em 0 }` (0,1,1; leaflet.css is appended to
   <head> after this file) outranks shell.css's `p { margin: 0 }` and the single-class resets
   above. The balloon spaces its rows by the grid gap alone, on both providers. */
.disposal-map-balloon .disposal-map-balloon-body p {
  margin: 0;
}

.disposal-map-balloon-label {
  margin: 0;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

.disposal-map-balloon-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.disposal-map-balloon-tag {
  color: var(--ok);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}

.disposal-map-balloon-tag.is-caution {
  color: var(--warn);
}

.disposal-map-balloon-tag.is-no {
  color: var(--ink-3);
  text-decoration: line-through;
}

.disposal-map-balloon-note {
  margin: 0;
  color: var(--ink);
  white-space: pre-line;
}

.disposal-map-balloon-open {
  justify-self: start;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.disposal-map-balloon-open:hover {
  background: var(--blue-wash);
}

/* Диалог координатного инструмента «Указать на карте» (Шаг 5 строит DOM,
   классы и стили под них — здесь, они часть F-4 этого шага). ------------ */

.disposal-map-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.disposal-map-picker-button {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  min-height: 40px;
  padding: 8px 12px;
  cursor: pointer;
}

.disposal-map-picker-button:hover {
  background: var(--blue-wash);
}

.disposal-map-dialog {
  max-width: min(720px, calc(100vw - 24px));
  width: 100%;
  padding: 20px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.disposal-map-dialog::backdrop {
  background: color-mix(in srgb, var(--ink) 40%, transparent);
}

.disposal-map-dialog-canvas {
  min-height: 320px;
  height: 60vh;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}

.disposal-map-dialog-readout {
  margin: 12px 0;
  color: var(--ink-2);
  font-size: 13px;
}

.disposal-map-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.disposal-map-pin {
  width: 26px;
  height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 3px solid var(--surface);
  background: var(--blue);
  box-shadow: var(--shadow);
  box-sizing: border-box;
}

.disposal-map :focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.disposal-map-dialog:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

@media (max-width: 760px) {
  .disposal-map-filters-toggle {
    display: block;
  }

  .disposal-map-body {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Collapsed by default above the map; the «Фильтры» button opens it. */
  .disposal-map-filters {
    display: none;
    height: auto;
    max-height: 70vh;
  }

  .disposal-map.is-filters-open .disposal-map-filters {
    display: block;
  }

  .disposal-map-canvas {
    height: 60vh;
    min-height: 320px;
  }
}
