.wf-filter {
  margin: 20px 0;
}
.wf-filter__container {
  display: flex;
  justify-content: space-between;
}
.wf-filter__dropdown {
  display: inline-block;
  position: relative;
  border-right: .5px solid #999;
}
.wf-filter__dropdown:last-child {
  border-right: none;
}
.wf-filter__dropdown .wf-filter__dropdown-toggle {
  background: transparent !important;
  color: black !important;
}
.wf-filter__dropdown:hover .wf-filter__dropdown-toggle {
  color: var(--color-primary) !important;
}
.wf-filter__dropdown .wf-filter__dropdown-toggle span {
  transition: .3s ease;
}
.wf-filter__dropdown.open .wf-filter__dropdown-toggle span {
  transform: rotate(90deg);
}
.wf-filter__dropdown-menu {
  display: none;
}
.wf-filter__dropdown.open .wf-filter__dropdown-menu {
  display: block;
}
.wf-filter__dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  line-height: 1.2;
  background: none;
  border: none;
  color: #B89E5B;
  cursor: pointer;
  padding: 0 18px;
  height: 40px;
  line-height: 40px;
  border: 1px solid #ccc;
}
.wf-filter__dropdown-toggle span {
  font-size: 12px;
}
.wf-filter__dropdown-menu {
  display: none;
  position: absolute;
  z-index: 10;
  background: #fff;
  padding: 18px;
  min-width: 240px;
  border-radius: 10px;
  border: 1px solid #eee;
  box-shadow: 0 2px 24px #0002;
}
.wf-filter__dropdown input[type=checkbox] {
  accent-color: var(--color-secondary);
  width: 22px;
  height: 22px;
}
.wf-filter__bar {
  display:flex; 
  width: fit-content;
}
.wf-filter__form .wf-filter__term {
  margin-bottom: 8px;
}
.wf-filter__term span {
  font-size: 14px;
}
.wf-filter__form label {
  display: flex;
  align-items: center;
}
.wf-filter__form input[type="checkbox"] {
  margin: 0;
}
.wf-filter__form span {
  margin-left: 8px;
  width: 90%;
}
.wf-filter__form button {
  width: 100%;
  background: #222;
  color: #fff;
  padding: 10px 0;
  border: none;
  border-radius: 3px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 10px;
}
.wf-filter__terms {
  max-height: 250px;
  overflow: scroll;
}
.wf-filter__active-filters {
  margin-bottom: 20px;
}
.wf-filter__active-filters strong {
  margin-right: 8px;
}
.wf-filter__remove-filter {
  display: inline-block;
  margin: 0 6px;
  padding: 4px 10px;
  background: #eee;
  border-radius: 6px;
  font-size: 13px;
  text-decoration: none;
  color: #000 !important;
}
.wf-filter__submit {
  display: flex;
  justify-content: center;
}
.wf-filter__remove-all {
  display: inline-block;
  margin-left: 10px;
  padding: 4px 10px;
  background: #444;
  color: #fff !important;
  border-radius: 6px;
  font-size: 13px;
  text-decoration: none;
}
.wf-filter__price .price-slider {
  margin: 20px 0;
}
.wf-preloader {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: #ffffffb0;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  text-align: center;
  padding: 50px 0;
  font-size: 24px;
  color: #000000;
}
.wf-spinner {
  display: inline-block;
  width: 50px;
  height: 50px;
  border: 3px solid #ccc;
  border-top-color: #000000;
  border-radius: 50%;
  animation: wf-spin 1s linear infinite;
  margin: 0 auto;
}
@keyframes wf-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.wf-dropdown {
  position: relative;
  display: inline-block;
}
.wf-dropdown button {
  background: transparent !important;
  color: black !important;
  min-width: auto;
  display: flex;
  justify-content: center;
  height: 100%;
  margin: 0;
}
.wf-filter__form--sort {
  display: flex;
  align-items: center;
}
.wf-dropdown__toggle {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 6px 12px;
  cursor: pointer;
  min-width: 200px;
  text-align: left;
  font-size: 14px;
}
.wf-dropdown__menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  margin-top: 5px;
  display: none;
  z-index: 999;
  min-width: 200px;
}
.wf-dropdown.open .wf-dropdown__menu {
  display: block;
}
.wf-dropdown__option {
  padding: 8px 12px;
}
.wf-dropdown__option input {
  display: none;
}
.wf-dropdown__option label {
  display: block;
  cursor: pointer;
}
.wf-dropdown__option input:checked + label {
  font-weight: bold;
  color: #000;
}
.woocommerce-ordering {
  display: none;
}


