/* ===================================
   ГЛОБАЛЬНЫЕ НАСТРОЙКИ ДЛЯ СТРАНИЦЫ КАТЕГОРИИ
=================================== */

body {
  background: #ffffff !important;
}

/* Основной контейнер */
.category-page {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1.5rem;
  background: #ffffff;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #222;
}

/* Хлебные крошки */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.breadcrumb li a {
  color: #1a73e8;
  text-decoration: none;
}

.breadcrumb li::after {
  content: "/";
  margin-left: 6px;
  color: #aaa;
}

.breadcrumb li:last-child::after {
  content: "";
  margin: 0;
}

/* Заголовок */
.category-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

/* Блок с картинкой и описанием */
.category-intro {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.category-thumb-wrap {
  max-width: 220px;
}

.category-thumb {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #eee;
}

.category-description {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #444;
}

/* ===================================
   ЛЕЙАУТ: ФИЛЬТРЫ + КОНТЕНТ
=================================== */

.category-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
}

/* ===================================
   ФИЛЬТРЫ
=================================== */

.filters {
  background: #ffffff;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #e5e5e5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 20px;
  height: fit-content;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.filters-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.filter-block {
  margin-bottom: 20px;
}

.filter-block-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}

.filter-options {
  margin: 0;
  padding: 0;
}

.filter-options li {
  list-style: none;
  margin-bottom: 6px;
}

.filter-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.93rem;
  color: #333;
}

.filter-options input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #1a73e8;
}

.apply-filters {
  width: 100%;
  background: #1a73e8;
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 8px;
}

.apply-filters:hover {
  background: #0f5fcc;
}

/* Кнопка фильтров для мобильных (по умолчанию скрыта) */
.filters-toggle-btn {
  display: none;
  padding: 10px 14px;
  background: #1a73e8;
  color: #fff;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  margin-bottom: 15px;
}

/* ===================================
   ОБЛАСТЬ ТОВАРОВ
=================================== */

.products-area {
  min-height: 200px;
  position: relative;
}

/* Лоадер при AJAX (можно доработать) */
.products-area.is-loading::after {
  content: "Загрузка...";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  z-index: 10;
}

/* Панель сортировки и переключения вида */
.products-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 10px;
}

.sort-wrapper {
  font-size: 0.95rem;
}

.sort-wrapper select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 0.95rem;
}

/* Переключатель вида */
.view-toggle {
  display: flex;
  gap: 6px;
}

.view-toggle button {
  background: #f1f3f4;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.view-toggle .active {
  background: #1a73e8;
  color: #fff;
}

/* ===================================
   СЕТКА ТОВАРОВ
=================================== */

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}

/* Карточка товара */
.product-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e5e5e5;
  padding: 15px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

/* Изображение товара */
.product-thumb img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  margin-bottom: 12px;
}

/* Информация о товаре */
.product-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-name {
  font-size: 1rem;
  font-weight: 500;
  color: #222;
  margin-bottom: 8px;
}

.product-name a {
  color: inherit;
  text-decoration: none;
}

.product-name a:hover {
  text-decoration: underline;
}

/* Цена */
.product-price {
  margin: 10px 0;
  font-size: 1rem;
  font-weight: 600;
}

.price-current {
  color: #222;
}

.old-price {
  text-decoration: line-through;
  color: #999;
  margin-right: 6px;
}

.new-price {
  color: #e53935;
}

/* Кнопка "В корзину" */
.buy-btn {
  width: 100%;
  padding: 10px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  margin-top: auto;
}

.buy-btn:hover {
  background: #0d5dcc;
}

/* Текст "товары не найдены" */
.no-products {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 0;
  color: #666;
}

/* Низ страницы: пагинация + результаты */
.category-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  gap: 10px;
}

.pagination-wrap {
  flex: 1;
}

.results-wrap {
  font-size: 0.9rem;
  color: #555;
  text-align: right;
}

/* ===================================
   ВИД СПИСКОМ
=================================== */

.products-grid.list-view {
  display: block;
}

.products-grid.list-view .product-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
}

.products-grid.list-view .product-thumb img {
  width: 100%;
  height: 200px;
}

/* ===================================
   АДАПТАЦИЯ ПОД ПЛАНШЕТЫ
=================================== */

@media (max-width: 1199px) {
  .category-intro {
    grid-template-columns: 1fr;
  }

  .category-thumb-wrap {
    max-width: 260px;
  }
}

/* ===================================
   АДАПТАЦИЯ ПОД МОБИЛЬНЫЕ
=================================== */

@media (max-width: 991px) {

  .category-page {
    padding: 1rem;
  }

  .category-layout {
    grid-template-columns: 1fr;
  }

  /* Показываем кнопку "Фильтры" */
  .filters-toggle-btn {
    display: inline-block;
  }

  /* Фильтры превращаем в выезжающую панель */
  .filters {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 85%;
    max-width: 360px;
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    z-index: 9999;
    background: #ffffff;
    padding: 20px;
    border-radius: 0;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.25);
  }

  .filters.open {
    display: block;
  }

  .products-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .category-bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  .results-wrap {
    text-align: left;
  }
}

/* Совсем маленькие экраны */
@media (max-width: 576px) {

  .products-grid {
    grid-template-columns: 1fr;
  }

  .products-grid.list-view .product-card {
    grid-template-columns: 140px 1fr;
  }

  .product-thumb img {
    height: 180px;
  }
}

/* Обёртка */
.pagination-wrap {
    margin: 40px 0;
    display: flex;
    justify-content: center;
}

/* Список */
.pagination-wrap ul.pagination {
    display: flex;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* Элементы */
.pagination-wrap ul.pagination > li {
    display: inline-flex;
}

/* Ссылки и текущая страница */
.pagination-wrap ul.pagination > li > a,
.pagination-wrap ul.pagination > li > span {
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #111827;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;

    transition: all 0.2s ease;
}

/* Hover */
.pagination-wrap ul.pagination > li > a:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

/* Активная страница */
.pagination-wrap ul.pagination > li.active > span {
    background: #111827;
    color: #fff;
    border-color: #111827;
    cursor: default;
}

/* Стрелки */
.pagination-wrap ul.pagination > li > a {
    font-weight: 600;
}
