/* 购物车样式 - 与 webhtml/cart.html 保持一致 */
.page-hero.small {
  padding: 35px 0;
}

.cart-section {
  padding: 20px 0 50px;
}

.cart-wrapper {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.cart-list {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #eee;
  overflow: hidden;
}

/* 表头与表体使用完全相同的 9 列网格，确保对齐 */
.cart-header {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) 100px 80px 90px 100px 120px 110px 90px;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  padding-right: 120px;
  background: #fafafa;
  border-bottom: 1px solid #eee;
  position: relative;
}

.cart-header .select-all {
  grid-column: 1;
}

.cart-header .cart-header-label {
  font-size: 13px;
  font-weight: 600;
  color: #666;
}

.cart-header .cart-header-label.product-col { grid-column: 2; padding-left: 42px; }
.cart-header .cart-header-label.cas-col { grid-column: 3; }
.cart-header .cart-header-label.purity-col { grid-column: 4; }
.cart-header .cart-header-label.spec-col { grid-column: 5; }
.cart-header .cart-header-label.price-col { grid-column: 6; }
.cart-header .cart-header-label.qty-col { grid-column: 7; }
.cart-header .cart-header-label.subtotal-col { grid-column: 8; }
.cart-header .cart-header-label.action-col { grid-column: 9; }

.cart-header .clear-btn {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #666;
}

.select-all input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.clear-btn {
  padding: 6px 14px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  font-size: 13px;
  color: #999;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
}

.cart-item {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) 100px 80px 90px 100px 120px 110px 90px;
  align-items: center;
  gap: 12px;
  padding: 20px;
  padding-right: 120px;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.2s;
}

.cart-item .item-checkbox { grid-column: 1; }
.cart-item .item-product { grid-column: 2; }
.cart-item .item-cas-col { grid-column: 3; min-width: 0; }
.cart-item .item-purity-col { grid-column: 4; min-width: 0; font-size: 13px; color: #666; }
.cart-item .item-spec-col { grid-column: 5; min-width: 0; }
.cart-item .item-price { grid-column: 6; }
.cart-item .item-quantity { grid-column: 7; }
.cart-item .item-subtotal { grid-column: 8; }
.cart-item .item-actions { grid-column: 9; }

.cart-item:hover {
  background: #fafafa;
}

.cart-item:last-child {
  border-bottom: none;
}

.item-checkbox {
  flex-shrink: 0;
}

.item-checkbox input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.item-image {
  width: 70px;
  height: 70px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-image i {
  font-size: 28px;
  color: var(--primary-color);
}

.item-product {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding-left: 42px;
}

.item-product .item-image {
  flex-shrink: 0;
}

.item-info {
  min-width: 0;
  text-align: left;
  width: 100%;
}

.item-info h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.item-cas-col,
.item-spec-col {
  font-size: 13px;
  color: #666;
}

.item-spec-col .spec-default {
  color: #999;
}

.item-price {
  width: 100px;
  text-align: center;
  flex-shrink: 0;
}

.item-price .price {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #ef4444;
}

.item-price .unit {
  font-size: 12px;
  color: #999;
}

.item-quantity {
  width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-shrink: 0;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.qty-btn:first-child {
  border-radius: 4px 0 0 4px;
}

.qty-btn:last-child {
  border-radius: 0 4px 4px 0;
}

.qty-btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.item-quantity input {
  width: 50px;
  height: 32px;
  border: 1px solid #ddd;
  border-left: none;
  border-right: none;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
}

.item-subtotal {
  width: 110px;
  text-align: center;
  flex-shrink: 0;
}

.item-subtotal .subtotal {
  font-size: 16px;
  font-weight: 600;
  color: #ef4444;
}

.item-actions {
  flex-shrink: 0;
}

.item-actions .action-btn,
.item-actions .btn-remove {
  padding: 6px 12px;
  border: 1px solid #eee;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #ef4444;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.item-actions .action-btn:hover,
.item-actions .btn-remove:hover {
  border-color: #ef4444;
  background: #fef2f2;
  color: #ef4444;
}

.cart-summary {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #eee;
  padding: 20px;
  position: sticky;
  top: 120px;
}

.cart-summary h3 {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 14px;
  color: #666;
}

.summary-row span:last-child {
  color: #333;
  font-weight: 500;
}

.summary-row .total-price {
  font-size: 18px;
  font-weight: 700;
  color: #ef4444;
}

.checkout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 16px;
  margin-bottom: 10px;
}

.checkout-btn:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
  color: #fff;
}

.continue-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  color: #666;
  font-size: 14px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}

.continue-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* 温馨提示 */
.cart-tips {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.cart-tips h4 {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-tips h4 i {
  color: var(--primary-color);
}

.cart-tips ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cart-tips li {
  font-size: 12px;
  color: #666;
  padding: 4px 0;
  line-height: 1.5;
}

/* 空购物车 */
.cart-empty {
  text-align: center;
  padding: 80px 20px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #eee;
}

.cart-empty .empty-icon {
  font-size: 80px;
  color: #ddd;
  margin-bottom: 20px;
}

.cart-empty h3 {
  font-size: 24px;
  margin: 0 0 10px;
  color: #333;
}

.cart-empty p {
  font-size: 16px;
  color: #999;
  margin: 0 0 30px;
}

.btn-go-shopping {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 30px;
  background: var(--primary-color);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 16px;
  transition: all 0.2s;
}

.btn-go-shopping:hover {
  background: var(--primary-dark);
  color: #fff;
}

@media (max-width: 1024px) {
  .cart-wrapper {
    grid-template-columns: 1fr;
  }
  .cart-summary {
    position: static;
  }
}

@media (max-width: 768px) {
  .cart-section {
    padding: 12px 0 30px;
  }
  .cart-wrapper {
    gap: 16px;
  }
  .cart-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
  }
  .cart-header .cart-header-label {
    display: none;
  }
  .cart-item {
    display: flex;
    flex-wrap: wrap;
    padding: 16px;
    gap: 12px;
  }
  .item-product {
    flex: 1 1 100%;
  }
  .item-cas-col,
  .item-spec-col {
    font-size: 12px;
  }
  .item-price {
    width: auto;
    text-align: left;
  }
  .item-quantity {
    width: auto;
  }
  .item-subtotal {
    width: auto;
    text-align: left;
  }
  .item-actions {
    width: 100%;
  }
}
