/*
 * FG Catalog Filters — sidebar styles.
 * Ported from legacy css/section.css (.cost__item, .range, .filter_group, .list_item).
 */

.fg-filter {
  font-family: var(--font-family, inherit);
}

.fg-filter .cost__item_title,
.fg-filter .group_title {
  font-family: var(--font-family, inherit);
  font-weight: 600;
  font-size: 16px;
  line-height: 140%;
  color: var(--dark, #121212);
  margin-bottom: 15px;
  /* сброс стилей <button> */
  background: none;
  border: none;
  padding: 0;
  display: block;
  width: 100%;
  text-align: left;
  cursor: default;
}

.fg-filter .group_toggle_icon {
  display: none;
}

.fg-filter .cost__panel {
  margin-bottom: 40px;
}

.fg-filter .wrap {
  max-width: 223px;
  font: 14px/1.4 Arial, sans-serif;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.fg-filter .inputs {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.fg-filter .inputs input[type="text"] {
  border: 1px solid var(--grey, #c4c4c4);
  border-radius: 6px;
  padding: 2px 10px;
  width: 83px;
  height: 24px;
  outline: none;
  font: inherit;
}

.fg-filter .range {
  position: relative;
  height: 24px;
}

.fg-filter .track {
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
}

.fg-filter .range input[type="range"] {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  width: 100%;
  pointer-events: none;
  -webkit-appearance: none;
  background: transparent;
  height: 24px;
  margin: 0;
}

.fg-filter .range input::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f5b533;
  border: 0;
  box-shadow: 0 0 0 2px #f5b533;
  cursor: pointer;
}

.fg-filter .range input::-moz-range-thumb {
  pointer-events: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f5b533;
  border: 0;
  cursor: pointer;
}

.fg-filter .range input::-webkit-slider-runnable-track { height: 4px; }
.fg-filter .range input::-moz-range-track { height: 4px; background: transparent; }

.fg-filter .progress {
  position: absolute;
  height: 4px;
  background: #f5b533;
  top: 10px;
  border-radius: 2px;
}

.fg-filter .filter_group {
  margin-bottom: 30px;
}

.fg-filter .group_list {
  display: flex;
  flex-direction: column;
  gap: 7.5px;
}

.fg-filter .list_item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-family: inherit;
}

.fg-filter .list_item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.fg-filter .checkmark {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--bright-yellow, #ffb516);
  background-color: #fff;
  position: relative;
  flex-shrink: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.fg-filter .checkmark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 3px;
  border-left: 2px solid var(--bright-yellow, #ffb516);
  border-bottom: 2px solid var(--bright-yellow, #ffb516);
  transform-origin: center;
  transform: translate(-50%, -50%) rotate(-45deg) scale(0);
  transition: transform 0.15s ease-out;
}

.fg-filter .list_item input[type="checkbox"]:checked + .checkmark::after {
  transform: translate(-50%, -50%) rotate(-45deg) scale(1);
}

.fg-filter .list_item input[type="checkbox"]:focus-visible + .checkmark {
  outline: 2px solid rgba(0, 0, 0, 0.5);
  outline-offset: 2px;
}

.fg-filter .label-text {
  font-size: 13px;
  line-height: 1.3;
  color: #333;
}

/* На странице с сайдбаром (~260px) — 3 колонки вместо 4 */
.headings ul.products.list-products {
  grid-template-columns: repeat(3, 1fr);
}

.headings.fg-loading { opacity: 0.5; pointer-events: none; }

.fg-no-products {
  padding: 40px 0;
  text-align: center;
  color: #666;
}

/* =====================================================
   Кнопка открытия фильтров (только мобильные)
===================================================== */
.fg-filter-btn {
  display: none;
}

/* =====================================================
   Шапка панели фильтров (кнопка закрытия)
===================================================== */
.fg-filter-header {
  display: none;
}

/* =====================================================
   Оверлей
===================================================== */
.fg-filter-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10000;
}
.fg-filter-overlay.is-open {
  display: block;
}

/* =====================================================
   Мобильный режим: drawer + сворачиваемые группы
===================================================== */
@media (max-width: 1024px) {

  /* Кнопка "Фильтры" */
  .fg-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    flex-shrink: 0;
    font-family: var(--font-family, inherit);
  }

  /* Drawer */
  .headings__nav {
    position: fixed !important;
    top: 0;
    right: 0;
    width: 300px !important;
    max-width: 90vw;
    height: 100vh;
    background: #fff;
    z-index: 10001;
    overflow-y: auto;
    transform: translateX(110%);
    transition: transform 0.28s ease;
    padding: 0 !important;
    box-sizing: border-box;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.14);
    flex: none !important;
  }
  .headings__nav.is-open {
    transform: translateX(0);
  }

  /* Шапка с кнопкой закрытия */
  .fg-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
  }
  .fg-filter-header__title {
    font-size: 17px;
    font-weight: 700;
    font-family: var(--font-family, inherit);
  }
  .fg-filter-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    line-height: 1;
  }

  /* Контент фильтров */
  .fg-filter {
    padding: 8px 20px 20px;
  }

  /* Сворачиваемые группы атрибутов */
  .fg-filter .filter_group {
    margin-bottom: 0;
    border-bottom: 1px solid #f0f0f0;
  }

  .fg-filter .group_title {
    padding: 13px 0;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
  }
  .fg-filter .group_toggle_icon {
    display: block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    position: relative;
  }
  .fg-filter .group_toggle_icon::before,
  .fg-filter .group_toggle_icon::after {
    content: '';
    position: absolute;
    background: #888;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
  }
  /* горизонтальная черта — всегда видна */
  .fg-filter .group_toggle_icon::before {
    width: 12px;
    height: 2px;
    top: 9px;
    left: 4px;
  }
  /* вертикальная черта — скрывается при открытии (превращается в минус) */
  .fg-filter .group_toggle_icon::after {
    width: 2px;
    height: 12px;
    top: 4px;
    left: 9px;
  }
  .fg-filter .filter_group.is-open .group_toggle_icon::after {
    transform: rotate(90deg);
    opacity: 0;
  }

  .fg-filter .group_list {
    padding-bottom: 12px;
  }
  .fg-filter .group_list[hidden] {
    display: none;
  }

  /* Сетка товаров: сайдбар теперь drawer, не занимает место → 2 колонки */
  .headings ul.products.list-products {
    grid-template-columns: repeat(2, 1fr);
  }
}
