/* ============================================================
   Product Filter Ajax Pro — Frontend Styles
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --pfap-primary:       #6366f1;
  --pfap-primary-dark:  #4f46e5;
  --pfap-primary-light: #ede9fe;
  --pfap-accent:        #f59e0b;
  --pfap-success:       #22c55e;
  --pfap-danger:        #ef4444;
  --pfap-bg:            #f8fafc;
  --pfap-card:          #ffffff;
  --pfap-border:        #e2e8f0;
  --pfap-border-hover:  #c7d2fe;
  --pfap-text:          #1e293b;
  --pfap-text-light:    #64748b;
  --pfap-radius:        12px;
  --pfap-radius-sm:     8px;
  --pfap-shadow:        0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --pfap-shadow-md:     0 4px 20px rgba(0,0,0,.10);
  --pfap-shadow-card:   0 2px 12px rgba(99,102,241,.08);
  --pfap-transition:    all .22s cubic-bezier(.4,0,.2,1);
}

/* ── Skin: Modern — Bo tròn mạnh, đổ bóng rõ ────────────────── */
.pfap-skin-modern {
  --pfap-radius:      24px;
  --pfap-radius-sm:   14px;
  --pfap-shadow:      0 4px 16px rgba(0,0,0,.10);
  --pfap-shadow-md:   0 8px 28px rgba(0,0,0,.14);
  --pfap-shadow-card: 0 4px 20px rgba(0,0,0,.12);
}

/* ── Skin: Minimal — Phẳng, góc vuông, viền mỏng ───────────── */
.pfap-skin-minimal {
  --pfap-radius:      2px;
  --pfap-radius-sm:   2px;
  --pfap-shadow:      none;
  --pfap-shadow-md:   0 1px 4px rgba(0,0,0,.08);
  --pfap-shadow-card: 0 1px 4px rgba(0,0,0,.06);
  --pfap-border:      #d0d5dd;
}

/* ── Layout ────────────────────────────────────────────────── */

/* Reset theme global styles that bleed into the filter panel (e.g. Flatsome).
   Scoped to .pfap-filter-panel and .pfap-drawer only — never touches .pfap-results-area
   so WooCommerce product cards rendered by the theme stay unaffected. */
.pfap-filter-panel *::before,
.pfap-filter-panel *::after,
.pfap-drawer *::before,
.pfap-drawer *::after {
  border-left: none !important;
  border-right: none !important;
}
.pfap-filter-panel ul,
.pfap-filter-panel ol,
.pfap-drawer ul,
.pfap-drawer ol {
  list-style: none;
  padding: 0;
  margin: 0;
}
.pfap-filter-panel li,
.pfap-drawer li {
  border: none !important;
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  border-bottom: none !important;
  background-image: none !important;
  box-shadow: none !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
}
/* Restore indent for nested category tree */
.pfap-check-nested > li {
  padding-left: 0 !important;
  margin-left: 0 !important;
}
.pfap-filter-panel li::before,
.pfap-filter-panel li::after,
.pfap-drawer li::before,
.pfap-drawer li::after {
  display: none !important;
  content: none !important;
  border: none !important;
}

.pfap-wrapper {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  width: 100%;
}

.pfap-wrapper--top {
  flex-direction: column;
}

.pfap-wrapper--top .pfap-filter-panel {
  width: 100%;
}

/* ── Sidebar mode (widget in WC sidebar) ─────────────────── */
.pfap-wrapper--sidebar-mode {
  display: block;
}

.pfap-wrapper--sidebar-mode .pfap-filter-panel {
  width: 100%;
  position: static;
  box-shadow: none;
}

.pfap-wrapper--top .pfap-filter-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.pfap-wrapper--top .pfap-filter-section {
  flex: 0 0 auto;
  min-width: 180px;
}

/* ── Filter Panel ──────────────────────────────────────────── */
.pfap-filter-panel {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
}

.pfap-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  background: var(--pfap-primary);
  color: #fff;
  border-radius: var(--pfap-radius) var(--pfap-radius) 0 0;
}

.pfap-filter-header__title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pfap-filter-header__title svg { opacity: .9; }

/* ── Panel search (inside sidebar) ────────────────────────── */
.pfap-panel-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--pfap-border);
}

.pfap-panel-search__wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pfap-panel-search__wrap input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--pfap-border);
  border-radius: var(--pfap-radius-sm);
  font-size: 13px;
  color: var(--pfap-text);
  background: var(--pfap-bg);
  transition: border-color .15s;
  box-sizing: border-box;
}

