.wpf-tax-filters {
  border: 1px solid #e2e2e2;
  padding: 12px;
  margin-bottom: 16px;
}

.wpf-tax-filters__group {
  margin-bottom: 12px;
}

.wpf-tax-filters__group--hidden {
  display: none;
}

.wpf-tax-filters__label {
  font-weight: 600;
  margin-bottom: 6px;
}

.wpf-tax-filters__option {
  display: block;
  margin-bottom: 4px;
  white-space: normal;
  word-break: break-word;
}

.wpf-tax-filters__option--hidden {
  display: none !important;
}

.wpf-tax-filters__show-more {
  margin-top: 6px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--wp--preset--color--palette-color-1);
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wpf-tax-filters__show-more-icon {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform 0.2s ease;
}

.wpf-tax-filters__group.is-expanded .wpf-tax-filters__show-more-icon {
  transform: rotate(180deg);
}

.wpf-tax-filters select {
  width: 100%;
  max-width: 100%;
}

.wpf-tax-filters__dropdown {
  position: relative;
}

.wpf-tax-filters__dropdown-toggle {
  width: 100% !important;
  text-align: left !important;
  background: #fff !important;
  border: 1px solid #ccc !important;
  padding: 6px 10px !important;
  cursor: pointer !important;
}

.wpf-tax-filters__dropdown-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  background: #fff;
  border: 1px solid #ccc;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  z-index: 10;
}

.wpf-tax-filters__dropdown.is-open .wpf-tax-filters__dropdown-menu {
  display: block;
}

.wpf-tax-filters__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: center;
}

.wpf-tax-filters__selected {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wpf-tax-filters__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid #111;
  border-radius: 999px;
  background: #f7f7f7;
  color: #111;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
}

.wpf-tax-filters__chip-remove {
  font-weight: 700;
  line-height: 1;
}

.wpf-tax-filters__apply {
  display: none !important;
}

.wpf-tax-filters__reset,
.wpf-tax-filters__apply {
  text-transform: uppercase;
}

.wpf-tax-filters.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

@media (max-width: 768px) {
  html.wpf-tax-filters--locked,
  body.wpf-tax-filters--locked {
    overflow: hidden;
    height: 100%;
  }

  .wpf-tax-filters-mobile {
    position: sticky;
    top: 0;
    z-index: 999;
    background: #fff;
    border-bottom: 1px solid #e2e2e2;
    padding: 10px;
    text-align: center;
  }

  .wpf-tax-filters-mobile.is-open {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    z-index: 999999;
    display: block;
    border-bottom: 0;
  }

  .wpf-tax-filters__mobile-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border: 1px solid #111;
    background: #fff;
    color: #111;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    justify-content: center;
    width: 70%;
  }

  .wpf-tax-filters__mobile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  .wpf-tax-filters__mobile-panel {
    display: none;
    padding: 12px;
    background: #fff;
    height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 200px;
    text-align: left;
  }

  .wpf-tax-filters-mobile.is-open .wpf-tax-filters__mobile-panel {
    display: block;
  }

  .wpf-tax-filters-mobile.is-open .wpf-tax-filters {
    display: block;
    height: auto;
  }

  .wpf-tax-filters__scroll {
    overflow: visible;
    padding-bottom: 0;
  }

  .wpf-tax-filters__actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    background: #fff;
    padding: 10px 12px 14px;
    margin-top: 0;
    margin-bottom: 0;
    justify-content: center;
    box-shadow: -2px 0 8px rgba(47, 27, 27, 0.08), 2px 2px 6px rgba(47, 27, 27, 0.08);
    z-index: 10;
  }

  .wpf-tax-filters__apply {
    display: inline-block !important;
  }
}

/* ==========================================================================
   Modern catalog improvements & color swatches
   ========================================================================== */

/* Sticky Sidebar for desktop */
@media (min-width: 1025px) {
  #secondary,
  .sidebar {
    position: sticky !important;
    top: 130px !important; /* Zapobiega nakładaniu się na główny header */
    align-self: flex-start !important;
    z-index: 10 !important;
  }

  .wpf-tax-filters-wrapper {
    max-height: calc(100vh - 160px) !important; /* Dostosowanie do wysokości ekranu minus marginesy */
    overflow-y: auto !important; /* Włączenie niezależnego przewijania filtrów */
    padding-right: 12px !important; /* Przestrzeń na estetyczny suwak */
  }

  /* Stylizacja suwaka wewnątrz filtrów na bardziej minimalistyczny (Webkit) */
  .wpf-tax-filters-wrapper::-webkit-scrollbar {
    width: 6px !important;
  }
  .wpf-tax-filters-wrapper::-webkit-scrollbar-track {
    background: transparent !important;
  }
  .wpf-tax-filters-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e0 !important;
    border-radius: 3px !important;
  }
  .wpf-tax-filters-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a0aec0 !important;
  }
}

