/* Product filter (pfilter) */
.pfilter {
  --pf-accent: #2b7fc3;
  --pf-accent-dark: #1f6aa6;
  --pf-text: #333;
  --pf-muted: #8a8f98;
  --pf-border: #e3e6ea;
  --pf-bg: #fff;
  --pf-soft: #f4f7fa;
  background: var(--pf-bg);
  border: 1px solid var(--pf-border);
  border-radius: 4px;
  margin-bottom: 20px;
  color: var(--pf-text);
  font-size: 14px;
}

.pfilter .pf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  border-bottom: 1px solid var(--pf-border);
}

.pfilter .pf-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.pfilter .pf-close {
  display: none;
  background: none;
  border: 0;
  font-size: 28px;
  line-height: 1;
  color: var(--pf-muted);
  padding: 0 4px;
}

/* Selected chips */
.pfilter .pf-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--pf-border);
}

.pfilter .pf-chip {
  background: var(--pf-soft);
  border: 1px solid var(--pf-border);
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--pf-text);
  cursor: pointer;
}

.pfilter .pf-chip span {
  color: var(--pf-muted);
  margin-left: 2px;
}

.pfilter .pf-chip:hover {
  border-color: var(--pf-accent);
}

.pfilter .pf-clear {
  background: none;
  border: 0;
  padding: 3px 4px;
  font-size: 13px;
  color: var(--pf-accent);
  text-decoration: underline;
  cursor: pointer;
}

/* Groups */
.pfilter .pf-group {
  border-bottom: 1px solid var(--pf-border);
}

.pfilter .pf-group:last-child {
  border-bottom: 0;
}

.pfilter .pf-title {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: 0;
  padding: 12px 15px;
  font-weight: 700;
  font-size: 15px;
  text-align: left;
  color: var(--pf-text);
  cursor: pointer;
}

.pfilter .pf-title i {
  font-size: 18px;
  transition: transform .15s ease;
}

.pfilter .pf-collapsed .pf-title i {
  transform: rotate(180deg);
}

.pfilter .pf-body {
  padding: 0 15px 14px;
}

.pfilter .pf-collapsed .pf-body {
  display: none;
}

/* Options */
.pfilter .pf-options {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pfilter .pf-opt label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 5px 0;
  font-weight: normal;
  cursor: pointer;
  line-height: 1.3;
}

.pfilter .pf-opt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.pfilter .pf-box {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: 1px solid #c4c9d0;
  border-radius: 4px;
  background: #fff;
  position: relative;
}

.pfilter .pf-opt input:checked + .pf-box {
  background: var(--pf-accent);
  border-color: var(--pf-accent);
}

.pfilter .pf-opt input:checked + .pf-box:after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.pfilter .pf-opt input:focus-visible + .pf-box,
.pfilter .pf-opt input:focus-visible + .pf-sw {
  outline: 2px solid var(--pf-accent);
  outline-offset: 2px;
}

.pfilter .pf-name {
  flex: 1 1 auto;
}

.pfilter .pf-count {
  color: var(--pf-muted);
  font-size: 13px;
}

.pfilter .pf-count:before { content: "("; }
.pfilter .pf-count:after { content: ")"; }

.pfilter .pf-opt label:hover .pf-name {
  color: var(--pf-accent);
}

.pfilter .pf-zero label {
  cursor: default;
  opacity: .45;
}

.pfilter .pf-zero label:hover .pf-name {
  color: inherit;
}

.pfilter .pf-extra {
  display: none;
}

.pfilter .pf-expanded .pf-extra {
  display: block;
}

.pfilter .pf-more {
  background: none;
  border: 0;
  padding: 6px 0 0;
  color: var(--pf-accent);
  font-size: 13px;
  cursor: pointer;
}

/* Swatches */
.pfilter .pf-sw {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .18);
  background-color: #eee;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 2px #fff;
}

.pfilter .pf-opt input:checked + .pf-sw {
  border: 2px solid var(--pf-accent);
}

/* Range slider */
.pfilter .pf-range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.pfilter .pf-range-inputs label {
  flex: 1 1 0;
  margin: 0;
  min-width: 0;
}

.pfilter .pf-range-inputs input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--pf-border);
  border-radius: 4px;
  padding: 0 8px;
  font-size: 14px;
  -moz-appearance: textfield;
}

.pfilter .pf-range-inputs input::-webkit-outer-spin-button,
.pfilter .pf-range-inputs input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pfilter .pf-dash,
.pfilter .pf-unit {
  color: var(--pf-muted);
}

.pfilter .pf-slider {
  position: relative;
  height: 24px;
}

.pfilter .pf-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 4px;
  border-radius: 2px;
  background: #dde1e6;
}

.pfilter .pf-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--pf-accent);
  border-radius: 2px;
}

.pfilter .pf-slider input[type=range] {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 24px;
  margin: 0;
  padding: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.pfilter .pf-slider input[type=range]::-webkit-slider-runnable-track {
  background: none;
  border: 0;
}

.pfilter .pf-slider input[type=range]::-moz-range-track {
  background: none;
  border: 0;
}

.pfilter .pf-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--pf-accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  cursor: pointer;
}

.pfilter .pf-slider input[type=range]::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--pf-accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  cursor: pointer;
}

/* Footer (mobile apply) */
.pfilter .pf-footer {
  display: none;
}

.pfilter .pf-apply {
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 4px;
  background: var(--pf-accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.pfilter .pf-apply:hover {
  background: var(--pf-accent-dark);
}

/* Loading */
#content.pf-loading,
.pfilter.pf-loading .pf-groups {
  opacity: .5;
  pointer-events: none;
  transition: opacity .15s ease;
}

/* Mobile button */
.pf-mobile-btn {
  display: none;
}

@media (max-width: 767px) {
  .pf-mobile-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 15px;
    padding: 10px 16px;
    border: 1px solid var(--pf-border, #e3e6ea);
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-weight: 700;
    font-size: 15px;
  }

  .pf-mobile-btn .pf-badge {
    display: inline-block;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #2b7fc3;
    color: #fff;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
  }

  .pfilter {
    display: none;
    position: fixed;
    z-index: 10000;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 76px;
  }

  body.pf-open {
    overflow: hidden;
  }

  body.pf-open #pfilter.pfilter {
    display: block !important;
  }

  .pfilter .pf-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
  }

  .pfilter .pf-close {
    display: block;
  }

  .pfilter .pf-footer {
    display: block;
    position: fixed;
    z-index: 3;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 12px 15px;
    background: #fff;
    border-top: 1px solid var(--pf-border);
  }

  .pfilter .pf-opt label {
    padding: 8px 0;
  }
}
