/* ============================================================
   Preloved Shop Filter — v1.4.0
   StellarTek (Custom Build) for Preloved Uniforms
============================================================ */
:root {
  --psf-sage:    #8A9489;
  --psf-sage-dk: #6e7a6d;
  --psf-amber:   #E98F00;
  --psf-cream:   #FAF6EF;
  --psf-border:  #e0dbd2;
  --psf-text:    #1a1a1a;
  --psf-muted:   #888;
  --psf-white:   #fff;
  --psf-font:    'Outfit', Arial, sans-serif;
  --psf-body:    'Source Sans 3', Arial, sans-serif;
}

/* ============================================================
   WRAPPER — sits inside Astra's content column
============================================================ */
#psf-wrap {
  width: 100%;
  padding: 0;
  box-sizing: border-box;
}

/* ============================================================
   SEARCH BAR
============================================================ */
.psf-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  width: 100%;
}

.psf-search-wrap {
  position: relative;
  flex: 1;
  max-width: 680px;
}

.psf-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--psf-muted);
  pointer-events: none;
  z-index: 2;
  flex-shrink: 0;
  display: block;
}

.psf-search-input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 44px 0 46px;
  border: 1.5px solid var(--psf-border);
  border-radius: 999px;
  background: var(--psf-white);
  font-family: var(--psf-body);
  font-size: 14px;
  color: var(--psf-text);
  box-sizing: border-box;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
}

.psf-search-input:focus {
  border-color: var(--psf-sage);
  box-shadow: 0 0 0 3px rgba(138,148,137,.13);
}

.psf-search-input::placeholder { color: #bbb; }

.psf-search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--psf-border);
  color: var(--psf-text);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s;
}

.psf-search-clear:hover { background: #ccc; }

/* Mobile toggle */
.psf-mobile-toggle {
  display: none;
  align-items: center;
  gap: 7px;
  height: 48px;
  padding: 0 18px;
  border: 1.5px solid var(--psf-border);
  border-radius: 999px;
  background: var(--psf-white);
  font-family: var(--psf-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--psf-text);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .2s;
}

.psf-mobile-toggle:hover { border-color: var(--psf-sage); }

/* ============================================================
   LAYOUT
============================================================ */
.psf-layout {
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

/* ============================================================
   SIDEBAR
============================================================ */
.psf-sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.psf-sidebar::-webkit-scrollbar { display: none; }

.psf-sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.psf-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 12px;
  margin-bottom: 4px;
}

.psf-sidebar-title {
  font-family: var(--psf-font);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--psf-muted);
}

.psf-clear-all {
  background: none;
  border: none;
  font-family: var(--psf-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--psf-amber);
  cursor: pointer;
  padding: 0;
}

.psf-clear-all:hover { text-decoration: underline; }

/* ============================================================
   PANELS — no box borders, clean dividers only
============================================================ */
.psf-panel {
  border: none;
  border-bottom: 1px solid var(--psf-border);
  background: transparent;
  border-radius: 0;
}

.psf-panel:first-of-type {
  border-top: 1px solid var(--psf-border);
}

.psf-panel-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 2px;
  background: none;
  border: none;
  font-family: var(--psf-font);
  font-size: 13px;
  font-weight: 700;
  color: var(--psf-text);
  cursor: pointer;
  text-align: left;
}

.psf-panel-toggle:hover { color: var(--psf-sage-dk); }

.psf-chevron {
  flex-shrink: 0;
  transition: transform .2s;
  color: var(--psf-muted);
}

.psf-panel-toggle[aria-expanded="false"] .psf-chevron {
  transform: rotate(-90deg);
}

.psf-panel-body {
  padding: 0 2px 14px;
}

/* ============================================================
   FILTER OPTIONS — clean radio list, no checkboxes
============================================================ */
.psf-check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--psf-border) transparent;
}

.psf-check-list::-webkit-scrollbar { width: 3px; }
.psf-check-list::-webkit-scrollbar-thumb { background: var(--psf-border); border-radius: 3px; }

.psf-check-list li { margin: 0; padding: 0; }

.psf-check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-family: var(--psf-body);
  font-size: 13.5px;
  color: var(--psf-text);
  cursor: pointer;
  transition: color .1s;
}

.psf-check-label:hover { color: var(--psf-sage-dk); }

/* Custom radio — circular, brand coloured */
.psf-check-label input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--psf-border);
  border-radius: 50%;
  background: var(--psf-white);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: border-color .15s;
  margin: 0;
}

.psf-check-label input[type="radio"]:checked {
  border-color: var(--psf-sage);
  background: var(--psf-sage);
  box-shadow: inset 0 0 0 3px var(--psf-white);
}

.psf-check-label input[type="radio"]:hover {
  border-color: var(--psf-sage);
}

.psf-clear-panel {
  margin-top: 8px;
  background: none;
  border: none;
  font-family: var(--psf-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--psf-amber);
  cursor: pointer;
  padding: 0;
  display: none;
}

