/* Lean Product Filters — inherits the theme's font stack on purpose. */

.lpf {
  --lpf-hairline: rgba(0, 0, 0, .09);
  --lpf-rule: rgba(0, 0, 0, .16);
  --lpf-muted: rgba(0, 0, 0, .58);
  --lpf-text: rgba(0, 0, 0, .84);
  --lpf-strong: rgba(0, 0, 0, .96);
  --lpf-hover: rgba(0, 0, 0, .04);
  --lpf-fill: rgba(0, 0, 0, .045);
  --lpf-radius: 4px;
  color: var(--lpf-text);
  font-size: 14px;
  line-height: 1.4;
  width: 100%;
}

.lpf * { box-sizing: border-box; }

.lpf__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- header */

.lpf__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 13px;
  border-bottom: 1px solid var(--lpf-rule);
}

.lpf__heading {
  font-size: 1.2em;
  font-weight: 700;
  letter-spacing: -.012em;
  line-height: 1.2;
  color: var(--lpf-strong);
}

.lpf__mobile-close {
  display: none;
}

.lpf__results {
  font-size: .82em;
  color: var(--lpf-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ------------------------------------------------------- active filters */

.lpf__active {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 13px 0 3px;
}

.lpf__chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px 5px 11px;
  border: 1px solid var(--lpf-rule);
  border-radius: 999px;
  text-decoration: none;
  color: inherit;
  font-size: .84em;
  line-height: 1.35;
  transition: background .12s ease, border-color .12s ease;
}

.lpf__chip:hover { background: var(--lpf-hover); border-color: currentColor; }
.lpf__chip span:last-child { font-size: 1.15em; opacity: .5; line-height: 1; }
.lpf__chip:hover span:last-child { opacity: 1; }

.lpf__clear {
  order: 99;
  font-size: .82em;
  color: var(--lpf-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 4px 2px;
}

.lpf__clear:hover { color: inherit; }

/* ---------------------------------------------------------------- groups */

.lpf__group {
  border-bottom: 1px solid var(--lpf-hairline);
  padding: 13px 0;
}

.lpf__group:last-child { border-bottom: 0; }

.lpf__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  padding: 2px 0;
  font-size: .95em;
  font-weight: 700;
  letter-spacing: -.005em;
  /* WooCommerce attribute labels are typed by hand and are often lowercase. */
  text-transform: capitalize;
  color: var(--lpf-strong);
}


.lpf__summary::-webkit-details-marker { display: none; }

.lpf__summary::after {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  margin-right: 3px;
  border-right: 1.5px solid;
  border-bottom: 1.5px solid;
  opacity: .42;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .18s ease;
}

.lpf__group[open] > .lpf__summary::after {
  transform: rotate(-135deg) translate(-2px, -2px);
}

/* --------------------------------------------------------------- options */

.lpf__options {
  display: flex;
  flex-direction: column;
  padding-top: 9px;
  max-height: 296px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, .2) transparent;
}

.lpf__options::-webkit-scrollbar { width: 5px; }
.lpf__options::-webkit-scrollbar-track { background: transparent; }
.lpf__options::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .2);
  border-radius: 999px;
}

.lpf__option {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  padding: 5px 7px;
  margin: 0 -7px;
  border-radius: var(--lpf-radius);
  color: var(--lpf-text);
  font-weight: 500;
  text-decoration: none;
  transition: background .12s ease;
}

.lpf__option:hover { background: var(--lpf-hover); }
.lpf__option.is-active { color: var(--lpf-strong); font-weight: 700; }

.lpf__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}


.lpf__box {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--lpf-rule);
  border-radius: 3px;
  display: grid;
  place-items: center;
  transition: background .12s ease, border-color .12s ease;
}

.lpf__option:hover .lpf__box { border-color: currentColor; }

.lpf__option.is-active .lpf__box {
  background: currentColor;
  border-color: currentColor;
}

/* Drawn rather than a checkmark glyph, which renders inconsistently across fonts. */
.lpf__option.is-active .lpf__box::after {
  content: '';
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* Tree rows. Indentation is presentational only: a nested term still filters on
   exactly the products assigned to it. */
.lpf__option--parent { color: var(--lpf-strong); font-weight: 700; }
.lpf__option--parent.is-active { font-weight: 700; }

.lpf__option--child { padding-left: 25px; }
.lpf__option--child .lpf__label { font-size: .96em; font-weight: 500; }
.lpf__option--child .lpf__box { transform: scale(.92); }

.lpf__option--group-start { margin-top: 11px; }

/* Anchored explicitly to the top edge. Without an offset an absolutely positioned
   pseudo-element falls back to its static position, which inside this centred grid
   row lands mid-label and strikes the text through. */
.lpf__option--group-start::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 7px;
  right: 7px;
  height: 0;
  border-top: 1px solid var(--lpf-hairline);
  pointer-events: none;
}

