/* ===== FILTERS BAR ===== */

.filters-bar {
  position: relative;
  margin-top: -36px; /* заходит на hero */
  z-index: 10;
}

.filters-bar--highlighted .filters-bar__inner {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35),
    0 24px 50px rgba(37, 99, 235, 0.22), 0 10px 24px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
  transition: box-shadow 0.35s ease, transform 0.35s ease;
}

.filters-bar__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;

  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;

  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);

  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.6);

  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ===== PRIMARY ===== */

.filters-primary {
  display: grid;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 10px;
}

/* pill */
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);

  border: 1px solid rgba(203, 213, 225, 0.8);
  cursor: pointer;

  font-size: 0.9rem;
  color: var(--color-text-strong);

  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.filter-pill:hover {
  background: var(--color-white);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.filter-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.filter-value {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* checkbox pill */
.filter-pill--checkbox {
  gap: 6px;
}

.filter-pill__checkbox {
  accent-color: var(--color-primary);
}

.filter {
  position: relative;
}

/* popover скрыт */
.filter-popover {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;

  min-width: 220px;
  padding: 8px;

  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);

  border-radius: 16px;
  border: 1px solid rgba(203, 213, 225, 0.8);

  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);

  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;

  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
}

.filter-popover--floating {
  position: absolute;
  top: 0;
  left: 0;
}

.filter-popover--visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* активное состояние */
.filter--open .filter-popover {
  display: block;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* список */
.filter-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.filter-list__item {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-text-strong);
  transition: background 0.2s ease;
}

.filter-list__item:hover {
  background: rgba(37, 99, 235, 0.08);
}

/* ===== SECONDARY ===== */

.filters-secondary {
  display: grid;
  grid-template-rows: auto auto;
  gap: 10px;
  align-items: start;
}

.filters-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.filters-sort__select {
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-white);
}

/* reset */
.filters-reset {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.filters-reset:hover {
  color: var(--color-text-strong);
}

/* контейнер */
.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* chip */
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  background: var(--color-white);
  color: var(--color-text-strong);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;

  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease,
    transform 0.2s ease;
}

.chip:hover {
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

/* выбран */
.chip--active {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35);
}

.filter-pill--toggle {
  padding: 10px 16px;
  font-weight: 600;
}

/* включено */
.filter-pill--toggle.filter-pill--active {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}

/* chips */
.filters-active {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 6px 12px;
  border-radius: 999px;
  background: var(--color-primary);
  color: var(--color-white);
  font-size: 0.85rem;
  font-weight: 500;

  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.filter-chip:hover {
  background: var(--color-primary-strong);
  transform: translateY(-1px);
}

.filter-chip__remove {
  opacity: 0.8;
  font-weight: 700;
}

/* buttons */
.filters-actions {
  display: flex;
  gap: 10px;
}

.filters-btn {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.filters-btn--ghost {
  background: transparent;
  color: var(--color-text-strong);
  border: 1px solid var(--color-border-strong);
}

@media (max-width: 768px) {
  .filters-bar__inner {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 14px;
  }

  .filters-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .filters-actions .filters-btn,
  .filters-actions .filter {
    width: 100%;
  }

  .filters-actions .filter-pill {
    width: 100%;
    justify-content: space-between;
  }

  .filters-active {
    overflow-x: auto;
    padding-bottom: 4px;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .filters-active::-webkit-scrollbar {
    display: none;
  }

  .filter-chip {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 6px 10px;
  }
}

.filters-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.filters-modal--open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.filters-modal__overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(
      120% 120% at 10% 8%,
      rgba(37, 99, 235, 0.2),
      rgba(15, 23, 42, 0.65)
    ),
    rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(10px) saturate(140%);
}

/* панель */
.filters-modal__panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  opacity: 0;
  isolation: isolate;

  width: min(720px, 92%);
  max-height: 90vh;

  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(248, 250, 252, 0.96) 55%,
    rgba(241, 245, 249, 0.95) 100%
  );
  border-radius: calc(var(--radius-xl) + 4px);
  display: flex;
  flex-direction: column;
  overflow: hidden;

  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 32px 90px rgba(15, 23, 42, 0.28),
    0 10px 24px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.filters-modal__popover-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

.filters-modal__panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
      120% 120% at 15% 0%,
      rgba(37, 99, 235, 0.12),
      transparent 45%
    ),
    radial-gradient(
      120% 120% at 85% 15%,
      rgba(248, 250, 252, 0.65),
      transparent 40%
    );
  pointer-events: none;
  z-index: 0;
}

.filters-modal__panel > * {
  position: relative;
  z-index: 1;
}

.filters-modal--open .filters-modal__panel {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* header / footer */
.filters-modal__header,
.filters-modal__footer {
  padding: 20px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.95),
    rgba(248, 250, 252, 0.9)
  );
  backdrop-filter: blur(10px);
  flex: 0 0 auto;
}

.filters-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  border-radius: 28px 28px 0 0;
  background-clip: padding-box;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.filters-modal__footer {
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: none;
  position: sticky;
  bottom: 0;
  z-index: 15;
  border-radius: 0 0 28px 28px;
  background-clip: padding-box;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
}

.filters-modal__title {
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  color: var(--color-text-strong);
}

.filters-modal__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(226, 232, 240, 0.8);
  background: linear-gradient(135deg, #ffffff, #f1f5f9);
  color: var(--color-text-strong);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.filters-modal__close:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  border-color: rgba(148, 163, 184, 0.8);
}

.filters-modal__content {
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.filters-modal__scroll {
  height: 100%;
  padding: 20px 20px 24px;
  overflow: auto;
  box-sizing: border-box;
}

.filters-modal__reset {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.85);
}

.filters-modal__reset:hover {
  border-color: rgba(203, 213, 225, 0.9);
  background: rgba(248, 250, 252, 0.95);
}

.filters-apply {
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.filters-apply:hover {
  background: var(--color-primary-strong);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.4);
}
