/* ============================================================
   PRODUCT LISTING FILTER  ·  product-filter.css  v5.0
   Place in: your-child-theme/product-filter/product-filter.css
   ============================================================ */

/* ── Design tokens ──────────────────────────────────────────── */
:root {
  --pf-accent:        #01275F;
  --pf-accent-light:  #E7F5FF;
  --pf-accent-border: #bfdbfe;
  --pf-text:          #111827;
  --pf-muted:         #6b7280;
  --pf-border:        #e5e7eb;
  --pf-bg:            #ffffff;
  --pf-radius:        10px;
  --pf-shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --pf-shadow-lg:     0 10px 30px rgba(0,0,0,.12);
  --pf-sidebar-w:     272px;
  --pf-gap:           28px;
  --pf-ease:          .18s ease;
}

/* ── Two-column layout ──────────────────────────────────────── */
.pf-wrapper {
  display: grid;
  grid-template-columns: var(--pf-sidebar-w) 1fr;
  gap: var(--pf-gap);
  align-items: start;
  font-family: inherit;
  color: var(--pf-text);
}

/* ════════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════════ */
.pf-sidebar {
  position: sticky;
  top: 90px;                /* ← adjust to match your header height */
  background: var(--pf-bg);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius);
  padding: 22px 20px 24px;
  box-shadow: var(--pf-shadow-sm);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--pf-border) transparent;
}

/* ── Sidebar header ─────────────────────────────────────────── */
.pf-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.pf-sidebar-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--pf-muted);
  margin: 0;
}
.pf-clear-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--pf-accent);
  cursor: pointer;
  text-decoration: underline;
  transition: opacity var(--pf-ease);
}
.pf-clear-btn:hover  { opacity: .65; }
.pf-clear-btn:focus-visible {
  outline: 2px solid var(--pf-accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── Filter group — always visible, no accordion ────────────── */
.pf-filter-group {
  border-top: 1px solid var(--pf-border);
  padding-top: 16px;
  margin-top: 16px;
}
.pf-filter-group:first-of-type {
  border-top: none;
  padding-top: 8px;
  margin-top: 8px;
}

/* Static taxonomy title */
.pf-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--pf-muted);
  margin: 0 0 8px;
  padding: 0;
}

/* ── Term list (always visible) ─────────────────────────────── */
.pf-term-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Checkbox row ───────────────────────────────────────────── */
.pf-term-label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 4px;
  cursor: pointer;
  font-size: 13.5px;
  border-radius: 5px;
  transition: background var(--pf-ease);
  user-select: none;
}
.pf-term-label:hover {
  background: var(--pf-accent-light);
}
.pf-term-label:hover .pf-term-name {
  color: var(--pf-accent);
}

/* Hide the native <input type="checkbox"> */
.pf-term-check {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Custom checkbox box */
.pf-checkmark {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  border: 2px solid var(--pf-border);
  border-radius: 4px;
  background: var(--pf-bg);
  position: relative;
  transition: background var(--pf-ease), border-color var(--pf-ease);
}
/* Tick mark (hidden by default) */
.pf-checkmark::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 2px;
  width: 9px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0);
  transition: transform .12s ease;
}
/* Checked state */
.pf-term-check:checked ~ .pf-checkmark {
  background: var(--pf-accent);
  border-color: var(--pf-accent);
}
.pf-term-check:checked ~ .pf-checkmark::after {
  transform: rotate(-45deg) scale(1);
}
/* Focus ring on the visible proxy (keyboard navigation) */
.pf-term-check:focus-visible ~ .pf-checkmark {
  outline: 2px solid var(--pf-accent);
  outline-offset: 2px;
}

.pf-term-name {
  flex: 1;
  line-height: 1.35;
  transition: color var(--pf-ease);
}
.pf-term-count {
  font-size: 11.5px;
  color: var(--pf-muted);
  flex-shrink: 0;
}

.pf-no-terms {
  font-size: 13px;
  color: var(--pf-muted);
  margin: 10px 0 0;
}

/* ════════════════════════════════════════════════════════════
   MAIN PANEL
   ════════════════════════════════════════════════════════════ */
.pf-main { min-width: 0; }

/* ── Toolbar ────────────────────────────────────────────────── */
.pf-toolbar {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  min-height: 32px;
}
.pf-result-count {
  margin: 0;
  font-size: 13px;
  color: var(--pf-muted);
  line-height: 1.7;
}
.pf-count-num { color: var(--pf-text); font-weight: 700; }

