/* ============================================================
   组件库 — 卡片与反馈 (Card & Feedback)
   商品卡 / 分类卡 / Alert / Toast / Badge / Skeleton
   ============================================================ */

/* ---------- 通用表面 ---------- */
.surface {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ---------- 商品卡 ---------- */
.product-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--dur-normal) var(--ease-out), box-shadow var(--dur-normal) var(--ease-out), border-color var(--dur-normal);
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--brand-200); }

.product-card .media {
  position: relative; aspect-ratio: 1/1; background: var(--color-surface-dim);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.product-card .media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease-out); }
.product-card:hover .media img { transform: scale(1.05); }

.product-card .badge-float { position: absolute; top: var(--space-3); left: var(--space-3); }

.product-card .fav-btn {
  position: absolute; top: var(--space-2); right: var(--space-2);
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.92); display: flex; align-items: center; justify-content: center;
  color: var(--neutral-500); box-shadow: var(--shadow-sm);
  transition: all var(--dur-fast);
}
.product-card .fav-btn:hover { color: var(--error-500); transform: scale(1.1); }
.product-card .fav-btn.active { color: var(--error-500); }

.product-card .body { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); flex: 1; }
.product-card .title {
  font-size: var(--text-base); font-weight: var(--weight-medium); color: var(--color-text-strong);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: var(--leading-normal); min-height: 3em;
}
.product-card .price-row { display: flex; align-items: baseline; gap: var(--space-2); margin-top: auto; }
.product-card .price { font-size: var(--text-xl); font-weight: var(--weight-bold); color: var(--brand-600); }
.product-card .price .symbol { font-size: var(--text-sm); margin-right: 1px; }
.product-card .price-old { font-size: var(--text-sm); color: var(--neutral-400); text-decoration: line-through; }
.product-card .meta { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--color-text-muted); }

.product-card .add-cart {
  margin-top: var(--space-3); width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 40px; font-size: var(--text-sm); font-weight: var(--weight-semibold);
  color: var(--brand-600); background: var(--brand-50);
  border-radius: var(--radius-full); transition: all var(--dur-fast);
}
.product-card .add-cart:hover { background: var(--brand-500); color: #fff; }

/* ---------- 分类卡 ---------- */
.cat-card {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  padding: var(--space-6) var(--space-4); text-align: center;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); transition: all var(--dur-normal) var(--ease-out);
}
.cat-card:hover { border-color: var(--brand-300); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.cat-card .emoji {
  width: 56px; height: 56px; border-radius: var(--radius-full);
  background: var(--brand-50); display: flex; align-items: center; justify-content: center;
}
.cat-card .name { font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--color-text-strong); }
.cat-card .count { font-size: var(--text-xs); color: var(--color-text-muted); }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 2px var(--space-2); font-size: var(--text-xs); font-weight: var(--weight-semibold);
  border-radius: var(--radius-sm); line-height: 1.6;
}
.badge--brand   { background: var(--brand-100); color: var(--brand-700); }
.badge--success { background: var(--success-100); color: #15803d; }
.badge--warning { background: var(--warning-100); color: #b45309; }
.badge--danger  { background: var(--error-100); color: #b91c1c; }
.badge--info    { background: var(--info-100); color: #0369a1; }
.badge--neutral { background: var(--neutral-100); color: var(--neutral-600); }

/* 数量徽标（购物车角标） */
.count-dot {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-full);
  background: var(--error-500); color: #fff; font-size: 11px; font-weight: var(--weight-bold);
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- Alert ---------- */
.alert {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4); border-radius: var(--radius-md);
  font-size: var(--text-sm); line-height: var(--leading-normal);
}
.alert .icon { flex: none; margin-top: 1px; }
.alert--success { background: var(--success-100); color: #166534; }
.alert--error   { background: var(--error-100); color: #991b1b; }
.alert--warning { background: var(--warning-100); color: #92400e; }
.alert--info    { background: var(--info-100); color: #075985; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; top: var(--space-4); left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: var(--space-2); }
.toast {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: rgba(28,25,23,0.92); color: #fff; border-radius: var(--radius-full);
  font-size: var(--text-sm); box-shadow: var(--shadow-lg);
  animation: toast-in var(--dur-normal) var(--ease-out);
}
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success-500); }
.toast--error .dot { background: var(--error-500); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Skeleton 骨架屏 ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface-dim) 25%, var(--color-border) 50%, var(--color-surface-dim) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }
