/* Collapse the theme spacer block that precedes the filter sidebar column. */
.wp-block-group:has(> .mk-smart-filters-layout) > .wp-block-spacer {
  display: none;
}

/* ===== Toolbar (Figma: single row — search left, sort+pagination right) ===== */
.kl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 1rem 0;
  margin-bottom: 0;
  border-bottom: 1px solid #ede8e0;
}

/* Search moved into toolbar from sidebar */
.kl-toolbar__search {
  flex: 0 0 auto;
  width: 240px;
}

.kl-toolbar__search .kl-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
}

.kl-toolbar__search .kl-search__input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 40px;
  border: 1px solid #e8ddd0;
  border-radius: 12px;
  background: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: #2d1f2d;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.kl-toolbar__search .kl-search__input::placeholder {
  color: #9a8a7a;
}

.kl-toolbar__search .kl-search__input:focus {
  border-color: #2d1f2d;
  box-shadow: 0 0 0 3px rgba(45, 31, 45, 0.25);
}

/* Search icon positioned inside input */
.kl-toolbar__search .kl-search__btn {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  height: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #9a8a7a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.kl-toolbar__search .kl-search__btn:hover {
  background: transparent;
}

/* Results count text below toolbar */
.mk-results-count {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: #9a8a7a;
  margin: 0.75rem 0 0;
  padding: 0;
}