.pfap-panel-search__wrap input:focus {
  outline: none;
  border-color: var(--pfap-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}



.pfap-filter-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px;
  min-height: 28px;
  max-width: 28px;
  max-height: 28px;
  border-radius: 50% !important;
  box-sizing: content-box !important;
  cursor: pointer;
  transition: var(--pfap-transition);
  flex-shrink: 0;
  padding: 0 !important;
  line-height: 1;
}

.pfap-filter-reset:hover {
  background: rgba(255,255,255,.35);
  transform: rotate(-45deg);
}

/* Reset button when header bar is hidden — sits inside .pfap-filter-inner, centred at bottom */
.pfap-filter-reset-bar {
  display: flex;
  justify-content: center;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--pfap-border);
  margin-top: 4px;
}

.pfap-filter-reset--standalone {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 0 16px !important;
  border-radius: var(--pfap-radius-sm) !important;
  background: var(--pfap-primary-light) !important;
  border-color: var(--pfap-border-hover) !important;
  color: var(--pfap-primary) !important;
  font-size: 13px;
  font-weight: 600;
}

.pfap-filter-reset--standalone:hover {
  background: var(--pfap-primary) !important;
  border-color: var(--pfap-primary) !important;
  color: #fff !important;
  transform: none;
}

.pfap-filter-inner {
  background: var(--pfap-card);
  border: 1px solid var(--pfap-border);
  border-top: none;
  border-radius: 0 0 var(--pfap-radius) var(--pfap-radius);
  box-shadow: var(--pfap-shadow-md);
}

/* When header bar is hidden, restore top border and full border-radius */
.pfap-filter-inner--no-header {
  border-top: 1px solid var(--pfap-border) !important;
  border-radius: var(--pfap-radius) !important;
}

.pfap-filter-inner--no-shadow {
  box-shadow: none !important;
}

/* ── Filter Section ────────────────────────────────────────── */
.pfap-filter-section {
  border-bottom: 1px solid var(--pfap-border);
}

.pfap-filter-section:last-child { border-bottom: none; }

.pfap-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background .15s;
}

.pfap-section-header:hover { background: var(--pfap-bg); }

.pfap-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--pfap-text);
}

.pfap-section-chevron {
  color: var(--pfap-text-light);
  transition: transform .2s;
}

.pfap-filter-section.collapsed .pfap-section-chevron {
  transform: rotate(-90deg);
}

.pfap-section-body {
  padding: 4px 20px 16px;
  overflow: hidden;
  transition: var(--pfap-transition);
}

.pfap-filter-section.collapsed .pfap-section-body {
  display: none;
}

/* ── Search box inside filter ──────────────────────────────── */
.pfap-filter-search {
  width: 100%;
  padding: 9px 14px;
  border: 1.5px solid var(--pfap-border);
  border-radius: var(--pfap-radius-sm);
  font-size: 13px;
  color: var(--pfap-text);
  transition: border-color .15s;
  box-sizing: border-box;
  margin-bottom: 10px;
}

