/* shop.css — 官网商品频道专用样式
 *
 * 与 assets/style.css 的关系：只**加**样式，不改也不覆盖 style.css 里任何一条规则。
 * 理由：style.css 服务全站 10 个页面（含有偿资讯、协议、隐私），
 * 在里面加 .card/.badge 这类通用类名会连带改坏别的页面排版
 *（本项目已经因为「撞名」踩过一次：搜索页的 .rcard 系列）。
 * 所有选择器都带 shop- 前缀，物理上不可能撞。
 *
 * 视觉基调沿用官网现有的暖红 + 米白，与首页/有偿资讯保持一致 ——
 * 审核员从首页点进商品页，看到的应该是同一个站，不是另一个站。
 */
:root {
  --shop-red: #c8452f;
  --shop-red-dark: #a5371f;
  --shop-ink: #2b2521;
  --shop-muted: #7a716a;
  --shop-line: #e8e0d8;
  --shop-bg: #faf7f3;
  --shop-card: #ffffff;
  --shop-ok: #2f7a52;
  --shop-warn: #b8860b;
}

/* ── 分类入口 ─────────────────────────────────────────────────────────── */
.shop-cats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 22px 0 0;
}
.shop-cat {
  display: block;
  padding: 18px 20px;
  background: var(--shop-card);
  border: 1px solid var(--shop-line);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s;
}
.shop-cat:hover { border-color: var(--shop-red); transform: translateY(-2px); }
.shop-cat-top { display: flex; align-items: center; gap: 10px; }
.shop-cat-icon { font-size: 22px; }
.shop-cat-name { font-size: 16px; font-weight: 600; color: var(--shop-ink); }
.shop-cat-desc { margin: 8px 0 0; font-size: 13px; color: var(--shop-muted); line-height: 1.6; }
.shop-cat-count { margin-top: 10px; font-size: 13px; color: var(--shop-red); font-weight: 600; }

/* ── 商品栅格 ─────────────────────────────────────────────────────────── */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  margin: 22px 0 0;
}
.shop-item {
  display: flex;
  flex-direction: column;
  background: var(--shop-card);
  border: 1px solid var(--shop-line);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s;
}
.shop-item:hover { border-color: var(--shop-red); transform: translateY(-2px); }

.shop-cover {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: #f0ebe5;
  display: block;
}
.shop-cover-fallback {
  width: 100%;
  aspect-ratio: 3 / 2;
  background: linear-gradient(135deg, #f3ece4, #e8ded2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--shop-muted);
  font-size: 13px;
}

.shop-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.shop-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--shop-ink);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.shop-desc {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--shop-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.shop-meta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--shop-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.shop-place::before { content: "📍 "; }

.shop-foot {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px dashed var(--shop-line);
}
.shop-price { color: var(--shop-red); font-weight: 700; font-size: 19px; }
.shop-price small { font-size: 12px; font-weight: 400; color: var(--shop-muted); margin-left: 2px; }
.shop-stock { font-size: 12px; color: var(--shop-muted); }

/* 分类角标 */
.shop-tagline { margin-top: 10px; }
.shop-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  background: #f6efe8;
  color: #8a6a4a;
  font-size: 12px;
}

/* ── 详情页 ───────────────────────────────────────────────────────────── */
.shop-detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; margin-top: 24px; }
@media (max-width: 860px) { .shop-detail { grid-template-columns: 1fr; } }

.shop-gallery-main {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  background: #f0ebe5;
  border: 1px solid var(--shop-line);
}
.shop-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.shop-thumb {
  width: 72px; height: 54px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--shop-line); cursor: pointer;
}
.shop-thumb:hover { border-color: var(--shop-red); }

.shop-dtitle { margin: 0 0 10px; font-size: 24px; line-height: 1.4; color: var(--shop-ink); }
.shop-ddesc { margin: 14px 0 0; font-size: 15px; line-height: 1.8; color: #4a423c; }

.shop-spec-box {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--shop-bg);
  border: 1px solid var(--shop-line);
  border-radius: 8px;
}
.shop-spec-box h4 { margin: 0 0 8px; font-size: 14px; color: var(--shop-ink); }
.shop-spec-box p { margin: 0; font-size: 14px; line-height: 1.7; color: #4a423c; }

/* 右侧下单卡 */
.shop-buy {
  position: sticky;
  top: 20px;
  padding: 20px;
  background: var(--shop-card);
  border: 1px solid var(--shop-line);
  border-radius: 10px;
}
.shop-buy-price { color: var(--shop-red); font-size: 30px; font-weight: 700; }
.shop-buy-price small { font-size: 14px; font-weight: 400; color: var(--shop-muted); }
.shop-kv { margin: 16px 0 0; font-size: 14px; }
.shop-kv div { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--shop-line); }
.shop-kv .k { color: var(--shop-muted); }
.shop-kv .v { color: var(--shop-ink); font-weight: 500; text-align: right; }

