/* =====================================
   FILTER SECTIONS — BASE
===================================== */

.filter-section {
  margin-bottom: 24px;
}

.filter-section__title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #000;
}

/* =====================================
   FILTER PANEL BODY — EQUAL HEIGHT GRID
   (NO SCROLL HERE!)
===================================== */

.filter-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

/* desktop: 2 columns, equal height */
@media (min-width: 1024px) {
  .filter-body {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
}

/* =====================================
   SECTION BODY — SCROLL ONLY WHEN OPEN
===================================== */

/* ❌ default: NO SCROLL, NO HEIGHT */
.filter-section__body {
  overflow: hidden;
  max-height: none;
}

/* ✅ ONLY when panel is open */
body.filter-open .filter-section__body {
  max-height: 420px;          /* ⬅️ ЄДИНА ВИСОТА */
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;

  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

/* Chrome / Edge / Safari */
body.filter-open .filter-section__body::-webkit-scrollbar {
  width: 6px;
}
body.filter-open .filter-section__body::-webkit-scrollbar-track {
  background: transparent;
}
body.filter-open .filter-section__body::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

/* =====================================
   PRICE FILTER — NO SCROLL EVER
===================================== */

.filter-section--price .filter-section__body {
  max-height: none !important;
  overflow: visible !important;
  padding-right: 0 !important;
}

/* =====================================
   LISTS — NEVER SCROLL THEMSELVES
===================================== */

.filter-categories,
.filter-tags,
.filter-brands,
.filter-colors {
  list-style: none;
  padding: 0;
  margin: 0;

  overflow: visible !important;
}

/* =====================================
   CATEGORIES + TAGS
===================================== */

.filter-categories,
.filter-tags {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-categories__btn,
.filter-tags__btn {
  width: 100%;
  text-align: left;
  background: #f4f4f4;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  color: #000;
  cursor: pointer;
  transition: background .15s ease;
}

.filter-categories__btn:hover,
.filter-tags__btn:hover {
  background: #e9e9e9;
}

.filter-categories__btn[aria-pressed="true"],
.filter-tags__btn[aria-pressed="true"] {
  background: #000;
  color: #fff;
}

/* =====================================
   BRANDS
===================================== */

.filter-brands {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 14px;
}

.filter-brands__item {
  list-style: none;
}

.filter-brands__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 6px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.filter-brands__btn img {
  width: 70px;
  height: 42px;
  object-fit: contain;
}

.filter-brands__name {
  font-size: 12px;
  line-height: 1.2;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-brands__btn:hover {
  border-color: #8DAC99;
}

.filter-brands__btn.is-active,
.filter-brands__btn[aria-pressed="true"] {
  border-color: #8DAC99;
  box-shadow: 0 0 0 1px rgba(141,172,153,.35);
}

/* =====================================
   COLORS
===================================== */

.filter-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-colors__btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
}

.filter-colors__btn img {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
}

.filter-colors__btn.is-active {
  border-color: #000;
}

/* =====================================
   FILTER PANEL — IOS CLICK SAFE
===================================== */

/* CLOSED → NOT IN DOM FLOW */
body:not(.filter-open) #filterOffcanvas {
  display: none !important;
}

/* OPEN */
body.filter-open #filterOffcanvas {
  display: block;
}

/* Overlay */
#filterOverlay {
  pointer-events: none;
}
body.filter-open #filterOverlay {
  pointer-events: auto;
}

/* =====================================
   UTILS
===================================== */

[hidden] {
  display: none !important;
}


/* MOBILE — categories must NOT affect layout */
@media (max-width: 1023px) {
  .shop-categories,
  #shop-categories,
  .product-categories {
    position: absolute !important;
    left: 0;
    right: 0;
    width: 100%;
  }

  body:not(.has-filters) .shop-categories,
  body:not(.has-filters) #shop-categories,
  body:not(.has-filters) .product-categories {
    position: relative !important;
  }
}



/* ===============================
   STYLE FILTER — LABELS
   =============================== */

.filter-styl {
  display: flex;
  flex-wrap: wrap;          /* ⬅️ в рядки */
  gap: 8px;                 /* відстань між лейблами */
  padding: 0;
  margin: 0;
  list-style: none;
}

.filter-styl__item {
  margin: 0;
}

.filter-styl__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.2;

  background: #fff;
  color: #000;

  border: 1px solid #000;   /* ⬅️ чорний бордер */
  border-radius: 2px;       /* мінімально, можна 0 */

  cursor: pointer;
  user-select: none;
  white-space: nowrap;

  transition:
    background-color .15s ease,
    color .15s ease,
    border-color .15s ease;
}

/* hover */
.filter-styl__btn:hover {
  background: #000;
  color: #fff;
}

/* active */
.filter-styl__btn.is-active,
.filter-styl__btn[aria-pressed="true"] {
  background: #000;
  color: #fff;
  border-color: #000;
}

/* focus (keyboard safe) */
.filter-styl__btn:focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}

/* =====================================
   MATERIAL (PHOTO TERMS)
   same logic as COLORS / BRANDS
===================================== */

