/* AS-PRO · интерактивная карта России (shared preview) */

.ru-map-widget {
  --ru-map-fill: #043598;
  --ru-map-fill-hover: #617ff9;
  --ru-map-fill-active: #01b4cc;
  --ru-map-stroke: rgba(255, 255, 255, 0.35);
  --ru-map-bg: #f0f4f8;
  --ru-map-radius: 12px;
  position: relative;
  font-family: Montserrat, Comfortaa, system-ui, sans-serif;
}

.ru-map-widget--dark {
  --ru-map-fill: #1a3a7a;
  --ru-map-fill-hover: #01b4cc;
  --ru-map-fill-active: #f25830;
  --ru-map-stroke: rgba(255, 255, 255, 0.12);
  --ru-map-bg: rgba(255, 255, 255, 0.04);
}

.ru-map-widget__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 16px;
}

.ru-map-widget__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  flex: 1 1 180px;
}

.ru-map-widget__hint {
  margin: 0;
  font-size: 0.8125rem;
  opacity: 0.72;
  flex: 1 1 220px;
}

.ru-map-widget__toggle,
.ru-map-widget__btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 5px;
  transition: background 0.25s ease, color 0.25s ease, transform 0.15s ease;
}

.ru-map-widget__toggle {
  background: var(--ru-map-fill);
  color: #fff;
}

.ru-map-widget__toggle:hover {
  background: var(--ru-map-fill-hover);
}

.ru-map-widget__canvas {
  background: var(--ru-map-bg);
  border-radius: var(--ru-map-radius);
  padding: 20px 16px;
  position: relative;
  overflow: hidden;
}

.ru-map-widget__canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(1, 180, 204, 0.08), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(4, 53, 152, 0.06), transparent 40%);
  pointer-events: none;
}

.ru-map-widget__svg-wrap {
  position: relative;
  z-index: 1;
}

.ru-map__svg {
  width: 100%;
  height: auto;
  display: block;
}

.ru-map__region {
  fill: var(--ru-map-fill);
  stroke: var(--ru-map-stroke);
  stroke-width: 0.8;
  cursor: pointer;
  transition: fill 0.2s ease, transform 0.2s ease, filter 0.2s ease;
  transform-origin: center;
  transform-box: fill-box;
}

.ru-map__region:hover,
.ru-map__region.is-hovered {
  fill: var(--ru-map-fill-hover);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}

.ru-map__region.is-active {
  fill: var(--ru-map-fill-active);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

.ru-map-widget__list {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  position: relative;
  z-index: 1;
}

.ru-map-widget.is-list .ru-map-widget__svg-wrap {
  display: none;
}

.ru-map-widget.is-list .ru-map-widget__list {
  display: grid;
}

.ru-map-list__item {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 0.8125rem;
  transition: border-color 0.2s, background 0.2s;
}

.ru-map-widget--dark .ru-map-list__item {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.ru-map-list__item:hover,
.ru-map-list__item.is-active {
  border-color: var(--ru-map-fill-active);
  background: rgba(1, 180, 204, 0.12);
}

.ru-map-list__item strong {
  display: block;
  font-size: 0.75rem;
  opacity: 0.65;
  margin-bottom: 2px;
}

.ru-map-widget__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.ru-map-stat {
  text-align: center;
  padding: 12px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.ru-map-widget--dark .ru-map-stat {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.ru-map-stat__num {
  display: block;
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ru-map-fill);
}

.ru-map-widget--dark .ru-map-stat__num {
  color: var(--ru-map-fill-active);
}

.ru-map-stat__lbl {
  display: block;
  font-size: 0.75rem;
  margin-top: 4px;
  opacity: 0.75;
}

.ru-map-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: rgba(33, 33, 33, 0.92);
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.8125rem;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.ru-map-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.ru-map-popup {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(33, 33, 33, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ru-map-popup.is-open {
  display: flex;
}

.ru-map-popup__card {
  background: #fff;
  border-radius: 10px;
  padding: 32px 28px;
  max-width: 560px;
  width: 100%;
  position: relative;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
  animation: ruMapPop 0.28s ease;
}

@keyframes ruMapPop {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: none; }
}

.ru-map-popup__close {
  position: absolute;
  top: 14px;
  right: 16px;
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #333;
  opacity: 0.6;
}

.ru-map-popup__close:hover {
  opacity: 1;
}

.ru-map-popup__title {
  margin: 0 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #ddd;
  font-size: 1.375rem;
  font-weight: 600;
}

.ru-map-popup__stats {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.ru-map-popup__stat {
  flex: 1;
  text-align: center;
}

.ru-map-popup__stat-num {
  font-size: 2.25rem;
  font-weight: 500;
  color: var(--ru-map-fill);
  line-height: 1;
}

.ru-map-popup__stat-lbl {
  font-size: 0.875rem;
  margin-top: 6px;
}

.ru-map-popup__cta {
  display: inline-block;
  background: var(--ru-map-fill);
  color: #fff;
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 14px 24px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  transition: background 0.25s;
}

.ru-map-popup__cta:hover {
  background: var(--ru-map-fill-hover);
}

@media (max-width: 768px) {
  .ru-map-widget__stats,
  .ru-map-popup__stats {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .ru-map-popup__stat-num {
    font-size: 1.75rem;
  }
}
