

.ai-filters {
  --ai-accent: #229ac8;
  --ai-text: #212529;
  --ai-group-label: #6b7280;
  --ai-chip-selected-bg: #444444;
  --ai-counter-bg: #f3f4f6;
  --ai-group-bg: #ffffff;
  --ai-group-border: #f3f4f6;
  --ai-selected-bg: #ffffff;
  --ai-selected-border: #e5e7eb;
  font-family: inherit;
  color: var(--ai-text);
  line-height: 1.4; font-size: 13px;
}
.ai-filters * { box-sizing: border-box; }

.ai-filters__header {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px; padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb; margin-bottom: 12px;
}
.ai-filters__title { margin: 0; font-size: 17px; font-weight: 600; }
.ai-filters__counter {
  font-size: 12px; color: #6b7280; background: #f3f4f6;
  padding: 3px 10px; border-radius: 12px;
}
.ai-filters__clear {
  margin-left: auto; font-size: 12px; color: #dc2626;
  text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
}
.ai-filters__clear:hover { color: #991b1b; text-decoration: underline; }

.ai-filters__selected {
  padding: 10px 12px 12px;
  margin-bottom: 12px;
  background: var(--ai-selected-bg);
  border: 1px solid var(--ai-selected-border);
  border-radius: 6px;
}
.ai-filters__selected-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--ai-group-label); margin-bottom: 8px; font-weight: 600;
}
.ai-filters__selected-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ai-selected-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 4px 4px 10px;
  background: var(--ai-chip-selected-bg); color: #fff;
  border: 1px solid var(--ai-chip-selected-bg); border-radius: 4px;
  font-size: 12px; line-height: 1.2; font-weight: 600;
  text-decoration: none; transition: all 0.12s;
  max-width: 100%;
}
.ai-selected-chip:hover {
  opacity: 0.85; color: #fff; text-decoration: none;
}
.ai-selected-chip__label {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 200px;
}
.ai-selected-chip__x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.2); color: #fff;
  transition: background 0.12s;
  font-size: 0.9em;
}
.ai-selected-chip:hover .ai-selected-chip__x {
  background: rgba(255, 255, 255, 0.35); color: #fff;
}

.ai-filters--vertical .ai-filter-group { margin-bottom: 18px; }
.ai-filters--vertical .ai-filter-group__list { display: flex; flex-direction: column; gap: 2px; }

