/* ════════════════════════════════════════════════════════
   WoodMart Advanced Filter Pro – waf-filter.css  v2.0
   ════════════════════════════════════════════════════════ */

/* ── Design tokens (overridden per-site via inline <style>) ── */
:root {
  --waf-accent:       #e63946;
  --waf-accent-rgb:   230, 57, 70;
  --waf-accent-light: rgba(var(--waf-accent-rgb), .10);
  --waf-dark:         #1a202c;
  --waf-mid:          #718096;
  --waf-muted:        #a0aec0;
  --waf-light:        #f7fafc;
  --waf-surface:      #ffffff;
  --waf-border:       #e2e8f0;
  --waf-border-focus: rgba(var(--waf-accent-rgb), .4);
  --waf-radius-sm:    6px;
  --waf-radius:       10px;
  --waf-radius-lg:    14px;
  --waf-speed:        0.22s;
  --waf-easing:       cubic-bezier(.4,0,.2,1);
  --waf-shadow:       0 2px 8px rgba(0,0,0,.08);
  --waf-shadow-md:    0 4px 20px rgba(0,0,0,.12);
}

/* ── Mobile drawer button ────────────────────────────── */
.waf-drawer-btn {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--waf-surface);
  border: 1.5px solid var(--waf-border);
  border-radius: var(--waf-radius);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--waf-dark);
  cursor: pointer;
  box-shadow: var(--waf-shadow);
  transition: all var(--waf-speed) var(--waf-easing);
  position: relative;
  width: 100%;
  justify-content: center;
  margin-bottom: 12px;
}
.waf-drawer-btn svg {
  width: 18px; height: 18px;
  stroke: var(--waf-accent);
  flex-shrink: 0;
}
.waf-drawer-btn:hover {
  border-color: var(--waf-accent);
  color: var(--waf-accent);
}
.waf-drawer-btn__badge {
  position: absolute;
  top: -6px; right: -6px;
  background: var(--waf-accent);
  color: #fff;
  border-radius: 50%;
  width: 20px; height: 20px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Drawer overlay + panel ──────────────────────────── */
.waf-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9998;
  opacity: 0;
  transition: opacity var(--waf-speed) var(--waf-easing);
}
.waf-drawer-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.waf-drawer-hd {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--waf-border);
  background: var(--waf-surface);
  font-size: 16px;
  font-weight: 700;
  color: var(--waf-dark);
  flex-shrink: 0;
}
.waf-drawer-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--waf-mid);
  padding: 0 4px;
  line-height: 1;
  transition: color var(--waf-speed);
}
.waf-drawer-close:hover { color: var(--waf-accent); }

/* Mobile drawer open state */
@media (max-width: 767px) {
  .waf-drawer-btn { display: flex; }

  #waf-filter-drawer.is-open .waf-drawer-overlay {
    display: block;
    opacity: 1;
  }
  #waf-filter-drawer .waf-drawer-panel {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: min(340px, 90vw);
    background: var(--waf-surface);
    z-index: 9999;
    transform: translateX(-110%);
    transition: transform var(--waf-speed) var(--waf-easing);
    box-shadow: var(--waf-shadow-md);
    overflow-y: auto;
  }
  #waf-filter-drawer.is-open .waf-drawer-panel {
    transform: translateX(0);
  }
  #waf-filter-drawer .waf-drawer-hd { display: flex; }
  #waf-filter-drawer .waf-filter-form { padding: 12px 16px; }
  #waf-filter-drawer .waf-active-bar { padding: 8px 16px; }
}

/* ── Main filter wrap ────────────────────────────────── */
.waf-filter-wrap {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--waf-dark);
  line-height: 1.5;
}

/* ── Active filters bar ──────────────────────────────── */
.waf-active-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--waf-border);
  margin-bottom: 4px;
}
.waf-active-bar:empty { display: none; }
.waf-active-bar__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--waf-muted);
  flex-shrink: 0;
}
.waf-active-bar__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
}
.waf-active-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--waf-accent-light);
  border: 1px solid rgba(var(--waf-accent-rgb), .25);
  color: var(--waf-accent);
  border-radius: 20px;
  padding: 3px 10px 3px 12px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--waf-speed), border-color var(--waf-speed);
  white-space: nowrap;
}
.waf-active-tag span {
  font-size: 14px;
  line-height: 1;
  opacity: .7;
}
.waf-active-tag:hover {
  background: rgba(var(--waf-accent-rgb), .18);
  text-decoration: none;
  color: var(--waf-accent);
}
.waf-active-bar__clear {
  font-size: 12px;
  color: var(--waf-mid);
  text-decoration: none;
  margin-left: auto;
  white-space: nowrap;
  transition: color var(--waf-speed);
}
.waf-active-bar__clear:hover { color: var(--waf-accent); text-decoration: underline; }