.pfap-filter-search:focus {
  outline: none;
  border-color: var(--pfap-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

/* ── Checkbox List ─────────────────────────────────────────── */
.pfap-check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Reset theme global list styles */
.pfap-check-list li,
.pfap-check-list li::before,
.pfap-check-list li::after {
  border: none;
  background: none;
  content: none;
  padding-left: 0;
  margin-left: 0;
}

.pfap-check-list::-webkit-scrollbar { width: 4px; }
.pfap-check-list::-webkit-scrollbar-track { background: transparent; }
.pfap-check-list::-webkit-scrollbar-thumb { background: var(--pfap-border); border-radius: 4px; }

.pfap-check-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: var(--pfap-radius-sm);
  cursor: pointer;
  transition: background .12s;
  font-size: 13px;
  color: var(--pfap-text);
}

.pfap-check-item:hover { background: var(--pfap-bg); }

/* Override Flatsome/theme global input[type=checkbox] styles */
.pfap-wrapper input[type="checkbox"] {
  font-size: inherit !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

.pfap-check-item input[type="checkbox"] {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: inline-block !important;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  border: 2px solid var(--pfap-border) !important;
  border-radius: 4px !important;
  flex-shrink: 0;
  cursor: pointer;
  transition: var(--pfap-transition);
  position: relative !important;
  top: 0 !important;
  margin: 0 8px 0 0 !important;
  padding: 0 !important;
  background: #fff !important;
  vertical-align: middle;
}

.pfap-check-item input[type="checkbox"]:checked {
  background: var(--pfap-primary) !important;
  border-color: var(--pfap-primary) !important;
}

.pfap-check-item input[type="checkbox"]:checked::after {
  content: '' !important;
  position: absolute !important;
  left: 3px !important;
  top: 1px !important;
  width: 6px !important;
  height: 9px !important;
  border: 2px solid #fff !important;
  border-top: none !important;
  border-left: none !important;
  transform: rotate(45deg) !important;
  display: block !important;
}

.pfap-check-label {
  flex: 1;
  line-height: 1.4;
  display: inline !important;
  width: auto !important;
  vertical-align: middle;
}

/* Parent item: bolder label */
.pfap-has-children > .pfap-item-row > .pfap-check-label {
  font-weight: 600;
}

/* Row wrapper: flex container for toggle + checkbox + label + count */
.pfap-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: var(--pfap-radius-sm);
  cursor: pointer;
  transition: background .12s;
}

.pfap-item-row:hover { background: var(--pfap-bg); }

/* Remove the old direct padding/background on pfap-check-item so items don't double-pad */
.pfap-check-item {
  display: block;
  padding: 0;
  background: none !important;
}

/* Parent item: no extra indent needed anymore */
.pfap-has-children {
  position: static;
  padding-left: 0;
}

/* Expand/collapse toggle chevron — between label and count */
.pfap-tree-toggle {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--pfap-text-light);
  border-radius: 4px;
  transition: background .12s, color .12s;
}

/* Invisible spacer for leaf items — same size as toggle so count column aligns */
.pfap-toggle-placeholder {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: block;
}

.pfap-tree-toggle:hover {
  background: rgba(99,102,241,.1);
  color: var(--pfap-primary);
}

.pfap-tree-toggle svg {
  display: block;
  transition: transform .2s ease;
}

.pfap-tree-toggle[aria-expanded="false"] svg {
  transform: rotate(-90deg);
}

/* Nested list: sits below .pfap-item-row, indented from the checkbox position */
.pfap-check-nested {
  padding-left: 16px !important;
  margin: 2px 0 4px 0 !important;
  border-left: 2px solid var(--pfap-border);
}

.pfap-check-count {
  font-size: 11px;
  color: var(--pfap-text-light);
  background: var(--pfap-bg);
  padding: 2px 6px;
  border-radius: 10px;
}

/* Nested subcategories — overrides old standalone rule (now handled above) */

.pfap-show-more {
  background: none;
  border: none;
  color: var(--pfap-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
  text-decoration: underline;
  transition: color .15s;
}

.pfap-show-more:hover { color: var(--pfap-primary-dark); }

/* ── Brand button list ─────────────────────────────────────── */
.pfap-brand-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pfap-brand-item {
  display: inline-flex;
}

.pfap-brand-item input[type="checkbox"] {
  display: none !important;
}

.pfap-brand-item label {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1.5px solid var(--pfap-border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--pfap-text);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, background .15s, color .15s;
  line-height: 1.4;
  width: auto !important;
  max-width: none !important;
}

.pfap-brand-item label:hover {
  border-color: var(--pfap-primary);
  color: var(--pfap-primary);
  background: var(--pfap-primary-light);
}

.pfap-brand-item input:checked + label {
  border-color: var(--pfap-primary);
  background: var(--pfap-primary);
  color: #fff;
}

.pfap-brand-count {
  font-size: 10px;
  font-weight: 600;
  opacity: .65;
  background: rgba(0,0,0,.07);
  border-radius: 8px;
  padding: 1px 5px;
  line-height: 1.5;
}

.pfap-brand-item input:checked + label .pfap-brand-count {
  background: rgba(255,255,255,.25);
  opacity: 1;
}

/* ── Tag button list ────────────────────────────────────────── */
.pfap-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pfap-tag-item {
  display: inline-flex;
}

.pfap-tag-item input[type="checkbox"] {
  display: none !important;
}

.pfap-tag-item label {
  display: inline-flex !important;
  align-items: center;
  padding: 4px 11px;
  border: 1.5px solid var(--pfap-border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--pfap-text-light);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, background .15s, color .15s;
  line-height: 1.4;
  width: auto !important;
  max-width: none !important;
}

.pfap-tag-item label:hover {
  border-color: var(--pfap-primary);
  color: var(--pfap-primary);
  background: var(--pfap-primary-light);
}

.pfap-tag-item input:checked + label {
  border-color: var(--pfap-primary);
  background: var(--pfap-primary-light);
  color: var(--pfap-primary);
  font-weight: 600;
}

/* ── Price Range Slider ────────────────────────────────────── */
.pfap-price-range {
  padding: 4px 0 2px;
}

/* Formatted price badge above slider */
.pfap-price-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--pfap-primary);
}

