/* ============================================================================
   Карта складов — паттерн «список слева, схема справа»
   Взаимодействие как в привычных картах маркетплейсов: выбрал точку в списке
   → карта подлетела → слева раскрылась карточка.
   Цвет — наш акцент (роль CTA/выбранное), не брендовый фиолетовый конкурента.
   ========================================================================== */

body.is-map { overflow: hidden; }

.mapx {
  display: grid;
  grid-template-columns: 420px 1fr;
  height: calc(100vh - 64px);
  background: var(--surface);
}

/* ------------------------------------------------------------- панель */
.mapx__side {
  display: flex; flex-direction: column;
  min-height: 0;                      /* чтобы список скроллился, а не рос */
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.mapx__head { padding: 20px 20px 14px; border-bottom: 1px solid var(--border-soft); }
.mapx__search { position: relative; margin-top: 12px; }
.mapx__search .field { padding-left: 38px; border-radius: var(--radius-pill); }
.mapx__search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
                    width: 16px; height: 16px; color: var(--ink-whisper); }

.mapx__count { font-size: var(--t-caption); color: var(--ink-graphite); margin-top: 10px; }

.mapx__list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

/* Строка списка — как выбор пункта выдачи: радио, адрес, режим работы */
.pt {
  display: grid; grid-template-columns: 22px 1fr; gap: 12px;
  padding: 14px 20px; cursor: pointer;
  border-bottom: 1px solid var(--rule);
  text-align: left; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0;
}
.pt:hover { background: #fafafa; }
.pt[aria-selected="true"] { background: #fff5f3; }

.pt__radio {
  width: 20px; height: 20px; border-radius: 50%; margin-top: 2px;
  box-shadow: inset 0 0 0 2px var(--border);
  display: grid; place-items: center; flex: none;
}
.pt[aria-selected="true"] .pt__radio { box-shadow: inset 0 0 0 2px var(--accent); }
.pt[aria-selected="true"] .pt__radio::after {
  content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
}

.pt__name { font-weight: 700; font-size: var(--t-body-sm); line-height: 1.35; }
.pt__addr { color: var(--ink-graphite); font-size: 13px; margin-top: 3px; }
.pt__meta { color: var(--ink-whisper); font-size: 12px; margin-top: 5px;
            display: flex; gap: 10px; flex-wrap: wrap; }

/* ------------------------------------------- плавающий попап над картой */
.map-popup {
  position: absolute; z-index: 500; top: 16px; left: 16px;
  width: 360px; max-width: calc(100% - 32px); max-height: calc(100% - 32px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.22), inset 0 0 0 1px rgba(0,0,0,.05);
  padding: 20px; animation: popup-in .18s ease;
}
.map-popup[hidden] { display: none; }
@keyframes popup-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (max-width: 900px) {
  .map-popup { top: 12px; left: 12px; right: 12px; width: auto; max-height: 70%; }
}
.det__close { float: right; background: none; border: 0; cursor: pointer;
              color: var(--ink-whisper); padding: 4px; line-height: 0; }
.det__close:hover { color: var(--ink); }
.det__kicker { font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
               color: var(--ink-whisper); font-weight: 700; }
.det__name { font-size: var(--t-h); font-weight: 700; letter-spacing: -.02em; padding-right: 28px; margin-top: 4px; }
.det__addr { color: var(--ink-graphite); font-size: var(--t-body-sm); margin-top: 6px; }

/* рейтинг + отзывы (отзывы селлеров — задел на будущее) */
.det__rate { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: var(--t-body-sm); }
.det__stars { display: inline-flex; gap: 1px; }
.det__rate b { font-weight: 700; }
.det__reviews { color: var(--accent); font-weight: 700; font-size: 13px; }
.det__reviews:hover { text-decoration: underline; }

/* слот фото — честный плейсхолдер под будущие снимки складов */
.det__photo {
  margin: 14px 0; aspect-ratio: 16 / 9; border-radius: var(--radius);
  background: repeating-linear-gradient(135deg, #f0f0f0, #f0f0f0 10px, #ececec 10px, #ececec 20px);
  box-shadow: var(--ring-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--ink-whisper);
}
.det__photo span { font-size: 12px; }

/* часы работы строкой, как у ПВЗ */
.det__hours { display: flex; align-items: center; gap: 8px; padding: 10px 0;
              border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
              font-size: var(--t-body-sm); font-weight: 600; color: var(--ink); }
.det__hours:empty { display: none; }

/* факты плиткой */
.det__facts { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.det__facts:empty { display: none; }
.det__facts .fct { flex: 1; min-width: 84px; background: var(--surface-sunk);
                   border-radius: var(--radius-sm); padding: 10px 12px; }
.det__facts .fct b { display: block; font-size: var(--t-sub); font-weight: 700; line-height: 1.1; }
.det__facts .fct span { font-size: 11px; color: var(--ink-graphite); }
.det__row { display: flex; align-items: baseline; justify-content: space-between;
            gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: var(--t-body-sm); }
.det__row:last-of-type { border-bottom: 0; }
.det__k { color: var(--ink-graphite); }
.det__v { font-weight: 600; text-align: right; }
.det__h { font-size: var(--t-caption); font-weight: 800; letter-spacing: .06em;
          text-transform: uppercase; color: var(--ink-graphite); margin: 18px 0 6px; }

/* Расстояния до узлов маркетплейсов — полоска-шкала, читается быстрее цифры */
.sc { display: grid; grid-template-columns: 62px 1fr 58px; gap: 10px;
      align-items: center; padding: 7px 0; font-size: 13px; }
.sc__mp { font-weight: 700; font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
          color: var(--ink-graphite); }
.sc__bar { height: 6px; border-radius: 3px; background: var(--surface-sunk); overflow: hidden; }
.sc__fill { height: 100%; background: var(--ink); border-radius: 3px; }
.sc__km { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------------------------------------------------------------- карта */
.mapx__map { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #e8e6e1; }

.leaflet-container { font-family: var(--font-ui); background: #e8e6e1; }
.leaflet-control-attribution { font-size: 10px; background: rgba(255,255,255,.75); }

/* Свои элементы управления — справа снизу, как в привычных картах */
.leaflet-control-zoom { border: 0 !important; box-shadow: var(--lift); border-radius: var(--radius) !important; overflow: hidden; }
.leaflet-control-zoom a {
  width: 40px !important; height: 40px !important; line-height: 40px !important;
  background: var(--surface) !important; color: var(--ink) !important;
  border: 0 !important; border-bottom: 1px solid var(--border-soft) !important;
  font-size: 20px !important; font-weight: 400 !important;
}
.leaflet-control-zoom a:last-child { border-bottom: 0 !important; }
.leaflet-control-zoom a:hover { background: #f5f5f5 !important; }

.map-locate {
  width: 40px; height: 40px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--lift); border: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--ink);
}
.map-locate:hover { background: #f5f5f5; }

/* ------------------------------------------------------------- маркеры */
/* Каплевидный пин с круглой иконкой — узнаваемая форма «точка на схеме» */
.pin { width: 34px; height: 44px; display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,.28)); }
.pin--sel { width: 44px; height: 56px; z-index: 1000 !important; }

.leaflet-marker-icon.pin-wrap { background: none; border: 0; }

/* Кластер в том же языке форм */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: none !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
  background: var(--ink) !important; color: #fff !important;
  font-family: var(--font-mono) !important; font-weight: 700 !important; font-size: 12px !important;
  box-shadow: 0 2px 6px rgba(0,0,0,.3); border: 2px solid #fff;
}

@media (max-width: 900px) {
  body.is-map { overflow: auto; }
  .mapx { grid-template-columns: 1fr; height: auto; }
  .mapx__side { border-right: 0; border-bottom: 1px solid var(--border); }
  .mapx__list { max-height: 40vh; }
  .mapx__map { height: 62vh; }
}