/* ── Active filter tag pills ────────────────────────────────── */
.pf-active-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.pf-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--pf-accent-light);
  color: var(--pf-accent);
  border: 1px solid var(--pf-accent-border);
  border-radius: 20px;
  padding: 3px 10px 3px 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}
.pf-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--pf-accent);
  padding: 2px 5px !important;
  border-radius: 20px;
  font-size: 10px;
  line-height: 1;
  opacity: .55;
  transition: opacity var(--pf-ease);
  display: flex;
  align-items: center;
}
.pf-tag-remove:hover { opacity: 1; }
.pf-tag-remove:focus-visible {
  outline: 2px solid var(--pf-accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── Loop Grid output area ──────────────────────────────────── */
.pf-loop-grid-wrap {
  min-height: 200px;
  transition: opacity .2s ease;
}
.pf-loop-grid-wrap.pf-loading {
  opacity: .4;
  pointer-events: none;
}

/* Main product grid (PHP-rendered) */
.pf-product-grid,
.pf-elementor-loop-grid.e-loop-grid {
  display: grid;
  grid-template-columns: repeat( 3, 1fr );
  gap: 24px;
}
.e-loop-item {
  display: flex;
  flex-direction: column;
}

/* ── Skeleton loader ────────────────────────────────────────── */
.pf-loop-grid-wrap.pf-loading {
  display: grid;
  grid-template-columns: repeat( 3, 1fr );
  gap: 24px;
}
.pf-skeleton-card {
  border-radius: var(--pf-radius);
  overflow: hidden;
  border: 1px solid var(--pf-border);
  animation: pf-pulse 1.5s ease-in-out infinite;
}
@keyframes pf-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .35; }
}
.pf-sk-img   { aspect-ratio: 4/3; background: #e5e7eb; }
.pf-sk-body  { padding: 14px 16px 16px; }
.pf-sk-line  { background: #e5e7eb; border-radius: 4px; margin-bottom: 8px; }
.pf-sk-title { height: 14px; width: 65%; }
.pf-sk-sub   { height: 12px; width: 40%; }

/* ── Empty state ────────────────────────────────────────────── */
.pf-empty {
  text-align: center;
  padding: 72px 24px;
  color: var(--pf-muted);
}
.pf-empty svg {
  width: 44px; height: 44px;
  opacity: .3;
  display: block;
  margin: 0 auto 14px;
}
.pf-empty p { font-size: 15px; margin: 0; line-height: 1.6; }

/* ── Product grid & cards ───────────────────────────────────── */
/* pf-product-grid is output by pf_render_cards() (PHP).        */
/* pf-fallback-grid is kept as an alias for compatibility.       */
.pf-product-grid,
.pf-fallback-grid {
  display: grid;
  grid-template-columns: repeat( 3, 1fr );
  gap: 24px;
}

.pf-card {
  background: var(--pf-bg);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius);
  overflow: hidden;
  box-shadow: var(--pf-shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform var(--pf-ease), box-shadow var(--pf-ease);
}
.pf-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--pf-shadow-lg);
}

/* ── Card image ── */
.pf-card-img-wrap {
  display: block;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #f3f4f6;
}
.pf-card-img-wrap .pf-card-img,
.pf-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
  display: block;
}
.pf-card:hover .pf-card-img-wrap img,
.pf-card:hover .pf-card-img-wrap .pf-card-img { transform: scale(1.04); }
.pf-card-no-img { background: #e5e7eb; }

/* ── Card body ── */
.pf-card-body {
  padding: 16px 18px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pf-card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}
.pf-card-title a {
  color: var(--pf-text);
  text-decoration: none;
}
.pf-card-title a:hover { color: var(--pf-accent); }

.pf-card-excerpt {
  font-size: 13px;
  color: var(--pf-muted);
  line-height: 1.55;
  margin: 0;
  flex: 1;
}

/* ── Taxonomy term badges ── */
.pf-card-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.pf-term-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--pf-accent);
  background: var(--pf-accent-light);
  border: 1px solid var(--pf-accent-border);
  border-radius: 20px;
  padding: 2px 9px;
  white-space: nowrap;
}

/* ── View Product link ── */
.pf-card-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--pf-accent);
  text-decoration: none;
  transition: opacity var(--pf-ease);
}
.pf-card-link:hover { opacity: .75; }

