/* Редизайн каталога и карточки товара в списках (BDW-1355). Макет: Figma «Каталог и фильтры ПК и Моб» (129:12014). Токены — в redesign-cart.css (:root --ck-*). */

/* ---------- Карточка товара «Product card / New» (30:2182), на телефоне «… Mobile» (30:2229) ---------- */
.pcard, .pcard * { box-sizing: border-box; }
.product.pcard {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: auto;
  padding: 12px;
  border-radius: 12px;
  background: var(--ck-white);
  font-family: var(--ck-font);
  color: var(--ck-dark);
}
/* Сверху полоса под бейджи «−10%», чтобы они не заходили на дверь (BDW-1394) */
.pcard__image { position: relative; display: block; box-sizing: border-box; height: 300px; padding-top: 28px; border-radius: 8px; overflow: hidden; }
.pcard__img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pcard__badges { position: absolute; top: 0; left: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.pcard__badge {
  display: flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--ck-green);
  font: 700 12px/16px var(--ck-font);
  color: var(--ck-white);
  white-space: nowrap;
}
.pcard__badge--sale { background: var(--ck-red); }
.pcard__colors { display: flex; align-items: center; gap: 6px; height: 20px; margin-top: 22px; overflow: hidden; }
.pcard__color {
  flex: none;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ck-dark-50) center / cover no-repeat;
  cursor: pointer;
}
.pcard__colors .pcard__color:only-child, .pcard__color { box-shadow: none; }
.pcard__color.is-active:not(:only-child) { box-shadow: inset 0 0 0 1.5px var(--ck-green); }
.pcard__name {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  font: 600 16px/22px var(--ck-font);
  color: var(--ck-dark);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pcard__name:hover { color: var(--ck-green); }
.pcard__prices { display: flex; align-items: baseline; gap: 10px; height: 26px; margin-top: 15px; overflow: hidden; white-space: nowrap; }
.pcard__price { font: 700 22px/26px var(--ck-font); color: var(--ck-dark); }
.pcard__price--sale { color: var(--ck-red); }
.pcard__old { font: 400 16px/20px var(--ck-font); color: #404855; text-decoration: line-through; }
.pcard__cart {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  margin-top: 14px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--ck-green);
  font: 600 13px/16px var(--ck-font);
  color: var(--ck-white);
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .2s;
}
.pcard__cart:hover { background: #00853a; }
.pcard__cart[disabled] { opacity: .6; cursor: default; }
.pcard__cart-icon { flex: none; display: block; }
.pcard__cart-icon--m { display: none; }

@media only screen and (min-width: 1025px) {
  .product.pcard:hover .product__inner { box-shadow: none; }
}

@media only screen and (max-width: 767px) {
  .product.pcard { padding: 8px; border-radius: 10px; }
  .pcard__image { height: 176px; padding-top: 22px; border-radius: 6px; }
  .pcard__badge { height: 20px; padding: 0 6px; border-radius: 5px; font-size: 11px; }
  .pcard__colors { gap: 4px; height: 14px; margin-top: 18px; }
  .pcard__color { width: 14px; height: 14px; }
  .pcard__name { font-size: 13px; line-height: 17px; }
  .pcard__prices { gap: 6px; height: 20px; margin-top: 10px; }
  .pcard__price { font-size: 16px; line-height: 20px; }
  .pcard__old { font-size: 12px; line-height: 16px; }
  .pcard__cart { gap: 6px; height: 36px; margin-top: 10px; font: 600 13px/20px var(--ck-font); text-transform: none; }
  .pcard__cart-icon { display: none; }
  .pcard__cart-icon--m { display: block; }
}

/* ---------- Страница категории (26:2148, моб. 26:3489) ---------- */
.main.cat-page { padding-top: 0; padding-bottom: 0; }
.cat-page { font-family: var(--ck-font); color: var(--ck-dark); }
.cat-page *, .cat-filters * { box-sizing: border-box; }
.cat-container { max-width: 1208px; margin: 0 auto; padding: 30px 20px 100px; }

.cat-breadcrumbs { margin-bottom: 16px; }

.cat-head { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 16px; margin-bottom: 24px; }
.cat-title { margin: 0; font: 700 32px/40px var(--ck-font); color: var(--ck-dark); text-transform: uppercase; }
.cat-title--section { margin: 0 0 40px; padding-top: 4px; line-height: 1.4; }
.cat-head__count { font: 400 16px/22px var(--ck-font); color: var(--ck-dark-300); white-space: nowrap; }

.cat-layout { display: grid; grid-template-columns: 277px minmax(0, 1fr); gap: 20px; align-items: start; }
.cat-main { min-width: 0; }

/* Плитки подкатегорий раздела — разметка и оформление плитки прежние (index.css), сетка по макету */
.cat-tiles.category__list { display: grid; grid-template-columns: repeat(4, 277px); gap: 20px; margin: 0; }
.cat-tiles .category__item { flex: none; width: auto; max-width: none; margin: 0; }

/* Пилюли подкатегорий — только телефон/планшет */
.cat-pills { display: none; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.cat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--ck-dark-100);
  border-radius: 18px;
  background: var(--ck-white);
  text-decoration: none;
  white-space: nowrap;
}
.cat-pill__name { font: 400 16px/20px var(--ck-font); color: var(--ck-dark); }
.cat-pill__count { font: 400 13px/18px var(--ck-font); color: var(--ck-dark-300); }
.cat-pill.is-active { border-color: var(--ck-green-50); background: var(--ck-green-50); }
/* Активный пункт — тем же шрифтом, что и остальные, выделяется только зелёным (замечание проверяющего) */
.cat-pill.is-active .cat-pill__name { color: #017b34; }
.cat-pill.is-active .cat-pill__count { color: #017b34; }

/* Тулбар: чипы выбранных фильтров слева, сортировка справа */
.cat-toolbar { display: flex; align-items: center; gap: 8px; min-height: 40px; margin-bottom: 20px; }
.cat-chips { order: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.cat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px 0 12px;
  border-radius: 16px;
  background: var(--ck-green-50);
  font: 400 13px/18px var(--ck-font);
  color: var(--ck-dark);
  text-decoration: none;
  white-space: nowrap;
}
.cat-chip img { flex: none; display: block; }
.cat-chip:hover { background: var(--ck-green-100); color: var(--ck-dark); }
.cat-chips__reset { font: 400 16px/20px var(--ck-font); color: var(--ck-dark-300); text-decoration: none; white-space: nowrap; }
.cat-chips__reset:hover { color: var(--ck-green); }

.cat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--ck-dark-100);
  border-radius: 8px;
  background: var(--ck-white);
  font: 600 14px/20px var(--ck-font);
  color: var(--ck-dark);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s;
}
/* Лёгкое засерение при наведении и пока открыт список сортировки */
.cat-btn:hover, .cat-sort.is-open .cat-sort__btn { background: var(--ck-dark-50); }
.cat-btn img { flex: none; display: block; }
.cat-btn--filters { display: none; }
.cat-btn__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--ck-green);
  font: 700 12px/16px var(--ck-font);
  color: var(--ck-white);
}

