/* Блок фильтров по вёрстке HTML2 (макеты 471:7348 мобайл, 471:7508 десктоп).
   Разметку даёт сниппет catFilter, поведение - assets/js/cat-filter.js. Подключается после polish.css. */

.filter {
  --f-green: #19a955; --f-yellow: #fcd500; --f-red: #e30613; --f-ink: #091c2c; --f-gray: #6e7279;
  --f-line: #dadddf; --f-chip: #efefef; --f-gut: 24px;
  --f-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M.5.5L5 5 9.5.5' fill='none' stroke='%239d9ea4' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --f-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 10 10'%3E%3Cpath d='M1 1l8 8M9 1L1 9' stroke='%23e30613' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  --f-sliders: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='14' viewBox='0 0 16 14' fill='none' stroke='%23091c2c' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 1v12M12 1v12'/%3E%3Ccircle cx='4' cy='9' r='2' fill='%23fff'/%3E%3Ccircle cx='12' cy='5' r='2' fill='%23fff'/%3E%3C/svg%3E");
  --f-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Crect width='12' height='12' rx='2' fill='%2319a955'/%3E%3C/svg%3E");
}

/* ---------- общий вид (десктоп; мобильная панель ниже) ---------- */
#mse2_filters { background: #fff; border-radius: 16px; overflow: hidden; font-family: inherit; color: var(--f-ink); }
.filter .filters__bar { display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 var(--f-gut); }
.filter .filters__title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; font-weight: 700; line-height: 1.5; }
.filter .filters__title::before { content: ""; width: 16px; height: 14px; background: var(--f-sliders) center / contain no-repeat; display: none; }
.filter .filters__bar .btn-reset-mobile { display: none; }
.filter .filters__apply { display: none; }

#mse2_filters .cf-field {
  margin: 0; padding: 0 var(--f-gut); border: 0; border-top: 1px solid var(--f-chip); border-radius: 0; background: #fff; box-shadow: none;
  position: relative; transition: box-shadow .2s;
}
#mse2_filters .cf-field:hover { box-shadow: 0 8px 24px rgba(9, 28, 44, .12); z-index: 1; }
#mse2_filters .filter_title {
  display: flex; align-items: center; margin: 0; padding: 22px 0 16px; font-size: 16px; font-weight: 700; line-height: 1.5;
  letter-spacing: 0; text-transform: none; color: var(--f-ink);
}
.cf-dot { display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--f-green); }

/* сворачиваемые группы */
#mse2_filters .cf-acc .filter_title { padding: 0; min-height: 60px; cursor: pointer; user-select: none; }
#mse2_filters .cf-acc .filter_title::after { content: ""; width: 10px; height: 6px; margin-left: auto; background: var(--f-chev) center / contain no-repeat; transform: rotate(180deg); transition: transform .2s; }
#mse2_filters .cf-acc.cf-collapsed .filter_title::after { transform: none; }
#mse2_filters .cf-acc.cf-collapsed > :not(.filter_title) { display: none; }
#mse2_filters .cf-acc:not(.cf-collapsed) { padding-bottom: 8px; }

/* поля цены */
#mse2_filters .mse2_number_inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
#mse2_filters .mse2_number_inputs label { width: auto; }
#mse2_filters .mse2_number_inputs input {
  width: 100%; height: 48px; padding: 0 16px; border: 1px solid var(--f-line); border-radius: 4px; background: #fff; font-size: 14px; color: var(--f-ink);
  box-sizing: border-box; -moz-appearance: textfield; box-shadow: none;
}
#mse2_filters .mse2_number_inputs input::-webkit-outer-spin-button, #mse2_filters .mse2_number_inputs input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#mse2_filters .mse2_number_inputs input:not(:placeholder-shown) { border-color: var(--f-green); }
#mse2_filters .mse2_number_inputs input:focus { border-color: var(--f-green); box-shadow: 0 0 0 1px var(--f-green); outline: 0; }
#mse2_filters .mse2_number_inputs input::placeholder { color: var(--f-gray); opacity: 1; }
#mse2_filters .cf-field:not(.cf-list) { padding-bottom: 24px; }

