/* ══════════════════════════════════════════
   CATEGORY PAGE
   ══════════════════════════════════════════ */

/* ── Мобайл поиск ── */
.cat-m-search {
  display: none;
}
@media (max-width: 510px) {
  .cat-m-search {
    display: block;
    padding: 14px 0 0;
  }
}

/* ── Хлебные крошки ── */
.cat-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 20px 0 0;
  font-size: 12px;
}

.cat-crumb {
  color: var(--white-40);
  text-decoration: none;
  transition: color var(--transition);
}
.cat-crumb:hover { color: var(--white-70); }

.cat-crumb-sep {
  color: var(--white-14);
  user-select: none;
  font-size: 13px;
}

.cat-crumb--current {
  color: var(--white-70);
  pointer-events: none;
}

/* ── Шапка страницы ── */
.cat-page-head {
  padding: 18px 0 0;
}

.cat-page-title {
  font-family: 'Unbounded', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 16px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.cat-page-count {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--white-40);
}

/* ── Чипсы подкатегорий ── */
/* Обёртка: стрелки + скролл-область */
.cat-chips-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.cat-chips-outer {
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  cursor: grab;
}
.cat-chips-outer::-webkit-scrollbar { display: none; }
.cat-chips-outer.grabbing { cursor: grabbing; }

.cat-chips {
  display: flex;
  gap: 8px;
  width: max-content;
}

/* Стрелки — только на десктопе */
.cat-chips-arrow {
  display: none;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--white-14);
  color: var(--white-70);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, border-color 0.18s, color 0.18s, opacity 0.18s;
  padding: 0;
}
.cat-chips-arrow:hover { background: var(--white-08); color: var(--white); border-color: rgba(255,255,255,0.2); }
.cat-chips-arrow:disabled { opacity: 0.25; pointer-events: none; }

@media (min-width: 861px) {
  .cat-chips-arrow { display: flex; }
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: 100px;
  border: 1px solid var(--white-14);
  background: transparent;
  color: var(--white-70);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.cat-chip:hover:not(.active) {
  background: var(--white-08);
  border-color: var(--white-40);
  color: var(--white);
}
.cat-chip.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

.cat-chip-count {
  font-size: 11px;
  opacity: 0.6;
}
.cat-chip.active .cat-chip-count { opacity: 0.8; }

/* ══════════════════════════════
   LAYOUT
   ══════════════════════════════ */
.cat-layout {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 60px;
}

/* ══════════════════════════════
   САЙДБАР
   ══════════════════════════════ */
.cat-sidebar {
  flex: 0 0 252px;
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
  scrollbar-width: none;
  padding-bottom: 18px;
}
.cat-sidebar::-webkit-scrollbar { display: none; }

.cat-sidebar-close {
  display: none;
  padding: 14px 14px 0;
  justify-content: flex-end;
}

.cat-sidebar-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--white-08);
  color: var(--white-70);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}
.cat-sidebar-close-btn:hover { background: var(--white-14); }

.cat-filter-card {
  background: var(--bg-card);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.cat-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cat-filter-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
}

.cat-filter-reset {
  font-size: 12px;
  color: var(--white-40);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: 'Inter', sans-serif;
  transition: color var(--transition);
}
.cat-filter-reset:hover { color: var(--purple); }

/* ── Группа фильтра ── */
.cat-filter-group {
  padding: 14px 0;
  border-top: 1px solid var(--white-08);
}

.cat-filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--white-40);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

/* ── Поля цены ── */
.cat-price-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cat-price-input {
  flex: 1;
  min-width: 0;
  background: var(--bg-light);
  border: 1px solid var(--white-08);
  border-radius: 9px;
  padding: 9px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--white);
  outline: none;
  transition: border-color var(--transition), background var(--transition);
  -moz-appearance: textfield;
}
.cat-price-input::-webkit-outer-spin-button,
.cat-price-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.cat-price-input::placeholder { color: var(--white-40); }
.cat-price-input:focus { border-color: rgba(139,93,246,0.45); background: rgba(139,93,246,0.06); }

.cat-price-sep {
  color: var(--white-40);
  font-size: 16px;
  flex-shrink: 0;
}

/* ── Кастомный дроп ── */
.cat-drop-wrap {
  position: relative;
}

.cat-drop-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-light);
  border: 1px solid var(--white-08);
  border-radius: 9px;
  padding: 9px 12px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--white);
  transition: border-color var(--transition);
}
.cat-drop-btn:hover,
.cat-drop-btn.open { border-color: rgba(139,93,246,0.4); }

