/* ============================================================
   03 · components  ——  跨页面复用的零件
   ------------------------------------------------------------
   判定标准：同一个 class 在 2 个以上页面出现，就放这里。
   只出现一次区块放 pages/*.css。
   命名约定（BEM-lite）：
     .block            结构
     .block__elem      结构内部元素（本文件里沿用历史写法 .block elem）
     .block--variant   变体
   ============================================================ */

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: .15s;
}
.btn-primary { background: var(--brand-2); color: #fff; }
.btn-primary:hover { background: #3581b1; }
/* 行动按钮：原站就是这条渐变（#f7bd00 → #f69400），字色深藏青 */
.btn-action { background: linear-gradient(to bottom, var(--action), var(--action-dark)); color: var(--action-ink); }
.btn-action:hover { filter: brightness(1.04); }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--brand-2); color: var(--brand-2); }
.btn[disabled] { background: #d8dce4; color: #8b94a3; cursor: not-allowed; box-shadow: none; filter: none; }

/* ---------- 面板（白底卡片容器） ---------- */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; }
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: .15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(69, 149, 199, .18); }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .field-row { grid-template-columns: 1fr; } }

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: var(--nav-bg);
  color: #fff;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 99px;
  z-index: 85;
  transition: .25s;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .25);
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 小标签 / 徽标 ---------- */
.pill {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 4px 11px;
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 500;
}
.pill.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--ok-soft);
  color: var(--ok);
}

/* ---------- 评分星星 ---------- */
.stars { color: #f5a623; font-size: 12px; }
.rating { display: flex; align-items: center; font-size: 12px; color: var(--ink-3); }

/* ---------- 分类磁贴 ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.cat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: .15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: #d7e5f5; }
.cat-card .ico { font-size: 20px; line-height: 1; }
.cat-card .nm { font-weight: 700; font-size: 15px; }
.cat-card .ct { font-size: 12.5px; color: var(--ink-3); }

/* ---------- 分类标签条 ---------- */
.cat-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 2px; }
.cat-tabs a {
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: #fff;
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 500;
  white-space: nowrap;
}
.cat-tabs a:hover { border-color: var(--brand-2); color: var(--brand-2); }
.cat-tabs a[aria-current="page"] { background: var(--brand-2); border-color: var(--brand-2); color: #fff; font-weight: 600; }

/* ---------- 产品卡（两套外观，见 pages/home.css 与 pages/category.css） ----------
   骨架在这里，差异用 --home / --tile 修饰类表达。
   TODO(换皮)：视觉统一后合并成一套，删掉修饰类。
   ------------------------------------------------------------------------ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .18s, transform .18s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.card-img { background: #fff; display: flex; align-items: center; justify-content: center; }
.card-img img { width: auto; object-fit: contain; }
.card-body { display: flex; flex-direction: column; flex: 1; }
.card-title { font-size: 15px; line-height: 1.35; font-weight: 500; }
.price-range small { color: var(--ink-3); }

/* ---------- 数量步进器 ---------- */
.qty {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  height: 36px;
  background: #fff;
}
.qty button { width: 30px; height: 100%; border: 0; background: #fff; cursor: pointer; font-size: 15px; color: var(--ink-2); }
.qty button:hover { background: #f4f6fb; }
.qty span { min-width: 32px; text-align: center; font-size: 13.5px; font-weight: 700; }
.qty button:disabled,
.qty input:disabled { opacity: .4; cursor: not-allowed; }
.qty input {
  width: 48px;
  height: 100%;
  border: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink);
}
.qty input:focus { outline: none; }

/* ---------- 金额行 ---------- */
.sumrow { display: flex; justify-content: space-between; gap: 14px; font-size: 14px; color: var(--ink-2); padding: 7px 0; }
.sumrow.total {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 14px;
  font-size: 19px;
  font-weight: 700;
  color: var(--brand);
}

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 56px 20px; }
.empty .ic { font-size: 34px; margin-bottom: 12px; }
.empty h3 { font-size: 17px; margin-bottom: 6px; }
.empty p { font-size: 13.5px; color: var(--ink-2); margin-bottom: 18px; }