.cat-sort { order: 2; position: relative; margin-left: auto; }
.cat-sort__text--short { display: none; }
.cat-sort__chevron { transition: transform .2s; }
.cat-sort.is-open .cat-sort__chevron { transform: rotate(180deg); }
.cat-sort__list {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  display: none;
  min-width: 100%;
  margin: 0;
  padding: 6px 0;
  border-radius: 8px;
  background: var(--ck-white);
  box-shadow: 0 8px 24px rgba(18, 26, 39, .14);
  list-style: none;
}
.cat-sort.is-open .cat-sort__list { display: block; }
.cat-sort__item { display: block; padding: 8px 16px; font: 400 14px/20px var(--ck-font); color: var(--ck-dark); text-decoration: none; white-space: nowrap; }
.cat-sort__item:hover { background: var(--ck-dark-50); color: var(--ck-dark); }
.cat-sort__item.is-active { font-weight: 600; color: var(--ck-green); }

/* Сетка карточек: 3 в ряд на ПК */
.products-list.cat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 0; }
.cat-grid .product.pcard { flex: none; width: auto; max-width: none; margin: 0; }
/* Появление карточек: всплывают снизу по очереди (шаг 0.175 с задаёт catalog-page.js). Класс cat-anim ставит скрипт в category.twig */
@media (prefers-reduced-motion: no-preference) {
  .cat-anim .cat-grid > .pcard:not(.is-shown) { opacity: 0; transform: translateY(24px); }
  .cat-anim .cat-grid > .pcard.is-shown { transition: opacity .5s ease-out, transform .5s cubic-bezier(.22, .61, .36, 1); }
}
.cat-empty { margin: 0; padding: 40px 0; font: 400 16px/22px var(--ck-font); color: var(--ck-dark-300); }

