/* ═══ M25: фасетные фильтры каталога + сортировка ═══ */

/* несуществующие связки скрываются на сервере — серых опций больше нет */

/* счётчик: правый край строки, приглушённый; перебиваем абсолютный
   .input_group span из темы (иначе счётчик спозиционируется как чекбокс) */
.input_group .tg-facet-count {
  position: static;
  width: auto;
  height: auto;
  left: auto;
  border: none;
  margin-left: auto;
  padding-left: 18px;
  color: rgba(15, 15, 15, 0.45);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

/* ─── строки опций: без квадратиков-чекбоксов, выбор — жирным ───
   Квадратик темы (.custom_check) убран из разметки; клик — по всей строке
   (нативный label[for]); выбранная опция — is-selected. */
.input_group label {
  flex: 1;
  min-width: 0;
  padding-left: 0 !important;
  padding-right: 12px;
  cursor: pointer;
  font-weight: 400;
  overflow-wrap: break-word;
}
.input_group.is-selected label {
  font-weight: 700;
}

/* единая обводка серых элементов каталога: цена / поиск / сортировка / чипы / пагинация */
.tg-opt-search,
.tg-sort__select,
.custom__summ input,
.filter__show,
.page-numbers li {
  border: 1px solid #ddd;
}

/* ─── списки опций: без внутреннего скролла ───
   Тема режет .custom__choise на 150px с overflow:auto — внутри блока
   появляется свой скроллбар («бегунок»). Раскрываем список целиком,
   страница скроллится сама; сворачивание группы кликом по заголовку
   (.close) остаётся. */
.custom__choise {
  max-height: none !important;
  overflow: visible !important;
}
.custom__choise.close {
  max-height: 0 !important;
  overflow: hidden !important;
}

/* поиск по опциям внутри группы (>8 опций): стиль инпутов темы, плоско */
.tg-opt-search {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 0;
  background-color: #f1f1f1;
  color: #0f0f0f;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
}
.tg-opt-search::placeholder {
  color: rgba(15, 15, 15, 0.35);
}
.tg-opt-search:focus {
  outline: none;
  border-color: #0f0f0f;
}
.input_group.tg-search-hidden {
  display: none;
}

/* спокойный ховер строки — как у остального магазина, плоско */
.input_group {
  padding: 2px 4px;
  margin: 0 -4px;
  transition: background 0.15s ease;
}
.input_group:hover {
  background: #f7f7f7;
}

/* сортировка */
.tg-sort {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  margin: 0 0 14px;
}
.tg-sort__label {
  font-size: 13px;
  color: rgba(15, 15, 15, 0.6);
}
.tg-sort__select {
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 0;
  background-color: #f1f1f1;
  color: #0f0f0f;
  cursor: pointer;
  outline: none;
}
.tg-sort__select:focus {
  color: #0f0f0f;
}

/* пустой результат */
.tg-no-products {
  grid-column: 1 / -1;
  padding: 40px 0;
  font-size: 16px;
  color: rgba(15, 15, 15, 0.6);
  text-align: center;
}

/* оверлей загрузки при fetch-подмене */
.products__content {
  position: relative;
}
.products__content.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.65);
  z-index: 50;
  pointer-events: none;
}

/* ═══ МОБИЛЬНАЯ ВЕРСИЯ (≤780px): фильтр — нижняя панель (bottom sheet) ═══
   Кнопка «Фильтры» + сортировка — одной строкой над каталогом; панель
   выезжает снизу, тело панели скроллится, внизу липкая кнопка
   «Показать (N)». Селекторы .filter__block .sidebar__filter — строго
   перебивают мобильные правила темы (.sidebar__filter.active с её
   translateY(373px) и max-height). */

/* служебные элементы видны только на мобильном (в media ниже) */
.tg-mob-close,
.tg-mob-footer {
  display: none;
}

/* бэкдроп под панелью: затемнение + клик закрывает */
.tg-mob-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.45);
  z-index: 990;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.tg-mob-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s;
}