.cat-drop-btn svg {
  flex-shrink: 0;
  color: var(--white-40);
  transition: transform 0.18s;
}
.cat-drop-btn.open svg { transform: rotate(180deg); }

.cat-drop-label { flex: 1; text-align: left; }

.cat-drop-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--white-14);
  border-radius: 12px;
  padding: 6px;
  z-index: 100;
  display: none;
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
}
.cat-drop-panel.open { display: block; }

.cat-drop-panel--right {
  left: auto;
  right: 0;
  min-width: 170px;
}

.cat-drop-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  border: none;
  background: none;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--white-70);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}
.cat-drop-item:hover { background: var(--white-08); color: var(--white); }
.cat-drop-item.active { color: var(--purple); }

/* Бейдж VIP в дропе */
.cat-drop-vip-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, #fee06d 0%, #f4a228 100%);
  color: #1a1a2e;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  flex-shrink: 0;
}

/* ── Тоггл «Только с фото» ── */
.cat-filter-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cat-filter-toggle-label {
  font-size: 13px;
  color: var(--white-70);
}

.cat-photo-toggle {
  width: 38px;
  height: 22px;
  border-radius: 100px;
  background: var(--white-14);
  border: none;
  cursor: pointer;
  position: relative;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.2s;
}
.cat-photo-toggle.on { background: var(--purple); }

.cat-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.18s;
}
.cat-photo-toggle.on .cat-toggle-thumb { transform: translateX(16px); }

/* ── Кнопка применить ── */
.cat-filter-apply {
  margin-top: 20px;
  width: 100%;
  padding: 12px 20px;
  border-radius: 11px;
  border: none;
  background: linear-gradient(135deg, #8b5df6 0%, #6b3fd4 100%);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(139,93,246,0.28);
  transition: filter 0.18s, box-shadow 0.18s;
}
.cat-filter-apply:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 20px rgba(139,93,246,0.4);
}

/* ══════════════════════════════
   ОСНОВНОЙ КОНТЕНТ
   ══════════════════════════════ */
.cat-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Применённые фильтры ── */
.cat-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.cat-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 12px;
  border-radius: 100px;
  background: rgba(139,93,246,0.12);
  border: 1px solid rgba(139,93,246,0.28);
  font-size: 12px;
  font-weight: 500;
  color: var(--purple);
}

.cat-active-chip-rm {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: rgba(139,93,246,0.25);
  color: var(--purple);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  transition: background var(--transition);
}
.cat-active-chip-rm:hover { background: rgba(139,93,246,0.45); }

/* ── Тулбар ── */
.cat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}


.cat-found {
  font-size: 13px;
  color: var(--white-40);
  white-space: nowrap;
}
.cat-found strong { color: var(--white-70); font-weight: 600; }

/* Мобайл-версия «Найдено» (под чипсами) — скрыта на десктопе */
.cat-found-mobile {
  display: none;
  font-size: 13px;
  color: var(--white-40);
  margin-bottom: 20px;
}
.cat-found-mobile strong { color: var(--white-70); font-weight: 600; }

.cat-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Кнопка сортировки */
.cat-sort-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--white-08);
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--white-70);
  white-space: nowrap;
  transition: border-color var(--transition), color var(--transition);
}
.cat-sort-btn:hover,
.cat-sort-btn.open {
  border-color: rgba(139,93,246,0.4);
  color: var(--white);
}
.cat-sort-btn svg {
  flex-shrink: 0;
  color: var(--white-40);
  transition: transform 0.18s;
}
.cat-sort-btn.open svg { transform: rotate(180deg); }

/* Переключатель вида */
.cat-view-toggle {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--white-08);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}

.cat-view-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--white-40);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.cat-view-btn:hover:not(.active) { color: var(--white-70); background: var(--white-08); }
.cat-view-btn.active { background: var(--purple); color: #fff; }

/* ── Мобильная кнопка фильтров ── */
.cat-filter-mobile-btn {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--white-14);
  background: var(--bg-card);
  color: var(--white-70);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--transition), color var(--transition);
}
.cat-filter-mobile-btn:hover {
  border-color: var(--white-40);
  color: var(--white);
}

/* ── Хэндл bottom-sheet ── */
.cat-sidebar-handle {
  display: none;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--white-14);
  margin: 12px auto 4px;
  flex-shrink: 0;
}

/* ── Секции VIP / Дропы ── */
.cat-section {
  margin-bottom: 28px;
}

.cat-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.cat-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Unbounded', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
}

/* ── Грид карточек ── */
.cat-grid {
  grid-template-columns: repeat(4, 1fr);
}