.cat-more {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  margin-top: 30px;
  border: 1px solid var(--ck-green);
  border-radius: 8px;
  background: var(--ck-white);
  font: 600 13px/16px var(--ck-font);
  color: var(--ck-green);
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s;
}
.cat-more:hover { background: var(--ck-green-50); color: var(--ck-green); }
.cat-more.is-loading { opacity: .6; pointer-events: none; }
.cat-pagination:not(:empty) { margin-top: 20px; }
/* Обычная постраничная навигация остаётся под кнопкой (ссылки для поисковиков и переход по номеру) — компактно */
.cat-pagination .pagination { justify-content: center; gap: 6px; margin: 0; padding: 0; }
.cat-pagination .pagination li { margin: 0; }
.cat-pagination .pagination a, .cat-pagination .pagination span {
  width: 36px;
  height: 36px;
  border: 1px solid var(--ck-dark-100);
  border-radius: 8px;
  background: var(--ck-white);
  font: 600 14px/20px var(--ck-font);
  color: var(--ck-dark);
}
.cat-pagination .pagination span { border: 0; background: none; }
.cat-pagination .pagination li:first-child a, .cat-pagination .pagination li:last-child a { border: 1px solid var(--ck-dark-100); }
.cat-pagination .pagination__current a { border-color: var(--ck-green); background: var(--ck-green); color: var(--ck-white); }
.cat-pagination .icon-arrow-sm { width: 6px; height: 11px; fill: currentColor; }

.cat-info { margin-top: 100px; margin-bottom: 0; }

/* ---------- Панель фильтров (31:2147) ---------- */
.cf-panel {
  display: flex;
  flex-direction: column;
  padding: 20px 20px 24px;
  border-radius: 12px;
  background: var(--ck-white);
  font-family: var(--ck-font);
  color: var(--ck-dark);
}
.cf-groups { display: flex; flex-direction: column; }
.cf-group { display: flex; flex-direction: column; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--ck-dark-100); }
.cf-group[data-option-id="p"] { gap: 12px; }
.cf-group--cats { gap: 4px; padding-top: 0; }
.cf-panel > .cf-group:last-child, .cf-groups > .cf-group:last-child { border-bottom: 0; }
.cf-panel > .cf-group:last-child { padding-bottom: 0; }
.cf-panel > .cf-ocfilter:first-child .cf-group:first-child { padding-top: 0; }
.cf-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.cf-group--cats .cf-group__head { margin-bottom: 8px; cursor: default; }
.cf-group__title { font: 600 16px/22px var(--ck-font); color: var(--ck-dark); }
.cf-group__chevron { flex: none; display: block; transition: transform .2s; }
.cf-group.is-open .cf-group__chevron { transform: rotate(180deg); }
.cf-group__body { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.cf-group:not(.is-open) .cf-group__body { display: none; }

/* Подкатегории */
.cf-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  text-decoration: none;
}
.cf-cat:hover { background: var(--ck-dark-50); }
.cf-cat__name { overflow: hidden; font: 400 16px/20px var(--ck-font); color: var(--ck-dark); text-overflow: ellipsis; white-space: nowrap; }
.cf-cat__count { flex: none; font: 400 13px/18px var(--ck-font); color: var(--ck-dark-300); }
.cf-cat.is-active { background: var(--ck-green-50); }
.cf-cat.is-active .cf-cat__name { color: #017b34; }
.cf-cat.is-active .cf-cat__count { color: #017b34; }

/* Цена */
.cf-price { gap: 12px; align-items: stretch; }
.cf-price__inputs { display: flex; gap: 11px; }
.cf-price__field {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 40px;
  margin: 0;
  padding: 0 8px 0 12px;
  border: 1px solid var(--ck-dark-200);
  border-radius: 8px;
  background: var(--ck-white);
  font: 400 16px/20px var(--ck-font);
  color: var(--ck-dark);
  cursor: text;
}
.cf-price__field:focus-within { border-color: var(--ck-green); }
.cf-price__field input { flex: 1 1 auto; width: 100%; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: none; font: inherit; color: inherit; }
.cf-range { position: relative; height: 18px; }
.cf-range__track { position: absolute; top: 7px; left: 0; right: 0; height: 4px; border-radius: 2px; background: var(--ck-dark-100); }
.cf-range__fill { position: absolute; top: 0; bottom: 0; left: 0; right: 0; border-radius: 2px; background: var(--ck-green); }
.cf-range__input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}
.cf-range__input:focus { outline: 0; }
.cf-range__input::-webkit-slider-runnable-track { height: 18px; background: none; }
.cf-range__input::-moz-range-track { height: 18px; background: none; }
.cf-range__input::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  background: url("/front/dist/images/catalog/thumb.svg") center / 18px 18px no-repeat;
  cursor: pointer;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
}
.cf-range__input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 0;
  background: url("/front/dist/images/catalog/thumb.svg") center / 18px 18px no-repeat;
  cursor: pointer;
  pointer-events: auto;
}

