/* ============================================
   草本酒坊 - 购物车页样式
   ============================================ */

.cart-page {
  padding: 100px 0 var(--space-12);
  min-height: 80vh;
}

.cart-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
}

.cart-title {
  font-family: var(--font-cn);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: 0.03em;
}

.cart-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.cart-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--space-6);
  align-items: start;
}

/* ── 购物车列表 ── */
.cart-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.cart-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: all var(--duration-normal) var(--ease-out-quart);
}

.cart-item:hover {
  border-color: var(--border-default);
}

/* ── 复选框 ── */
.cart-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  flex-shrink: 0;
  padding-top: 20px;
}

.cart-check input[type="checkbox"] {
  display: none;
}

.check-mark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-out-quart);
  flex-shrink: 0;
}

.check-mark::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--bg-base);
  border-bottom: 2px solid var(--bg-base);
  transform: rotate(-45deg) translateY(-1px);
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.cart-check input:checked + .check-mark {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.cart-check input:checked + .check-mark::after {
  opacity: 1;
}

.check-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  user-select: none;
}

/* ── 商品图片 ── */
.cart-item-img {
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-input);
  text-decoration: none;
}

.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out-expo);
}

.cart-item:hover .cart-item-img img {
  transform: scale(1.05);
}

/* ── 商品信息 ── */
.cart-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.cart-item-name {
  font-family: var(--font-cn);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out-quart);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item-name:hover {
  color: var(--text-accent);
}

.cart-item-spec {
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  display: inline-block;
  width: fit-content;
}

.cart-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-2);
}

.cart-item-price {
  font-size: var(--text-lg);
}

/* ── 右侧操作 ── */
.cart-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  flex-shrink: 0;
  padding-top: 4px;
}

.cart-item-subtotal {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text-accent);
}

.cart-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-out-quart);
  background: none;
  border: none;
  cursor: pointer;
}

.cart-delete:hover {
  color: var(--color-error);
  background: oklch(55% 0.18 25 / 0.1);
}

/* ── 工具栏 ── */
.cart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
}

.cart-toolbar .cart-check {
  padding-top: 0;
}

.cart-delete-selected {
  font-size: var(--text-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-out-quart);
  background: none;
  border: none;
}

.cart-delete-selected:hover {
  color: var(--color-error);
  background: oklch(55% 0.18 25 / 0.1);
}

/* ── 结算面板 ── */
.settlement-panel {
  padding: var(--space-6);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  position: sticky;
  top: 96px;
}

.settlement-title {
  font-family: var(--font-cn);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-5);
  letter-spacing: 0.03em;
}

.settlement-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.settlement-free {
  color: var(--color-success);
}

.settlement-discount .discount-amount {
  color: var(--color-error);
  font-weight: var(--weight-semibold);
}

.settlement-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-4) 0;
}

.settlement-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--space-2) 0;
}

.settlement-total span:first-child {
  font-size: var(--text-base);
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}

.total-amount {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--text-accent);
}

.settlement-note {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-2);
}

.settlement-btn {
  width: 100%;
  margin-top: var(--space-5);
}

.settlement-guarantees {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

/* ── 猜你喜欢 ── */
.cart-recommend {
  margin-top: var(--space-5);
  padding: var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.recommend-title {
  font-family: var(--font-cn);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.recommend-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out-quart);
  border-bottom: 1px solid var(--border-subtle);
}

.recommend-item:last-child {
  border-bottom: none;
}

.recommend-item:hover {
  transform: translateX(4px);
}

.recommend-item img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-input);
  flex-shrink: 0;
}

.recommend-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.recommend-name {
  font-size: var(--text-sm);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recommend-info .price {
  font-size: var(--text-sm);
}

/* ── 空购物车 ── */
.cart-empty {
  text-align: center;
  padding: var(--space-16) 0;
}

.cart-empty-icon {
  color: var(--text-muted);
  opacity: 0.3;
  margin-bottom: var(--space-5);
}

.cart-empty h2 {
  font-family: var(--font-cn);
  font-size: var(--text-2xl);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.cart-empty p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-6);
}

/* ── 响应式 ── */
@media (max-width: 1024px) {
  .cart-layout {
    grid-template-columns: 1fr 300px;
    gap: var(--space-4);
  }
}

@media (max-width: 768px) {
  .cart-page {
    padding: 80px 0 var(--space-8);
  }

  .cart-layout {
    grid-template-columns: 1fr;
  }

  .cart-item {
    gap: var(--space-3);
    padding: var(--space-4);
  }

  .cart-item-img {
    width: 80px;
    height: 80px;
  }

  .cart-item-actions {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
  }

  .cart-item {
    position: relative;
  }

  .cart-item-subtotal {
    font-size: var(--text-sm);
  }

  .settlement-panel {
    position: static;
  }
}
