/* Desktop filter drawer: allow scrolling when many sections expanded */

/* Ensure the drawer itself can scroll (desktop + mobile) */
#filter-drawer-panel {
  overflow: hidden; /* keep header/footer fixed; body scrolls */
}

#filter-drawer-panel .woocommerce-product-filters {
  min-height: 0; /* required for nested flex overflow */
}

#filter-drawer-panel .woocommerce-product-filters > .flex-1 {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Accordion behavior: avoid max-height clipping; let the drawer scroll instead */
#filter-drawer-panel .accordion-trigger[aria-expanded="false"] + .accordion-content {
  display: none;
}

#filter-drawer-panel .accordion-trigger[aria-expanded="true"] + .accordion-content {
  display: block;
  max-height: none !important;
  overflow: visible !important;
}

/* STEP31 fix: prevent product hover states while filter drawer is open */
body.filter-drawer-is-open #filter-drawer-overlay {
  z-index: 9998 !important;
  background: rgba(0, 0, 0, 0.55) !important;
}

body.filter-drawer-is-open #filter-drawer-panel {
  z-index: 9999 !important;
}

body.filter-drawer-is-open #archive-product-grid,
body.filter-drawer-is-open #archive-product-grid * {
  pointer-events: none !important;
}

body.filter-drawer-is-open #archive-product-grid .product-card-index:hover,
body.filter-drawer-is-open #archive-product-grid .product-card-index:focus,
body.filter-drawer-is-open #archive-product-grid .product-card-index:focus-within {
  transform: none !important;
  box-shadow: none !important;
}

body.filter-drawer-is-open #archive-product-grid .home-product-quick-view,
body.filter-drawer-is-open #archive-product-grid .quick-view-btn,
body.filter-drawer-is-open #archive-product-grid .add_to_cart_button,
body.filter-drawer-is-open #archive-product-grid .ajax_add_to_cart,
body.filter-drawer-is-open #archive-product-grid .button {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}


/* STEP31 fix: keep toolbar color consistent while drawer is open */
body.filter-drawer-is-open #archive-toolbar-dim {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.price-slider-fill {
  transition: left 160ms ease, width 160ms ease;
}

/* STEP31 FIX — filter drawer button hover + toolbar no-products spacing */
#filter-drawer-apply,
#woocommerce-product-filters-drawer button[type="submit"],
#filter-drawer-panel .filter-apply-btn {
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 120ms ease, box-shadow 180ms ease !important;
}

#filter-drawer-apply:hover,
#woocommerce-product-filters-drawer button[type="submit"]:hover,
#filter-drawer-panel .filter-apply-btn:hover {
  background: #151821 !important;
  border-color: #151821 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(21, 24, 33, 0.16) !important;
}

#filter-drawer-panel a[href*="shop"],
#filter-drawer-panel .clear-filters,
#filter-drawer-panel .reset-filters,
#filter-drawer-panel [data-clear-filters],
#filter-drawer-panel button.clear-filters,
#filter-drawer-panel button.reset-filters {
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 120ms ease, box-shadow 180ms ease !important;
}

#filter-drawer-panel a[href*="shop"]:hover,
#filter-drawer-panel .clear-filters:hover,
#filter-drawer-panel .reset-filters:hover,
#filter-drawer-panel [data-clear-filters]:hover,
#filter-drawer-panel button.clear-filters:hover,
#filter-drawer-panel button.reset-filters:hover {
  background: #151821 !important;
  border-color: #151821 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(21, 24, 33, 0.12) !important;
}

@media (min-width: 768px) {
  body.post-type-archive-product .archive-shop-toolbar,
  body.tax-product_cat .archive-shop-toolbar {
    display: grid !important;
    grid-template-columns: minmax(250px, 320px) minmax(0, 1fr) minmax(250px, 360px) !important;
    align-items: stretch !important;
  }

  body.post-type-archive-product .archive-view-switcher,
  body.tax-product_cat .archive-view-switcher {
    grid-column: 1 !important;
    justify-self: start !important;
    width: 100% !important;
  }

  body.post-type-archive-product .archive-products-count,
  body.tax-product_cat .archive-products-count {
    grid-column: 2 !important;
    justify-self: center !important;
    align-self: center !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0 28px !important;
    text-align: center !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    line-height: 1.6 !important;
  }

  body.post-type-archive-product .archive-toolbar-actions,
  body.tax-product_cat .archive-toolbar-actions,
  body.post-type-archive-product .archive-toolbar-right,
  body.tax-product_cat .archive-toolbar-right {
    grid-column: 3 !important;
    justify-self: end !important;
    width: 100% !important;
  }

  body.post-type-archive-product .archive-sort,
  body.tax-product_cat .archive-sort,
  body.post-type-archive-product .archive-toolbar-action,
  body.tax-product_cat .archive-toolbar-action {
    white-space: nowrap !important;
  }
}

@media (min-width: 768px) and (max-width: 1180px) {
  body.post-type-archive-product .archive-shop-toolbar,
  body.tax-product_cat .archive-shop-toolbar {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(220px, 320px) !important;
  }

  body.post-type-archive-product .archive-products-count,
  body.tax-product_cat .archive-products-count {
    font-size: 10px !important;
    letter-spacing: 0.12em !important;
    padding: 0 18px !important;
  }
}