.filter-material {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;

  overflow: visible !important;
}

.filter-material__item {
  margin: 0;
}

/* button */
.filter-material__btn {
  display: flex;
  align-items: center;
  gap: 6px;

  padding: 4px 6px;
  background: #fff;
  color: #000;

  border: 1px solid #ddd;
  border-radius: 4px;

  cursor: pointer;
  user-select: none;

  transition:
    border-color .15s ease,
    background-color .15s ease;
}

/* image */
.filter-material__btn img {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

/* label */
.filter-material__name {
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

/* hover */
.filter-material__btn:hover {
  border-color: #000;
}

/* active */
.filter-material__btn.is-active,
.filter-material__btn[aria-pressed="true"] {
  border-color: #000;
  background: #fff;
}

/* keyboard */
.filter-material__btn:focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}


/* ===============================
   OPTSIIA FILTER — LABELS
=============================== */

.filter-optsiia {
  display: flex;
  flex-wrap: wrap;          /* ⬅️ в рядки */
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;

  overflow: visible;        /* скрол контролюється body */
}

.filter-optsiia__item {
  margin: 0;
}

.filter-optsiia__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.2;

  background: #fff;
  color: #000;

  border: 1px solid #000;   /* чорний бордер */
  border-radius: 2px;

  cursor: pointer;
  user-select: none;
  white-space: nowrap;

  transition:
    background-color .15s ease,
    color .15s ease,
    border-color .15s ease;
}

/* hover */
.filter-optsiia__btn:hover {
  background: #000;
  color: #fff;
}

/* active */
.filter-optsiia__btn.is-active,
.filter-optsiia__btn[aria-pressed="true"] {
  background: #000;
  color: #fff;
  border-color: #000;
}

/* keyboard focus */
.filter-optsiia__btn:focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}


/* =========================================
   FILTER — DOPUSTYME NAVANTAZHENNIA (LABELS)
========================================= */

/* контейнер */
.filter-dopustyme-navantazhennia {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* item */
.filter-dopustyme-navantazhennia__item {
  margin: 0; /* прибираємо вертикальний відступ */
}

/* кнопка */
.filter-dopustyme-navantazhennia__btn {
  display: inline-flex;
  align-items: center;

  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.2;

  background: #f5f5f5;
  color: #222;

  border: 1px solid #ddd;
  border-radius: 6px;

  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.filter-dopustyme-navantazhennia__btn:hover {
  background: #eaeaea;
}

.filter-dopustyme-navantazhennia__btn.is-active,
.filter-dopustyme-navantazhennia__btn[aria-pressed="true"] {
  background: #000;
  color: #fff;
  border-color: #000;
}



/* =========================================
   FILTER — MEKHANIZM ROZKLADANNIA (LABELS)
========================================= */

/* контейнер */
.filter-mekhanizm-rozkladannia {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* item */
.filter-mekhanizm-rozkladannia__item {
  margin: 0;
}

/* кнопка */
.filter-mekhanizm-rozkladannia__btn {
  display: inline-flex;
  align-items: center;

  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;

  background: #f5f5f5;
  color: #222;

  border: 1px solid #ddd;
  border-radius: 6px;

  cursor: pointer;
  user-select: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.filter-mekhanizm-rozkladannia__btn:hover {
  background: #eaeaea;
}

/* active */
.filter-mekhanizm-rozkladannia__btn.is-active,
.filter-mekhanizm-rozkladannia__btn[aria-pressed="true"] {
  background: #000;
  color: #fff;
  border-color: #000;
}

/* =========================================
   FILTER — PRUZHYNNYI BLOK (LABELS)
========================================= */

/* контейнер */
.filter-pruzhynnyi-blok {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* item */
.filter-pruzhynnyi-blok__item {
  margin: 0;
}

/* кнопка */
.filter-pruzhynnyi-blok__btn {
  display: inline-flex;
  align-items: center;

  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;

  background: #f5f5f5;
  color: #222;

  border: 1px solid #ddd;
  border-radius: 6px;

  cursor: pointer;
  user-select: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.filter-pruzhynnyi-blok__btn:hover {
  background: #eaeaea;
}

/* active */
.filter-pruzhynnyi-blok__btn.is-active,
.filter-pruzhynnyi-blok__btn[aria-pressed="true"] {
  background: #000;
  color: #fff;
  border-color: #000;
}
/* =========================================
   FILTER — SPALNE MISTSE (LABELS)
========================================= */

/* контейнер */
.filter-spalne-mistse {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* item */
.filter-spalne-mistse__item {
  margin: 0;
}

/* кнопка */
.filter-spalne-mistse__btn {
  display: inline-flex;
  align-items: center;

  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;

  background: #f5f5f5;
  color: #222;

  border: 1px solid #ddd;
  border-radius: 6px;

  cursor: pointer;
  user-select: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.filter-spalne-mistse__btn:hover {
  background: #eaeaea;
}

/* active */
.filter-spalne-mistse__btn.is-active,
.filter-spalne-mistse__btn[aria-pressed="true"] {
  background: #000;
  color: #fff;
  border-color: #000;
}
