/* پنل فیلتر — بدون تغییر در ساختار و ظاهر */
.filters-panel-shell {
  position: fixed;
  inset: 0;
  z-index: 999999;
  pointer-events: none;
}
.filters-panel-shell:not([hidden]) {
  pointer-events: auto;
}
.filters-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
}
.filters-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(100%, 390px);
  background: var(--bg-body, #fff);
  box-shadow: -2px 0 12px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
[dir="rtl"] .filters-drawer { right: auto; left: 0; box-shadow: 2px 0 12px rgba(0,0,0,0.15); }
.filters-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.filters-title { margin: 0; font-size: 1.125rem; }
.filters-close {
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.filters-close:hover { background: rgba(0,0,0,0.06); }
.filters-close::before { content: "\2715"; font-size: 1.25rem; }
.filters-active-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  flex: 0 0 auto;
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(102, 126, 234, 0.25);
  max-height: 10rem;
  overflow-y: auto;
  background: rgba(102, 126, 234, 0.1);
  min-height: 2.75rem;
}
.filters-active-bar[hidden] { display: none !important; }
.filters-active-bar__title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #667eea;
}
.filters-active-bar__list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
}
.filters-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  padding: 0.3125rem 0.375rem 0.3125rem 0.625rem;
  border-radius: 999px;
  background: rgba(102, 126, 234, 0.14);
  border: 1px solid rgba(102, 126, 234, 0.22);
  color: inherit;
  font-size: 0.8125rem;
  line-height: 1.3;
}
.filters-active-chip__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
}
.filters-active-chip__remove {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.375rem;
  height: 1.375rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1.125rem;
  line-height: 1;
  opacity: 0.75;
}
.filters-active-chip__remove:hover {
  opacity: 1;
  background: rgba(0,0,0,0.08);
}

/* نوار chip زیر جستجو — کوچک و مینیمال */
.filters-active-bar--page {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  min-height: 0;
  max-height: none;
  overflow: visible;
  border: none;
  background: transparent;
  flex: none;
  order: unset;
}
.filters-active-bar--page[hidden] {
  display: none !important;
}
.filters-active-bar--page .filters-active-bar__list {
  width: 100%;
  gap: 0.35rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 1px 4px;
}
.filters-active-bar--page .filters-active-bar__list::-webkit-scrollbar {
  display: none;
}
.filters-active-bar--page .filters-active-chip {
  flex: 0 0 auto;
  max-width: 11rem;
  padding: 0.2rem 0.25rem 0.2rem 0.5rem;
  font-size: 0.6875rem;
  line-height: 1.25;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(106, 0, 255, 0.18);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  color: #4a5568;
}
.filters-active-bar--page .filters-active-chip__label {
  max-width: 8.5rem;
}
.filters-active-bar--page .filters-active-chip__remove {
  width: 1.125rem;
  height: 1.125rem;
  font-size: 0.9375rem;
  opacity: 0.65;
}
.filters-active-bar--page .filters-active-chip__remove:hover,
.filters-active-bar--page .filters-active-chip__remove:focus-visible {
  opacity: 1;
  background: rgba(106, 0, 255, 0.1);
  outline: none;
}

