/* Умный каталог — боковая панель + mobile bottom sheet */

.catalog-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

html.is-catalog .catalog-sidebar,
body.page-catalog .catalog-sidebar {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100dvh - 96px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 8px;
}

.catalog-filters {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 16px);
  padding: 14px 12px 12px;
}

.catalog-filters__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.catalog-filters__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent, #1a5f7a);
}

.catalog-filters__reset {
  border: none;
  background: none;
  color: var(--muted, #5c6f82);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.catalog-filters__reset:hover {
  color: var(--accent, #1a5f7a);
  background: rgba(26, 95, 122, 0.06);
}

.catalog-filters__section {
  border-top: 1px solid var(--border, #e8edf2);
  padding-top: 10px;
  margin-top: 10px;
}

.catalog-filters__section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.catalog-filters__section > summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text, #1a2b3c);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  user-select: none;
}

.catalog-filters__section > summary::-webkit-details-marker {
  display: none;
}

.catalog-filters__section > summary::after {
  content: "▾";
  color: var(--muted, #5c6f82);
  font-size: 0.75rem;
  transition: transform 0.2s;
}

.catalog-filters__section[open] > summary::after {
  transform: rotate(180deg);
}

.catalog-filters__options {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-right: 2px;
}

.catalog-filters__option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--text, #1a2b3c);
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 8px;
  line-height: 1.25;
}

.catalog-filters__option:hover:not(.is-disabled) {
  background: rgba(26, 95, 122, 0.06);
}

.catalog-filters__option.is-disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.catalog-filters__option input {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 0;
}

.catalog-filters__count {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted, #5c6f82);
  font-variant-numeric: tabular-nums;
}

.catalog-filters-mobile-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 2px solid var(--accent, #1a5f7a);
  border-radius: var(--radius-btn, 6px);
  background: #fff;
  color: var(--accent, #1a5f7a);
  font-weight: 600;
  font: inherit;
  cursor: pointer;
  flex: 1;
}

.catalog-filters-mobile-btn__badge {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent, #1a5f7a);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.catalog-active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.catalog-active-chips[hidden] {
  display: none !important;
}

.catalog-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(26, 95, 122, 0.25);
  background: rgba(26, 95, 122, 0.08);
  color: var(--accent, #1a5f7a);
  font-size: 0.8rem;
  line-height: 1.2;
}

.catalog-chip button {
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  opacity: 0.75;
}

.catalog-chip button:hover {
  opacity: 1;
}

.catalog-filters-sheet {
  position: fixed;
  inset: 0;
  z-index: 160;
  pointer-events: none;
  visibility: hidden;
}

.catalog-filters-sheet.is-open {
  pointer-events: auto;
  visibility: visible;
}

.catalog-filters-sheet__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 25, 35, 0.45);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.catalog-filters-sheet.is-open .catalog-filters-sheet__overlay {
  opacity: 1;
}

.catalog-filters-sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88dvh;
  background: var(--surface, #fff);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 40px rgba(15, 25, 35, 0.18);
  transform: translateY(105%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
}

.catalog-filters-sheet.is-open .catalog-filters-sheet__panel {
  transform: translateY(0);
}

.catalog-filters-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border, #e8edf2);
  flex-shrink: 0;
}

.catalog-filters-sheet__body {
  overflow: auto;
  padding: 12px 16px;
  flex: 1;
  min-height: 0;
}

.catalog-filters-sheet__foot {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border, #e8edf2);
  flex-shrink: 0;
}

.catalog-filters-sheet__close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted, #5c6f82);
  padding: 4px 8px;
}

.search-suggest__filters {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border, #e8edf2);
  font-size: 0.8rem;
  color: var(--muted, #5c6f82);
}

.search-suggest__filters strong {
  color: var(--accent, #1a5f7a);
}

.product-card__line-range {
  margin: 2px 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.product-card__line-range-link {
  color: var(--muted, #5c6f82);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.product-card__line-range-link:hover {
  color: var(--accent, #1a5f7a);
  border-bottom-color: rgba(26, 95, 122, 0.35);
}

.product-card__line-range-n {
  font-variant-numeric: tabular-nums;
}

.product-grid.is-loading .product-card:not(.product-card--skeleton) {
  opacity: 0.35;
  pointer-events: none;
}

.product-card--skeleton {
  pointer-events: none;
  animation: catalog-skel-pulse 1.2s ease-in-out infinite;
}

.product-card--skeleton .product-card__img,
.product-card--skeleton .product-card__name,
.product-card--skeleton .product-card__price {
  background: linear-gradient(90deg, #eef2f5 25%, #f8fafb 50%, #eef2f5 75%);
  background-size: 200% 100%;
  border-radius: 8px;
  color: transparent !important;
  min-height: 1em;
}

.product-card--skeleton .product-card__img {
  min-height: 140px;
}

@keyframes catalog-skel-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.65;
  }
}

body.page-home .catalog-filters,
body.page-home .catalog-filters-mobile-btn,
body.page-home .catalog-active-chips,
body.page-home .catalog-filters-sheet,
html.is-home .catalog-filters,
html.is-home .catalog-filters-mobile-btn,
html.is-home .catalog-active-chips {
  display: none !important;
}

@media (min-width: 769px) {
  html.is-catalog .catalog-filters,
  body.page-catalog .catalog-filters {
    display: block;
  }

  html.is-catalog .catalog-filters-mobile-btn,
  body.page-catalog .catalog-filters-mobile-btn {
    display: none !important;
  }

  html.is-catalog .catalog-layout,
  body.page-catalog .catalog-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .catalog-sidebar {
    display: contents;
  }

  html.is-catalog .catalog-filters,
  body.page-catalog .catalog-filters {
    display: none !important;
  }

  html.is-catalog .catalog-filters-mobile-btn,
  body.page-catalog .catalog-filters-mobile-btn {
    display: inline-flex;
  }

  html.is-catalog .smart-filter-toggle,
  body.page-catalog .smart-filter-toggle {
    display: none !important;
  }
}

/* Inline-фильтры: компактная строка с выпадающими списками */
.catalog-inline-filters {
  margin-bottom: 10px;
}

.catalog-inline-filters__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
}

/* Липкая строка фильтров под шапкой (родитель — .catalog-main, не узкий #category-seo) */
.catalog-filters-sticky {
  position: -webkit-sticky;
  position: sticky;
  top: var(--header-sticky-top, 0px);
  z-index: 114;
  margin-bottom: 16px;
  background: var(--surface, #fff);
  padding-top: 4px;
  padding-bottom: 4px;
}

.catalog-filters-sticky:has(.cf-dropdown.is-open) {
  z-index: 118;
}

body.page-home.page-home--catalog .catalog-inline-filters__bar,
html.is-catalog .catalog-inline-filters__bar,
body.page-catalog .catalog-inline-filters__bar {
  box-shadow: 0 2px 10px rgba(15, 35, 52, 0.06);
}

.cf-dropdown {
  position: relative;
}

.cf-dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border, #dfe4ea);
  border-radius: 10px;
  background: #fff;
  color: var(--text, #1a2b3c);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.cf-dropdown__trigger:hover {
  border-color: rgba(26, 95, 122, 0.4);
  background: rgba(26, 95, 122, 0.04);
}

.cf-dropdown.is-open .cf-dropdown__trigger,
.cf-dropdown__trigger.has-value {
  border-color: var(--accent, #1a5f7a);
  background: rgba(26, 95, 122, 0.08);
  color: var(--accent, #1a5f7a);
}

.cf-dropdown__value {
  font-weight: 600;
}

.cf-dropdown__count {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent, #1a5f7a);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.cf-dropdown__caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.55;
  transition: transform 0.15s;
}

.cf-dropdown.is-open .cf-dropdown__caret {
  transform: rotate(180deg);
}

.cf-dropdown__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  min-width: 260px;
  max-width: min(380px, calc(100vw - 32px));
  max-height: min(360px, 60vh);
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(26, 43, 60, 0.14);
  overflow: hidden;
}

.cf-dropdown__panel[hidden] {
  display: none !important;
}

.cf-dropdown__search {
  flex-shrink: 0;
  margin: 10px 10px 0;
  padding: 9px 12px;
  border: 1px solid var(--border, #dfe4ea);
  border-radius: 8px;
  font: inherit;
  font-size: 0.875rem;
  outline: none;
}

.cf-dropdown__search:focus {
  border-color: var(--accent, #1a5f7a);
  box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.12);
}

.cf-dropdown__options {
  overflow-y: auto;
  padding: 6px;
  flex: 1;
  min-height: 0;
}

.cf-dropdown__pick {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text, #1a2b3c);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.cf-dropdown__pick:hover {
  background: rgba(26, 95, 122, 0.06);
}

.cf-dropdown__pick.is-selected {
  background: rgba(26, 95, 122, 0.12);
  color: var(--accent, #1a5f7a);
  font-weight: 600;
}

.cf-dropdown__pick[hidden] {
  display: none !important;
}

.cf-dropdown__options--grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
}

.cf-dropdown__options--grid .cf-dropdown__pick {
  text-align: center;
  padding: 10px 6px;
  border: 1px solid var(--border, #e8edf2);
  border-radius: 10px;
  background: #f8fafc;
  font-size: 0.84rem;
  font-weight: 500;
}

.cf-dropdown__options--grid .cf-dropdown__pick:hover {
  border-color: rgba(26, 95, 122, 0.3);
  background: rgba(26, 95, 122, 0.06);
}

.cf-dropdown__options--grid .cf-dropdown__pick.is-selected {
  border-color: var(--accent, #1a5f7a);
  background: rgba(26, 95, 122, 0.12);
  color: var(--accent, #1a5f7a);
  font-weight: 700;
}

.catalog-inline-filters__reset {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--muted, #5c6f82);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.catalog-inline-filters__reset.is-hidden,
.catalog-inline-filters__reset[hidden] {
  display: none !important;
}

.catalog-inline-filters__reset:hover {
  color: var(--accent, #1a5f7a);
  background: rgba(26, 95, 122, 0.06);
}

@media (max-width: 768px) {
  body.page-home.page-home--catalog .catalog-inline-filters,
  #catalog-filters-bar {
    display: none !important;
  }

  body.page-home.page-home--catalog .catalog-filters-mobile-btn {
    display: inline-flex !important;
  }
}

@media (min-width: 769px) {
  body.page-home.page-home--catalog .catalog-tools-row {
    display: none !important;
  }

  body.page-home.page-home--catalog .catalog-inline-filters {
    margin-bottom: 0;
  }

  body.page-home.page-home--catalog .catalog-inline-filters__bar {
    border-radius: 12px;
    margin-bottom: 16px;
  }
}
