/*
 * Редизайн по макетам Figma (2026-10): мобильная шапка, карточки каталога, корзина.
 * Подключается из page_blocks/header_mobile_custom.php (на всех страницах).
 */

/* ===================== Мобильная шапка (до 991px) ===================== */
.mobileheader.mobileheader_custom {
  position: relative;
  height: auto;
  padding: 0 16px;
  background: #f7f7f7;
  box-shadow: none;
}
.mobileheader_custom .mobileheader__row {
  display: flex;
  align-items: center;
}
.mobileheader_custom .mobileheader__row--top {
  justify-content: space-between;
  gap: 12px;
  height: 52px;
}
.mobileheader_custom .mobileheader__row--bottom {
  gap: 14px;
  padding-bottom: 10px;
}

/* логотип */
.mobileheader_custom .mobileheader__logo {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 170px;
}
.mobileheader_custom .mobileheader__logo a {
  display: flex;
  align-items: center;
}
.mobileheader_custom .mobileheader__logo img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 30px;
}

/* город, язык, телефон */
.mobileheader_custom .mobileheader__tools {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 18px;
}
.mobileheader_custom .mobileheader__tool {
  display: flex;
  align-items: center;
}
.mobileheader_custom .regions,
.mobileheader_custom .regions__chooser {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
}
.mobileheader_custom .regions__chooser .dropdown-select__icon-left {
  margin-right: 6px;
}
.mobileheader_custom .regions__chooser svg path,
.mobileheader_custom .mlang__icon svg path {
  fill: #222;
}
.mobileheader_custom .regions__name {
  font-size: 15px;
  color: #222;
  white-space: nowrap;
}

