/* ===================== eTroniX — Catalog page ===================== */

.catalog { padding-top: 26px; padding-bottom: 40px; }

.crumbs { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-4); margin-bottom: 14px; }
.crumbs a { color: var(--ink-3); cursor: pointer; }
.crumbs a:hover { color: var(--blue); }

.cat-title { display: flex; align-items: baseline; gap: 14px; margin-bottom: 24px; }
.cat-title h1 { font-size: 34px; letter-spacing: -0.03em; }
.cat-count { font-size: 13px; color: var(--ink-4); }

.cat-layout { display: grid; grid-template-columns: 262px 1fr; gap: 28px; align-items: start; }

/* ---- Filters sidebar (Desktop sticky) ---- */
.filters-wrap {
  position: sticky;
  top: calc(var(--header-h, 80px) + 16px);
  max-height: calc(100vh - var(--header-h, 80px) - 32px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.filters-wrap::-webkit-scrollbar { width: 4px; }
.filters-wrap::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }

.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 6px 20px 12px; }

.fil-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 6px; }
.fil-reset { font-size: 12.5px; font-weight: 700; color: var(--blue); cursor: pointer; }
.fil-reset:hover { text-decoration: underline; }
.fil-grp { padding: 16px 0; border-bottom: 1px solid var(--line); }
.fil-title { font-family: var(--ff-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 11px; }

/* Search inside filters */
.fil-grp-search { padding: 12px 0; }
.fil-search-box { display: flex; align-items: center; gap: 8px; height: 40px; border: 1.5px solid var(--line-2); border-radius: 10px; padding: 0 12px; transition: border-color .15s; }
.fil-search-box:focus-within { border-color: var(--blue); }
.fil-search-ic { width: 16px; height: 16px; color: var(--ink-4); flex: 0 0 auto; }
.fil-search-input { flex: 1; border: none; background: none; font-family: inherit; font-size: 14px; color: var(--ink); outline: none; }
.fil-search-input::placeholder { color: var(--ink-4); }
.fil-search-clear { display: flex; align-items: center; justify-content: center; color: var(--ink-4); cursor: pointer; padding: 2px; border-radius: 4px; }
.fil-search-clear:hover { color: var(--ink); }

/* Collapsible group */
.fil-collapsible-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; margin-bottom: 0; }
.fil-arrow { transition: transform .2s; }
.fil-grp-collapsible .fil-collapsible-body { display: none; padding-top: 8px; }
.fil-grp-collapsible.open .fil-collapsible-body { display: block; }
.fil-grp-collapsible.open .fil-arrow { transform: rotate(180deg); }

/* Checkboxes & radios */
.fil-radio, .fil-check { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.fil-check-lbl { flex: 1; }
.fil-radio em, .fil-check em { margin-left: auto; font-style: normal; font-family: var(--ff-mono); font-size: 12px; color: var(--ink-4); }
.fil-radio input, .fil-check input { display: none; }

/* Custom radio dot */
.fil-radio .dot-radio { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; transition: all .15s; }
.fil-radio .dot-radio::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); opacity: 0; transition: opacity .15s; }
.fil-radio.on .dot-radio { border-color: var(--blue); }
.fil-radio.on .dot-radio::after { opacity: 1; }
.fil-radio:hover .dot-radio { border-color: var(--blue); }
.fil-radio.on { color: var(--blue); }

/* Custom checkbox */
.fil-check .box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-2); display: flex; align-items: center; justify-content: center; color: #fff; flex: 0 0 auto; transition: all .15s; }
.fil-check .box svg { width: 14px; height: 14px; opacity: 0; }
.fil-check.on .box { background: var(--blue); border-color: var(--blue); }
.fil-check.on .box svg { opacity: 1; }
.fil-check:hover .box { border-color: var(--blue); }

