/* ==========================================================================
   «Уточнить наличие»: окно филиалов, «Хочу под заказ», выбор мессенджера.
   Подключается в footer.tpl на всех страницах (каталог, поиск, товар).
   Figma: «Правки по "Узнать наличие"»
   ========================================================================== */

/* ==========================================================================
   Stock branches modal (Figma 338:679 / 1056:10760 / 1056:10728)
   ========================================================================== */
.modal--stock {
  max-width: 1144px;
  width: 100%;
  padding: 40px 64px 64px;
  background: var(--bg);
  border: 0;
  border-radius: var(--r-4);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
.modal--stock .modal__close,
.stock-modal__close {
  position: static;
  width: 57px;
  height: 57px;
  flex: none;
}
.modal--stock .modal__close img {
  width: 36px;
  height: 36px;
}

.stock-modal {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.stock-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.stock-modal__title {
  margin: 0;
  font-family: var(--font-main);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}

.stock-modal__body {
  display: flex;
  align-items: flex-start;
  gap: 25px;
}
.stock-modal__cities {
  flex: 0 0 392px;
  width: 392px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stock-modal__aside {
  flex: 1 1 599px;
  width: 599px;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.stock-modal__map {
  width: 100%;
  height: 558px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-4);
  overflow: hidden;
  background: var(--bg-2);
}
.stock-modal__map iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  filter: invert(0.92) hue-rotate(180deg) brightness(0.95) contrast(0.95);
}
[data-theme="light"] .stock-modal__map iframe { filter: none; }

/* Compact «Перейти в магазин» inside expanded branch contacts */
.stock-modal__go {
  display: none;
  margin-top: 4px;
  align-self: flex-start;
  width: auto;
  min-height: 0;
  padding: 8px 14px;
  gap: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  color: #fff;
  border-radius: 10px;
}
.stock-modal .city-card__address.is-active .stock-modal__go {
  display: inline-flex;
}
.stock-modal__go span {
  color: inherit;
  font: inherit;
}
[data-theme="light"] .stock-modal__go {
  background: linear-gradient(116deg, #F9CADB 18%, #B2ECCC 65%);
  color: var(--text);
}
[data-theme="light"] .stock-modal__go::before {
  background: linear-gradient(116deg, #8F1743 38%, #0F9C4D 100%);
}

/* Address rows: label + qty; contacts via .is-active (home.css) */
.stock-modal .city-card__address {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.stock-modal .city-card__address-main {
  flex: 1 1 auto;
  width: 100%;
}
.stock-modal .city-card__address-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.stock-modal .city-card__address-qty {
  flex: none;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: nowrap;
}
.stock-modal .city-card__address--active,
.stock-modal .city-card__address.is-active {
  background: rgba(15, 156, 77, 0.08);
}
.stock-modal .tag--green {
  color: var(--green);
  background: transparent;
  padding: 3px 7px;
  font-weight: 400;
  line-height: 1.5;
}
[data-theme="light"] .stock-modal .tag--green {
  color: var(--green-dark);
  border-color: var(--green-dark);
}

/* ---------- TABLET (max-width: 1199px) — Figma 1056:10760 ---------- */
@media (max-width: 1199px) {
  [data-stock-modal].modal {
    padding: 0;
    align-items: stretch;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal--stock {
    max-width: none;
    width: 100%;
    min-height: 100%;
    max-height: none; /* page scrolls via [data-stock-modal].modal */
    border-radius: 0;
    padding: 40px;
    overflow: visible;
  }
  .modal--stock .modal__close,
  .stock-modal__close {
    width: 35px;
    height: 35px;
  }
  .modal--stock .modal__close img {
    width: 28px;
    height: 28px;
  }

  .stock-modal {
    gap: 24px;
    min-height: auto;
    justify-content: flex-start;
  }
  .stock-modal__title { font-size: 26px; }

  .stock-modal__body {
    flex-direction: column;
    gap: 16px;
  }
  .stock-modal__aside {
    display: contents;
    width: auto;
    flex: none;
  }
  .stock-modal__map {
    order: 1;
    height: 320px;
    border-radius: 12px;
  }
  .stock-modal__cities {
    order: 2;
    flex: none;
    width: 100%;
  }
  .stock-modal .city-card { border-radius: 12px; }
  .stock-modal .city-card__name { font-size: 18px; }
  .stock-modal .city-card__head { padding: 12px 8px; }
  .stock-modal .city-card__address-text { font-size: 15px; }
  .stock-modal .tag--lg { font-size: 12px; }
}

/* ---------- MOBILE (max-width: 767px) — Figma 1056:10728 ---------- */
@media (max-width: 767px) {
  .modal--stock { padding: 32px 20px; }
  .stock-modal { gap: 24px; }
  .stock-modal__title {
    font-size: 24px;
    max-width: 11em;
  }
  .stock-modal__map { height: 221px; }
  .stock-modal__cities { gap: 8px; }
  .stock-modal .city-card__name { font-size: 16px; }
  .stock-modal .city-card__address-text { font-size: 16px; }
  .stock-modal__go { padding: 8px 12px; font-size: 13px; }
}

/* ---------- Выбранный филиал + «Подтвердить» ---------- */
.stock-modal__selected {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stock-modal__selected[hidden] { display: none; }
.stock-modal__selected-label {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-muted);
}
.stock-modal__selected-name {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
}
.stock-modal__confirm {
  width: 100%;
  margin-top: 4px;
}

/* ---------- «Не подходит другой магазин?» ---------- */
.stock-request-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-4);
  background: var(--bg-2);
}
.stock-request-box__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}
.stock-request-box__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-muted);
}
.stock-request-box__btn {
  width: 100%;
  margin-top: 8px;
}

@media (max-width: 1199px) {
  .stock-modal__selected { order: 3; }
  .stock-request-box { order: 4; }
}
@media (max-width: 767px) {
  .stock-request-box__title { font-size: 18px; }
}

/* ---------- Кнопка «Уточнить наличие» в карточке и на странице товара ---------- */
.product-card--out .product-card__cart--request {
  color: var(--text);
  cursor: pointer;
}
.product-card--out .product-card__cart--request::before {
  background: linear-gradient(116deg, #8F1743 38%, #0F9C4D 100%);
}
[data-theme="light"] .product-card--out .product-card__cart--request {
  background: #FDF9F8;
  color: #060814;
}
[data-theme="light"] .product-card--out .product-card__cart--request::before {
  background: linear-gradient(92.9deg, #8F1743 38.27%, #0F9C4D 98.78%);
}
[data-theme="light"] .product-card--out .product-card__cart--request:hover {
  background: linear-gradient(92.9deg, #F9CADB 18.57%, #B2ECCC 65.01%);
}
.product-card__cart--request.is-loading,
.product-info__cart--request.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ---------- Окно «Где удобнее написать?» ---------- */
.modal--messengers {
  text-align: center;
}
.modal--messengers .modal__subtitle {
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.messenger-list {
  display: flex;
  flex-direction: column;
  max-width: 420px;
  margin: 24px auto 0;
  border: 1px solid var(--stroke);
  border-radius: var(--r-4);
  overflow: hidden;
  text-align: left;
}
.messenger-list__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
  text-decoration: none;
  transition: background var(--tr);
}
.messenger-list__item + .messenger-list__item {
  border-top: 1px solid var(--stroke);
}
.messenger-list__item:hover { background: var(--bg-2); }
.messenger-list__icon {
  flex: none;
  width: 24px;
  height: 24px;
  display: block;
}
.messenger-list__name { flex: 1 1 auto; }
.messenger-list__arrow {
  flex: none;
  width: 20px;
  height: 20px;
  opacity: 0.6;
}
.messenger-list__note {
  max-width: 420px;
  margin: 16px auto 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-muted);
}
.messenger-list__copied {
  max-width: 420px;
  margin: 16px auto 0;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: rgba(15, 156, 77, 0.12);
}
.messenger-list__copied[hidden] { display: none; }