.pfap-price-dash {
  font-weight: 400;
  color: var(--pfap-text-light);
  font-size: 13px;
}

/* Inputs row below slider */
.pfap-price-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
}

.pfap-price-sep {
  color: var(--pfap-text-light);
  flex-shrink: 0;
  font-size: 13px;
}

.pfap-price-field {
  flex: 1;
  position: relative;
}

.pfap-price-field input {
  width: 100%;
  padding: 7px 22px 7px 9px;
  border: 1.5px solid var(--pfap-border);
  border-radius: var(--pfap-radius-sm);
  font-size: 12px;
  color: var(--pfap-text);
  box-sizing: border-box;
  transition: border-color .15s;
  text-align: center;
}

.pfap-price-field input:focus {
  outline: none;
  border-color: var(--pfap-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.pfap-price-unit {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--pfap-text-light);
  pointer-events: none;
}

.pfap-slider-wrapper {
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
}

.pfap-range-slider {
  position: absolute;
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  top: 50%;
  transform: translateY(-50%);
}

.pfap-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--pfap-primary);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--pfap-primary), 0 2px 6px rgba(99,102,241,.35);
  cursor: pointer;
  pointer-events: all;
  transition: transform .15s;
}

.pfap-range-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }

.pfap-range-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--pfap-primary);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--pfap-primary);
  cursor: pointer;
  pointer-events: all;
}

.pfap-range-track {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  width: 100%;
  background: var(--pfap-border);
  border-radius: 4px;
  z-index: 0;
}

.pfap-range-fill {
  position: absolute;
  height: 100%;
  background: var(--pfap-primary);
  border-radius: 4px;
}

/* ── Price List (radio mode) ───────────────────────────────── */
.pfap-price-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pfap-price-list-item + .pfap-price-list-item {
  border-top: 1px solid var(--pfap-border);
}

.pfap-price-list-item label {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 6px;
  cursor: pointer;
  border-radius: var(--pfap-radius-sm);
  transition: background .12s;
  user-select: none;
  position: relative;
}

.pfap-price-list-item label:hover {
  background: rgba(99,102,241,.06);
}

.pfap-price-list-item input[type="radio"] {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: inline-block !important;
  flex-shrink: 0;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  border: 2px solid var(--pfap-border) !important;
  border-radius: 50% !important;
  background: #fff !important;
  cursor: pointer;
  margin: 0 !important;
  padding: 0 !important;
  position: relative !important;
  vertical-align: middle;
  transition: border-color .15s, background .15s;
}

.pfap-price-list-item input[type="radio"]:checked {
  border-color: var(--pfap-primary) !important;
  background: var(--pfap-primary) !important;
}

.pfap-price-list-item input[type="radio"]:checked::after {
  content: '' !important;
  display: block !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 6px !important;
  height: 6px !important;
  border-radius: 50% !important;
  background: #fff !important;
}

/* Label wrapper: tag (Dưới/Trên) + amount */
.pfap-price-label {
  display: flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  font-size: 13px;
  color: var(--pfap-text);
  line-height: 1.3;
}

.pfap-price-tag {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--pfap-text-light);
  flex-shrink: 0;
}

.pfap-price-amt {
  font-weight: 600;
  color: var(--pfap-text);
  font-size: 13px;
}

.pfap-price-sep {
  font-size: 11px;
  color: var(--pfap-text-light);
  flex-shrink: 0;
}

/* Checked state */
.pfap-price-list-item input[type="radio"]:checked + .pfap-price-label .pfap-price-amt {
  color: var(--pfap-primary);
}

.pfap-price-list-item input[type="radio"]:checked + .pfap-price-label .pfap-price-tag {
  color: var(--pfap-primary-dark, var(--pfap-primary));
  opacity: .8;
}

.pfap-price-list-item input[type="radio"]:checked + .pfap-price-label .pfap-price-sep {
  color: var(--pfap-primary);
  opacity: .6;
}