/* язык */
.mlang {
  position: relative;
}
.mlang__toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 0;
  border: none;
  background: none;
  font-size: 15px;
  line-height: 1;
  color: #222;
  cursor: pointer;
}
.mlang__icon,
.mlang__icon svg {
  display: block;
  width: 18px;
  height: 18px;
}
.mlang__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: -12px;
  z-index: 3001;
  min-width: 160px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
}
.mlang--open .mlang__dropdown {
  opacity: 1;
  visibility: visible;
}
.mlang__dropdown .dropdown {
  display: block;
  padding: 6px 0;
  border-radius: 8px;
  background: #fff;
  background: var(--card_bg_black, #fff);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
}
.mlang__option {
  display: block;
  padding: 10px 18px;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
}
.mlang__option--current {
  font-weight: 600;
  cursor: default;
}

/* телефон: иконка в шапке */
.mobileheader_custom .mobileheader__phones .phones,
.mobileheader_custom .mobileheader__phones .phones__inner {
  position: static;
}
.mobileheader_custom .mobileheader__phones .icon-block__only-icon {
  display: flex;
  align-items: center;
  padding: 6px 2px;
  cursor: pointer;
}
.mobileheader_custom .mobileheader__phones .header__icon {
  width: 18px;
  height: 22px;
}
.mobileheader_custom .mobileheader__phones .header__icon svg {
  width: 18px;
  height: 22px;
}

/* телефон: панель «Телефоны» */
.mobileheader_custom #mobilephones {
  top: 100%;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mobileheader_custom .mobilephones__menu-dropdown {
  padding-bottom: 16px;
}
.mobileheader_custom .mobilephones__menu-item--callback {
  margin: 0;
  padding: 4px 23px 12px;
}
.mobilephones__social {
  padding: 4px 23px 8px;
}
.mobilephones__social .social__items.social__items--grid {
  grid-template-columns: repeat(auto-fill, 52px);
  grid-gap: 6px;
  margin: 0;
}
.mobilephones__social .social__items .social__link {
  min-width: 52px;
  height: 44px;
}
.mobilephones__info {
  padding: 10px 23px 0;
}
.mobilephones__info .phones__dropdown-title {
  margin-bottom: 4px;
  font-size: 13px;
  color: #999;
}
.mobilephones__info .phones__dropdown-value,
.mobilephones__info .phones__dropdown-value a {
  font-size: 16px;
  line-height: 1.4;
  color: #222;
}

/* бургер */
.mobileheader_custom .mobileheader__burger {
  flex-shrink: 0;
}
.mobileheader_custom .mobileheader__burger .burger {
  display: flex;
  align-items: center;
  margin: 0 0 0 -8px;
  padding: 12px 8px;
  cursor: pointer;
}
.mobileheader_custom .mobileheader__burger svg {
  width: 20px;
  height: 15px;
}
.mobileheader_custom .mobileheader__burger svg path,
.mobileheader_custom .mobileheader__burger svg rect {
  fill: #222;
}

/* поиск */
.mobileheader_custom .mobileheader__search {
  flex: 1 1 auto;
  min-width: 0;
}
.mobileheader_custom .mobileheader__search .search-wrapper,
.mobileheader_custom .mobileheader__search .search-wrapper > div {
  position: relative;
}
.mobileheader_custom .mobileheader__search form.search {
  display: flex;
  align-items: center;
  position: relative;
}
.mobileheader_custom .mobileheader__search .search-input-close,
.mobileheader_custom .mobileheader__search .btn-clear-search,
.mobileheader_custom .mobileheader__search .searchtype {
  display: none !important;
}
.mobileheader_custom .mobileheader__search .search-input {
  height: 44px;
  padding: 0 12px 0 44px;
  border: 1px solid #ececec;
  border-radius: 6px;
  background: #fff;
  font-size: 15px;
  color: #222 !important;
  box-shadow: none;
}
.mobileheader_custom .mobileheader__search .search-input::placeholder {
  color: #999 !important;
  opacity: 1;
}
.mobileheader_custom .mobileheader__search .search-input:focus {
  border-color: #c9c9c9;
}
.mobileheader_custom .mobileheader__search .search-button-div {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: auto;
}
.mobileheader_custom .mobileheader__search .btn-search {
  height: 100%;
  padding: 0 12px 0 14px;
}
.mobileheader_custom .mobileheader__search .btn-search svg path {
  fill: #222;
}
.mobileheader_custom div.title-search-result {
  top: calc(100% + 4px) !important;
  left: 0 !important;
  z-index: 3001;
  margin: 0;
  max-height: 60vh;
  overflow-y: auto;
  background: #fff;
}

/* корзина */
.mobileheader_custom .mobileheader__cart {
  flex-shrink: 0;
}
.mobileheader_custom .mobileheader__cart .header-cart a {
  display: flex;
  align-items: center;
  padding: 8px 0 8px 4px;
}
.mobileheader_custom .mobileheader__cart .header__icon,
.mobileheader_custom .mobileheader__cart .header__icon svg {
  width: 26px;
  height: 22px;
}

/* узкие телефоны */
@media (max-width: 389px) {
  .mobileheader.mobileheader_custom {
    padding: 0 12px;
  }
  .mobileheader_custom .mobileheader__logo {
    max-width: 128px;
  }
  .mobileheader_custom .mobileheader__tools {
    gap: 12px;
  }
  .mobileheader_custom .regions__name,
  .mlang__toggle {
    font-size: 14px;
  }
  .mobileheader_custom .regions__chooser .dropdown-select__icon-left {
    display: none;
  }
}
@media (max-width: 339px) {
  .mobileheader_custom .mobileheader__region {
    display: none;
  }
}

/* планшеты: шапка шире — элементы крупнее */
@media (min-width: 600px) and (max-width: 991px) {
  .mobileheader.mobileheader_custom {
    padding: 0 24px;
  }
  .mobileheader_custom .mobileheader__row--top {
    height: 60px;
  }
  .mobileheader_custom .mobileheader__logo {
    max-width: 200px;
  }
  .mobileheader_custom .mobileheader__logo img {
    max-height: 34px;
  }
  .mobileheader_custom .mobileheader__tools {
    gap: 28px;
  }
  .mobileheader_custom .mobileheader__row--bottom {
    gap: 20px;
    padding-bottom: 12px;
  }
}

/* закреплённая шапка: всегда вверху экрана при прокрутке.
   Штатный sticky темы на сайте не держался, поэтому fixed + отступ сверху на высоту шапки
   (высоту пишет js/dst-mobile-header.js в --dst-mheader-height, 106px — запасное значение) */
@media (max-width: 991px) {
  body.mheader-vcustom #mobileheader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 993;
  }
  body.mheader-vcustom #mobileheader.filter-none {
    z-index: 998;
  }
  body.mheader-vcustom {
    padding-top: var(--dst-mheader-height, 106px);
  }
  body.mheader-vcustom .mobileheader_custom {
    box-shadow: 0 1px 0 #e5e5e5;
  }
}
@media (min-width: 600px) and (max-width: 991px) {
  body.mheader-vcustom {
    padding-top: var(--dst-mheader-height, 116px);
  }
}