/* ════════════════════════════════════════════════════════════
   PAGINATION
   ════════════════════════════════════════════════════════════ */
.pf-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 36px;
}
.pf-page-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--pf-border);
  background: var(--pf-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--pf-shadow-sm);
  transition: background var(--pf-ease), border-color var(--pf-ease),
              box-shadow var(--pf-ease), opacity var(--pf-ease);
}
.pf-page-btn svg { width: 20px; height: 20px; color: var(--pf-text); }
.pf-page-btn:hover:not([disabled]) {
  background: var(--pf-accent);
  border-color: var(--pf-accent);
  box-shadow: 0 4px 14px rgba(29,78,216,.28);
}
.pf-page-btn:hover:not([disabled]) svg { color: #fff; }
.pf-page-btn:focus-visible {
  outline: 2px solid var(--pf-accent);
  outline-offset: 3px;
}
.pf-page-btn[disabled] { opacity: .3; cursor: not-allowed; }
.pf-page-info {
  font-size: 13px;
  color: var(--pf-muted);
  min-width: 52px;
  text-align: center;
}
.pf-current-page { font-weight: 700; color: var(--pf-text); }

/* ════════════════════════════════════════════════════════════
   COLLAPSIBLE SIDEBAR TOGGLE
   Hidden on desktop; shown as a full-width button on ≤960px.
   ════════════════════════════════════════════════════════════ */

/* Toggle button — hidden on desktop */
.pf-sidebar-toggle {
  display: none;
}

/* Sidebar body — always visible on desktop */
.pf-sidebar-body {
  display: block;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */

/* ── ≤960px: stack sidebar above grid, enable collapse ───── */
@media ( max-width: 960px ) {

  /* Stack layout */
  .pf-wrapper {
    grid-template-columns: 1fr;
  }

  /* Sidebar sits inline, no longer sticky */
  .pf-sidebar {
    position: static;
    max-height: none;
    overflow-y: visible;
    padding: 0;
  }

  /* Show the toggle button */
  .pf-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: var(--pf-bg);
    border: 1px solid var(--pf-border);
    border-radius: var(--pf-radius);
    padding: 13px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--pf-text);
    cursor: pointer;
    box-shadow: var(--pf-shadow-sm);
    transition: background var(--pf-ease), border-color var(--pf-ease);
  }
  .pf-sidebar-toggle:hover {
    background: var(--pf-accent-light);
    border-color: var(--pf-accent);
  }
  .pf-sidebar-toggle:focus-visible {
    outline: 2px solid var(--pf-accent);
    outline-offset: 2px;
  }

  .pf-sidebar-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .pf-sidebar-chevron {
    width: 18px;
    height: 18px;
    color: var(--pf-muted);
    flex-shrink: 0;
    transition: transform var(--pf-ease);
  }
  .pf-sidebar-toggle[aria-expanded="false"] .pf-sidebar-chevron {
    transform: rotate(-90deg);
  }

  /* Collapsible body */
  .pf-sidebar-body {
    overflow: hidden;
    transition: max-height .3s ease, opacity .3s ease;
    /* JS sets max-height dynamically */
  }
  .pf-sidebar-body.is-collapsed {
    max-height: 0 !important;
    opacity: 0;
  }

  /* Inner padding when open */
  .pf-sidebar-body .pf-sidebar-header,
  .pf-sidebar-body .pf-filter-group,
  .pf-sidebar-body .pf-no-terms {
    padding-left: 16px;
    padding-right: 16px;
  }
  .pf-sidebar-body .pf-sidebar-header {
    padding-top: 16px;
  }
  .pf-sidebar-body .pf-filter-group:last-child {
    padding-bottom: 16px;
    margin-bottom: 0;
  }
}

/* ── ≤1024px: 2 product columns ────────────────────────────── */
@media ( max-width: 1024px ) {
  .pf-product-grid,
  .pf-elementor-loop-grid.e-loop-grid,
  .pf-fallback-grid,
  .pf-loop-grid-wrap.pf-loading {
    grid-template-columns: repeat( 2, 1fr );
    gap: 20px;
  }
}

/* ── ≤550px: 1 product column ──────────────────────────────── */
@media ( max-width: 550px ) {
  .pf-product-grid,
  .pf-elementor-loop-grid.e-loop-grid,
  .pf-fallback-grid,
  .pf-loop-grid-wrap.pf-loading {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}