.kl-toolbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== Custom Select ===== */
.kl-select {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.kl-select select {
  appearance: none;
  -webkit-appearance: none;
  height: 40px;
  padding: 0 36px 0 14px;
  border: 1px solid #e8ddd0;
  border-radius: 12px;
  background: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: #2d1f2d;
  cursor: pointer;
  outline: none;
  min-width: 130px;
  transition: border-color 0.2s;
}

.kl-select--wide select {
  min-width: 200px;
}

.kl-select select:focus {
  border-color: #2d1f2d;
  box-shadow: 0 0 0 3px rgba(45, 31, 45, 0.25);
}

.kl-select__icon {
  position: absolute;
  right: 12px;
  pointer-events: none;
  color: #9a8a7a;
  display: flex;
  align-items: center;
}

/* ===== Pagination ===== */
.kl-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.kl-pagination__arrow {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 8px;
  color: #9a8a7a;
  cursor: pointer;
  text-decoration: none;
  font-size: 18px;
  transition: background-color 0.2s, color 0.2s;
}

.kl-pagination__arrow:hover {
  background: #f5efe8;
  color: #4a2a3a;
}

.kl-pagination__page {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #4a2a3a;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.kl-pagination__page:hover {
  background: #f5efe8;
}

.kl-pagination__page--active {
  background: #fde5f1;
  color: #2d1f2d;
}

.kl-pagination__page--active:hover {
  background: #f5c9dd;
}

/* ===== Kiddie Luxe Filters ===== */
:root {
  --kl-bg: #ffffff;
  --kl-card: #ffffff;
  --kl-border: #e8ddd0;
  --kl-primary: #fde5f1;
  --kl-primary-fg: #2d1f2d;
  --kl-foreground: #2d1f2d;
  --kl-muted: #9a8a7a;
  --kl-ring: #2d1f2d;
  --kl-secondary: #ede4d8;
  --kl-accent-hover: rgba(45, 31, 45, 0.06);
  --kl-radius: 12px;
  --kl-font-body: 'Inter', sans-serif;
}

.kl-filters {
  width: 100%;
  font-family: var(--kl-font-body);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.kl-filters__form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Hidden sort select (functional, not visual) */
.kl-filters__sort-select {
  display: none;
}

/* Hide sidebar sort when toolbar has it */
.mk-smart-filters .kl-filters__sort {
  display: none !important;
}

/* Clear filters link */
.kl-filters__clear {
  font-size: 11px;
  font-family: var(--kl-font-body);
  color: var(--kl-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.kl-filters__clear:hover {
  color: var(--kl-foreground);
}

/* Status (loading indicator - visually hidden but accessible) */
.kl-filters__status {
  min-height: 1rem;
  margin: 0;
  font-size: 0.82rem;
  color: var(--kl-muted);
  font-family: var(--kl-font-body);
}

/* Поиск — icon inside input (Figma style) */
.kl-search {
  position: relative;
  display: flex;
  align-items: center;
  font-family: var(--kl-font-body);
}

/* Align sidebar search top edge with toolbar controls top edge. */
.mk-smart-filters .kl-search {
  margin-top: 1rem;
}

.kl-search__input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 40px;
  border: 1px solid var(--kl-border);
  border-radius: var(--kl-radius);
  background: var(--kl-card);
  font-size: 14px;
  font-family: var(--kl-font-body);
  color: var(--kl-foreground);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.kl-search__input::placeholder {
  color: var(--kl-muted);
}

.kl-search__input:focus {
  border-color: #2d1f2d;
  box-shadow: 0 0 0 3px rgba(45, 31, 45, 0.25);
}

.kl-search button.kl-search__btn,
.woocommerce button[type="submit"].kl-search__btn {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  height: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--kl-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  margin: 0;
}

.kl-search__btn:hover {
  background: transparent;
}

/* Сортировка (кастомный select) */
.kl-filters__sort {
  position: relative;
}
.kl-filters__sort-trigger {
  width: 100%;
  height: 40px;
  border-radius: var(--kl-radius);
  border: 1px solid var(--kl-border);
  background: var(--kl-card);
  padding: 0 12px;
  font-size: 14px;
  font-family: var(--kl-font-body);
  color: var(--kl-foreground);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  outline: none;
  transition: box-shadow 0.2s;
}
.kl-filters__sort-trigger:focus {
  box-shadow: 0 0 0 2px var(--kl-ring);
}
.kl-filters__sort-icon {
  opacity: 0.5;
  transition: transform 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.kl-filters__sort.open .kl-filters__sort-icon {
  transform: rotate(180deg);
}
.kl-filters__sort-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--kl-card);
  border: 1px solid var(--kl-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  z-index: 50;
  padding: 4px;
  animation: kl-fadeIn 0.15s ease;
}
.kl-filters__sort.open .kl-filters__sort-dropdown {
  display: block;
}
.kl-filters__sort-item {
  padding: 8px 12px 8px 32px;
  font-size: 14px;
  font-family: var(--kl-font-body);
  color: var(--kl-foreground);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}
.kl-filters__sort-item:hover {
  background: var(--kl-accent-hover);
}
.kl-filters__sort-item.active::before {
  content: '✓';
  position: absolute;
  left: 10px;
  font-size: 13px;
  color: var(--kl-foreground);
}

/* Разделитель */
.kl-filters__divider {
  height: 1px;
  background: var(--kl-border);
}

/* Метка ФИЛЬТРЫ */
.kl-filters__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--kl-muted);
  margin: 0;
}

/* Секции (категории, цена) */
.kl-filters__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.kl-filters__section-title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--kl-foreground);
  font-family: var(--kl-font-body);
}
.kl-filters__chevron-up,
.kl-filters__chevron-down {
  color: var(--kl-muted);
  flex-shrink: 0;
}
/* Показываем/скрываем стрелки */
.kl-filters__section .kl-filters__chevron-down { display: none; }
.kl-filters__section .kl-filters__chevron-up { display: block; }
.kl-filters__section.collapsed .kl-filters__chevron-down { display: block; }
.kl-filters__section.collapsed .kl-filters__chevron-up { display: none; }

.kl-filters__section-body {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
  padding: 0;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 0;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: #d8d0c4 transparent;
}

.kl-filters__section-body::-webkit-scrollbar {
  width: 4px;
}

.kl-filters__section-body::-webkit-scrollbar-thumb {
  background: #d8d0c4;
  border-radius: 4px;
}

.kl-filters__section-body::-webkit-scrollbar-track {
  background: transparent;
}
.kl-filters__section.collapsed .kl-filters__section-body {
  display: none;
}