/* ── Rating Filter ─────────────────────────────────────────── */
.pfap-rating-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pfap-rating-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 4px;
  cursor: pointer;
  border-radius: 6px;
  transition: background .12s;
}

.pfap-rating-item:hover { background: var(--pfap-bg); }

.pfap-rating-item input[type="radio"] { display: none; }

.pfap-rating-stars { display: flex; gap: 2px; }

.pfap-rating-star {
  font-size: 16px;
  color: #d1d5db;
  line-height: 1;
}

.pfap-rating-star.on { color: #f59e0b; }

.pfap-rating-item.active .pfap-rating-star.on,
.pfap-rating-item input:checked ~ .pfap-rating-stars .pfap-rating-star.on { color: #f59e0b; }

.pfap-rating-label {
  font-size: 12px;
  color: var(--pfap-text-light);
}

/* ── Toggle pills (on sale / in stock) ─────────────────────── */
.pfap-toggle-pills {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pfap-pill-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1.5px solid var(--pfap-border);
  border-radius: var(--pfap-radius-sm);
  cursor: pointer;
  transition: var(--pfap-transition);
  font-size: 13px;
  color: var(--pfap-text);
  font-weight: 500;
}

.pfap-pill-toggle:hover { border-color: var(--pfap-border-hover); background: var(--pfap-bg); }

.pfap-pill-toggle input { display: none; }

.pfap-pill-toggle__switch {
  width: 36px;
  height: 20px;
  background: #d1d5db;
  border-radius: 10px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}

.pfap-pill-toggle__switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.pfap-pill-toggle.active {
  border-color: var(--pfap-primary);
  background: var(--pfap-primary-light);
}

.pfap-pill-toggle.active .pfap-pill-toggle__switch { background: var(--pfap-primary); }
.pfap-pill-toggle.active .pfap-pill-toggle__switch::after { transform: translateX(16px); }

/* ── Color swatches ────────────────────────────────────────── */
.pfap-swatch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Force the li to be exactly swatch-sized so theme styles can't stretch it */
.pfap-swatch-item {
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0 !important;
  margin: 0 !important;
  background: none !important;
  cursor: pointer;
}

.pfap-swatch-item .pfap-swatch-inner {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px;
  min-height: 28px;
  max-width: 28px;
  max-height: 28px;
  border-radius: 50% !important;
  border: 2.5px solid transparent;
  transition: transform .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.pfap-swatch-item:hover .pfap-swatch-inner { transform: scale(1.15); }

.pfap-swatch-item.pfap-swatch-active .pfap-swatch-inner {
  box-shadow: 0 0 0 3px var(--pfap-primary);
}

/* ── Button swatches (tag/pill style) ──────────────────────── */
.pfap-swatch-list--button {
  gap: 6px;
}

.pfap-swatch-item--button {
  width: auto !important;
  height: auto !important;
}

.pfap-swatch-item--button .pfap-swatch-inner {
  display: inline-flex !important;
  align-items: center;
  width: auto !important;
  height: auto !important;
  min-width: unset;
  min-height: unset;
  max-width: none !important;
  max-height: none !important;
  border-radius: 20px !important;
  border: 1.5px solid var(--pfap-border);
  background: none;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--pfap-text);
  white-space: nowrap;
  user-select: none;
  transition: border-color .15s, background .15s, color .15s;
  overflow: visible;
}

.pfap-swatch-item--button:hover .pfap-swatch-inner {
  border-color: var(--pfap-primary);
  color: var(--pfap-primary);
  background: var(--pfap-primary-light);
  transform: none;
  box-shadow: none;
}

.pfap-swatch-item--button.pfap-swatch-active .pfap-swatch-inner {
  border-color: var(--pfap-primary);
  background: var(--pfap-primary);
  color: #fff;
  box-shadow: none;
  transform: none;
}

/* ── Image swatches ────────────────────────────────────────── */
.pfap-swatch-list--image {
  gap: 8px;
}

.pfap-swatch-item--image {
  width: 44px !important;
  height: 44px !important;
}

.pfap-swatch-item--image .pfap-swatch-inner {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px !important;
  max-height: 44px !important;
  border-radius: var(--pfap-radius-sm) !important;
  border: 2.5px solid transparent;
  overflow: hidden;
  background: var(--pfap-bg);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}

.pfap-swatch-item--image:hover .pfap-swatch-inner {
  transform: scale(1.08);
  border-color: var(--pfap-border-hover);
}

.pfap-swatch-item--image .pfap-swatch-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pfap-swatch-item--image.pfap-swatch-active .pfap-swatch-inner {
  border-color: var(--pfap-primary);
  box-shadow: 0 0 0 2px var(--pfap-primary);
  transform: none;
}

.pfap-swatch-initials {
  font-size: 12px;
  font-weight: 700;
  color: var(--pfap-text-light);
  line-height: 1;
}

/* ── Main Content ──────────────────────────────────────────── */
.pfap-main-content { flex: 1; min-width: 0; }


/* ── Sort Bar ──────────────────────────────────────────────── */
.pfap-sort-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pfap-sort-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--pfap-text-light);
  white-space: nowrap;
  flex-shrink: 0;
}

