/* ============================================
   海汇商城 - 列表页样式 list.css
   ============================================ */

/* 筛选区 */
.filter-section {
  background: #fff;
  margin-top: 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  overflow: hidden;
}

/* 品牌筛选行 */
.filter-brands {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.filter-brands::-webkit-scrollbar {
  height: 4px;
}

.filter-brands::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 2px;
}

.filter-brands .filter-label {
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
  margin-right: 4px;
}

/* 排序栏 */
.filter-sort {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 16px;
  flex-wrap: wrap;
}

.sort-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-sub);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.sort-item:hover {
  color: var(--primary);
}

.sort-item.active {
  color: var(--primary);
  font-weight: 500;
}

.sort-item .sort-arrow {
  font-size: 10px;
  line-height: 1;
}

/* 价格区间 */
.price-range {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.price-range input {
  width: 60px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
  font-size: 13px;
  color: var(--text-main);
}

.price-range input:focus {
  border-color: var(--primary);
}

.price-range .separator {
  color: var(--text-muted);
}

.price-range .price-confirm {
  background: var(--primary);
  color: #fff;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  border: none;
  cursor: pointer;
}

.price-range .price-confirm:hover {
  background: var(--primary-dark);
}

.sort-count {
  color: var(--text-muted);
  font-size: 13px;
  margin-left: auto;
}

/* ============================================
   商品网格
   ============================================ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 12px;
}

/* 商品卡片 */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(22, 119, 255, 0.12);
  transform: translateY(-2px);
}

.card-img {
  width: 100%;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fafafa;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.product-card:hover .card-img img {
  transform: scale(1.05);
}

.card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-badges {
  margin-bottom: 6px;
  min-height: 18px;
}

.card-title {
  font-size: 14px;
  color: var(--text-main);
  font-weight: 400;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 39px;
}

.card-specs {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-price {
  margin-bottom: 6px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}

.card-price .price-now {
  font-size: 18px;
}

.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.card-footer .card-tags {
  display: flex;
  gap: 4px;
}

/* 加购按钮 */
.cart-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.cart-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
}

/* ============================================
   分页
   ============================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 30px 0;
}

.pagination button,
.pagination span {
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text-sub);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0 8px;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.pagination .page-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pagination button:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  background: #f5f5f5;
}

/* ============================================
   空状态
   ============================================ */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 1199px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 991px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 767px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .card-img {
    height: 160px;
  }

  .card-title {
    font-size: 13px;
    -webkit-line-clamp: 2;
  }

  .card-price .price-now {
    font-size: 16px;
  }

  .filter-sort {
    gap: 12px;
  }

  .price-range {
    margin-left: 0;
    width: 100%;
    margin-top: 8px;
  }

  .sort-count {
    display: none;
  }
}

@media (max-width: 479px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .card-body {
    padding: 8px 8px 10px;
  }
}