/* ── Filter form ─────────────────────────────────────── */
.waf-filter-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Collapsible section ─────────────────────────────── */
.waf-section {
  border-bottom: 1px solid var(--waf-border);
}
.waf-section:last-of-type { border-bottom: none; }

.waf-section__hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 14px 0;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--waf-dark);
  transition: color var(--waf-speed);
}
.waf-section__hd:hover { color: var(--waf-accent); }
.waf-section__title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
}

/* Chevron */
.waf-chevron {
  width: 10px; height: 10px;
  flex-shrink: 0;
  stroke: currentColor;
  transition: transform var(--waf-speed) var(--waf-easing);
}
.waf-section.is-open .waf-chevron {
  transform: rotate(-180deg);
}

/* Section body (accordion) */
.waf-section__bd {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--waf-easing), padding 0.2s;
  padding-bottom: 0;
}
.waf-section.is-open .waf-section__bd {
  max-height: 700px;
  padding-bottom: 14px;
}

/* ── Sort select ─────────────────────────────────────── */
.waf-select {
  width: 100%;
  padding: 9px 36px 9px 12px;
  border: 1.5px solid var(--waf-border);
  border-radius: var(--waf-radius-sm);
  background: var(--waf-light);
  font-size: 13.5px;
  color: var(--waf-dark);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23718096' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: border-color var(--waf-speed), box-shadow var(--waf-speed);
  font-family: inherit;
}
.waf-select:focus {
  outline: none;
  border-color: var(--waf-accent);
  box-shadow: 0 0 0 3px var(--waf-accent-light);
}

/* ── In-stock toggle row ─────────────────────────────── */
.waf-instock-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--waf-border);
}
.waf-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 8px;
}
.waf-toggle__text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--waf-dark);
}
.waf-toggle__switch { position: relative; flex-shrink: 0; }
.waf-toggle__switch input {
  opacity: 0; width: 0; height: 0; position: absolute;
}
.waf-toggle__track {
  display: block;
  width: 42px; height: 23px;
  background: var(--waf-border);
  border-radius: 23px;
  transition: background var(--waf-speed);
  position: relative;
}
.waf-toggle__thumb {
  position: absolute;
  top: 2.5px; left: 2.5px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--waf-speed) var(--waf-easing);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.waf-toggle__switch input:checked ~ .waf-toggle__track {
  background: var(--waf-accent);
}
.waf-toggle__switch input:checked ~ .waf-toggle__track .waf-toggle__thumb {
  transform: translateX(19px);
}
.waf-toggle__switch input:focus ~ .waf-toggle__track {
  box-shadow: 0 0 0 3px var(--waf-accent-light);
}

/* ── Brand search input ──────────────────────────────── */
.waf-search-input-wrap {
  position: relative;
  margin-bottom: 8px;
}
.waf-search-input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  border: 1.5px solid var(--waf-border);
  border-radius: var(--waf-radius-sm);
  font-size: 13px;
  color: var(--waf-dark);
  background: var(--waf-light);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  transition: border-color var(--waf-speed), box-shadow var(--waf-speed);
  font-family: inherit;
  box-sizing: border-box;
}
.waf-search-input:focus {
  outline: none;
  border-color: var(--waf-accent);
  box-shadow: 0 0 0 3px var(--waf-accent-light);
}

/* ── Checklist ───────────────────────────────────────── */
.waf-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--waf-border) transparent;
}
.waf-checklist::-webkit-scrollbar { width: 4px; }
.waf-checklist::-webkit-scrollbar-thumb { background: var(--waf-border); border-radius: 4px; }
.waf-checklist li { margin: 0; }

/* ── Checkbox item ───────────────────────────────────── */
.waf-check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 2px;
  cursor: pointer;
  transition: color var(--waf-speed);
  border-radius: 4px;
}
.waf-check:hover { color: var(--waf-accent); }
.waf-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}
/* Custom checkbox box */
.waf-check__box {
  flex-shrink: 0;
  width: 16px; height: 16px;
  border: 1.5px solid var(--waf-border);
  border-radius: 4px;
  background: var(--waf-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--waf-speed), border-color var(--waf-speed);
  position: relative;
}
.waf-check__box::after {
  content: '';
  display: none;
  width: 9px; height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(0, -1px);
}
.waf-check input:checked ~ .waf-check__box {
  background: var(--waf-accent);
  border-color: var(--waf-accent);
}
.waf-check input:checked ~ .waf-check__box::after { display: block; }
.waf-check input:focus ~ .waf-check__box {
  box-shadow: 0 0 0 3px var(--waf-accent-light);
}