.ai-filters--horizontal { padding: 14px; background: #f8f9fa; border-radius: 10px; margin-bottom: 20px; }
.ai-filters--horizontal .ai-filter-group { display: inline-block; margin-right: 24px; margin-bottom: 12px; vertical-align: top; }
.ai-filters--horizontal .ai-filter-group__label { display: block; margin-bottom: 6px; font-weight: 600; }
.ai-filters--horizontal .ai-filter-group__list { display: flex; flex-direction: column; gap: 2px; min-width: 180px; }

.ai-filters--sticky { position: sticky; top: 10px; max-height: calc(100vh - 40px); overflow-y: auto; }

.ai-filter-group { background: var(--ai-group-bg); border-bottom: 1px solid var(--ai-group-border); padding: 10px 12px 14px; border-radius: 6px; }
.ai-filter-group:last-child { border-bottom: none; }
.ai-filter-group__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; cursor: pointer; user-select: none;
}
.ai-filter-group__label { font-weight: 600; font-size: 14px; color: var(--ai-group-label); }
.ai-filter-group__toggle {
  background: none; border: none; padding: 4px; cursor: pointer;
  color: #6b7280; width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px;
}
.ai-filter-group__toggle:hover { background: #f3f4f6; color: #444; }

.ai-ico-chevron {
  display: inline-block;
  width: 10px; height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 0.2s ease;
}
.ai-filter-group[data-collapsed="1"] .ai-ico-chevron {
  transform: rotate(-45deg) translate(-1px, 1px);
}
.ai-filter-group[data-collapsed="1"] .ai-filter-group__body { display: none; }

.ai-filter-group__search {
  width: 100%; padding: 6px 10px; margin-bottom: 8px;
  border: 1px solid #e5e7eb; border-radius: 4px; font-size: 12px;
  background: #fff;
}
.ai-filter-group__search:focus { outline: none; border-color: #444; box-shadow: 0 0 0 2px rgba(68, 68, 68, 0.15); }

.ai-filter-group__list { margin: 0; padding: 0; }
.ai-filter-option { display: block; }
.ai-filter-option--hidden { display: none; }
.ai-filter-group[data-expanded="1"] .ai-filter-option--hidden { display: block; }

.ai-chip {
  display: flex; align-items: center;
  padding: 6px 8px; border-radius: 4px;
  text-decoration: none; color: #374151;
  font-size: 13px; line-height: 1.3;
  transition: background 0.12s;
  gap: 8px;
}
.ai-chip:hover {
  background: #f3f4f6; text-decoration: none; color: #111827;
}

.ai-chip { position: relative; }
.ai-filters .ai-chip::before {
  content: "";
  width: 16px; height: 16px;
  flex-shrink: 0;
  border: 1.5px solid #cbd5e1;
  border-radius: 3px;
  background: #fff;
  transition: all 0.12s;
  display: inline-block;
}
.ai-filters .ai-chip:hover::before { border-color: var(--ai-accent); }

.ai-filters .ai-chip--active {
  background: #eff6ff; color: var(--ai-accent); font-weight: 500;
}
.ai-filters .ai-chip--active:hover { background: #dbeafe; color: var(--ai-accent); }
.ai-filters .ai-chip--active::before {
  background: var(--ai-accent); border-color: var(--ai-accent);
}
.ai-filters .ai-chip--active::after {
  content: ""; position: absolute;
  left: 11px; top: 49%;
  width: 10px; height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translateY(-65%) rotate(-45deg);
  pointer-events: none;
}

.ai-chip__label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-chip__count {
  flex-shrink: 0;
  color: #6b7280; font-size: 11px;
  background: var(--ai-counter-bg);
  padding: 1px 6px; border-radius: 10px;
  min-width: 20px; text-align: center;
}
.ai-chip--active .ai-chip__count { color: var(--ai-accent); font-weight: 600; }

.ai-filter-group__more {
  background: transparent; border: none; color: var(--ai-accent);
  padding: 6px 8px; cursor: pointer; font-size: 12px;
  margin-top: 4px; text-align: left; width: 100%;
  border-radius: 4px;
}
.ai-filter-group__more:hover { background: #eff6ff; }
.ai-filter-group__more .ai-less-label { display: none; }
.ai-filter-group[data-expanded="1"] .ai-filter-group__more .ai-more-label { display: none; }
.ai-filter-group[data-expanded="1"] .ai-filter-group__more .ai-less-label { display: inline; }

.ai-filter-price__inputs { display: flex; align-items: center; gap: 6px; margin-bottom: 16px; }
.ai-filter-price__min, .ai-filter-price__max {
  flex: 1; padding: 6px 10px; border: 1px solid #e5e7eb; border-radius: 4px;
  font-size: 13px; min-width: 0; text-align: center;
  background: #f9fafb;
}
.ai-filter-price__min:focus, .ai-filter-price__max:focus {
  outline: none; border-color: #10b981; box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
  background: #fff;
}
.ai-filter-price__sep { color: #9ca3af; font-weight: bold; }
.ai-filter-price__ccy { color: #6b7280; font-size: 12px; padding-left: 4px; }

.ai-filter-price__slider {
  position: relative;
  height: 24px;
  margin: 4px 0 6px;
}
.ai-filter-price__track {
  position: absolute; left: 9px; right: 9px; top: 50%;
  height: 4px; transform: translateY(-50%);
  background: #e5e7eb; border-radius: 4px;
}
.ai-filter-price__range {
  position: absolute; top: 50%;

  left:  calc(9px + (100% - 18px) * var(--lo, 0));
  width: calc((100% - 18px) * (var(--hi, 1) - var(--lo, 0)));
  height: 4px; transform: translateY(-50%);
  background: linear-gradient(90deg, var(--ai-accent), var(--ai-accent));
  border-radius: 4px;
  pointer-events: none;
}

.ai-filter-price__handle-min,
.ai-filter-price__handle-max {
  position: absolute; left: 0; right: 0; top: 0;
  width: 100%; height: 100%;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background: transparent; pointer-events: none; margin: 0; padding: 0;
  outline: none; border: none;
}

.ai-filter-price__handle-min::-webkit-slider-runnable-track,
.ai-filter-price__handle-max::-webkit-slider-runnable-track {
  background: transparent; border: none; height: 4px;
}
.ai-filter-price__handle-min::-webkit-slider-thumb,
.ai-filter-price__handle-max::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  pointer-events: auto;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ai-accent); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: grab; margin-top: -7px;
  transition: transform 0.1s;
}
.ai-filter-price__handle-min::-webkit-slider-thumb:active,
.ai-filter-price__handle-max::-webkit-slider-thumb:active {
  cursor: grabbing; transform: scale(1.1); background: var(--ai-accent);
}

.ai-filter-price__handle-min::-moz-range-track,
.ai-filter-price__handle-max::-moz-range-track {
  background: transparent; border: none; height: 100%;
}
.ai-filter-price__handle-min::-moz-range-progress,
.ai-filter-price__handle-max::-moz-range-progress {
  background: transparent;
}
.ai-filter-price__handle-min::-moz-range-thumb,
.ai-filter-price__handle-max::-moz-range-thumb {
  pointer-events: auto;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ai-accent); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: grab;
}
.ai-filter-price__handle-min::-moz-focus-outer,
.ai-filter-price__handle-max::-moz-focus-outer { border: 0; }

.ai-filter-price__handle-min { z-index: 2; }
.ai-filter-price__handle-max { z-index: 3; }

.ai-ico-x::before { content: "×"; font-weight: bold; font-size: 1.1em; line-height: 1; }

.ai-filters-trigger {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  z-index: 1030;
  display: none;
  align-items: center; gap: 8px;
  background: var(--ai-accent); color: #fff;
  border: none; border-radius: 6px;
  padding: 10px 16px;
  font-size: 14px; font-weight: 600; line-height: 1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ai-filters-trigger--pill   { border-radius: 999px; padding: 10px 20px; }
.ai-filters-trigger--circle {
  border-radius: 50%;
  width: 52px; height: 52px;
  padding: 0;
  justify-content: center;
  gap: 0;
}
.ai-filters-trigger--circle .ai-filters-trigger__label,
.ai-filters-trigger--circle .ai-filters-trigger__count { display: none !important; }
.ai-filters-trigger--circle .ai-filters-trigger__icon { width: 22px; height: 22px; }
.ai-filters-trigger:hover  { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(34, 154, 200, 0.45), 0 3px 8px rgba(0, 0, 0, 0.16); }
.ai-filters-trigger:active { transform: scale(0.97); }
.ai-filters-trigger__icon {
  display: block; width: 18px; height: 18px; flex-shrink: 0;

  background:
    linear-gradient(#fff, #fff) center 3px / 18px 2px no-repeat,
    linear-gradient(#fff, #fff) center 8px / 12px 2px no-repeat,
    linear-gradient(#fff, #fff) center 13px / 6px 2px no-repeat;
}
.ai-filters-trigger__label { font-weight: 600; }
.ai-filters-trigger__count {
  display: inline-block;
  min-width: 20px; height: 20px;
  background: #fff; color: var(--ai-accent);
  border-radius: 10px; padding: 0 6px;
  font-size: 11px; font-weight: 700;
  line-height: 20px; text-align: center;
  margin-left: 2px;
}

.ai-filters-backdrop {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(17, 24, 39, 0.55);
  z-index: 1040;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.ai-filters-backdrop--open { opacity: 1; pointer-events: auto; }

.ai-filters-close {
  position: absolute; top: 12px; right: 14px;
  width: 36px; height: 36px;
  background: transparent; border: none;
  font-size: 28px; line-height: 1; color: #6b7280;
  cursor: pointer; padding: 0;
  display: none; z-index: 2;
}
.ai-filters-close:hover { color: #111827; }

.ai-filters-body-lock { overflow: hidden; }

@media (max-width: 768px) {
  .ai-filters--sticky { position: static; max-height: none; overflow: visible; }


  .ai-filters-trigger { display: inline-flex; }


  .ai-filters--mobile {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 85vw; max-width: 360px;
    background: #fff;
    box-shadow: 2px 0 24px rgba(0, 0, 0, 0.18);
    z-index: 1050;
    padding: 16px 16px 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
                visibility 0s linear 0.28s;
  }
  .ai-filters--mobile.ai-filters--mobile-open {
    visibility: visible;
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
                visibility 0s linear 0s;
  }

  .ai-filters--mobile .ai-filters-close { display: block; }


  .ai-filters--mobile > .ai-filters__header { padding-top: 6px; padding-right: 40px; }
}