.shop-seller { display: flex; align-items: center; gap: 10px; margin: 16px 0 0; }
.shop-seller-av {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  background: #eee6dd; border: 1px solid var(--shop-line);
}
.shop-seller-name { font-size: 14px; color: var(--shop-ink); font-weight: 500; }
.shop-seller-role { font-size: 12px; color: var(--shop-muted); }

/* ── 表单（下单 / 入驻共用）─────────────────────────────────────────── */
.shop-field { margin-bottom: 16px; }
.shop-field label { display: block; font-size: 14px; color: var(--shop-ink); margin-bottom: 6px; font-weight: 500; }
.shop-field label .req { color: var(--shop-red); margin-left: 2px; }
.shop-field input, .shop-field select, .shop-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--shop-line);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--shop-ink);
  background: #fff;
  box-sizing: border-box;
}
.shop-field input:focus, .shop-field select:focus, .shop-field textarea:focus {
  outline: none;
  border-color: var(--shop-red);
}
.shop-field .hint { margin-top: 5px; font-size: 12px; color: var(--shop-muted); line-height: 1.6; }

.shop-qty { display: flex; align-items: center; gap: 10px; }
.shop-qty input { width: 90px; }
.shop-qty button {
  width: 34px; height: 34px; border: 1px solid var(--shop-line);
  background: #fff; border-radius: 6px; cursor: pointer; font-size: 17px; color: var(--shop-ink);
}
.shop-qty button:hover { border-color: var(--shop-red); color: var(--shop-red); }