.pfap-sort-select {
  padding: 8px 12px;
  border: 1.5px solid var(--pfap-border);
  border-radius: var(--pfap-radius-sm);
  font-size: 13px;
  color: var(--pfap-text);
  background: var(--pfap-card);
  cursor: pointer;
  transition: border-color .15s;
  min-width: 160px;
}

.pfap-sort-select:focus {
  outline: none;
  border-color: var(--pfap-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

/* ── Mobile sidebar overlay backdrop ──────────────────────── */
.pfap-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9998;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}

.pfap-mobile-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ── Filter toggle button ──────────────────────────────────── */
/* Always visible in drawer mode; hidden by default for sidebar (shown via JS/mobile) */
.pfap-filter-toggle-btn {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--pfap-primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--pfap-radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}

.pfap-filter-toggle-btn:hover { background: var(--pfap-primary-dark); }

/* Drawer mode: always show toggle button (filter is always hidden in a drawer) */
.pfap-wrapper--drawer .pfap-filter-toggle-btn { display: inline-flex; }


/* ── Product Grid ──────────────────────────────────────────── */
.pfap-products {
  display: grid;
  gap: 20px;
}

.pfap-cols-2 { grid-template-columns: repeat(2, 1fr); }
.pfap-cols-3 { grid-template-columns: repeat(3, 1fr); }
.pfap-cols-4 { grid-template-columns: repeat(4, 1fr); }
.pfap-cols-5 { grid-template-columns: repeat(5, 1fr); }


/* Neutralise Flatsome vertical-line pseudo-elements only on the plugin's own product cards.
   Scoped specifically to .pfap-product-card so theme card decorators on
   non-plugin elements are never touched. */
.pfap-product-card *::before,
.pfap-product-card *::after {
  border-left: none !important;
  border-right: none !important;
  box-shadow: none !important;
}

/* Kill Flatsome generic border/outline on divs only INSIDE the plugin's product card grid.
   Using child-combinator chains so this never applies to anything outside the plugin. */
.pfap-products-wrap > .pfap-products > .pfap-product-card,
.pfap-products-wrap > .pfap-products > .pfap-product-card div {
  border-left: none !important;
  border-right: none !important;
  outline: none !important;
}

/* ── Product Card ──────────────────────────────────────────── */
.pfap-product-card {
  background: var(--pfap-card);
  border: 1px solid var(--pfap-border);
  border-radius: var(--pfap-radius);
  overflow: hidden;
  box-shadow: var(--pfap-shadow);
  transition: var(--pfap-transition);
  position: relative;
  display: flex;
  flex-direction: column;
}

.pfap-product-card:hover {
  box-shadow: var(--pfap-shadow-card);
  border-color: var(--pfap-border-hover);
  transform: translateY(-3px);
}

.pfap-product-card__thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--pfap-bg);
}

.pfap-product-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
  display: block;
}

.pfap-product-card:hover .pfap-product-card__thumb img {
  transform: scale(1.06);
}

/* Badges */
.pfap-product-card__badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pfap-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.pfap-badge--sale { background: #fef2f2; color: #dc2626; }
.pfap-badge--outofstock { background: #f1f5f9; color: #64748b; }

/* Hover actions */
.pfap-product-card__actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  transition: opacity .2s;
}

.pfap-product-card:hover .pfap-product-card__actions { opacity: 1; }

.pfap-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: #fff;
  border-radius: var(--pfap-radius-sm);
  color: var(--pfap-text-light);
  text-decoration: none;
  box-shadow: var(--pfap-shadow-md);
  transition: var(--pfap-transition);
}