/* Nowoczesna stylistyka dla standardowych checkboxów */
.wpf-tax-filters__option:not(.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option) {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #4a5568;
  margin-bottom: 6px;
  user-select: none;
}

.wpf-tax-filters__option:not(.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option) input[type="checkbox"] {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 18px !important;
  height: 18px !important;
  border: 1px solid #cbd5e0 !important;
  border-radius: 4px !important;
  outline: none !important;
  transition: all 0.2s ease !important;
  background-color: #fff !important;
  position: relative !important;
  cursor: pointer !important;
  display: inline-block !important;
  margin: 0 !important;
}

.wpf-tax-filters__option:not(.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option) input[type="checkbox"]:checked {
  background-color: #2b6cb0 !important;
  border-color: #2b6cb0 !important;
}

.wpf-tax-filters__option:not(.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option) input[type="checkbox"]:checked::after {
  content: "" !important;
  position: absolute !important;
  left: 5px !important;
  top: 2px !important;
  width: 5px !important;
  height: 10px !important;
  border: solid #ffffff !important;
  border-width: 0 2px 2px 0 !important;
  transform: rotate(45deg) !important;
}

/* Styling Color Swatches for pa_kolor */
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__control {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin-top: 8px !important;
}

.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option {
  display: inline-flex;
  position: relative;
  margin-bottom: 0;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 4px 12px 4px 30px; /* Pozwala na zmieszczenie kółka koloru po lewej */
  background: #ffffff;
  font-size: 0.85rem;
  font-weight: 500;
  color: #4a5568;
  transition: all 0.2s ease;
  user-select: none;
}

/* Ukrycie standardowego checkboxa */
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option input[type="checkbox"],
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option input[type="radio"] {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
}

/* Kółko reprezentujące kolor */
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option::before {
  content: "" !important;
  position: absolute !important;
  left: 8px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 14px !important;
  height: 14px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  transition: transform 0.2s ease !important;
}

/* Definicje konkretnych kolorów na podstawie wartości slug w input */
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="szar"])::before { background-color: #a0aec0 !important; }
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="bez"])::before { background-color: #e2d2b5 !important; }
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="crem"])::before { background-color: #f7e7ce !important; }
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="krem"])::before { background-color: #f7e7ce !important; }
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="czarn"])::before { background-color: #1a202c !important; }
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="bial"])::before { background-color: #ffffff !important; }
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="braz"])::before { background-color: #8b5a2b !important; }
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="niebiesk"])::before { background-color: #3182ce !important; }
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="zielon"])::before { background-color: #38a169 !important; }
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="czerwon"])::before { background-color: #e53e3e !important; }
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="antracyt"])::before { background-color: #2d3748 !important; }
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="grafit"])::before { background-color: #4a5568 !important; }
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="miedz"])::before { background-color: #b87333 !important; }
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="srebr"])::before { background-color: #e2e8f0 !important; }
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input[value*="zlot"])::before { background-color: #ecc94b !important; }

/* Domyślny kolor dla pozostałych */
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option::before {
  background-color: #e2e8f0 !important;
}

/* Stan zaznaczony */
.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input:checked) {
  border-color: #2b6cb0 !important;
  background-color: #ebf8ff !important;
  color: #2b6cb0 !important;
}

.wpf-tax-filters__group[data-key="pa_kolor"] .wpf-tax-filters__option:has(input:checked)::before {
  transform: translateY(-50%) scale(1.15) !important;
}

/* Wymuszenie ukrycia opcji powyżej limitu "Pokaż więcej" */
.wpf-tax-filters__option.wpf-tax-filters__option--hidden {
  display: none !important;
}

/* Stylizacja górnego kontenera z aktywnymi filtrami */
.wpf-tax-filters__selected-top {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin-bottom: 25px !important;
  width: 100% !important;
}