/* Категории — чекбоксы */
.kl-filters__cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.375rem 0.25rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.kl-filters__cat-item:hover {
  background: #ffffff;
}
.kl-filters__cat-item:hover .kl-filters__cat-label {
  color: var(--kl-foreground);
}
.kl-filters__cat-left {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.kl-filters__checkbox {
  position: relative;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.kl-filters__checkbox input {
  position: absolute;
  opacity: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.kl-filters__checkmark {
  position: absolute;
  top: 0; left: 0;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid var(--kl-foreground);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.kl-filters__checkmark svg {
  display: none;
  color: var(--kl-primary-fg);
}
.kl-filters__checkbox input:checked + .kl-filters__checkmark {
  background: var(--kl-primary);
}
.kl-filters__checkbox input:checked + .kl-filters__checkmark svg {
  display: block;
}
.kl-filters__checkbox input:focus-visible + .kl-filters__checkmark {
  box-shadow: 0 0 0 2px var(--kl-ring);
}
.kl-filters__cat-label {
  font-size: 14px;
  color: var(--kl-foreground);
  font-family: var(--kl-font-body);
  transition: color 0.15s;
}
.kl-filters__cat-count {
  font-size: 12px;
  color: var(--kl-muted);
  font-family: var(--kl-font-body);
}

/* Двойной слайдер цены */
.kl-filters__slider-wrap {
  position: relative;
  height: 20px;
  margin-bottom: 16px;
}
.kl-filters__slider-track {
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 8px;
  transform: translateY(-50%);
  background: var(--kl-secondary);
  border-radius: 999px;
  overflow: hidden;
}
/*
 * Fill is positioned using CSS custom properties set by smart-filters.js:
 *   --mk-price-selected-start: left offset percentage
 *   --mk-price-selected-width: fill width percentage
 */
.kl-filters__slider-range {
  position: absolute;
  height: 100%;
  background: var(--kl-foreground);
  left: var(--mk-price-selected-start, 0%);
  width: var(--mk-price-selected-width, 100%);
}
.kl-filters__range {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  margin: 0;
}
.kl-filters__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--kl-card);
  border: 2px solid var(--kl-foreground);
  cursor: pointer;
  pointer-events: all;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: box-shadow 0.15s;
}
.kl-filters__range::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 3px rgba(45, 31, 45, 0.12);
}
.kl-filters__range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--kl-card);
  border: 2px solid var(--kl-foreground);
  cursor: pointer;
  pointer-events: all;
}

/* Поля мин/макс цена */
.kl-filters__price-inputs {
  display: flex;
  gap: 12px;
}
.kl-filters__price-field {
  flex: 1;
}
.kl-filters__price-label {
  display: block;
  font-size: 10px;
  color: var(--kl-muted);
  margin-top: 4px;
  font-family: var(--kl-font-body);
}

/* Number inputs */
.kl-filters__input {
  width: 100%;
  height: 40px;
  border-radius: var(--kl-radius);
  border: 1px solid var(--kl-border);
  background: var(--kl-card);
  padding: 0 12px;
  font-size: 14px;
  font-family: var(--kl-font-body);
  color: var(--kl-foreground);
  outline: none;
  transition: box-shadow 0.2s;
  box-sizing: border-box;
}
.kl-filters__input:focus {
  box-shadow: 0 0 0 2px var(--kl-ring);
}
.kl-filters__input::placeholder {
  color: var(--kl-muted);
}
.kl-filters__input--small {
  font-size: 13px;
  height: 36px;
}

/* Убираем стрелки у number input */
.kl-filters__input[type="number"]::-webkit-inner-spin-button,
.kl-filters__input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.kl-filters__input[type="number"] {
  -moz-appearance: textfield;
}

/* Responsive: remove scroll limit on mobile */
@media (max-width: 980px) {
  .kl-filters__section-body {
    max-height: none;
  }
}

/* Анимация */
@keyframes kl-fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