/* ползунок */
#mse2_filters .mse2_number_slider { position: relative; height: 4px; margin: 20px 11px 12px; border: 0; border-radius: 2px; background: var(--f-line); font-size: 1em; }
#mse2_filters .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; border: 0; border-radius: 2px; background: var(--f-green); }
#mse2_filters .ui-slider .ui-slider-handle {
  top: -9px; width: 22px; height: 22px; margin-left: -11px; border: 3px solid #fff; border-radius: 50%; background: var(--f-yellow);
  box-shadow: 0 1px 4px rgba(9, 28, 44, .25); cursor: grab; outline: 0;
}
#mse2_filters .ui-slider .ui-slider-handle:focus-visible { box-shadow: 0 0 0 3px rgba(25, 169, 85, .4); }

/* чекбоксы */
#mse2_filters .cf-check { position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; margin: 0; padding: 0; font-size: 14px; line-height: 1.3; color: var(--f-ink); cursor: pointer; }
#mse2_filters .cf-check input {
  appearance: none; -webkit-appearance: none; flex: 0 0 20px; width: 20px; height: 20px; margin: 0; border: 1px solid var(--f-line); border-radius: 4px; background: #fff;
  transition: border-color .12s;
}
#mse2_filters .cf-check:hover input { border-color: var(--f-green); }
#mse2_filters .cf-check input:checked { border-color: var(--f-green); background: #fff var(--f-tick) center / 12px 12px no-repeat; }
#mse2_filters .cf-check input:focus-visible { outline: 2px solid #2877bc; outline-offset: 2px; }
#mse2_filters .cf-check .cf-name { flex: 1 1 auto; }
#mse2_filters .cf-check .cf-count { flex: 0 0 auto; min-width: 0; padding: 0; border-radius: 0; background: none; font-size: 14px; color: var(--f-gray); }
#mse2_filters .cf-more {
  display: block; width: max-content; margin: 8px 0 16px auto; padding: 2px 12px; border: 0; border-radius: 4px; background: var(--f-chip); color: var(--f-gray); font-size: 12px; text-decoration: none; opacity: 1;
}
#mse2_filters .cf-more:hover { color: var(--f-ink); }

/* сброс - красная строка внизу блока */
#mse2_filters .cf-reset {
  display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: none; height: 60px; margin: 0; padding: 0 var(--f-gut); box-sizing: border-box;
  border: 0; border-top: 1px solid var(--f-chip); border-radius: 0; background: #fff; text-align: left; text-decoration: none; opacity: 1;
  font-size: 16px; font-weight: 700; line-height: 1; color: var(--f-red);
}
#mse2_filters .cf-reset::after { content: ""; width: 12px; height: 12px; background: var(--f-x) center / contain no-repeat; }
#mse2_filters .cf-reset:hover { color: var(--f-red); background: #fff7f7; }