/* ── 按钮 ─────────────────────────────────────────────────────────────── */
.shop-btn {
  display: block;
  flex: none;
  width: 100%;
  padding: 13px 20px;
  border: none;
  border-radius: 8px;
  background: var(--shop-red);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
  font-family: inherit;
}
.shop-btn:hover { background: var(--shop-red-dark); }
.shop-btn:disabled { background: #c9bfb6; cursor: not-allowed; }
.shop-btn-ghost {
  background: #fff;
  color: var(--shop-red);
  border: 1px solid var(--shop-red);
  margin-top: 10px;
}
.shop-btn-ghost:hover { background: #fdf6f4; }

/* ── 订单摘要 ─────────────────────────────────────────────────────────── */
.shop-summary {
  margin-top: 18px;
  padding: 16px 18px;
  background: var(--shop-bg);
  border: 1px solid var(--shop-line);
  border-radius: 8px;
}
.shop-summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; color: #4a423c; }
.shop-summary-row.total {
  margin-top: 8px; padding-top: 12px;
  border-top: 1px solid var(--shop-line);
  font-size: 16px; font-weight: 700; color: var(--shop-red);
}

/* ── 状态 / 提示 ──────────────────────────────────────────────────────── */
.shop-steps { display: flex; gap: 8px; margin: 20px 0 0; flex-wrap: wrap; }
.shop-step {
  padding: 7px 14px; border-radius: 20px; font-size: 13px;
  background: #f1ebe4; color: var(--shop-muted);
}
.shop-step.on { background: var(--shop-red); color: #fff; }

.shop-msg { margin: 14px 0 0; padding: 11px 14px; border-radius: 6px; font-size: 14px; display: none; }
.shop-msg.err { display: block; background: #fdecea; color: #a5371f; border: 1px solid #f5c6c0; }
.shop-msg.ok { display: block; background: #e9f5ee; color: var(--shop-ok); border: 1px solid #b9e0cb; }

.shop-empty { padding: 60px 20px; text-align: center; color: var(--shop-muted); }

/* 溯源说明条：明确告诉审核员商品来自平台真实资源 */
.shop-sync-note {
  margin: 0 0 6px;
  padding: 11px 15px;
  background: #f2f7fb;
  border: 1px solid #d6e4f0;
  border-radius: 6px;
  font-size: 13px;
  color: #4a6b85;
  line-height: 1.7;
}

/* 🔴 截图里「上一步」把「提交订单」挤成竖排 —— flex 子项默认 min-width:auto，
   长文案 + flex:1 会互相挤压。显式给 min-width:0 + white-space:nowrap。 */
.shop-btn { min-width: 0; white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════════
   收货地址簿（步骤②）
   ══════════════════════════════════════════════════════════════════ */

/* 「不需要配送」开关 —— 放最上面，因为它决定下面整块显不显示 */
.addr-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 10px 12px;
  background: #f7f8fa;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  font-size: 13px;
  color: #4a4a4a;
  cursor: pointer;
}
.addr-toggle input { width: 16px; height: 16px; cursor: pointer; }

.addr-list { display: grid; gap: 8px; margin-bottom: 10px; }

/* 🔴 按钮做地址卡片：整块可点，但文字要能换行。
   第一版没写 white-space:nowrap，长地址（「北京市怀柔区…长虹路1号院2号楼」）
   会被挤成一行并撑破卡片。 */
.addr-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font: inherit;
}
.addr-card:hover { border-color: var(--shop-red); }
.addr-card-on {
  border-color: var(--shop-red);
  background: #fff6f6;
}

.addr-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.addr-card-top strong { font-size: 14px; color: #1a1a1a; }
.addr-phone { font-size: 13px; color: #666; font-variant-numeric: tabular-nums; }

.addr-tag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--shop-red);
  color: #fff;
}
.addr-tag2 { background: #e8eaed; color: #666; }

.addr-detail {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  word-break: break-all;
}

.addr-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.shop-btn-sm { padding: 7px 14px; font-size: 13px; margin-top: 0; }

/* 地址表单 */
.addr-form {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  background: #fafbfc;
}
.addr-form-title { font-size: 14px; font-weight: 600; color: #1a1a1a; margin-bottom: 10px; }

.addr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.addr-grid input {
  padding: 9px 11px;
  border: 1px solid #e0e2e5;
  border-radius: 6px;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
}
/* ⚠️ 前两个是「姓名/手机号」并排，后两个是「地区/详细」并排。
   窄屏（小程序 webview 常见 375px）下两列会太挤，单列更可读。 */
@media (max-width: 480px) {
  .addr-grid { grid-template-columns: 1fr; }
}

.addr-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 13px;
  color: #666;
}
.addr-tag-pick { display: flex; align-items: center; gap: 6px; }
.addr-tag-btn {
  padding: 3px 10px;
  border: 1px solid #e0e2e5;
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  color: #666;
}
.addr-tag-on { border-color: var(--shop-red); color: var(--shop-red); background: #fff6f6; }
.addr-def { display: flex; align-items: center; gap: 5px; cursor: pointer; }

.addr-form-btns { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hint-err { color: #d33; }
.hint-ok { color: #2a7; }

/* ══════════════════════════════════════════════════════════════════
   订单消息与凭证（订单详情页）
   ══════════════════════════════════════════════════════════════════ */

.order-msgs { margin-top: 20px; }

.order-msgs-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 10px;
}

.order-msg-empty {
  padding: 16px;
  background: #f7f8fa;
  border: 1px dashed #d8dade;
  border-radius: 8px;
  font-size: 13px;
  color: #888;
  line-height: 1.6;
}

.order-msg {
  border: 1px solid #e8eaed;
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

/* 物流消息左边一条橙色边 —— 一眼能区分消息类型 */
.order-msg-logistics { border-left: 3px solid #f5a623; }
.order-msg-voucher { border-left: 3px solid #7b5cff; }
.order-msg-notice { border-left: 3px solid #2b8aef; }
.order-msg-contact { border-left: 3px solid #20a97e; }

.order-msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  background: #fafbfc;
  border-bottom: 1px solid #f0f1f3;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
}
.order-msg-time {
  font-size: 12px;
  font-weight: 400;
  color: #999;
  font-variant-numeric: tabular-nums;
}

.order-msg-body { padding: 12px 14px; }

.order-msg-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0;
  flex-wrap: wrap;
}
.order-msg-k {
  flex: 0 0 68px;
  font-size: 13px;
  color: #888;
}
.order-msg-v {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: #1a1a1a;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}

/* 兑换码 / 运单号：等宽字体 + 浅底，方便一眼看清数字 */
.order-msg-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  letter-spacing: .5px;
  background: #f2f3f5;
  padding: 3px 8px;
  border-radius: 4px;
  word-break: break-all;
}

.order-msg-copy {
  flex: none;
  padding: 4px 12px;
  border: 1px solid #d8dade;
  border-radius: 5px;
  background: #fff;
  font-size: 12px;
  color: #555;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.order-msg-copy:hover { border-color: var(--shop-red); color: var(--shop-red); }
.order-msg-copy:active { background: #f6f6f6; }

/* ══════════════════════════════════════════════════════════════════
   按钮组 —— 修「并排按钮被挤成竖排」
   ══════════════════════════════════════════════════════════════════
   🔴 根因（用户截图三次指出的问题）：
     `.shop-btn` 里有 `width: 100%`（原本是给「单独一个按钮」用的），
     页面里写 `style="flex:1"` 想让它在并排时平分宽度 ——
     但 **`width:100%` 让按钮占满整行，`flex:1` 完全失效**，
     于是「上一步」占满左边，「下一步」被推到屏幕外，只露出一个竖排的字。

   ⇒ 正确做法：**并排时用容器类 `.shop-btns` + 容器内子按钮清掉 width**，
     不再用 inline 的 `flex:1`（它和 width:100% 冲突）。

   用法：
     <div class="shop-btns">
       <button class="shop-btn shop-btn-ghost">上一步</button>
       <button class="shop-btn">下一步：确认订单</button>
     </div>
*/
.shop-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;      /* 窄屏时允许换行，而不是把字挤成竖排 */
  align-items: stretch;
}

/* 关键：清掉 width:100%，让 flex 分配生效 */
.shop-btns > .shop-btn,
.shop-btns > .shop-btn-ghost,
.shop-btns > a.shop-btn {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  margin-top: 0;
}

/* 长文案不换行也不竖排 —— 这是最关键的一条。
   没有它，「下一步：确认订单」在 flex 里会被压成每行一个字。 */
.shop-btns > .shop-btn,
.shop-btns > a.shop-btn {
  white-space: nowrap;
  text-align: center;
}

/* 窄屏：两个按钮改上下排，保证可点区域完整 */
@media (max-width: 420px) {
  .shop-btns { flex-direction: column; }
  .shop-btns > .shop-btn,
  .shop-btns > a.shop-btn {
    flex: none;
    width: 100%;
  }
}

/* 订单第⑤步的收款码 —— 与资讯页 .paymodal-qr 同一形态 */
.shop-pay-qr img {
  width: 176px;
  height: 176px;
  border: 1px solid var(--shop-line);
  border-radius: 10px;
  padding: 8px;
  box-sizing: border-box;
  background: #fff;
}
@media (max-width: 420px) {
  .shop-pay-qr img { width: 152px; height: 152px; }
}

/* ============ 下单页（游客 checkout）============ */
.ord-card {
  background: var(--white);
  border: 1px solid var(--shop-line);
  border-radius: 12px;
  padding: 22px;
  max-width: 560px;
}
.ord-prod { display: flex; gap: 14px; align-items: center; padding-bottom: 16px; border-bottom: 1px dashed var(--shop-line); }
.ord-prod-img { width: 76px; height: 76px; border-radius: 10px; overflow: hidden; flex: 0 0 auto; background: #EDE7DA; }
.ord-prod-img img { width: 100%; height: 100%; object-fit: cover; }
.ord-prod-info { min-width: 0; }
.ord-prod-name { font-size: 16px; font-weight: 600; color: var(--shop-ink); }
.ord-prod-meta { font-size: 12px; color: var(--shop-muted); margin: 4px 0; }
.ord-prod-price { color: var(--red); font-weight: 600; }

.ord-qty { display: flex; align-items: center; gap: 10px; margin: 18px 0; }
.ord-qty-label { font-size: 14px; color: var(--shop-ink); }
.ord-qty-btn { width: 34px; height: 34px; border: 1px solid var(--shop-line); background: #fff; border-radius: 8px; font-size: 18px; cursor: pointer; color: var(--shop-ink); }
.ord-qty-btn:hover { border-color: var(--red); color: var(--red); }
.ord-qty-input { width: 54px; height: 34px; text-align: center; border: 1px solid var(--shop-line); border-radius: 8px; }
.ord-qty-stock { font-size: 12px; color: var(--shop-muted); margin-left: auto; }

.ord-ship { margin: 8px 0 4px; }
.ord-ship h4 { margin: 0 0 10px; font-size: 15px; color: var(--shop-ink); }
.ord-ship .shop-field { margin-bottom: 12px; }
.ord-ship .shop-field textarea { width: 100%; border: 1px solid var(--shop-line); border-radius: 8px; padding: 9px 12px; font-size: 14px; font-family: inherit; resize: vertical; box-sizing: border-box; }

.ord-block-title { font-size: 14px; color: var(--shop-ink); font-weight: 600; margin: 14px 0 8px; }
.ord-line { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; font-size: 14px; border-bottom: 1px dashed var(--shop-line); color: var(--shop-ink); }
.ord-line span:last-child { color: var(--shop-muted); text-align: right; }
.ord-summary { display: flex; justify-content: flex-end; margin-top: 14px; font-size: 15px; }
.ord-summary strong { color: var(--red); font-size: 18px; margin-left: 6px; }

.ord-status { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 13px; margin-bottom: 12px; }
.ord-status-pending { background: #FFF3E0; color: #B26A00; }
.ord-status-paid { background: #E6F4EA; color: #2F7D4F; }