/* ===================== Каталог: карточки в списке (мобильные и планшеты) ===================== */
@media (max-width: 991px) {
  /* цена 20px */
  .catalog-block .catalog-block__info .price__new-val {
    font-size: 20px;
    line-height: 1.3;
    font-weight: 600;
  }
  /* без рейтинга */
  .catalog-block .catalog-block__info-tech .line-block__item:has(> .rating),
  .catalog-block .catalog-block__info-tech .rating {
    display: none;
  }
  /* без избранного и сравнения под кнопкой «Купить» */
  .catalog-block .catalog-block__info-bottom .js-replace-icons {
    display: none !important;
  }
}

/* ===================== Корзина: «Помогите подобрать товар» ===================== */
.basket-checkout-btn.basket-help-pick .btn {
  width: 100%;
}

/* ===================== Корзина: «Добавить к заказу» (батарейки к пультам) ===================== */
.basket-addons {
  margin-top: 32px;
}
.basket-addons[hidden] {
  display: none;
}
.basket-addons__title {
  margin: 0 0 16px;
  font-size: 24px;
  line-height: 1.3;
  font-weight: 500;
  color: #222;
}
.basket-addons__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.basket-addons__item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px;
  border: 1px solid #ececec;
  border-radius: 8px;
  background: #fff;
}
.basket-addons__image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 180px;
  margin-bottom: 14px;
}
.basket-addons__image img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.basket-addons__price {
  margin-bottom: 6px;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
  color: #222;
}
.basket-addons__name {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.4;
}
.basket-addons__status {
  margin-bottom: 14px;
  font-size: 13px;
}
.basket-addons__btn {
  margin-top: auto;
  align-self: flex-start;
}
.basket-addons__btn[disabled] {
  opacity: 0.6;
  pointer-events: none;
}

@media (max-width: 1199px) {
  .basket-addons__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* телефоны и планшеты — горизонтальная лента, как на макете */
@media (max-width: 991px) {
  .basket-addons {
    margin-top: 24px;
  }
  .basket-addons__title {
    font-size: 20px;
  }
  .basket-addons__list {
    display: flex;
    gap: 12px;
    margin: 0 -16px;
    padding: 0 16px 4px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .basket-addons__list::-webkit-scrollbar {
    display: none;
  }
  .basket-addons__item {
    flex: 0 0 180px;
    padding: 12px;
    scroll-snap-align: start;
  }
  .basket-addons__image {
    height: 140px;
  }
  .basket-addons__name {
    font-size: 13px;
  }
  .basket-addons__btn {
    font-size: 13px;
  }
}

/* стикеры и «В наличии» в карточках «Добавить к заказу» */
.basket-addons__image {
  position: relative;
}
.basket-addons__stickers {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.basket-addons__sticker {
  padding: 3px 8px;
  border-radius: 4px;
  background: #4fad46;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
}
.basket-addons__sticker--stock {
  background: #e8483c;
}
.basket-addons__sticker--recommend {
  background: #7b61c9;
}
.basket-addons__sticker--original {
  background: #3b7fd9;
}
.basket-addons__status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #4fad46;
}
.basket-addons__status::before {
  content: '';
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: #4fad46 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3.5 7.2l2.3 2.3 4.7-4.9' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat;
}
