/* Shop page — top filter bar (module CSS; themes should not own this). */

/* —— Top filter bar (replaces left category sidebar) —— */
.shop-filters {
  margin: 0 0 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.shop-filters__bar {
  width: 100%;
}

.shop-filters__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.shop-filters__row--main {
  justify-content: space-between;
}

/* Facet row (category / price): no outer frame; toggled by Filter */
.shop-filters__panel {
  display: none;
  width: 100%;
}

.shop-filters.is-open .shop-filters__panel {
  display: block;
}

.shop-filters__panel[hidden] {
  display: none !important;
}

.shop-filters__row--chips {
  gap: 0.5rem;
}

/* Dual-range retail price slider */
.shop-price-panel {
  min-width: min(17.5rem, 88vw);
  padding: 0.65rem 0.75rem 0.85rem;
}

.shop-price-panel__head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.55rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line, #e5e7eb);
}

.shop-price-panel__reset {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--hush, #6b7280);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.12em;
  cursor: pointer;
}

.shop-price-slider {
  /* track 6px, thumb 18px → center with webkit margin-top: (6-18)/2 = -6px */
  --price-track-h: 6px;
  --price-thumb: 18px;
  position: relative;
  height: var(--price-thumb);
  margin: 0.45rem 0 0.85rem;
  --price-lo: 0%;
  --price-hi: 100%;
}

.shop-price-slider::before,
.shop-price-slider::after {
  content: "";
  position: absolute;
  top: 50%;
  height: var(--price-track-h);
  transform: translateY(-50%);
  border-radius: 999px;
  pointer-events: none;
}

.shop-price-slider::before {
  left: 0;
  right: 0;
  background: var(--line, #e5e7eb);
  z-index: 0;
}

.shop-price-slider::after {
  left: var(--price-lo);
  right: calc(100% - var(--price-hi));
  background: var(--accent, #2563eb);
  z-index: 1;
}

.shop-price-slider__input {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  pointer-events: none;
  z-index: 2;
}

.shop-price-slider__input--max {
  z-index: 3;
}

.shop-price-slider__input::-webkit-slider-runnable-track {
  height: var(--price-track-h);
  background: transparent;
  border: none;
}

.shop-price-slider__input::-moz-range-track {
  height: var(--price-track-h);
  background: transparent;
  border: none;
}

.shop-price-slider__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--price-thumb);
  height: var(--price-thumb);
  margin-top: calc((var(--price-track-h) - var(--price-thumb)) / 2);
  border-radius: 999px;
  background: var(--accent, #2563eb);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.22);
  cursor: pointer;
  pointer-events: auto;
}

.shop-price-slider__input::-moz-range-thumb {
  width: var(--price-thumb);
  height: var(--price-thumb);
  border-radius: 999px;
  background: var(--accent, #2563eb);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.22);
  cursor: pointer;
  pointer-events: auto;
}

.shop-price-panel__inputs {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.shop-price-panel__field {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 0.5rem);
  padding: 0.35rem 0.5rem;
  background: var(--white, #fff);
}

.shop-price-panel__cur {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--hush, #6b7280);
  flex-shrink: 0;
}

.shop-price-panel__field input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--void, #111);
  outline: none;
}

.shop-price-panel__dash {
  color: var(--hush, #6b7280);
  font-weight: 600;
}

/* In-stock toggle chip */
a.shop-chip--toggle {
  text-decoration: none;
  color: inherit;
}

a.shop-chip--toggle .shop-chip__summary {
  cursor: pointer;
}

a.shop-chip--toggle.is-active .shop-chip__summary {
  border-color: var(--void, #111);
  background: var(--void, #111);
  color: #fff;
}

a.shop-chip--toggle.is-active .shop-chip__label {
  color: #fff;
}

/* Active filter pills */
.shop-active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.6rem;
  margin: 0.15rem 0 0;
  padding: 0;
}

.shop-active-filters__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  padding: 0.45rem 0.7rem;
  border: 0;
  border-radius: var(--radius, 0.5rem);
  background: #f3f4f6;
  color: #111;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none !important;
  line-height: 1.25;
  white-space: nowrap;
}

.shop-active-filters__pill > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-active-filters__pill:hover {
  background: #e5e7eb;
  color: #111;
}

.shop-active-filters__x {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1em;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1;
  color: #6b7280;
}

.shop-active-filters__pill:hover .shop-active-filters__x {
  color: #111;
}

.shop-active-filters__clear {
  margin-left: 0.1rem;
  padding: 0.2rem 0;
  color: #6b7280;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: underline !important;
  text-underline-offset: 0.14em;
  white-space: nowrap;
}

.shop-active-filters__clear:hover {
  color: #111;
}

.shop-filters__start,
.shop-filters__end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
}

.shop-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius, 0.5rem);
  background: var(--chalk, #f4f4f5);
  padding: 0.45rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--void);
  cursor: pointer;
}

