/* ===============================
   FILTER PANEL — BASE
=============================== */

.filter-panel {
  position: relative;
  margin: 20px 0;
}

.filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: #8DAC99;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

/* ===============================
   OFFCANVAS PANEL — BASE
=============================== */

.filter-offcanvas {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  margin-top: 14px;
  padding: 16px;
}

/* HEADER */
.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

#filterCloseBtn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
}

/* BODY */
.filter-body {
  display: block;
}

/* ===============================
   JS STATE
=============================== */

.filter-offcanvas {
  display: none;
}

.filter-offcanvas.is-open {
  display: block;
}

/* ===============================
   FILTER PANEL — FIXED UNDER HEADER (DESKTOP)
=============================== */

.site-header {
  position: relative;
  z-index: 10000;
}

.filter-offcanvas {
  position: fixed;
  top: var(--header-height, 80px);
  left: 0;
  right: 0;
  z-index: 9999;

  background: #fff;
  border-bottom: 1px solid #e5e5e5;

  /* ⬅️ ЄДИНИЙ СКРОЛ */
  max-height: calc(100vh - var(--header-height, 80px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===============================
   BODY LOCK (CORRECT)
=============================== */

body.filter-open {
  overflow: hidden;
  touch-action: none;
}

/* ===============================
   MOBILE FILTER DRAWER
=============================== */

@media (max-width: 768px) {

  #filterOffcanvas {
    position: fixed;
    top: 0;
    left: 0;

    width: 86%;
    max-width: 340px;
    height: 100vh;

    transform: translateX(-100%);
    transition: transform .35s ease;

    background: #fff;
    z-index: 100002;

    /* ⬅️ ЄДИНИЙ СКРОЛ */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #filterOffcanvas.is-open {
    transform: translateX(0);
  }
}

/* ===============================
   FILTER OVERLAY — MOBILE
=============================== */

@media (max-width: 768px) {

  #filterOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);

    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease;

    z-index: 100000;
  }

  body.filter-open #filterOverlay {
    opacity: 1;
    visibility: visible;
  }
}

/* ===============================
   MOBILE FILTER TRIGGER
=============================== */

@media (max-width: 768px) {

  #mobileFilterBtn {
    position: fixed;
    top: 50%;
    left: -10px;
    transform: translateY(-50%);

    z-index: 100001;

    width: 44px;
    height: 96px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #000;
    border: none;
    border-radius: 0 12px 12px 0;

    box-shadow: 4px 0 14px rgba(0,0,0,.35);
    cursor: pointer;
  }

  #mobileFilterBtn svg {
    width: 22px;
    height: 22px;
    stroke: #D2A84A;
    stroke-width: 2.2;
  }

  #mobileFilterBtn::after {
    content: '';
    position: absolute;
    right: 6px;
    top: 50%;
    width: 4px;
    height: 36px;
    background: #D2A84A;
    border-radius: 2px;
    transform: translateY(-50%);
    opacity: .6;
  }
}

/* ===============================
   DESKTOP GRID LAYOUT
=============================== */

@media (min-width: 1024px) {

  .filter-offcanvas .filter-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 22px;
    align-items: start;
  }

  .filter-offcanvas .filter-section {
    width: auto;
    max-width: 420px;
  }

  .filter-price {
    max-width: 420px;
  }
}

/* ===============================
   FILTER SECTION BODY — SAFE
   ❌ БЕЗ ВНУТРІШНІХ СКРОЛІВ
=============================== */

.filter-section__body {
  overflow: visible;
  max-height: none;
}

/* =====================================
   FILTER — TKANYNA CHOKHLA (LABELS)
===================================== */

.filter-tkanyna-chokhla {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-tkanyna-chokhla__item {
  margin: 0;
}

.filter-tkanyna-chokhla__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;
}

.filter-tkanyna-chokhla__btn:hover {
  background: #eaeaea;
}

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

/* =====================================
   FILTER — VYSOTA MATRATSU (LABELS)
===================================== */

.filter-vysota-matratsu {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-vysota-matratsu__item {
  margin: 0;
}

.filter-vysota-matratsu__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;
}

.filter-vysota-matratsu__btn:hover {
  background: #eaeaea;
}

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

/* =====================================
   FILTER — VYSOTA SHAFY (LABELS)
===================================== */

.filter-vysota-shafy {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-vysota-shafy__item {
  margin: 0;
}

.filter-vysota-shafy__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;
}

.filter-vysota-shafy__btn:hover {
  background: #eaeaea;
}

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


/* =====================================
   FILTER — HLYBYNA SHAFY (LABELS)
===================================== */

.filter-hlybyna-shafy {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-hlybyna-shafy__item {
  margin: 0;
}

.filter-hlybyna-shafy__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;
}

.filter-hlybyna-shafy__btn:hover {
  background: #eaeaea;
}

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