.lpf__option { position: relative; }

.lpf__count {
  font-size: .8em;
  color: var(--lpf-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.lpf__option.is-active .lpf__count { color: inherit; opacity: .7; }

/* ----------------------------------------------------------------- price */

.lpf__price-wrap { padding-top: 11px; }

.lpf__price-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.lpf__price-field { position: relative; display: block; }

/* A real prefix element is more resilient than a pseudo-element here: Flatsome's
   mobile form CSS can override input padding aggressively, which previously let the
   currency glyph paint directly over the placeholder/value on iOS. */
.lpf__currency {
  position: absolute;
  z-index: 1;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--lpf-muted);
  font-size: .9em;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
}

.lpf__price-field input {
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 6px 10px 6px 30px !important;
  text-indent: 0 !important;
  border: 1px solid var(--lpf-rule);
  border-radius: var(--lpf-radius);
  background: transparent;
  color: inherit;
  font-size: .95em;
  font-variant-numeric: tabular-nums;
  box-shadow: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

.lpf__price-field input::-webkit-outer-spin-button,
.lpf__price-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.lpf__price-field input::placeholder { color: var(--lpf-muted); opacity: .55; }
.lpf__price-field input:focus { border-color: currentColor; outline: none; }

.lpf__price-sep { opacity: .4; }

.lpf__price-apply {
  display: block;
  width: 100%;
  min-height: 38px;
  margin: 9px 0 0;
  padding: 8px 12px;
  border: 1px solid currentColor;
  border-radius: var(--lpf-radius);
  background: transparent;
  color: inherit;
  font-size: .8em;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1.2;
  cursor: pointer;
  transition: background .12s ease;
}

/* Deliberately a tint rather than a solid fill: the sidebar background is the
   theme's, so inverting to a fixed text colour is not safe here. */
.lpf__price-apply:hover { background: rgba(0, 0, 0, .07); }

.lpf__presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 11px;
}

.lpf__preset {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px;
  border-radius: var(--lpf-radius);
  background: var(--lpf-fill);
  color: inherit;
  text-decoration: none;
  font-size: .86em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: background .12s ease, box-shadow .12s ease;
}

.lpf__preset:hover { background: rgba(0, 0, 0, .08); }

.lpf__preset.is-active {
  box-shadow: inset 0 0 0 1.5px currentColor;
  font-weight: 600;
}

/* ------------------------------------------------------------ show more */

.lpf__more {
  display: block;
  width: 100%;
  margin: 9px 0 0;
  padding: 6px 7px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font-size: .86em;
  font-weight: 600;
  cursor: pointer;
  opacity: .7;
}

.lpf__more:hover { opacity: 1; text-decoration: underline; text-underline-offset: 2px; }
.lpf__more:disabled { cursor: progress; opacity: .4; }
.lpf__group[aria-busy="true"] .lpf__options { opacity: .65; }

/* --------------------------------------------------------------- states */

.lpf-loading { position: relative; min-height: 120px; }

.lpf-loading::after {
  content: '';
  position: absolute;
  z-index: 999;
  inset: 0;
  background: rgba(255, 255, 255, .55);
  pointer-events: auto;
}

.lpf-is-loading { cursor: progress; }
.lpf-is-loading .lpf { pointer-events: none; opacity: .72; }

.lpf__option:focus-visible,
.lpf__preset:focus-visible,
.lpf__chip:focus-visible,
.lpf__summary:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: var(--lpf-radius);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  .lpf * { transition: none !important; }
}

@media (max-width: 849px) {
  .lpf__options { max-height: 258px; }
}

/* ------------------------------------------------ category tree branches */

.lpf__tree-branch {
  position: relative;
}

.lpf__tree-branch--separated {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--lpf-hairline);
}

.lpf__tree-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 2px;
}

.lpf__tree-head .lpf__option--branch-parent {
  margin-right: 0;
}

.lpf__branch-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--lpf-radius);
  background: transparent;
  color: var(--lpf-text);
  cursor: pointer;
}

.lpf__branch-toggle::before {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: .5;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .16s ease, opacity .12s ease;
}

.lpf__branch-toggle[aria-expanded="true"]::before {
  transform: rotate(-135deg) translate(-2px, -2px);
}

.lpf__branch-toggle:hover {
  background: var(--lpf-hover);
}

.lpf__branch-toggle:hover::before { opacity: .9; }

.lpf__branch-toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 1px;
}

.lpf__tree-children[hidden] {
  display: none !important;
}

.lpf__tree-children {
  padding-bottom: 2px;
}