.psf-clear-panel:hover { text-decoration: underline; }

/* School search input */
.psf-school-search {
  display: block;
  width: 100%;
  margin: 4px 0 8px;
  padding: 8px 12px;
  border: 1.5px solid var(--psf-border);
  border-radius: 8px;
  font-family: var(--psf-body);
  font-size: 13px;
  color: var(--psf-text);
  box-sizing: border-box;
  outline: none;
  background: var(--psf-white);
  transition: border-color .2s;
  -webkit-appearance: none;
}

.psf-school-search:focus { border-color: var(--psf-sage); }

/* ============================================================
   PRICE PANEL
============================================================ */
.psf-price-inputs {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 8px 0;
}

.psf-price-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.psf-price-field label {
  font-size: 10px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: .06em !important;
  color: var(--psf-muted) !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  display: block !important;
  text-align: left !important;
}

.psf-price-input {
  width: 100%;
  height: 36px;
  padding: 0 8px;
  border: 1.5px solid var(--psf-border);
  border-radius: 8px;
  font-family: var(--psf-body);
  font-size: 13px;
  color: var(--psf-text);
  box-sizing: border-box;
  outline: none;
  background: var(--psf-white);
  transition: border-color .2s;
  -webkit-appearance: none;
  text-align: center;
}

.psf-price-input:focus { border-color: var(--psf-sage); }

.psf-price-sep {
  color: var(--psf-muted);
  font-size: 14px;
  padding-bottom: 6px;
  flex-shrink: 0;
}

/* Price slider — clean dual track */
.psf-price-range-wrap {
  position: relative;
  height: 28px;
  margin: 12px 0 8px;
}

.psf-price-range-wrap::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
  background: var(--psf-border);
  border-radius: 4px;
  z-index: 0;
}

.psf-range {
  position: absolute;
  width: 100%;
  top: 50%;
  transform: translateY(-50%);
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  height: 28px;
  margin: 0;
  padding: 0;
  z-index: 1;
}

.psf-range::-webkit-slider-runnable-track {
  background: transparent;
  height: 4px;
}

.psf-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--psf-white);
  border: 2px solid var(--psf-sage);
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  cursor: pointer;
  pointer-events: all;
  margin-top: -8px;
  transition: border-color .15s, box-shadow .15s;
}

.psf-range::-webkit-slider-thumb:hover {
  border-color: var(--psf-sage-dk);
  box-shadow: 0 0 0 4px rgba(138,148,137,.15);
}

.psf-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--psf-white);
  border: 2px solid var(--psf-sage);
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  cursor: pointer;
  pointer-events: all;
}

.psf-btn-apply {
  display: block;
  width: 100%;
  height: 38px;
  border: none;
  border-radius: 999px;
  background: var(--psf-sage);
  color: var(--psf-white);
  font-family: var(--psf-font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
  margin-top: 4px;
}

.psf-btn-apply:hover { background: var(--psf-sage-dk); }

/* ============================================================
   RESULTS AREA
============================================================ */
.psf-results-wrap {
  flex: 1;
  min-width: 0;
}

.psf-result-count {
  font-family: var(--psf-body);
  font-size: 13px;
  color: var(--psf-muted);
  margin: 0 0 18px;
}

/* ============================================================
   PRODUCT GRID
============================================================ */
ul.psf-products {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 18px !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

li.psf-product-card {
  background: var(--psf-white);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--psf-border);
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
}

li.psf-product-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.09);
  transform: translateY(-2px);
}

.psf-card-img-wrap {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f5f5f3;
}

.psf-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}

li.psf-product-card:hover .psf-card-img-wrap img {
  transform: scale(1.03);
}

.psf-no-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--psf-body);
  font-size: 12px;
  color: var(--psf-muted);
}

.psf-card-body {
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
}

.psf-card-title {
  font-family: var(--psf-font);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--psf-text);
  text-decoration: none;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.psf-card-title:hover { color: var(--psf-sage-dk); }

.psf-card-price {
  font-family: var(--psf-font);
  font-size: 15px;
  font-weight: 700;
  color: var(--psf-text);
}

.psf-card-price .woocommerce-Price-amount { color: inherit; }

.psf-card-btn {
  display: block;
  margin-top: auto;
  padding: 9px 0;
  border-radius: 999px;
  background: var(--psf-amber);
  color: #1a1a1a;
  font-family: var(--psf-font);
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s;
}

.psf-card-btn:hover { background: #d18000; color: #1a1a1a; }

/* ============================================================
   LOADING / EMPTY
============================================================ */
.psf-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}

.psf-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--psf-border);
  border-top-color: var(--psf-sage);
  border-radius: 50%;
  animation: psf-spin .7s linear infinite;
}

@keyframes psf-spin { to { transform: rotate(360deg); } }

