/*
 * Panel filtrów (ps_facetedsearch) – jeden element .os-filters dla wszystkich szerokości:
 *   telefon  < 768 px   arkusz wysuwany od dołu,
 *   tablet   < 1200 px  panel boczny,
 *   komputer ≥ 1200 px  wąska, przyklejona kolumna po lewej.
 * Logika filtrowania zostaje w module; tu jest tylko wygląd. Ładowane z catalog/listing/product-list.tpl.
 */
.os-filters {
  --bs-offcanvas-width: min(24rem, 92vw);
  --bs-offcanvas-bg: #fff;
  --of-ink: #0f172a;
  --of-text: #475569;
  --of-muted: #64748b;
  --of-line: #e2e8f0;
  color: var(--of-text);
}

.os-filters__title {
  margin: 0;
  color: var(--of-ink);
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.3;
}

.os-filters__heading {
  display: none;
  align-items: center;
  gap: .625rem;
  margin: 0 0 .5rem;
  color: var(--of-ink);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.4;
}

.os-filters__heading svg {
  flex: none;
  color: var(--of-muted);
}

.os-filters__footer {
  display: none;
}

/* ---------- Poniżej 1200 px: panel wysuwany ---------- */
@media (max-width: 1199.98px) {
  .os-filters.offcanvas-xl {
    border: 0;
    box-shadow: 0 0 48px rgb(15 23 42 / .28);
  }

  .os-filters__header.offcanvas-header {
    flex: none;
    align-items: center;
    justify-content: space-between;
    padding: .875rem 1rem .75rem 1.25rem;
    border-bottom: 1px solid var(--of-line);
  }

  .os-filters__close.btn-close {
    flex: none;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    background-color: #f8fafc;
    background-size: .75rem;
    opacity: 1;
  }

  .os-filters__close.btn-close:hover {
    background-color: var(--of-line);
  }

  .os-filters__body.offcanvas-body {
    flex: 1 1 auto;
    padding: .25rem 1.25rem 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .os-filters__footer {
    display: block;
    flex: none;
    padding: .75rem 1.25rem calc(.75rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--of-line);
    background: #fff;
  }

  .os-filters__apply.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3rem;
    padding: .625rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
  }
}

/* Telefon: arkusz od dołu na całą szerokość. Stany .show/.showing powtórzone, bo ten arkusz
   stoi poza warstwami Bootstrapa i inaczej nadpisałby jego regułę odsłaniającą panel. */
@media (max-width: 767.98px) {
  .os-filters.offcanvas-xl.offcanvas-start {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 86vh;
    height: 86dvh;
    max-height: 100%;
    border-radius: 1.25rem 1.25rem 0 0;
    transform: translateY(100%);
  }

  .os-filters.offcanvas-xl.offcanvas-start.showing,
  .os-filters.offcanvas-xl.offcanvas-start.show:not(.hiding) {
    transform: none;
  }
}

/* ---------- Od 1200 px: kolumna po lewej, przyklejona podczas przewijania listy ---------- */
@media (min-width: 1200px) {
  .os-filters {
    position: sticky;
    top: 5.5rem;
    max-height: calc(100vh - 6.5rem);
    padding: 0 .5rem 1rem 0;
    overflow-y: auto;
    scrollbar-width: thin;
  }

  .os-filters__body.offcanvas-body {
    display: block;
  }

  .os-filters__heading {
    display: flex;
  }
}

/* ---------- Sekcje filtrów ---------- */
.os-filters #search-filters {
  display: block;
}

.os-filters #search-filters .accordion {
  --bs-accordion-bg: transparent;
}

.os-filters #search-filters .accordion-item {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--of-line);
  background: transparent;
}

.os-filters #search-filters .accordion-item:last-child {
  border-bottom: 0;
}

.os-filters #search-filters .accordion-button {
  gap: .75rem;
  min-height: 48px;
  padding: .75rem 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--of-ink);
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.4;
  text-transform: none;
}

.os-filters #search-filters .accordion-button:hover {
  color: #94470c;
}

.os-filters #search-filters .accordion-button::after {
  width: .75rem;
  height: .75rem;
  background-size: .75rem;
  opacity: .6;
}

.os-filters #search-filters .accordion-body {
  margin: 0;
  padding: 0 0 .875rem;
  list-style: none;
}

.os-filters #search-filters .search-filters__link {
  display: block;
  color: #334155;
  font-size: .9375rem;
  line-height: 1.45;
  text-decoration: none;
}

.os-filters #search-filters .search-filters__link:hover {
  color: #94470c;
}

.os-filters #search-filters .search-filters__magnitude {
  color: var(--of-muted);
  font-size: .8125rem;
}

/* Cały wiersz opcji jest polem dotyku (min. 44 px). */
.os-filters #search-filters .form-check {
  display: flex;
  align-items: center;
  gap: .625rem;
  min-height: 44px;
  margin: 0;
  padding: .25rem 0;
}