/* Branch separators supersede the old row-level separator. */
.lpf__tree-branch .lpf__option--group-start::before {
  display: none;
}

.lpf__option[data-lpf-depth="2"] { padding-left: 40px; }
.lpf__option[data-lpf-depth="3"] { padding-left: 54px; }

@media (prefers-reduced-motion: reduce) {
  .lpf__branch-toggle::before { transition: none; }
}

/* Flatsome Shop Sidebar bridge. Hidden only after LPF is confirmed present so a
   JavaScript failure never leaves shoppers without filters. */
#shop-sidebar.lpf-sidebar-active .lpf-legacy-filter-hidden,
#shop-sidebar .lpf-legacy-filter-hidden {
  display: none !important;
}

#shop-sidebar [data-lpf-mobile-mirror] {
  width: 100%;
}


/* ------------------------------------------------------ Flatsome mobile drawer */
@media (max-width: 849px) {
  /* Reorder only the filter UI, not the archive: price is the most common numeric
     refinement and should be reachable before long category/brand/attribute lists. */
  .lpf {
    display: flex;
    flex-direction: column;
  }
  .lpf > .lpf__header { order: 0; }
  .lpf > .lpf__active { order: 1; }
  .lpf > .lpf__group { order: 3; }
  .lpf > .lpf__group[data-lpf-group="price"] { order: 2; }

  .lpf__group[data-lpf-group="price"] {
    padding-top: 10px;
    padding-bottom: 11px;
  }
  .lpf__group[data-lpf-group="price"] .lpf__summary {
    font-size: .92em;
  }
  .lpf__price-wrap { padding-top: 8px; }
  .lpf__price-row { gap: 6px; }

  /* Use high-specificity + !important on the dimensions/padding that Flatsome's
     generic mobile input rules otherwise override. */
  .lpf .lpf__price-field input[type="number"] {
    height: 34px !important;
    min-height: 34px !important;
    padding: 4px 7px 4px 27px !important;
    margin: 0 !important;
    font-size: 13px !important;
    font-weight: 600;
    line-height: 1.2 !important;
  }
  .lpf .lpf__currency {
    left: 9px;
    font-size: 12px;
  }
  .lpf__price-sep { font-size: 12px; }
  .lpf__price-apply {
    min-height: 32px;
    margin-top: 7px;
    padding: 6px 10px;
    font-size: .75em;
  }
  .lpf__presets {
    gap: 5px;
    margin-top: 7px;
  }
  .lpf__preset {
    min-height: 31px;
    padding: 5px 6px;
    font-size: .78em;
  }

  /* LPF owns its mobile close control inside the white filter header. We no longer
     depend on where Flatsome/Magnific happens to inject .mfp-close. */
  #shop-sidebar .lpf__header,
  .mfp-wrap.lpf-shop-filter-popup .lpf__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 34px;
    align-items: center;
    column-gap: 10px;
  }

  #shop-sidebar .lpf__mobile-close,
  .mfp-wrap.lpf-shop-filter-popup .lpf__mobile-close {
    display: grid !important;
    place-items: center;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    margin: -5px -5px -5px 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: #222 !important;
    opacity: .72;
    box-shadow: none !important;
    cursor: pointer;
    position: relative;
  }

  #shop-sidebar .lpf__mobile-close span::before,
  #shop-sidebar .lpf__mobile-close span::after,
  .mfp-wrap.lpf-shop-filter-popup .lpf__mobile-close span::before,
  .mfp-wrap.lpf-shop-filter-popup .lpf__mobile-close span::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 19px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transform-origin: center;
  }
  #shop-sidebar .lpf__mobile-close span::before,
  .mfp-wrap.lpf-shop-filter-popup .lpf__mobile-close span::before { transform: translate(-50%, -50%) rotate(45deg); }
  #shop-sidebar .lpf__mobile-close span::after,
  .mfp-wrap.lpf-shop-filter-popup .lpf__mobile-close span::after { transform: translate(-50%, -50%) rotate(-45deg); }
  #shop-sidebar .lpf__mobile-close:hover,
  #shop-sidebar .lpf__mobile-close:focus,
  .mfp-wrap.lpf-shop-filter-popup .lpf__mobile-close:hover,
  .mfp-wrap.lpf-shop-filter-popup .lpf__mobile-close:focus { opacity: 1; }

  /* Hide Flatsome's overlay X only for the popup that actually contains LPF. */
  .mfp-wrap.lpf-shop-filter-popup > .mfp-close,
  .mfp-wrap.lpf-shop-filter-popup .mfp-content > .mfp-close,
  .mfp-wrap.lpf-shop-filter-popup .mfp-container > .mfp-close {
    display: none !important;
  }
}