/* ---------- мобильная панель (до 960px) ---------- */
@media (max-width: 960px) {
  .filterActive { padding: 0; background: #fff; overflow: hidden; }
  .filterActive:before { display: none; }
  .filterActive .filter { display: block; width: 100%; max-width: none; height: 100%; margin: 0; overflow: hidden; background: #fff; }
  .filterActive .filter .btn-reset-mobile { display: none; }
  #mse2_filters { display: flex; flex-direction: column; height: 100%; border-radius: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  #mse2_filters > * { flex-shrink: 0; }

  .filter .filters__bar { position: sticky; top: 0; z-index: 3; min-height: 60px; background: #fff; border-bottom: 1px solid var(--f-line); }
  .filter .filters__title::before { display: block; }
  .filter .filters__bar .btn-reset-mobile {
    display: inline-flex; align-items: center; gap: 8px; width: auto; max-width: none; height: auto; margin: 0; padding: 0; border: 0; background: none; color: var(--f-red); font-size: 14px; text-transform: none;
  }
  .filter .filters__bar .btn-reset-mobile::after { content: ""; width: 12px; height: 12px; background: var(--f-x) center / contain no-repeat; }
  .filter .filters__apply { display: block; position: sticky; bottom: 0; z-index: 3; margin-top: auto; background: #fff; }
  .filter .filters__apply button {
    display: block; width: 100%; height: 48px; margin: 0; padding: 0; border: 0; border-radius: 0; background: var(--f-green); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
  }
  #mse2_filters .cf-reset { display: none; }

  #mse2_filters .cf-field { border-top: 0; border-bottom: 1px solid var(--f-line); }
  #mse2_filters .cf-field:hover { box-shadow: none; }
  #mse2_filters .filter_title { padding-top: 24px; }
  #mse2_filters .cf-acc .filter_title { padding-top: 0; }
  #mse2_filters .cf-check { min-height: 40px; gap: 8px; }
  #mse2_filters .cf-more { margin: 8px 0 16px auto; }
}

/* поля цены сверху, ползунок под ними (как в макете) */
#mse2_filters .cf-field:not(.cf-list) { display: flex; flex-direction: column; }
#mse2_filters .cf-field:not(.cf-list) .mse2_number_inputs { order: 1; }
#mse2_filters .cf-field:not(.cf-list) .mse2_number_slider { order: 2; margin: 22px 11px 4px; }
#mse2_filters .cf-sale { padding-bottom: 8px; }

@media (max-width: 960px) {
  .filter .filters__bar .btn-reset-mobile { position: static; top: auto; line-height: 1; text-align: right; }
}

/* кнопка «Все» / «Скрыть»: капсом, 10px */
#mse2_filters .cf-more { font-size: 10px; text-transform: uppercase; letter-spacing: .02em; }

/* значения, которых нет в текущей выборке (число 0) */
#mse2_filters .cf-check.cf-off { color: var(--f-line); cursor: not-allowed; }
#mse2_filters .cf-check.cf-off .cf-count { color: var(--f-line); }
#mse2_filters .cf-check.cf-off input, #mse2_filters .cf-check.cf-off:hover input { border: 0; background: var(--f-chip); cursor: not-allowed; }

/* десктоп: без шапки «Фильтры», блок начинается с цены */
@media (min-width: 961px) {
  .filter .filters__bar { display: none; }
  #mse2_filters .cf-field:first-of-type { border-top: 0; }
}

/* ползунок: ручки (28px вместе с рамкой) по центру зелёной линии; до краёв блока слева, справа и снизу по 24px */
#mse2_filters .ui-slider .ui-slider-handle { top: -12px; margin-left: -14px; }
#mse2_filters .cf-field:not(.cf-list) .mse2_number_slider { margin: 25px 14px 12px; }

/* ритм внутри групп: над заголовком и под последним значением по 24px, как слева и справа до краёв блока */
#mse2_filters .cf-field { padding-top: 0; }
#mse2_filters .filter_title { padding-top: 18px; }   /* строка 24px: от верха блока до верхней кромки букв около 24px */
#mse2_filters .cf-acc .filter_title { padding: 18px 0 0; min-height: 0; line-height: 24px; margin-bottom: 12px; box-sizing: content-box; }
#mse2_filters .cf-acc.cf-collapsed { padding-bottom: 0; }
#mse2_filters .cf-acc.cf-collapsed .filter_title { padding: 18px 0; margin-bottom: 0; }
#mse2_filters .cf-list:not(.cf-collapsed) { padding-bottom: 14px; }
#mse2_filters .cf-list .cf-more { margin-bottom: 10px; }

/* «Сбросить фильтры»: при наведении тема красила верхнюю линию синим */
#mse2_filters .cf-reset, #mse2_filters .cf-reset:hover, #mse2_filters .cf-reset:focus, #mse2_filters .cf-reset:active { border-color: transparent; border-top-color: #efefef; outline: 0; }