/* --- mobile controls --- */
.wf-mobile-controls {
  display:none;
  gap:8px;
  width:100%;
  margin:10px 0 14px;
}
.wf-mobile-btn {
  flex:1;
  padding:10px 14px;
  border:1px solid #ddd;
  border-radius:20px;
  background:#fff;
  font-weight:600;
  font-size:14px;
  cursor:pointer;
  justify-content: space-between;
}
.wf-filter .wf-mobile-btn span {
  transition: .3s ease;
}
.wf-mobile-btn--filters.open > span,
.wf-mobile-btn--sort.open > span {
  transform: rotate(90deg);
}

/* upewnij się, że menu ma wysoki z-index (nad innymi elementami) */
.wf-filter__dropdown-menu{
  z-index:1000;
}


@media (max-width:1200px){
  .wf-filter__bar {
    flex-wrap: wrap;
  }
}

/* mobile */
@media (max-width:768px){
  .wf-filter__container{
    flex-direction:column;
  }

  /* pokaż przyciski na mobile */
  .wf-mobile-controls{
    display:flex;
  }

  /* --- Pasek FILTRÓW (cały bar) – wysokość zamiast display --- */
  .wf-filter__bar{
    /* domyślnie zwinięty */
    width: 100%;
    overflow:hidden;
    max-height:0;
    transition:max-height .3s ease;
    flex-direction: column;
    flex-wrap: nowrap;
  }
  .wf-filter.wf-open-filters .wf-filter__bar{
    /* otwarty panel filtrów */
    max-height:2000px; /* wystarczająco duża wartość */
    width:100%;
  }

  /* elementy wewnątrz paska filtrów */
  .wf-filter .wf-filter__dropdown{
    display:block;
    width:100%;
    border-right:0;
    margin-bottom:8px;
  }
  .wf-filter .wf-filter__dropdown-toggle{
    display:flex;
    width:100%;
    justify-content:space-between;
    border-bottom: .5px solid #999;
    border-radius: 0;
  }

  /* --- Pojedynczy dropdown filtra – płynne rozwijanie sekcji --- */
  .wf-filter.wf-open-filters .wf-filter__dropdown-menu {
    position:static;
    min-width:unset;
    box-shadow:none;
    border:0;
    overflow:hidden;
    max-height:0;
    transition:
    max-height .3s ease;
  }
  .wf-filter.wf-open-filters .wf-filter__dropdown.open .wf-filter__dropdown-menu{
    max-height:900px; /* duża wartość – „auto” nie animuje w CSS */
  }

  /* --- Panel SORTUJ – wysokość zamiast display --- */
  .wf-filter__form--sort{
    overflow:hidden;
    max-height:0;
    transition:max-height .28s ease;
    width:100%;
  }
  .wf-filter__form--sort .wf-dropdown {
    width: 100%;
  }
  .wf-filter__form--sort .wf-dropdown__toggle {
    display: none;
  }
  
  .wf-filter.wf-open-sort .wf-filter__form--sort{
    max-height:800px;
  }

  /* Samo menu sortu – nie chowaj przez display, tylko wysokością */
  .wf-filter__form--sort .wf-dropdown__menu{
    /* upewnij się, że menu istnieje w przepływie */
    display:block;              /* nadpisuje ewentualne reguły desktopowe */
    position:static;
    margin-top:8px;
    border:1px solid #eee;
    border-radius:8px;
    box-shadow:none;
    border: none;
    overflow:hidden;
    max-height:0;
    transition:max-height .28s ease;
  }
  .wf-filter.wf-open-sort .wf-dropdown__menu{
    max-height:600px;
  }
  .wf-dropdown__option {
    border-bottom: .5px solid #999;
    border-radius: 0;
  }
}