.psf-no-results {
  text-align: center;
  padding: 80px 20px;
  font-family: var(--psf-body);
  color: var(--psf-muted);
}

.psf-no-results p { font-size: 15px; margin: 0 0 18px; }

.psf-btn-reset {
  padding: 11px 24px;
  border: 1.5px solid var(--psf-sage);
  border-radius: 999px;
  background: none;
  font-family: var(--psf-font);
  font-size: 13px;
  font-weight: 700;
  color: var(--psf-sage);
  cursor: pointer;
  transition: background .2s, color .2s;
}

.psf-btn-reset:hover { background: var(--psf-sage); color: var(--psf-white); }

/* ============================================================
   PAGINATION
============================================================ */
.psf-pagination {
  display: flex;
  gap: 6px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.psf-page-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border: 1.5px solid var(--psf-border);
  border-radius: 8px;
  background: var(--psf-white);
  font-family: var(--psf-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--psf-text);
  cursor: pointer;
  transition: all .15s;
}

.psf-page-btn:hover { border-color: var(--psf-sage); color: var(--psf-sage); }
.psf-page-btn.active { background: var(--psf-sage); border-color: var(--psf-sage); color: var(--psf-white); }

/* ============================================================
   HIDE ASTRA'S DEFAULT WC PRODUCT LIST
============================================================ */
.woocommerce ul.products,
.woocommerce-page ul.products {
  display: none !important;
}

/* ============================================================
   MOBILE — ≤ 860px
============================================================ */
@media (max-width: 860px) {

  .psf-mobile-toggle { display: flex; }

  .psf-layout { flex-direction: column; gap: 0; }

  .psf-sidebar {
    width: 100%;
    position: static;
    max-height: none;
    overflow: visible;
    display: none;
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid var(--psf-border);
    border-radius: 12px;
    background: var(--psf-white);
    box-sizing: border-box;
  }

  .psf-sidebar.psf-open { display: block; }

  ul.psf-products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .psf-search-wrap { max-width: 100%; }
}

@media (max-width: 480px) {
  ul.psf-products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .psf-card-body { padding: 10px 10px 12px; }
  .psf-card-title { font-size: 12.5px; }
  .psf-card-price { font-size: 13px; }
}

/* ============================================================
   v1.4.1 FIXES — targeting Astra-specific structural issues
============================================================ */

/* Remove the big blank space: Astra's shop page header/breadcrumb area */
.woocommerce-products-header,
.ast-shop-summary-wrap,
.woocommerce-breadcrumb,
.ast-breadcrumbs-wrapper,
.shop-header-image {
  display: none !important;
}

/* Remove the "Shop" h1 title that floats above our UI */
.woocommerce-products-header__title,
h1.woocommerce-products-header__title,
.ast-woo-shop-page-title {
  display: none !important;
}

/* Fix Astra's content column padding which causes the narrow search bar */
.ast-woo-shop-archive .site-content,
.woocommerce #psf-wrap,
.ast-container #psf-wrap {
  width: 100% !important;
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}

/* Search bar — ensure full width of Astra content column */
.psf-search-bar {
  margin-top: 0 !important;
}

.psf-search-wrap {
  max-width: 100% !important;
  width: 100% !important;
}

/* Fix icon overlap — ensure input left padding is always honoured */
.psf-search-input {
  padding-left: 48px !important;
}

/* Panel toggle headers — remove the heavy dark sage button look,
   keep it as clean text with a subtle hover */
.psf-panel-toggle {
  background: transparent !important;
  color: var(--psf-text) !important;
  padding: 13px 0 !important;
}

.psf-panel-toggle:hover {
  background: transparent !important;
  color: var(--psf-sage-dk) !important;
}

/* Remove any background Astra might be injecting into our sidebar panels */
.psf-panel {
  background: transparent !important;
  border-left: none !important;
  border-right: none !important;
}

/* Province list — ensure it doesn't get cut off by Astra row height */
.psf-sidebar {
  max-height: none !important;
  overflow: visible !important;
  overflow-y: auto !important;
  max-height: calc(100vh - 140px) !important;
}

/* Product grid — force 3 cols against any Astra .column overrides */
.psf-results-wrap ul.psf-products,
#psf-results ul.psf-products {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 18px !important;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  float: none !important;
  clear: none !important;
}

/* Remove any bullet points Astra or WC adds to li items */
#psf-results ul.psf-products li,
#psf-results ul.psf-products li::before,
#psf-results ul.psf-products li::after {
  list-style: none !important;
  content: none !important;
  display: block !important;
  float: none !important;
  clear: none !important;
}

/* Ensure Astra doesn't add padding to our product cards */
li.psf-product-card {
  padding: 0 !important;
  margin: 0 !important;
  width: auto !important;
  float: none !important;
}

/* Responsive overrides */
@media (max-width: 860px) {
  #psf-results ul.psf-products {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 480px) {
  #psf-results ul.psf-products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
}
