/* ==========================================================================
   PRODUCT FILTERS (sidebar / mobile overlay) — /shop only.
   Split out of archive-product-reskin.css. Scope (#wp--skip-link--target)
   and every !important kept 1:1 — this file loads only on is_shop(), after
   wp2025custom-reskin (which supplies the :root tokens + reset).

   Coupling: the max-width:767.98px overlay breakpoint below MUST stay equal
   to the min-width:768px row/column split in archive-product-list-reskin.css
   — otherwise the two disagree in the 601-767px gap (row layout, collapsed
   filter).
   ========================================================================== */

/* --- Filter panel (sidebar) --- */
#wp--skip-link--target .wc-block-product-filters {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  background: var(--surface) !important;
}

#wp--skip-link--target .wc-block-product-filters__open-overlay {
  display: none;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  min-height: 44px;
  background: var(--bg) !important;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
}

#wp--skip-link--target .wc-block-product-filters__open-overlay:hover {
  background: var(--surface-200) !important;
  border-color: var(--border-400);
}

@media (max-width: 767.98px) {
  /* Below 768px only the open-overlay button shows — the panel itself
     (border/radius/padding/bg) is desktop sidebar chrome and should be
     invisible around the button. */
  #wp--skip-link--target .wc-block-product-filters {
    border: none;
    border-radius: 0;
    padding: 0;
    background: transparent !important;
  }

  #wp--skip-link--target .wc-block-product-filters__open-overlay {
    display: flex;
  }

  #wp--skip-link--target .wc-block-product-filters__overlay-content {
    display: none;
  }

  #wp--skip-link--target .wc-block-product-filters.is-overlay-opened .wc-block-product-filters__overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(25, 25, 24, 0.4) !important;
    display: flex;
    align-items: flex-end;
  }

  #wp--skip-link--target .wc-block-product-filters:not(.is-overlay-opened) .wc-block-product-filters__overlay {
    display: none;
  }

  /* WC's own rule pins this to position:absolute; inset:0 (used to slide it
     in/out via transform). Left as-is it stretches top:0 to bottom:0, and
     since max-height:88vh over-constrains that stretch, the UA drops
     `bottom` and keeps `top:0` — docking the sheet to the top edge instead
     of the bottom. Overriding to inset from the bottom only (top:auto)
     keeps WC's slide transform working while actually anchoring it as a
     bottom sheet. */
  #wp--skip-link--target .wc-block-product-filters__overlay-dialog {
    position: absolute;
    inset: auto 0 0 0;
    background: var(--bg) !important;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    padding: 1.25rem;
  }

  #wp--skip-link--target .wc-block-product-filters.is-overlay-opened .wc-block-product-filters__overlay-content {
    display: block;
  }

  /* Float the close control as a bare top-right icon button (modal-corner
     convention) instead of a bordered header row, so the sheet reads as
     content-first with the dismiss action out of the normal flow. Label
     text stays for assistive tech, hidden visually only. */
  #wp--skip-link--target .wc-block-product-filters__overlay-header {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 1;
    display: flex;
    justify-content: flex-end;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
  }

  #wp--skip-link--target .wc-block-product-filters__close-overlay {
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    background: var(--surface) !important;
  }

  #wp--skip-link--target .wc-block-product-filters__close-overlay span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  #wp--skip-link--target .wc-block-product-filters__overlay-content {
    padding-top: 2.5rem;
  }
}

@media (min-width: 768px) {

  #wp--skip-link--target .wc-block-product-filters__overlay-header,
  #wp--skip-link--target .wc-block-product-filters__overlay-footer {
    display: none;
  }
}

#wp--skip-link--target .wc-block-product-filters__close-overlay {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 44px;
  min-width: 44px;
  justify-content: center;
  background: none !important;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

#wp--skip-link--target .wc-block-product-filters__close-overlay:hover {
  color: var(--muted-600);
}

#wp--skip-link--target .wc-block-product-filters__overlay-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 1rem;
}

#wp--skip-link--target .wc-block-product-filters__apply {
  width: 100%;
  min-height: 44px;
  border-radius: 999px;
  border: none;
  background: var(--accent-500) !important;
  color: var(--fg) !important;
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
}

#wp--skip-link--target .wc-block-product-filters__apply:hover {
  background: var(--accent-600) !important;
}

#wp--skip-link--target .wc-block-product-filters__apply:active {
  background: var(--accent-700) !important;
}

/* --- Active filter chips --- */
#wp--skip-link--target .wc-block-product-filter-removable-chips__items {
  list-style: none;
  display: flex !important;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0 0 0.75rem;
}

#wp--skip-link--target .wc-block-product-filter-removable-chips__item {
  display: flex !important;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.375rem;
  max-width: 100%;
  background: var(--bg) !important;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.375rem 0.5rem 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

#wp--skip-link--target .wc-block-product-filter-removable-chips__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

#wp--skip-link--target .wc-block-product-filter-removable-chips__remove {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: none !important;
  color: var(--muted);
  cursor: pointer;
  border-radius: 50%;
}

#wp--skip-link--target .wc-block-product-filter-removable-chips__remove-icon {
  fill: currentColor !important;
}

#wp--skip-link--target .wc-block-product-filter-removable-chips__remove:hover {
  color: var(--bg) !important;
  background: var(--fg) !important;
}

#wp--skip-link--target .wc-block-product-filter-clear-button .wp-block-button__link {
  display: inline-flex !important;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--fg) !important;
  border-radius: 999px;
  background: var(--bg) !important;
  color: var(--fg) !important;
  font-weight: 600;
  font-size: 0.8125rem;
  cursor: pointer;
}

#wp--skip-link--target .wc-block-product-filter-clear-button .wp-block-button__link:hover {
  background: var(--fg) !important;
  color: var(--bg) !important;
}

/* --- Filter section headings --- */
#wp--skip-link--target .wc-block-product-filters__overlay-content .wp-block-heading {
  font-size: 0.9375rem !important;
  font-weight: 700;
}

#wp--skip-link--target [data-block-name="woocommerce/product-filter-price"],
#wp--skip-link--target [data-block-name="woocommerce/product-filter-taxonomy"],
#wp--skip-link--target [data-block-name="woocommerce/product-filter-status"],
#wp--skip-link--target [data-block-name="woocommerce/product-filter-rating"] {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 1rem;
}

/* --- Price slider --- */
#wp--skip-link--target .wc-block-product-filter-price-slider__range {
  position: relative;
  height: 4px;
  background: var(--border) !important;
  border-radius: 999px;
  margin: 1.5rem 0.5rem 1rem;
}

#wp--skip-link--target .wc-block-product-filter-price-slider__range .range-bar {
  position: absolute;
  left: var(--low);
  right: calc(100% - var(--high));
  top: 0;
  bottom: 0;
  background: var(--accent-500) !important;
  border-radius: 999px;
}

#wp--skip-link--target .wc-block-product-filter-price-slider__range input[type="range"] {
  position: absolute;
  top: -10px;
  width: 100%;
  height: 24px;
  margin: 0;
  background: none !important;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}

#wp--skip-link--target .wc-block-product-filter-price-slider__range input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  pointer-events: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg) !important;
  border: 2px solid var(--accent-600);
  cursor: pointer;
}

#wp--skip-link--target .wc-block-product-filter-price-slider__range input[type="range"]:hover::-webkit-slider-thumb {
  border-color: var(--accent-700);
}

#wp--skip-link--target .wc-block-product-filter-price-slider__range input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg) !important;
  border: 2px solid var(--accent-600);
  cursor: pointer;
}

#wp--skip-link--target .wc-block-product-filter-price-slider__content {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

#wp--skip-link--target .wc-block-product-filter-price-slider__content .wc-block-product-filter-price-slider__range {
  flex: 1 1 100%;
}

#wp--skip-link--target .wc-block-product-filter-price-slider__left,
#wp--skip-link--target .wc-block-product-filter-price-slider__right {
  flex: 1 1 auto;
}

#wp--skip-link--target .wc-block-product-filter-price-slider__left input,
#wp--skip-link--target .wc-block-product-filter-price-slider__right input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  background: var(--bg) !important;
}

#wp--skip-link--target .wc-block-product-filter-price-slider__left input:focus-visible,
#wp--skip-link--target .wc-block-product-filter-price-slider__right input:focus-visible {
  border-color: var(--accent-600);
}

/* --- Filter checkbox lists --- */
#wp--skip-link--target .wc-block-product-filter-checkbox-list fieldset {
  border: none !important;
  margin: 0;
  padding: 0;
  min-width: 0;
}

#wp--skip-link--target .wc-block-product-filter-checkbox-list__items {
  display: flex !important;
  flex-direction: column;
  gap: 0.5rem;
}

#wp--skip-link--target .wc-block-product-filter-checkbox-list__label {
  display: flex !important;
  align-items: center;
  gap: 0.625rem;
  min-height: 32px;
  cursor: pointer;
  font-size: 0.875rem;
}

#wp--skip-link--target .wc-block-product-filter-checkbox-list__input-wrapper {
  position: relative;
  width: 18px;
  height: 18px;
  flex: none;
}

#wp--skip-link--target .wc-block-product-filter-checkbox-list__input {
  position: absolute;
  inset: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

#wp--skip-link--target .wc-block-product-filter-checkbox-list__mark {
  position: absolute;
  inset: 0;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-400);
  border-radius: 4px;
  background: var(--bg) !important;
  color: transparent;
  pointer-events: none;
}

#wp--skip-link--target .wc-block-product-filter-checkbox-list__input:hover~.wc-block-product-filter-checkbox-list__mark {
  border-color: var(--fg);
}

#wp--skip-link--target .wc-block-product-filter-checkbox-list__input:checked~.wc-block-product-filter-checkbox-list__mark {
  background: var(--fg) !important;
  border-color: var(--fg);
  color: var(--bg);
}

#wp--skip-link--target .wc-block-product-filter-checkbox-list__input:focus-visible~.wc-block-product-filter-checkbox-list__mark {
  outline: 2px solid var(--accent-600);
  outline-offset: 2px;
}
