/* ==========================================
   ОСНОВНОЙ LAYOUT
   ========================================== */
.main {
  padding-bottom: 60px;
}

.main__inner {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* ==========================================
   САЙДБАР
   ========================================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: calc(var(--header-height) + 12px);
  max-height: calc(100vh - var(--header-height) - 24px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #ddd #f5f5f5;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: #f5f5f5;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

/* Заголовок сайдбара */
.sidebar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: var(--bg-white);
  z-index: 1;
}

.sidebar__header h2 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.sidebar__header h2 i {
  color: var(--primary);
}

.sidebar__close {
  display: none;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
}

.sidebar__close:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* Блоки сайдбара */
.sidebar__block {
  border-bottom: 1px solid var(--border-light);
}

.sidebar__block:last-of-type {
  border-bottom: none;
}

/* Заголовок блока (аккордеон) */
.sidebar__title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.sidebar__title:hover {
  background: var(--bg-gray);
}

.sidebar__title i {
  font-size: 11px;
  color: var(--text-light);
  transition: transform 0.3s;
}

.sidebar__title.collapsed i {
  transform: rotate(-90deg);
}

/* Тело блока */
.sidebar__body {
  padding: 0 20px 16px;
  display: none;
}

.sidebar__body.open {
  display: block;
}

/* Поиск категории */
.search-filter {
  position: relative;
  margin-bottom: 12px;
}

.search-filter input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.search-filter input:focus {
  border-color: var(--primary);
}

.search-filter i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-light);
  pointer-events: none;
}

/* Список категорий */
.sidebar__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar__list li {
  margin-bottom: 1px;
}

.sidebar__list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
}

.sidebar__list a:hover,
.sidebar__list a.active {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar__list a.active {
  font-weight: 600;
}

.sidebar__list .count {
  font-size: 11px;
  color: var(--text-light);
}

/* Цена — поля ввода */
.price-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.price-field {
  flex: 1;
  position: relative;
}

.price-field label {
  position: absolute;
  top: 6px;
  left: 10px;
  font-size: 10px;
  color: var(--text-light);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  pointer-events: none;
}

.price-field input {
  width: 100%;
  padding: 22px 10px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
}

.price-field input:focus {
  border-color: var(--primary);
}

.price-dash {
  color: var(--text-light);
  font-weight: 300;
  padding-top: 8px;
}

/* Ползунок цены */
.range-slider {
  position: relative;
  height: 6px;
  margin: 16px 0;
}

.range-track {
  position: absolute;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
}

.range-fill {
  position: absolute;
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  left: 0;
  right: 0;
}

.range-slider input[type="range"] {
  position: absolute;
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  top: 0;
  margin: 0;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  pointer-events: all;
  border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,0.2);
  transition: transform 0.15s;
}

.range-slider input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 10px rgba(231,76,60,0.4);
}

.range-slider input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  pointer-events: all;
  border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,0.2);
}

/* Пресеты цен */
.price-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  background: var(--bg-white);
  transition: all 0.15s;
}

.preset-btn:hover,
.preset-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Рейтинг */
.rating-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rating-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}

.rating-option:hover {
  background: var(--bg-gray);
}

.rating-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.rating-option .stars {
  color: var(--warning);
  font-size: 13px;
  display: flex;
  gap: 1px;
  letter-spacing: 1px;
}

.rating-label {
  font-weight: 600;
  font-size: 12px;
}

.rating-option .count {
  color: var(--text-light);
  font-size: 11px;
  margin-left: auto;
}

/* Чекбоксы */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.custom-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s;
}

.custom-checkbox:hover {
  background: var(--bg-gray);
}

.custom-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
  cursor: pointer;
}

/* Кнопки сайдбара */
.sidebar__actions {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: var(--bg-white);
  border-top: 1px solid var(--border-light);
}

.sidebar__apply {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.sidebar__apply:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.sidebar__reset {
  width: 100%;
  padding: 10px;
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  background: none;
  transition: all 0.15s;
}

.sidebar__reset:hover {
  background: var(--bg-gray);
  color: var(--primary);
}

/* ==========================================
   КОНТЕНТ (правая часть)
   ========================================== */
.content {
  flex: 1;
  min-width: 0;
}

.content__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.content__heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.content__title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.content__count {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.content__count i {
  font-size: 11px;
}

.content__controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Кнопка фильтров (мобильная) */
.filter-toggle-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-white);
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-toggle-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Сортировка */
.sort-dropdown {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-dropdown label {
  color: var(--text-muted);
  font-size: 14px;
}

.sort-dropdown select {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.sort-dropdown select:focus {
  border-color: var(--primary);
}

/* Переключатель вида */
.view-switcher {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-btn {
  width: 36px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  cursor: pointer;
  background: var(--bg-white);
  transition: all 0.15s;
}

.view-btn:last-child {
  border-right: none;
}

.view-btn:hover {
  background: var(--bg-gray);
  color: var(--text-secondary);
}

.view-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Активные фильтры */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.active-filters__label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.tag-remove {
  font-size: 16px;
  color: var(--primary);
  line-height: 1;
  padding: 0;
  opacity: 0.7;
  cursor: pointer;
  border: none;
  background: none;
}

.tag-remove:hover {
  opacity: 1;
}

.clear-filters {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  background: none;
  transition: all 0.15s;
}

.clear-filters:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* Пустое состояние */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.empty-state__icon {
  font-size: 60px;
  color: var(--text-light);
  margin-bottom: 20px;
}

.empty-state h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 20px;
}

.empty-state__btn {
  padding: 12px 30px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-size: 14px;
}

.empty-state__btn:hover {
  background: var(--primary-dark);
}

/* Пагинация */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
}

.page-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-white);
  cursor: pointer;
  transition: all 0.15s;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-numbers {
  display: flex;
  gap: 4px;
}

.page-num {
  min-width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-white);
  cursor: pointer;
  transition: all 0.15s;
}

.page-num:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.page-num.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.page-dots {
  display: flex;
  align-items: center;
  padding: 0 4px;
  color: var(--text-light);
}

.pagination__info {
  text-align: center;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ==========================================
   АДАПТИВ — САЙДБАР
   ========================================== */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -340px;
    width: 320px;
    min-width: 320px;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    z-index: 999;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar__close {
    display: flex;
  }

  .filter-toggle-btn {
    display: flex;
  }
}

@media (max-width: 768px) {
  .content__top {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .content__title {
    font-size: 24px;
  }

  /* Панель фильтров и сортировки становится в 2 строки на смартфонах */
  .content__controls {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
  }

  .filter-toggle-btn {
    flex: 1; /* Кнопка "Фильтры" тянется */
    justify-content: center;
    padding: 10px;
  }

  .sort-dropdown {
    flex: 1; /* Сортировка тянется */
  }
  
  .sort-dropdown select {
    width: 100%; /* Select на всю ширину своей колонки */
  }

  .sort-dropdown label {
    display: none;
  }

  /* Пагинация */
  .pagination {
    flex-wrap: wrap;
  }
  .page-btn span {
    display: none; /* Убираем текст Назад/Вперед, оставляем стрелочки */
  }
}