#category-page .category-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: start;
}

#category-page .category-layout.no-sidebar {
  grid-template-columns: 1fr;
}

/* ── Sidebar ── */
#category-page .category-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 80px);
}

#category-page .category-sidebar-right {
  position: sticky;
  top: 16px;
}

/* ── Category header ── */
#category-page .category-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
#category-page .category-thumb {
  width: 56px; height: 56px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--menu-border);
  flex-shrink: 0;
}
#category-page .category-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ── Mobile toolbar (hidden on desktop) ── */
#category-page .mobile-toolbar { display: none; gap: 10px; margin-bottom: 8px; }

#category-page .filter-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 4px;
  background: #1f2937; color: #fff; font-size: 10px; font-weight: 700;
}

#category-page .view-toggle { display: flex; gap: 4px; }
#category-page .view-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--menu-border); background: var(--white-color);
  color: var(--menu-text-muted); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
#category-page .view-btn.active, .view-btn:hover { background: #1f2937; border-color: #1f2937; color: #fff; }

/* ── Products grid ── */
#category-page .products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* с сайдбаром */
  gap: 16px; margin-bottom: 20px;
}
#category-page .no-sidebar .products-grid {
  grid-template-columns: repeat(4, 1fr); /* без сайдбара */
}
#category-page .products-grid.list-layout {
  grid-template-columns: 1fr !important;
}

/* ── Product card ── */
#category-page .product-card {
  background: var(--white-color); border: 1px solid var(--menu-border);
  border-radius: var(--border-radius); overflow: hidden;
  display: flex; flex-direction: column; transition: box-shadow 0.2s;
}
#category-page .product-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
#category-page .product-card-image {
  position: relative; display: block; aspect-ratio: 1;
  overflow: hidden; background: var(--menu-bg);
}
#category-page .product-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
#category-page .product-card:hover .product-card-image img { transform: scale(1.04); }
#category-page .product-card-actions {
  position: absolute; top: 8px; right: 8px;
  display: flex; flex-direction: column; gap: 4px;
  opacity: 0; transform: translateX(6px); transition: all 0.2s;
}
#category-page .product-card:hover .product-card-actions { opacity: 1; transform: translateX(0); }

#category-page .product-card-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
#category-page .product-card-name {
  font-size: 13px; font-weight: 600; color: var(--menu-text);
  text-decoration: none; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
#category-page .product-card-name:hover { color: #3b82f6; }
#category-page .product-card-rating { font-size: 11px; color: #f59e0b; display: flex; gap: 1px; }
#category-page .product-card-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-top: auto; }
#category-page .price-current { font-size: 16px; font-weight: 700; color: var(--menu-text); }
#category-page .price-old { font-size: 12px; color: var(--menu-text-muted); text-decoration: line-through; }
#category-page .price-tax { font-size: 11px; color: var(--menu-text-muted); width: 100%; }

/* list layout */
#category-page .products-grid.list-layout .product-card { flex-direction: row; }
#category-page .products-grid.list-layout .product-card-image { width: 120px; height: 120px; aspect-ratio: unset; flex-shrink: 0; }
#category-page .products-grid.list-layout .product-card-body { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; flex: 1; }
#category-page .products-grid.list-layout .product-card-name { flex: 1; min-width: 160px; -webkit-line-clamp: unset; }
#category-page .products-grid.list-layout .product-card-price { margin-top: 0; }
#category-page .products-grid.list-layout .product-card-cart { width: auto; padding: 0 16px; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  #category-page .products-grid { grid-template-columns: repeat(2, 1fr); }
  #category-page .no-sidebar .products-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  #category-page .category-layout { grid-template-columns: 1fr !important; }
  #category-page .category-sidebar { display: none; }
  #category-page .mobile-toolbar { display: flex; }
  #category-page .mobile-toolbar > * { flex: 1; }
  #category-page .view-toggle { margin-left: auto; }
  #category-page .products-list-toolbar .toolbar-right .select-wrapper:first-child { width: 100%; }
  #category-page .products-list-toolbar .compare-link { display: none; }
  #category-page .products-grid,
  #category-page .no-sidebar .products-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  #category-page .products-grid { gap: 10px; }
}