/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-light);
}
.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}
.page-count {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Products Layout */
.products-layout {
  display: flex;
  gap: var(--space-6);
  margin-bottom: var(--space-12);
}

/* Filter Panel */
.filter-panel {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  align-self: flex-start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: var(--space-2);
}
.filter-panel::-webkit-scrollbar {
  width: 4px;
}
.filter-panel::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.filter-group {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-light);
}
.filter-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.filter-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.filter-options .checkbox {
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}
.filter-options .checkbox:hover {
  color: var(--text-primary);
}

.rating-filter {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.rating-filter .rating-star svg {
  width: 14px;
  height: 14px;
}

.price-range {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.price-range .input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-size: 0.875rem;
}
.price-range span {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.filter-tags .tag {
  transition: all var(--transition-fast);
}
.filter-tags .tag:hover {
  background: var(--color-primary);
  color: var(--text-white);
  border-color: var(--color-primary);
}

/* Products Main */
.products-main {
  flex: 1;
  min-width: 0;
}

/* Sort Bar */
.sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}

.sort-options {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.sort-btn {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  transition: all var(--transition-fast);
  border: none;
  cursor: pointer;
}
.sort-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.sort-btn.active {
  color: var(--color-primary);
  background: rgba(124, 58, 237, 0.1);
  font-weight: 600;
}

.view-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  background: transparent;
  transition: all var(--transition-fast);
  border: none;
  cursor: pointer;
}
.view-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.view-btn.active {
  color: var(--color-primary);
  background: rgba(124, 58, 237, 0.1);
}
.view-btn svg {
  width: 18px;
  height: 18px;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

/* Product Card (reuse from index with additions) */
.product-card {
  overflow: hidden;
}
.product-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.product-img {
  width: 100%;
  height: 100%;
  transition: transform var(--transition-slow);
}
.product-card:hover .product-img {
  transform: scale(1.05);
}
.product-cover .badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 1;
}
.product-fav {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 1;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-white);
  transition: all var(--transition-fast);
  border: none;
  cursor: pointer;
}
.product-fav:hover {
  background: var(--color-accent);
}
.product-fav.active {
  background: var(--color-accent);
}
.product-fav.active svg {
  fill: currentColor;
}
.product-fav svg {
  width: 16px;
  height: 16px;
}

.product-body {
  padding: var(--space-4);
}
.product-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: var(--space-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.product-sales {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-light);
}
.product-author {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* Product List View */
.product-grid.list-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.product-grid.list-view .product-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.product-grid.list-view .product-cover {
  width: 240px;
  min-width: 240px;
  aspect-ratio: auto;
  height: auto;
}

.product-grid.list-view .product-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.product-grid.list-view .product-title {
  font-size: 1rem;
  -webkit-line-clamp: 1;
}

.product-grid.list-view .product-meta {
  margin-bottom: var(--space-2);
}

.product-grid.list-view .product-footer {
  border-top: none;
  padding-top: 0;
}

/* Pagination */
.page-ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 1023px) {
  .products-layout {
    flex-direction: column;
  }

  .filter-panel {
    position: static;
    width: 100%;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    gap: var(--space-4);
    padding-right: 0;
    padding-bottom: var(--space-2);
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .filter-panel::-webkit-scrollbar {
    display: none;
  }

  .filter-group {
    flex-shrink: 0;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    min-width: 180px;
  }

  .filter-tags {
    flex-wrap: nowrap;
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-grid.list-view .product-cover {
    width: 180px;
    min-width: 180px;
  }
}

@media (max-width: 767px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .sort-bar {
    flex-direction: column;
    gap: var(--space-3);
    align-items: flex-start;
  }

  .sort-options {
    overflow-x: auto;
    width: 100%;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .sort-options::-webkit-scrollbar {
    display: none;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .product-grid.list-view .product-card {
    flex-direction: column;
  }

  .product-grid.list-view .product-cover {
    width: 100%;
    min-width: auto;
    aspect-ratio: 16 / 10;
    height: auto;
  }
}
