/* Блок 2.4 — интерактивная карта Leaflet (Краснодар) */

.map-section {
  overflow: hidden;
}

.map-block {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 960px) {
  .map-block {
    grid-template-columns: 1.35fr 0.65fr;
    gap: 1.75rem;
    align-items: start;
  }
}

.map-block__visual {
  position: relative;
  border-radius: var(--yh-radius);
  overflow: hidden;
  border: 1px solid var(--yh-border);
  box-shadow: var(--yh-shadow);
  min-height: 360px;
  background: linear-gradient(180deg, #87ceeb 0%, #b8dff5 18%, #e8f4fc 40%, #f7fafc 100%);
}

.map-block__sky {
  pointer-events: none;
  position: absolute;
  inset: 0 0 auto 0;
  height: 72px;
  z-index: 500;
  background: linear-gradient(180deg, rgba(135, 206, 235, 0.55) 0%, transparent 100%);
}

.map-block__sun {
  pointer-events: none;
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 501;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff9c4, #ffd54f 45%, #ffb300 100%);
  box-shadow: 0 0 28px rgba(255, 213, 79, 0.75);
  animation: map-sun-glow 4s ease-in-out infinite;
}

@keyframes map-sun-glow {
  0%,
  100% {
    box-shadow: 0 0 28px rgba(255, 213, 79, 0.75);
  }
  50% {
    box-shadow: 0 0 40px rgba(255, 213, 79, 0.95);
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-block__sun {
    animation: none;
  }
}

.map-leaflet {
  width: 100%;
  height: min(58vh, 480px);
  min-height: 360px;
  z-index: 1;
  filter: saturate(1.08) brightness(1.03) contrast(1.02);
}

.map-leaflet .leaflet-tile-pane {
  opacity: 0.96;
}

.map-leaflet .leaflet-control-attribution {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.85);
}

/* Маркеры */
.map-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  filter: drop-shadow(0 4px 10px rgba(15, 39, 68, 0.2));
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.map-pin--dim {
  opacity: 1;
  transform: scale(1);
}

.map-pin--active {
  opacity: 1;
  transform: scale(1.05);
  z-index: 1000 !important;
}

.map-pin__logo {
  display: block;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 12px rgba(15, 39, 68, 0.18);
}

/* Склад — только логотип, без кружка и подписи */
.map-pin-hub-only {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 3px 10px rgba(15, 39, 68, 0.28));
  pointer-events: none;
}

.map-pin--dest .map-pin__logo {
  width: 44px;
  height: 44px;
}

.map-pin__label {
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--yh-navy);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 6px;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Маршруты — всегда видны; активный чуть ярче */
.map-route-line--active {
  filter: drop-shadow(0 0 4px rgba(232, 93, 4, 0.45));
}

.map-route-label {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--yh-navy);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--yh-border);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(15, 39, 68, 0.1);
  white-space: nowrap;
}

.map-route-label--active {
  border-color: var(--yh-cta);
  color: var(--yh-cta);
}

.map-route-label--dim {
  opacity: 0.92;
}

/* Коробка на маршруте — 📦 + бейдж МП */
.leaflet-div-icon.map-box-wrap {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.map-parcel {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 44px;
  pointer-events: none;
}

.map-parcel__emoji {
  font-size: 34px;
  line-height: 1;
  display: block;
  filter: drop-shadow(0 3px 6px rgba(15, 39, 68, 0.35));
}

.map-parcel__tag {
  margin-top: -2px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(15, 39, 68, 0.25);
  font-family: var(--font-sans);
}

.map-legend {
  pointer-events: none;
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 600;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--yh-border);
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--yh-navy);
  box-shadow: 0 2px 10px rgba(15, 39, 68, 0.1);
}

.map-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.map-legend__icon {
  font-size: 1rem;
  line-height: 1;
}

.map-block__panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.map-routes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.map-route-card {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.map-route-card__inner {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.85rem 1rem;
  background: var(--yh-surface);
  border: 1px solid var(--yh-border);
  border-radius: var(--yh-radius);
  box-shadow: 0 2px 12px rgba(15, 39, 68, 0.04);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.map-route-card__logo {
  grid-row: span 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(15, 39, 68, 0.1);
}

.map-route-card:hover .map-route-card__inner,
.map-route-card:focus-visible .map-route-card__inner {
  border-color: rgba(232, 93, 4, 0.45);
}

.map-route-card--active .map-route-card__inner {
  border-color: var(--yh-cta);
  box-shadow: 0 4px 20px rgba(232, 93, 4, 0.15);
}

.map-route-card:focus-visible .map-route-card__inner {
  outline: 2px solid var(--yh-cta);
  outline-offset: 2px;
}

.map-route-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--yh-navy);
}

.map-route-card__addr {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--yh-muted);
  line-height: 1.35;
}

.map-route-card__stats {
  grid-column: 2;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--yh-navy);
}

.map-route-card__stats strong {
  color: var(--yh-cta);
}

/* Карточка склада — в стиле маршрутов справа */
.map-hub-card {
  margin: 0;
}

.map-hub-card__inner {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.85rem 1rem;
  background: var(--yh-surface);
  border: 2px solid var(--yh-cta);
  border-radius: var(--yh-radius);
  box-shadow: 0 4px 20px rgba(232, 93, 4, 0.12);
}

.map-hub-card__logo {
  grid-row: span 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  border: 2px solid rgba(232, 93, 4, 0.25);
  padding: 2px;
}

.map-hub-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--yh-navy);
}

.map-hub-card__addr {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--yh-muted);
  line-height: 1.35;
}

.map-hub-card__meta {
  grid-column: 2;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--yh-cta);
}

.map-block__note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--yh-muted);
  line-height: 1.4;
}

.map-block.is-loading .map-leaflet {
  opacity: 0.5;
}

@media (prefers-reduced-motion: reduce) {
  .map-box-wrap {
    display: none;
  }
}