/* Brands scrollable list */
.fil-brands-list { max-height: 310px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.fil-brands-list::-webkit-scrollbar { width: 4px; }
.fil-brands-list::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
.fil-brands-list .fil-check { margin-right: 10px; }

/* price range */
.fil-price { display: flex; align-items: center; gap: 8px; }
.fil-price input { width: 100%; height: 40px; border: 1.5px solid var(--line-2); border-radius: 10px; padding: 0 12px; font-size: 14px; font-family: var(--ff-mono); }
.fil-price input:focus { outline: none; border-color: var(--blue); }

.fil-range-wrap { position: relative; height: 20px; margin-top: 14px; }
.fil-range-track { position: absolute; top: 50%; left: 0; right: 0; height: 4px; background: var(--line-2); border-radius: 2px; transform: translateY(-50%); }
.fil-range-fill { position: absolute; height: 100%; background: var(--blue); border-radius: 2px; }
.fil-range-wrap .fil-range { position: absolute; top: 0; left: 0; width: 100%; height: 100%; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; pointer-events: none; }
.fil-range-wrap .fil-range::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--blue); box-shadow: 0 1px 4px rgba(0,0,0,.15); pointer-events: all; cursor: pointer; }
.fil-range-wrap .fil-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--blue); box-shadow: 0 1px 4px rgba(0,0,0,.15); pointer-events: all; cursor: pointer; }
.fil-price-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-4); margin-top: 6px; }