.os-filters #search-filters .form-check-input {
  flex: 0 0 1.25rem;
  float: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  border-color: #94a3b8;
  cursor: pointer;
}

.os-filters #search-filters .form-check-input[type='checkbox'] {
  border-radius: .3125rem;
}

.os-filters #search-filters .form-check-input:checked {
  border-color: #bd5b08;
  background-color: #f5831f;
}

.os-filters #search-filters .form-check-label {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
  min-height: 2.25rem;
  cursor: pointer;
}

/* Lista „Dostępność” ma własny, bezramkowy wygląd w store-redesign.css – tutaj zostaje pominięta. */
.os-filters #search-filters .accordion-item:not([data-type='availability']) .search-filters__dropdown-toggle,
.os-filters #search-filters .accordion-item:not([data-type='availability']) .search-filters__dropdown-toggle:is(:hover, :focus, :active, [aria-expanded='true']) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  width: 100%;
  min-height: 44px;
  padding: .5rem .875rem;
  border: 1px solid #cbd5e1;
  border-radius: .75rem;
  background: #fff;
  box-shadow: none;
  color: #334155;
  font-size: .9375rem;
  font-weight: 400;
  text-align: left;
  white-space: normal;
}

.os-filters #search-filters .accordion-item:not([data-type='availability']) .search-filters__dropdown-toggle:is(:hover, [aria-expanded='true']) {
  border-color: #fdba74;
}

.os-filters #search-filters .dropdown-menu {
  min-width: 100%;
  max-height: 18rem;
  padding: .375rem;
  overflow-y: auto;
  border: 1px solid var(--of-line);
  border-radius: .75rem;
  box-shadow: 0 12px 28px rgb(15 23 42 / .14);
}

.os-filters #search-filters .dropdown-item {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: .5rem .625rem;
  border-radius: .5rem;
  font-size: .9375rem;
  white-space: normal;
}

.os-filters #search-filters .dropdown-item:hover {
  background: #fff7ed;
  color: #94470c;
}

.os-filters #search-filters .search-filters__clear {
  margin: 0 0 .5rem;
}

.os-filters #search-filters .js-search-filters-clear-all {
  width: 100%;
  min-height: 44px;
  border: 1px solid #fdba74;
  border-radius: .75rem;
  background: #fff7ed;
  color: #94470c;
  font-size: .875rem;
  font-weight: 700;
}

/* Cena: suwak i pola „Od / Do”. */
.os-filters #search-filters .search-filters__slider-container {
  margin: 0;
  padding: .5rem .625rem 1rem;
}

.os-filters #search-filters .noUi-target {
  height: 4px;
  margin: .5rem 0 1.25rem;
  border: 0;
  background: var(--of-line);
  box-shadow: none;
}

.os-filters #search-filters .noUi-connect {
  background: #f5831f;
}

.os-filters #search-filters .noUi-handle {
  top: -9px;
  right: -11px;
  width: 22px;
  height: 22px;
  border: 2px solid #f5831f;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgb(15 23 42 / .15);
}

.os-filters #search-filters .noUi-handle::before,
.os-filters #search-filters .noUi-handle::after {
  display: none;
}

.os-filters #search-filters .noUi-touch-area {
  position: absolute;
  inset: -11px;
}

.os-filters #search-filters .js-faceted-values {
  padding: .5rem .625rem;
  border-radius: .5rem;
  background: #f8fafc;
  color: var(--of-text);
  font-size: .875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.os-filters #search-filters .search-filters__price-form {
  margin-top: .25rem;
}

.os-filters #search-filters .search-filters__price-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .625rem;
}

.os-filters #search-filters .search-filters__price-field {
  min-width: 0;
}

.os-filters #search-filters .search-filters__price-field label {
  display: block;
  margin-bottom: .375rem;
  color: var(--of-muted);
  font-size: .8125rem;
}

.os-filters #search-filters .search-filters__price-field input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: .5rem .625rem;
  border: 1px solid #cbd5e1;
  border-radius: .625rem;
  background: #fff;
  color: var(--of-ink);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.os-filters #search-filters .search-filters__price-apply {
  width: 100%;
  min-height: 44px;
  margin-top: .625rem;
  padding: .375rem .75rem;
  border: 1px solid #334155;
  border-radius: .75rem;
  background: #fff;
  color: var(--of-ink);
  font-size: .9375rem;
  font-weight: 700;
}

.os-filters #search-filters .search-filters__price-apply:hover {
  border-color: var(--of-ink);
  background: #f1f5f9;
  color: var(--of-ink);
}

.os-filters :is(a, button, input, .noUi-handle):focus-visible {
  outline: 3px solid #b45a0d;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .os-filters #search-filters .search-filters__dropdown-toggle {
    transition: border-color .15s ease;
  }
}
