/*
 *  LEDme — Component Facets Redesign
 *  Butoane pill moderne, tot pe un rând, fără bullet-uri
*/

/* ── Font size responsive ── */
@media screen and (max-width: 474px) {
  .facets__summary { font-size: calc(14px / 16 * var(--base-body-size) + 0px); }
}
@media screen and (min-width: 475px) and (max-width: 1023px) {
  .facets__summary { font-size: calc(15px / 16 * var(--base-body-size) + 0px); }
}
@media screen and (min-width: 1024px) {
  .facets__summary { font-size: calc(16px / 16 * var(--base-body-size) + 0px); }
}

/* ── Layout de bază ── */
.facets {
  display: block;
  margin-left: var(--horizontal-padding);
  margin-right: var(--horizontal-padding);
}

.facets__form {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

/* ── Container filtre ── */
.facets__prewrapper {
  max-width: 100%;
  flex: 1;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 14px 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  margin-bottom: 14px;
}

/* Ascundem titlul "Filtre" — butonul deja explică */
.facets__heading {
  display: none;
}

/* ── Wrapper filtre — rând orizontal ── */
.facets__wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* ── Disclosure (container buton+dropdown) ── */
.facets__disclosure {
  width: auto;
  display: inline-block;
  position: relative;
  margin: 0 0 6px 0;
}

/* ── Buton pill ── */
.facets__summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background-color: #f3f4f6;
  border: 1.5px solid #d1d5db;
  border-radius: 50px;
  color: #374151;
  padding: 6px 14px;
  width: auto;
  cursor: pointer;
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 100ms linear, background 100ms linear, color 100ms linear;
  -webkit-appearance: none;
  outline: none !important;
  resize: none;
  vertical-align: middle;
  background-image: none;
  background-repeat: no-repeat;
}

.no-touchevents .facets__summary:hover,
.facets__summary:focus,
.facets__summary.content-opened {
  border-color: #374151;
  background-color: #e9eaec;
}

.facets__summary:focus-visible {
  box-shadow: 0 0 0 3px rgba(27, 107, 58, 0.2);
}

/* Filtru deschis — verde */
.facets__disclosure[open] > .facets__summary {
  border-color: #1b6b3a;
  background-color: #ecfdf5;
  color: #1b6b3a;
}

/* Badge cu numărul de valori active */
.facets__summary .facets__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1b6b3a;
  color: #fff;
  border-radius: 50%;
  width: 17px;
  height: 17px;
  font-size: 10px;
  font-weight: 700;
}

/* ── Panoul dropdown ── */
.facets__display {
  position: absolute;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  width: max-content;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.11);
  z-index: 100;
}