/* ---- Toolbar ---- */
.cat-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.active-chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.achip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 12px; border-radius: 9px; background: var(--blue-soft); color: var(--blue-deep); font-weight: 700; font-size: 12.5px; cursor: pointer; }
.achip:hover { background: var(--blue-soft-2); }
.cat-sort { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.sort-sel { position: relative; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 11px; color: var(--ink-2); }
.sort-sel select { appearance: none; border: none; background: none; font-family: inherit; font-weight: 700; font-size: 13.5px; color: var(--ink); padding-right: 4px; outline: none; cursor: pointer; }
.view-toggle { display: flex; gap: 3px; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 11px; padding: 3px; }
.view-toggle button { width: 36px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--ink-3); cursor: pointer; }
.view-toggle button svg { width: 19px; height: 19px; }
.view-toggle button.on { background: var(--blue); color: #fff; }

/* ---- List view rows ---- */
.plist { display: flex; flex-direction: column; gap: 14px; }
.prow { display: grid; grid-template-columns: 160px 1fr 230px; gap: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; cursor: pointer; transition: box-shadow .2s, border-color .2s; }
.prow:hover { box-shadow: var(--sh-2); border-color: var(--line-2); }
.prow-img { width: 160px; height: 160px; object-fit: contain; border-radius: var(--r-md); background: #f5f7fc; user-select: none; -webkit-user-drag: none; display: block; }
.prow-body { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.prow-name { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.prow-tag { font-size: 13.5px; color: var(--ink-3); margin: 0; }
.prow-rate { display: flex; align-items: center; gap: 8px; }
.prow-badges { display: flex; gap: 6px; margin-top: auto; }
.prow-buy { display: flex; flex-direction: column; align-items: stretch; gap: 10px; justify-content: center; border-left: 1px solid var(--line); padding-left: 22px; }
.prow-stock { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.prow-stock .dot { width: 7px; height: 7px; border-radius: 50%; }
.prow-buy .faved { color: var(--red); border-color: var(--red); }

/* ---- Pagination ---- */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 32px; flex-wrap: wrap; }
.pager--top { margin-top: 0; margin-bottom: 25px; }
.pager-btn { min-width: 38px; height: 38px; padding: 0 8px; border-radius: 10px; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: border-color .15s, background .15s, color .15s; }
.pager-btn:hover:not(.disabled):not(.active) { border-color: var(--blue); color: var(--blue); }
.pager-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.pager-btn.disabled { opacity: .35; cursor: default; pointer-events: none; }
.pager-ellipsis { min-width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; color: var(--ink-4); font-size: 15px; }

/* ---- Empty state ---- */
.empty { padding: 60px 30px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty h3 { font-size: 22px; }
.empty p { color: var(--ink-3); margin: 0 0 8px; }

/* ---- Mobile filters overlay ---- */
#fil-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
  align-items: flex-start;
}
#fil-overlay.open { display: flex; }

.fil-drawer {
  width: min(360px, 94vw);
  height: 100dvh;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 32px rgba(0,0,0,.18);
  animation: drawerIn .22s ease;
}
@keyframes drawerIn { from { transform: translateX(-100%); } to { transform: translateX(0); } }

.fil-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.fil-drawer-close { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; color: var(--ink-3); cursor: pointer; }
.fil-drawer-close:hover { background: var(--bg-2); color: var(--ink); }

.fil-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 24px;
}

body.fil-overlay-open { overflow: hidden; }

/* ---- Mobile FAB (fixed filter button) ---- */
.fil-fab {
  display: none;
  position: fixed;
  right: 16px;
  bottom: calc(64px + env(safe-area-inset-bottom) + 12px);
  z-index: 200;
  height: 46px;
  padding: 0 18px;
  border-radius: 23px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  gap: 8px;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
  border: none;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.fil-fab:active { transform: scale(.96); box-shadow: 0 2px 10px rgba(0,0,0,.14); }
.fil-fab svg { width: 17px; height: 17px; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .cat-layout { grid-template-columns: 1fr; }
  .filters-wrap { display: none; }
  .fil-fab { display: flex; }

  /* cat-sort left-aligned */
  .cat-sort { margin-left: 0; }
  .cat-toolbar { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .pager-btn { min-width: 34px; height: 34px; font-size: 13px; }
}

/* ---- Mobile: по 2 карточки в ряд, компактно ---- */
@media (max-width: 640px) {
  /* две колонки вместо одной (перебивает .pgrid из components.css) */
  .catalog .pgrid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .catalog .pcard { min-width: 0; }

  /* меньше картинка и паддинги медиа */
  .catalog .pcard-media { padding: 8px; }

  /* компактное тело карточки */
  .catalog .pcard-body { padding: 2px 9px 11px; gap: 5px; }
  .catalog .pcard-brand { font-size: 9px; }
  .catalog .pcard-name { font-size: 11.5px; line-height: 1.25; min-height: 2.3em; }

  /* рейтинг: мельче звёзды и текст (инлайн-стили → !important) */
  .catalog .pcard-rate { gap: 5px; }
  .catalog .pcard-rate .stars svg { width: 11px !important; height: 11px !important; }
  .catalog .pcard-rate span { font-size: 9.5px !important; }

  /* цена и старая цена (инлайн font-size → !important) */
  .catalog .pcard-foot { gap: 6px; padding-top: 2px; }
  .catalog .pcard-foot > div { gap: 6px; }
  .catalog .pcard-foot > div > span:first-child { font-size: 13px !important; }
  .catalog .pcard-foot > div > span:nth-child(2) { font-size: 9px !important; }

  /* кнопка «в корзину» поменьше */
  .catalog .pcard-add { width: 32px; height: 32px; border-radius: 9px; }
  .catalog .pcard-add svg { width: 16px; height: 16px; }

  .catalog .pcard-stock { font-size: 10px; gap: 5px; }

  /* кнопка избранного / бейджи ближе к углам */
  .catalog .pcard-fav { width: 28px; height: 28px; top: 12px; right: 12px; border-radius: 8px; }
  .catalog .pcard-fav svg { width: 14px; height: 14px; }
  .catalog .pcard-badges { top: 12px; left: 12px; }
  .catalog .pcard-oos span { font-size: 9px; padding: 4px 8px; }
}

/* Подкатегории внутри выбранной категории (фильтр) */
.fil-subcats { margin: 2px 0 6px; padding-left: 12px; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.fil-subradio { font-size: 13px; }
.fil-subradio em { margin-left: auto; color: var(--ink-4); font-style: normal; font-size: 12px; }