[data-theme="dark"] .filters-active-bar--page {
  background: transparent;
  border: none;
}
[data-theme="dark"] .filters-active-bar--page .filters-active-chip {
  background: rgba(30, 34, 42, 0.95);
  border-color: rgba(167, 139, 250, 0.28);
  color: #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}
[data-theme="dark"] .filters-active-bar--page .filters-active-chip__remove:hover,
[data-theme="dark"] .filters-active-bar--page .filters-active-chip__remove:focus-visible {
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 991px) {
  .filters-active-bar--page {
    margin-top: 4px;
  }
  .filters-active-bar--page .filters-active-chip {
    max-width: 9.5rem;
    font-size: 0.625rem;
    padding: 0.18rem 0.2rem 0.18rem 0.45rem;
  }
  .filters-active-bar--page .filters-active-chip__label {
    max-width: 7rem;
  }
  .filters-active-bar--page .filters-active-chip__remove {
    width: 1rem;
    height: 1rem;
    font-size: 0.875rem;
  }
}

.filters-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}
.filters-fieldset {
  margin: 0 0 1.25rem;
  padding: 0;
  border: none;
}
.filters-fieldset legend {
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}
.filters-price-row {
  position: relative;
  display: flex;
  gap: 0;
  height: 2rem;
  align-items: center;
}
.filters-range {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}
.filters-range::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; appearance: none; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--accent, #667eea); cursor: pointer; }
.filters-range::-moz-range-thumb { pointer-events: auto; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--accent, #667eea); cursor: pointer; border: none; }
.filters-range-track {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  background: var(--accent, #667eea);
  opacity: 0.4;
  pointer-events: none;
  border-radius: 2px;
}
.filters-price-inputs {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.filters-input {
  flex: 1;
  max-width: 150px;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px;
  font-size: 1rem;
}
.filters-sort-radios {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.filters-sort-radios label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.filters-check-wrap { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.filters-image-radios { display: flex; flex-direction: column; gap: 0.5rem; }
.filters-radio-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.filters-fieldset--brand .filters-brand-search {
  margin-bottom: 0.5rem;
  max-width: 285px !important;
}
.filters-brand-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: min(52vh, 320px);
  overflow-y: auto;
  padding: 2px 0;
  margin-top: 0.35rem;
}
.filters-brand-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 10px 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  background: var(--bg-body, #fff);
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: center;
  min-height: 0;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.filters-brand-item:hover {
  border-color: var(--hp-accent, #6e00ff);
  background: rgba(110, 0, 255, 0.04);
}
.filters-brand-item.is-active {
  border-color: var(--hp-accent, #6e00ff);
  background: rgba(110, 0, 255, 0.08);
  box-shadow: 0 0 0 1px var(--hp-accent, #6e00ff);
}
.filters-brand-item img {
  width: 100%;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
}
.filters-brand-item__name {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.filters-drawer-footer {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(0,0,0,0.08);
}
.filters-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
}
.filters-reset { background: rgba(0,0,0,0.08); color: inherit; }
.filters-apply { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; }
.filters-toggle { background: transparent; border: none; cursor: pointer; padding: 0.5rem; }
.filters-toggle.has-badge { position: relative; }
.filters-toggle.has-badge::after { content: none; }

/* Badge نقطه آبی روی خود آیکون فیلتر */
.filters-toggle .fa-filter {
  position: relative;
  display: inline-block;
}
.filters-toggle.has-badge .fa-filter::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--accent, #667eea);
  border-radius: 50%;
}


[data-theme="dark"] .filters-drawer {
  background: #171a20;
  color: #f3f4f6;
}

[data-theme="dark"] .filters-drawer-header,
[data-theme="dark"] .filters-drawer-footer {
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .filters-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .filters-active-bar {
  background: rgba(102, 126, 234, 0.08);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .filters-active-bar__title {
  color: rgba(255, 255, 255, 0.65);
}

[data-theme="dark"] .filters-active-chip {
  background: rgba(102, 126, 234, 0.2);
  border-color: rgba(102, 126, 234, 0.35);
}

[data-theme="dark"] .filters-active-chip__remove:hover {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .filters-input {
  background: #252a36;
  border-color: #3d4454;
  color: #f3f4f6;
}

[data-theme="dark"] .filters-input::placeholder {
  color: #9ca3af;
}

[data-theme="dark"] .filters-brand-item {
  background: #252a36;
  border-color: rgba(255, 255, 255, 0.14);
  color: #f3f4f6;
}

[data-theme="dark"] .filters-brand-item:hover,
[data-theme="dark"] .filters-brand-item.is-active {
  background: rgba(110, 0, 255, 0.18);
  border-color: rgba(167, 139, 250, 0.65);
}

[data-theme="dark"] .filters-reset {
  background: rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
}

[data-theme="dark"] .filters-sort-radios label,
[data-theme="dark"] .filters-check-wrap,
[data-theme="dark"] .filters-radio-label {
  color: #e5e7eb;
}

[data-theme="dark"] .filters-fieldset legend {
  color: #f3f4f6;
}