/* Header dropdown */
.facets__header {
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.facets__header a {
  display: inline-block;
  font-size: 12px;
  color: #1b6b3a;
  text-decoration: underline;
}

.facets__selected {
  font-size: 12px;
  color: #6b7280;
}

/* ── Lista checkboxuri — fără bullet ── */
.facets__list {
  list-style: none;
  padding: 10px 14px;
  margin: 0;
}

.facets__item {
  padding: 3px 0;
}

.facets__item label {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  cursor: pointer;
  font-size: 13.5px;
  color: #374151;
  transition: color 100ms;
}

.no-touchevents .facets__item label:hover {
  color: #1b6b3a;
}

.facets__item label.facet-checkbox--disabled {
  opacity: 0.3;
  pointer-events: none;
}

.facets__item input[type=checkbox] {
  cursor: pointer;
  accent-color: #1b6b3a;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* ── Preț range ── */
.facets__price {
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.facets__price .field {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  position: relative;
  flex: 1;
}

.facets__price .field:focus-within {
  border-color: #1b6b3a;
}

.facets__price .field__currency {
  position: absolute;
  opacity: 0.4;
  top: 50%;
  transform: translateY(-50%);
  left: 10px;
  padding-top: 1px;
  font-size: 12px;
  pointer-events: none;
}

.facets__price .field__label {
  text-transform: lowercase;
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.facets__price input {
  width: 85px;
  height: 34px;
  padding-left: 24px;
  border: none;
  text-align: right;
  background: transparent;
  font-size: 13px;
  border-radius: 8px;
  outline: none;
}

/* ── Sort dropdown ── */
.collection-filters__item select {
  width: fit-content;
}

.collection-filters__label {
  margin-bottom: 8px;
  display: block;
  font-size: 12px;
  color: #6b7280;
}

/* ── Overlay click-outside ── */
.disclosure-has-popup:focus { outline: none !important; }
.disclosure-has-popup summary:focus { outline: none !important; }

.disclosure-has-popup[open] > summary::before {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 2;
  display: block;
  cursor: default;
  content: " ";
  background: transparent;
}

.disclosure-has-popup[open] > summary + * {
  z-index: 100;
}

/* ── Chip-uri filtre active ── */
.active-facets {
  margin: 8px 0 4px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid #f3f4f6;
}

.active-facets:empty { display: none; }

.active-facets__button {
  position: relative;
  font-size: 12px !important;
  padding: 4px 32px 4px 12px !important;
  border-radius: 50px !important;
}

.active-facets__button--light {
  background: #ecfdf5 !important;
  border-color: #1b6b3a !important;
  color: #1b6b3a !important;
}

.active-facets__button svg {
  top: 50%;
  right: 6px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  position: absolute;
  pointer-events: none;
}

.active-facets__button svg * {
  transition: all 100ms linear;
  fill: #1b6b3a;
}

.no-touchevents .active-facets__button:hover svg * {
  fill: #145028;
  stroke: none;
}

/* Buton "Șterge toate" */
.active-facets a.button--solid {
  background: #1b6b3a !important;
  color: #fff !important;
  border-color: #1b6b3a !important;
  border-radius: 50px !important;
  font-size: 12px !important;
  padding: 4px 14px !important;
}

/* ── Mobile (sidebar) ── */
.facets__form--mobile {
  display: block;
}
.facets__form--mobile .facets__prewrapper {
  max-width: 100%;
  padding: var(--sidebar-gutter);
  border: none;
  box-shadow: none;
  border-radius: 0;
  background: transparent;
}
.facets__form--mobile .facets__heading {
  display: block;
  margin-top: 1.125rem;
  line-height: 1;
  font-weight: var(--font-weight-body-bold);
}
.facets__form--mobile .facets__disclosure {
  width: 100%;
  margin-bottom: 0;
}
.facets__form--mobile .facets__summary {
  width: 100%;
  padding-left: 0;
  padding-right: 1.875rem;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid var(--color-borders-main) !important;
  background-position: 100% center;
  background-color: transparent;
}
.facets__form--mobile .facets__display {
  position: relative;
  border: 0;
  top: 0;
  left: 0;
  width: 100%;
  max-height: none;
  box-shadow: none;
  border-radius: 0;
}
.facets__form--mobile .facets__header {
  display: none;
}
.facets__form--mobile .facets__list {
  margin-top: 0.75rem;
  padding: 0;
}
.facets__form--mobile .facets__price {
  padding: 0.75rem 0 0.5rem;
}
.facets__form--mobile .active-facets {
  margin-top: 1.125rem;
  border-top: none;
  padding-top: 0;
}
.facets__form--mobile .collection-filters__item {
  padding: 0 var(--sidebar-gutter);
}
.facets__form--mobile .collection-filters__item select {
  width: 100%;
}
.facets__form--mobile .collection-filters__label {
  display: block;
  margin-top: 1.125rem;
  line-height: 1;
  font-weight: var(--font-weight-body-bold);
  color: inherit;
  font-size: inherit;
}

/* ── Misc ── */
.collection-product-count {
  opacity: 0.66;
  margin-bottom: 1.75rem;
}

.collection.loading {
  opacity: 0.36;
  pointer-events: none;
}

@media screen and (max-width: 767px) {
  .section-heading--facets .section-heading__text {
    order: 2;
  }
  .section-heading--facets .section-heading__actions {
    order: 1;
    margin-top: 0;
    margin-bottom: 0.875rem;
  }
}