@media (max-width: 780px) {
  html.tg-noscroll {
    overflow: hidden;
  }

  /* чат-виджет Jivo висит поверх всего (z-index max) — пока открыта
     панель фильтров, прячем его контейнер и зелёную вкладку, чтобы
     не наезжали на лист */
  html.tg-noscroll #jivo-iframe-container,
  html.tg-noscroll #jvLabelWrap {
    display: none !important;
  }

  /* ─── тулбар: [Фильтры (n)] [сортировка] — два одинаковых квадрата ─── */
  .tg-mob-bar {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin: 0 0 14px;
  }
  .tg-mob-bar .tg-sort {
    display: flex;
    flex: none;
    width: calc(50% - 5px);
    min-width: 0;
    margin: 0;
  }
  .tg-sort__label {
    display: none;
  }
  .tg-sort__select {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 44px;
    box-sizing: border-box;
    padding: 0 10px;
  }

  .mobile_btn {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
    width: calc(50% - 5px);
    min-width: 0;
    height: 44px;
    box-sizing: border-box;
    margin: 0;
    padding: 0 12px;
    background: #f1f1f1;
    border: 1px solid #ddd;
    font-family: inherit;
    font-size: 15px;
    font-weight: 400;
    color: #0f0f0f;
    cursor: pointer;
  }
  .mobile_btn svg {
    flex: 0 0 auto;
  }
  .mobile_btn__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile_btn__count {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: auto;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 9px;
    background: #0f0f0f;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
  }
  .mobile_btn__count.is-visible {
    display: flex;
  }

  /* ─── чипи выбранных фильтров ─── */
  .mobile__checked {
    margin: -4px 0 14px;
  }
  .filter__show {
    position: relative;
    padding: 7px 26px 7px 10px;
    border: 1px solid #ddd;
    background: #fff;
    color: #0f0f0f;
    font-size: 13px;
  }
  .filter__show::after {
    content: url(/wp-content/themes/technica/images/rremove.svg);
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
  }

  /* ─── панель фильтров: нижний лист ─── */
  .filter__block .sidebar__filter {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding: 0 16px calc(12px + env(safe-area-inset-bottom));
    background: #fff;
    z-index: 1000;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -8px 30px rgba(15, 15, 15, 0.18);
    opacity: 1;
    pointer-events: none;
    transform: translateY(103%);
    visibility: hidden;
    transition: transform 0.3s ease, visibility 0s linear 0.3s;
  }
  .filter__block .sidebar__filter.active {
    pointer-events: all;
    transform: translateY(0);
    visibility: visible;
    transition: transform 0.3s ease, visibility 0s;
  }

  /* «ручка» листа */
  .filter__block .sidebar__filter::before {
    content: "";
    flex: 0 0 auto;
    width: 36px;
    height: 4px;
    margin: 8px auto 0;
    border-radius: 2px;
    background: #dcdcdc;
  }

  /* шапка: заголовок / сброс / крестик */
  .sidebar__filter .filters__header {
    flex: 0 0 auto;
    margin: 6px 0 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
  }
  .sidebar__filter .filters__header h3 {
    flex: 1;
    min-width: 0;
    font-size: 18px;
  }
  .sidebar__filter .filters__header a {
    white-space: nowrap;
  }
  .tg-mob-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    margin: 0 -6px 0 2px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
  }

  /* тело панели — скроллится только оно */
  .sidebar__filter .search__form {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 4px 6px 16px 0;
  }

  /* футер: липкая кнопка «Показать (N)» */
  .tg-mob-footer {
    display: block;
    flex: 0 0 auto;
    padding-top: 10px;
    border-top: 1px solid #eee;
  }
  .tg-mob-apply {
    display: block;
    width: 100%;
    height: 48px;
    border: none;
    background: #0f0f0f;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
  }
  .tg-mob-apply:active {
    background: #000;
  }

  /* iOS не зумит страницу при фокусе, если в инпуте ≥16px */
  .tg-opt-search,
  .custom__summ input {
    font-size: 16px;
  }
}