.pfap-action-btn:hover { background: var(--pfap-primary); color: #fff; transform: scale(1.1); }

/* Body */
.pfap-product-card__body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.pfap-product-card__cat {
  font-size: 11px;
  color: var(--pfap-primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 5px;
}

.pfap-product-card__title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pfap-product-card__title a {
  color: var(--pfap-text);
  text-decoration: none;
  transition: color .15s;
}

.pfap-product-card__title a:hover { color: var(--pfap-primary); }

.pfap-product-card__rating {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
}

.pfap-stars { display: flex; gap: 2px; }

.pfap-star { font-size: 14px; line-height: 1; }
.pfap-star--full  { color: #f59e0b; }
.pfap-star--half  { color: #f59e0b; opacity: .6; }
.pfap-star--empty { color: #d1d5db; }

.pfap-product-card__review-count {
  font-size: 12px;
  color: var(--pfap-text-light);
}

.pfap-product-card__price {
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--pfap-primary);
  margin-top: auto;
}

.pfap-product-card__price del {
  font-size: 13px;
  color: var(--pfap-text-light);
  font-weight: 400;
  margin-right: 4px;
}

.pfap-product-card__price ins {
  text-decoration: none;
  color: var(--pfap-danger);
}

.pfap-product-card__footer { display: flex; }

/* Add to cart button */
.pfap-btn-cart {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  background: var(--pfap-primary);
  color: #fff;
  border: none;
  border-radius: var(--pfap-radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--pfap-transition);
  text-decoration: none;
  text-align: center;
}

.pfap-btn-cart:hover { background: var(--pfap-primary-dark); transform: translateY(-1px); }
.pfap-btn-cart:active { transform: translateY(0); }

.pfap-btn-cart--details {
  background: transparent;
  color: var(--pfap-primary);
  border: 1.5px solid var(--pfap-primary);
}

.pfap-btn-cart--details:hover { background: var(--pfap-primary); color: #fff; }

.pfap-btn-cart.pfap-loading {
  opacity: .7;
  pointer-events: none;
}

.pfap-btn-cart.pfap-added {
  background: var(--pfap-success);
}

/* ── Add to cart toast ─────────────────────────────────────── */
.pfap-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #fff;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--pfap-shadow-md);
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 320px;
}

.pfap-toast.pfap-toast--show {
  transform: translateY(0);
  opacity: 1;
}

.pfap-toast--success { border-left: 4px solid var(--pfap-success); }
.pfap-toast--error   { border-left: 4px solid var(--pfap-danger); }



/* ── Loading overlay ───────────────────────────────────────── */
.pfap-loading-overlay {
  position: relative;
  min-height: 200px;
}

.pfap-loading-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.8);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 10;
  border-radius: var(--pfap-radius);
}

.pfap-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  width: 40px;
  height: 40px;
  border: 3px solid var(--pfap-primary-light);
  border-top-color: var(--pfap-primary);
  border-radius: 50%;
  animation: pfap-spin .7s linear infinite;
}

@keyframes pfap-spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

/* ── Pagination ────────────────────────────────────────────── */
.pfap-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.pfap-page-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 8px;
  border: 1.5px solid var(--pfap-border);
  border-radius: var(--pfap-radius-sm);
  background: var(--pfap-card);
  color: var(--pfap-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--pfap-transition);
}

.pfap-page-btn:hover:not(.pfap-page-btn--active) {
  border-color: var(--pfap-primary);
  color: var(--pfap-primary);
  background: var(--pfap-primary-light);
}

.pfap-page-btn--active {
  background: var(--pfap-primary);
  color: #fff;
  border-color: var(--pfap-primary);
  box-shadow: 0 2px 8px rgba(99,102,241,.35);
}

.pfap-page-prev,
.pfap-page-next { font-size: 18px; }

.pfap-page-dots { color: var(--pfap-text-light); line-height: 38px; }

/* ── Drawer mode ───────────────────────────────────────────── */
.pfap-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9998;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}

.pfap-drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.pfap-drawer {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 320px;
  max-width: 90vw;
  background: var(--pfap-card);
  z-index: 9999;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--pfap-shadow-md);
}

.pfap-drawer.open { transform: translateX(0); }

.pfap-drawer-close {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 14px 16px;
}

.pfap-drawer-close-btn {
  background: none;
  border: 1.5px solid var(--pfap-border);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  color: var(--pfap-text-light);
  transition: var(--pfap-transition);
}

.pfap-drawer-close-btn:hover { border-color: var(--pfap-primary); color: var(--pfap-primary); }

/* ── Responsive ────────────────────────────────────────────── */