/* Brand icon avatar */
.waf-brand-icon {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--waf-accent-light);
  color: var(--waf-accent);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
}
.waf-check:hover .waf-brand-icon {
  background: rgba(var(--waf-accent-rgb), .18);
}

.waf-check__label {
  flex: 1;
  font-size: 13.5px;
  line-height: 1.3;
  user-select: none;
}
.waf-count {
  font-size: 11.5px;
  color: var(--waf-muted);
  flex-shrink: 0;
}

/* ── Show more button ────────────────────────────────── */
.waf-show-more {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 6px 0;
  background: none;
  border: none;
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--waf-accent);
  cursor: pointer;
  transition: opacity var(--waf-speed);
  font-family: inherit;
}
.waf-show-more:hover { opacity: .75; }

/* ── Price range ─────────────────────────────────────── */
.waf-price-wrap { display: flex; flex-direction: column; gap: 14px; }

/* Dual-range track */
.waf-range-wrap {
  position: relative;
  height: 20px;
  margin-top: 4px;
}
.waf-range-track {
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 4px;
  background: var(--waf-border);
  border-radius: 4px;
  transform: translateY(-50%);
}
.waf-range-fill {
  position: absolute;
  height: 100%;
  background: var(--waf-accent);
  border-radius: 4px;
}
.waf-range {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 4px;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
  outline: none;
}
.waf-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--waf-accent);
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  cursor: pointer;
  pointer-events: all;
  transition: transform var(--waf-speed), box-shadow var(--waf-speed);
}
.waf-range::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--waf-accent);
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  cursor: pointer;
  pointer-events: all;
}
.waf-range::-webkit-slider-thumb:hover,
.waf-range:focus::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 0 5px var(--waf-accent-light);
}

/* Price input boxes */
.waf-price-inputs {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.waf-price-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.waf-price-box__lbl {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--waf-muted);
}
.waf-price-box__sym {
  position: absolute;
  left: 9px;
  bottom: 9px;
  font-size: 12px;
  color: var(--waf-mid);
  pointer-events: none;
}
.waf-price-input {
  width: 100%;
  padding: 8px 8px 8px 22px;
  border: 1.5px solid var(--waf-border);
  border-radius: var(--waf-radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--waf-dark);
  background: var(--waf-light);
  transition: border-color var(--waf-speed), box-shadow var(--waf-speed);
  box-sizing: border-box;
  font-family: inherit;
}
.waf-price-input:focus {
  outline: none;
  border-color: var(--waf-accent);
  box-shadow: 0 0 0 3px var(--waf-accent-light);
}
.waf-price-dash {
  color: var(--waf-muted);
  font-size: 18px;
  padding-bottom: 6px;
  flex-shrink: 0;
}

/* ── Action buttons ──────────────────────────────────── */
.waf-actions {
  display: flex;
  gap: 8px;
  padding-top: 18px;
  padding-bottom: 6px;
}
.waf-btn {
  flex: 1;
  padding: 11px 14px;
  border: none;
  border-radius: var(--waf-radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  letter-spacing: .02em;
  transition: opacity var(--waf-speed), background var(--waf-speed), transform .1s;
  font-family: inherit;
  line-height: 1.4;
}
.waf-btn:active { transform: scale(.97); }
.waf-btn--apply {
  background: var(--waf-accent);
  color: #fff;
  box-shadow: 0 3px 10px rgba(var(--waf-accent-rgb), .35);
}
.waf-btn--apply:hover { opacity: .9; text-decoration: none; color: #fff; }
.waf-btn--reset {
  background: var(--waf-light);
  color: var(--waf-mid);
  border: 1.5px solid var(--waf-border);
  flex: 0 0 auto;
  padding: 11px 16px;
}
.waf-btn--reset:hover {
  background: var(--waf-border);
  color: var(--waf-dark);
  text-decoration: none;
}

/* ── No-JS / search hide ─────────────────────────────── */
.waf-hidden { display: none !important; }

/* ── Reduced motion ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* ── Responsive: very small sidebar ─────────────────── */
@media (max-width: 280px) {
  .waf-filter-wrap { font-size: 13px; }
  .waf-actions { flex-direction: column; }
  .waf-btn--reset { flex: 1; }
}

/* ── Virtual capacity term badge ─────────────────────── */
.waf-virtual-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--waf-accent);
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: .65;
  vertical-align: middle;
  line-height: 1;
}