.shop-filter-btn:hover {
  border-color: var(--void);
  background: var(--white);
}

.shop-filter-btn.is-active {
  border-color: var(--void);
  background: var(--white);
}

.shop-filter-btn__icon {
  flex-shrink: 0;
}

.shop-toolbar__count {
  margin: 0;
  font-size: 0.875rem;
  color: var(--hush);
}

.shop-toolbar__sort {
  margin: 0;
}

.shop-toolbar__label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.shop-toolbar__label-text {
  color: var(--hush);
  font-weight: 500;
}

.shop-toolbar__select {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius, 0.5rem);
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--void);
  max-width: 14rem;
}

.shop-toolbar__select:focus {
  outline: 2px solid rgb(var(--void-rgb) / 0.25);
  outline-offset: 1px;
}

.shop-view {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius, 0.5rem);
  background: var(--white);
}

.shop-view__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: 0;
  border: 0;
  border-radius: var(--radius, 0.5rem);
  background: transparent;
  color: var(--hush);
  cursor: pointer;
}

.shop-view__btn:hover {
  color: var(--void);
  background: var(--chalk, #f4f4f5);
}

.shop-view__btn.is-active {
  color: var(--void);
  background: var(--chalk, #f4f4f5);
}

.shop-chip {
  position: relative;
  margin: 0;
}

.shop-chip__summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius, 0.5rem);
  background: var(--white);
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.shop-chip__summary::-webkit-details-marker {
  display: none;
}

.shop-chip.is-active .shop-chip__summary,
.shop-chip[open] .shop-chip__summary {
  border-color: var(--void);
}

.shop-chip__label {
  color: var(--hush);
  font-weight: 500;
}

.shop-chip__value {
  color: var(--void);
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-chip__caret {
  font-size: 0.7rem;
  color: var(--hush);
}

.shop-chip__menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 40;
  min-width: min(18rem, 85vw);
  max-height: min(22rem, 60vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius, 0.5rem);
  background: var(--white);
  box-shadow: 0 10px 28px rgb(var(--void-rgb) / 0.12);
  padding: 0.35rem;
}

.shop-chip__menu .shop-tree {
  padding: 0.25rem;
  max-height: none;
  overflow: visible;
}

.shop-chip__menu--plain {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 10rem;
}

.shop-chip__option {
  display: block;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius, 0.5rem);
  color: var(--void);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.shop-chip__option:hover {
  background: var(--chalk, #f4f4f5);
}

.shop-chip__option.is-active {
  background: var(--void);
  color: var(--white);
  font-weight: 600;
}

.shop-tree {
  margin: 0;
  padding: 0.75rem 0.75rem 1.5rem;
  list-style: none;
  overflow: auto;
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
}

.shop-tree__item {
  margin: 0;
}

.shop-tree__link {
  display: block;
  padding: 0.45rem 0.5rem;
  padding-left: calc(0.5rem + (var(--shop-depth, 0) * 0.85rem));
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--void);
  border-radius: var(--radius);
  text-decoration: none;
  line-height: 1.35;
}

.shop-tree__link:hover {
  background: var(--chalk);
}

.shop-tree__link.is-ancestor {
  font-weight: 600;
}

.shop-tree__link.is-active {
  background: var(--void);
  color: var(--white);
  font-weight: 600;
}

/* Legacy header filter control (usually hidden via ShowShopCat=false) */
.shop-cat-open {
  display: none;
}

@media (min-width: 1200px) {
  .product-grid--shop {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1600px) {
  .product-grid--shop {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* List view */
.product-grid--shop.is-list {
  grid-template-columns: 1fr !important;
  gap: 0.85rem;
}

.product-grid--shop.is-list .product-card__link {
  display: grid;
  grid-template-columns: minmax(5.5rem, 8rem) minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
}

/* Neutralize legacy left-rail rules still present in some theme site.css */
.shop-layout {
  display: block !important;
}
.shop-sidebar,
.shop-toolbar__category {
  display: none !important;
}

.product-grid--shop.is-list .product-card__media {
  aspect-ratio: 1;
  border-radius: var(--radius-lg, 0.75rem) 0 0 var(--radius-lg, 0.75rem);
}

.product-grid--shop.is-list .product-card__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.85rem 1rem;
}