/* ── List view ── */
.cat-grid--list {
  grid-template-columns: 1fr;
}

.cat-grid--list .product-card {
  display: grid;
  grid-template-columns: 160px 1fr;
}

.cat-grid--list .card-img {
  aspect-ratio: unset;
  height: 100%;
}

.cat-grid--list .card-img img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.cat-grid--list .card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* .card-badge и .card-badge--vip определены в products.css */

/* VIP обводка убрана — карточки выглядят как обычные */

/* ── Тоглы типа объявления (VIP / Дропы) ── */
.cat-type-toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* VIP тогл — золотой акцент вместо фиолетового */
.cat-vip-toggle.on {
  background: rgba(254,224,109,0.85);
}

/* ── VIP-секция — разделитель снизу ── */
.cat-vip-section {
  padding-bottom: 28px;
  margin-bottom: 28px;
}

.cat-drop-section {
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--white-14);
}

/* ── Пагинация ── */
.cat-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 36px;
}

.cat-page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--white-08);
  background: var(--bg-card);
  color: var(--white-70);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.cat-page-btn:hover:not(.active):not(:disabled) {
  background: var(--white-08);
  border-color: var(--white-40);
  color: var(--white);
}
.cat-page-btn.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}
.cat-page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.cat-page-ellipsis {
  color: var(--white-40);
  font-size: 14px;
  padding: 0 2px;
  user-select: none;
}

.cat-page-next { padding: 0 14px; }

/* ── Оверлей мобильного сайдбара ── */
.cat-filter-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 390;
  opacity: 0;
  transition: opacity 0.22s;
}
.cat-filter-overlay.open {
  display: block;
  opacity: 1;
}

/* ══════════════════════════════
   АДАПТИВ
   ══════════════════════════════ */
@media (max-width: 1200px) {
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  /* Сайдбар — bottom sheet снизу */
  .cat-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-width: none;
    height: auto;
    max-height: 88vh;
    transform: translateY(100%);
    z-index: 400;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    padding: 0;
    transition: transform 0.32s cubic-bezier(.32,.72,0,1);
  }
  .cat-sidebar.open { transform: translateY(0); }

  /* Хэндл — вне зоны скролла, всегда виден */
  .cat-sidebar-handle {
    display: block;
    flex-shrink: 0;
    margin: 12px auto 4px;
  }
  .cat-sidebar-close { display: flex; flex-shrink: 0; }

  /* Карточка фильтра — скроллируемая область */
  .cat-filter-card {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    border-radius: 0;
    padding: 16px 16px 48px;
  }
  .cat-filter-card::-webkit-scrollbar { display: none; }

  /* Тулбар: [Фильтры] [Сортировка] рядом слева */
  .cat-toolbar { flex-wrap: nowrap; gap: 8px; margin-bottom: 12px; order: -1; justify-content: flex-start; }
  .cat-found { display: none; }
  .cat-filter-mobile-btn { display: flex; }
  .cat-toolbar-right { margin-left: 0; }         /* сортировка вплотную к фильтру */

  /* Сортировка — та же высота, что кнопка фильтра */
  .cat-sort-btn { padding: 10px 14px; }

  /* Найдено — под чипсами */
  .cat-found-mobile {
    display: block;
    font-size: 13px;
    color: var(--white-40);
    margin-bottom: 28px;
  }

  /* Чипсы идут после тулбара (через order), отступ снизу тулбара достаточен */
  .cat-active-filters { margin-top: 0; }

  .cat-grid { grid-template-columns: repeat(3, 1fr); }

  /* Меньший отступ перед футером */
  .cat-layout { padding-bottom: 28px; }
}

@media (max-width: 640px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 420px) {
  .cat-page-title { font-size: 18px; }
  .cat-grid--list .product-card { grid-template-columns: 110px 1fr; }
}

/* ── Лимит рядов: 6 рядов на всех размерах ── */

/* Десктоп (4 кол.): показываем 24 карточки */
#regularGrid .product-card:nth-child(n+25) { display: none; }

/* Планшет (3 кол., ≤860px): 18 карточек */
@media (max-width: 860px) {
  #regularGrid .product-card:nth-child(n+19) { display: none !important; }
}

/* Мобилка (2 кол., ≤640px): 12 карточек */
@media (max-width: 640px) {
  #regularGrid .product-card:nth-child(n+13) { display: none !important; }
}

/* products.css скрывает карточки с 7-й на мобилке — показываем 7–12 */
@media (max-width: 510px) {
  .cat-grid .product-card:nth-child(-n+12) {
    display: flex !important;
    flex-direction: column !important;
  }
}