/* Чекбоксы и цвета */
.cf-check { position: relative; display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 400; cursor: pointer; }
.cf-check input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.cf-check__box {
  flex: none;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--ck-dark-200);
  border-radius: 5px;
  background: var(--ck-white) center / 12px 12px no-repeat;
}
.cf-check input:checked + .cf-check__box { border-color: var(--ck-green); background-color: var(--ck-green); background-image: url("/front/dist/images/catalog/check.svg"); }
.cf-check input:focus-visible + .cf-check__box, .cf-check input:focus-visible + .cf-check__ring { box-shadow: 0 0 0 2px var(--ck-green-100); }
.cf-check__label { font: 400 16px/20px var(--ck-font); color: var(--ck-dark); }
.cf-check__ring { flex: none; display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 12px; }
.cf-check__swatch { display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--ck-dark-50) center / cover no-repeat; box-shadow: inset 0 0 0 1px rgba(18, 26, 39, .08); }
.cf-check input:checked + .cf-check__ring { box-shadow: inset 0 0 0 1.5px var(--ck-green); }
.cf-check.is-disabled { cursor: default; opacity: .4; }
.cf-check--more { display: none; }
.cf-group.is-expanded .cf-check--more { display: flex; }
.cf-more { padding: 0; border: 0; background: none; font: 600 14px/20px var(--ck-font); color: var(--ck-green); cursor: pointer; }
.cf-group.is-expanded .cf-more { display: none; }

.cf-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 8px; }
.cf-apply {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--ck-green);
  font: 600 13px/16px var(--ck-font);
  color: var(--ck-white);
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color .2s, opacity .2s;
}
.cf-apply:hover { background: #00853a; color: var(--ck-white); }
.cf-apply.is-loading { opacity: .7; }
.cf-apply.is-empty { opacity: .5; pointer-events: none; }
.cf-reset { font: 400 16px/20px var(--ck-font); color: var(--ck-dark-300); text-decoration: none; }
.cf-reset:hover { color: var(--ck-green); }

/* Шапка шторки (только телефон) */
.cat-filters__overlay, .cat-filters__head { display: none; }

/* ---------- Планшет и телефон: фильтры в шторке ---------- */
@media only screen and (max-width: 1200px) {
  .cat-container { padding: 20px 20px 80px; }
  .cat-breadcrumbs { display: none; }
  .cat-head { column-gap: 10px; margin-bottom: 16px; }
  .cat-title { font-size: 24px; line-height: 30px; }
  .cat-title--section { margin-bottom: 20px; padding-top: 0; line-height: 1.4; }
  .cat-head__count { font-size: 13px; line-height: 18px; }
  .cat-pills { display: flex; }

  .cat-tiles.category__list { grid-template-columns: repeat(auto-fill, minmax(166px, 1fr)); gap: 4px; }

  .cat-layout { display: block; }
  .cat-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 10px; margin-bottom: 16px; }
  .cat-btn { height: 44px; }
  .cat-btn--filters { display: flex; order: 0; }
  .cat-sort { order: 1; margin-left: 0; }
  .cat-sort__btn { width: 100%; }
  .cat-chips { order: 2; grid-column: 1 / -1; }

  .products-list.cat-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
  .cat-more { height: 48px; margin-top: 16px; }
  .cat-info { margin-top: 60px; }

  .cat-filters { position: fixed; inset: 0; z-index: 1000; display: none; }
  .cat-filters.is-open { display: block; }
  .cat-filters__overlay { display: block; position: absolute; inset: 0; background: rgba(18, 26, 39, .5); }
  .cat-filters__sheet {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 420px;
    background: var(--ck-white);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cat-filters__head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    flex: none;
    height: 56px;
    padding: 0 20px;
    border-bottom: 1px solid var(--ck-dark-100);
    background: var(--ck-white);
  }
  .cat-filters__close { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin-left: -10px; padding: 0; border: 0; border-radius: 18px; background: none; cursor: pointer; }
  .cat-filters__close img { width: 16px; height: 16px; }
  .cat-filters__title { font: 600 16px/22px var(--ck-font); color: var(--ck-dark); }
  .cat-filters__reset { justify-self: end; font: 600 14px/20px var(--ck-font); color: var(--ck-green); text-decoration: none; }
  .cf-panel { flex: 1 0 auto; padding: 20px 20px 0; border-radius: 0; }
  .cf-ocfilter { display: flex; flex-direction: column; flex: 1 0 auto; }
  .cf-groups { flex: 1 0 auto; padding-bottom: 16px; }
  .cf-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin: 0 -20px;
    padding: 12px 20px;
    background: var(--ck-white);
    box-shadow: 0 -4px 16px rgba(18, 26, 38, .1);
  }
  .cf-apply { height: 48px; }
  .cf-reset { display: none; }
  body.cat-filters-open { overflow: hidden; }
}

@media only screen and (max-width: 767px) {
  .cat-tiles.category__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .products-list.cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cat-sort__text { display: none; }
  .cat-sort__text--short { display: inline; }
  .cat-sort__list { left: auto; right: 0; }
  .cat-filters__sheet { max-width: none; }
}

/* Главный слайдер: первый слайд — <img> вместо background-image (LCP находится сразу, srcset для телефона) */
.main-slider__item-inner--img { z-index: 0; overflow: hidden; }
.main-slider__img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; }