/* ── 1200px: compact sidebar ───────────────────────────────── */
@media (max-width: 1199px) {
  .pfap-filter-panel { width: 260px; }
}

/* ── 1024px: tablet ────────────────────────────────────────── */
@media (max-width: 1024px) {
  .pfap-filter-panel { width: 240px; }
  .pfap-cols-4 { grid-template-columns: repeat(3, 1fr); }
  .pfap-cols-5 { grid-template-columns: repeat(3, 1fr); }
}

/* ── 768px: mobile ─────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Stack the wrapper vertically */
  .pfap-wrapper:not(.pfap-wrapper--sidebar-mode) {
    flex-direction: column;
  }

  /* Sidebar filter: become a fixed left-side drawer on mobile */
  .pfap-wrapper:not(.pfap-wrapper--sidebar-mode):not(.pfap-wrapper--top) .pfap-filter-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    z-index: 9999;
    overflow-y: auto;
    transform: translateX(-110%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    box-shadow: var(--pfap-shadow-md);
    display: block !important;
    visibility: hidden;
    border-radius: 0;
  }

  .pfap-wrapper:not(.pfap-wrapper--sidebar-mode):not(.pfap-wrapper--top) .pfap-filter-panel.open {
    transform: translateX(0);
    visibility: visible;
  }

  /* Mobile sidebar backdrop */
  .pfap-mobile-overlay { display: block; }

  /* Show toggle button (for sidebar mode on mobile) */
  .pfap-filter-toggle-btn { display: inline-flex; }

  /* Top filter: wrap sections */
  .pfap-wrapper--top .pfap-filter-inner {
    gap: 10px;
  }

  .pfap-wrapper--top .pfap-filter-section {
    flex: 1 1 160px;
    min-width: 140px;
  }

  /* Product grid columns */
  .pfap-cols-3,
  .pfap-cols-4,
  .pfap-cols-5 { grid-template-columns: repeat(2, 1fr); }

  /* Sort bar: full width row on mobile */
  .pfap-results-area .pfap-sort-bar {
    margin-bottom: 12px;
  }

  .pfap-sort-select { flex: 1; min-width: 0; }

  /* Toolbar */
  .pfap-toolbar { flex-direction: column; align-items: flex-start; }
  .pfap-toolbar-right { width: 100%; }

  /* Filter panel inner padding */
  .pfap-section-header { padding: 12px 16px; }
  .pfap-section-body { padding: 4px 16px 14px; }
  .pfap-filter-header { padding: 14px 16px 12px; }

  /* Toast: stretch to mobile width */
  .pfap-toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: none;
  }

  /* Pagination: slightly smaller */
  .pfap-page-btn { min-width: 36px; height: 36px; }
}

/* ── 480px: small phones ───────────────────────────────────── */
@media (max-width: 480px) {

  /* Single column grid */
  .pfap-cols-2,
  .pfap-cols-3,
  .pfap-cols-4,
  .pfap-cols-5 { grid-template-columns: 1fr; }

  /* Card body */
  .pfap-product-card__body { padding: 10px 12px 12px; }
  .pfap-product-card__title { font-size: 13px; }
  .pfap-product-card__price { font-size: 15px; }
  .pfap-btn-cart { padding: 8px 10px; font-size: 12px; }

  /* Top filter: stack sections */
  .pfap-wrapper--top .pfap-filter-section {
    flex: 1 1 100%;
  }

  /* Pagination */
  .pfap-pagination { gap: 4px; }
  .pfap-page-btn { min-width: 34px; height: 34px; font-size: 13px; }

  /* Price inputs */
  .pfap-price-inputs { gap: 4px; }
  .pfap-price-field input { font-size: 11px; padding: 6px 18px 6px 8px; }

  /* Brand & tag pills: tighter gap */
  .pfap-brand-list, .pfap-tag-list { gap: 6px; }
  .pfap-brand-item label,
  .pfap-tag-item label { padding: 4px 10px; font-size: 11px; }
}

/* ── 360px: very small phones ──────────────────────────────── */
@media (max-width: 360px) {
  .pfap-products { gap: 12px; }
  .pfap-product-card__body { padding: 8px 10px 10px; }
  .pfap-filter-header { padding: 12px 14px 10px; }
  .pfap-section-header { padding: 10px 14px; }
  .pfap-section-body { padding: 4px 14px 12px; }
  .pfap-filter-toggle-btn { padding: 9px 14px; font-size: 13px; }
}
