/* 优选好物商城 - 移动端样式 */
:root {
  --primary: #ff4d4f;
  --primary-dark: #e43b3d;
  --green: #07c160;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #8a9099;
  --line: #eceef1;
  --radius: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  background: #e9ebef;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.phone {
  position: relative;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}

button, input, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: 0; }
img { display: block; max-width: 100%; }

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar .title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; }
.topbar .side { min-width: 40px; display: flex; align-items: center; }
.topbar .side.right { justify-content: flex-end; font-size: 13px; color: var(--muted); }
.back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-left: -8px;
  border-radius: 50%;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}
.back:active { background: #f2f3f5; }

/* ---------- 首页 ---------- */
.hero {
  margin: 12px;
  padding: 20px 18px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(120deg, #ff6b6b 0%, #ff4d4f 55%, #ff8a5b 100%);
  box-shadow: 0 6px 18px rgba(255, 77, 79, .18);
}
.hero .hero-sub { font-size: 12px; opacity: .9; letter-spacing: 2px; }
.hero .hero-title { margin-top: 6px; font-size: 24px; font-weight: 700; letter-spacing: 1px; }
.hero .hero-desc { margin-top: 8px; font-size: 12px; opacity: .92; }
.hero .hero-pill {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
  font-size: 12px;
}

.service-row {
  display: flex;
  margin: 0 12px 12px;
  padding: 12px 0;
  background: #fff;
  border-radius: var(--radius);
}
.service-row .item { flex: 1; text-align: center; font-size: 12px; color: #555b64; }
.service-row .item + .item { border-left: 1px solid var(--line); }
.service-row .item .ico { font-size: 17px; margin-right: 4px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 16px 10px;
}
.section-head .h { font-size: 16px; font-weight: 600; }
.section-head .t { font-size: 12px; color: var(--muted); }

.catbar { display: flex; gap: 8px; padding: 0 16px 10px; }
.cat {
  padding: 5px 14px;
  border-radius: 999px;
  background: #fff;
  color: #61666d;
  font-size: 13px;
  border: 1px solid transparent;
}
.cat.active { background: #fff0f0; color: var(--primary); border-color: #ffd2d3; font-weight: 600; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 12px 88px;
}
.goods {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.03);
}
.goods .pic { position: relative; width: 100%; aspect-ratio: 1 / 1; background: #f2f3f5; }
.goods .pic img { width: 100%; height: 100%; object-fit: cover; }
.goods .tag {
  position: absolute; left: 8px; top: 8px;
  padding: 2px 7px; border-radius: 4px;
  background: var(--primary); color: #fff; font-size: 10px;
}
.goods .body { padding: 9px 10px 11px; }
.goods .name { font-size: 13px; line-height: 1.4; height: 36px; overflow: hidden; }
.goods .sub { margin-top: 2px; font-size: 11px; color: var(--muted); height: 16px; overflow: hidden; }
.goods .bottom { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 6px; }
.goods .price { color: var(--primary); font-weight: 700; font-size: 17px; }
.goods .price small { font-size: 11px; font-weight: 500; }
.goods .old { margin-left: 4px; font-size: 10px; color: #b6bbc2; text-decoration: line-through; }
.goods .sales { font-size: 10px; color: var(--muted); }
.goods .add {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 18px; line-height: 24px; text-align: center;
}
.goods .add:active { background: var(--primary-dark); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  width: 100%;
  max-width: 480px;
  height: 58px;
  padding-bottom: var(--safe-bottom);
  background: #fff;
  border-top: 1px solid var(--line);
}
.tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11px; color: var(--muted); position: relative;
}
.tabbar .tab.active { color: var(--primary); font-weight: 600; }
.tabbar .tab .ti { font-size: 20px; line-height: 1; }
.tabbar .badge {
  position: absolute; top: 4px; left: 50%; margin-left: 6px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--primary); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center;
}
.tabbar .badge:empty { display: none; }

/* ---------- 商品详情 ---------- */
.detail-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #fff; }
.detail-price-box { padding: 14px 16px 12px; background: #fff; }
.detail-price { color: var(--primary); font-size: 26px; font-weight: 700; }
.detail-price small { font-size: 14px; }
.detail-old { margin-left: 8px; color: #b6bbc2; font-size: 12px; text-decoration: line-through; }
.detail-sales { float: right; margin-top: 12px; font-size: 12px; color: var(--muted); }
.detail-name { margin-top: 4px; font-size: 17px; font-weight: 600; line-height: 1.4; }
.detail-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }

.panel { margin-top: 10px; padding: 14px 16px; background: #fff; }
.panel-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.spec-group { margin-bottom: 14px; }
.spec-group:last-child { margin-bottom: 0; }
.spec-label { margin-bottom: 8px; font-size: 13px; color: #555b64; }
.spec-options { display: flex; flex-wrap: wrap; gap: 8px; }
.spec {
  padding: 6px 13px; border: 1px solid var(--line); border-radius: 6px;
  background: #fafafa; color: #555b64; font-size: 12px;
}
.spec.active { border-color: var(--primary); color: var(--primary); background: #fff4f4; font-weight: 600; }

.qty-row { display: flex; align-items: center; justify-content: space-between; }
.qty-row .label { font-size: 13px; color: #555b64; }
.stepper { display: flex; align-items: center; gap: 0; }
.stepper button {
  width: 30px; height: 30px; border-radius: 5px;
  background: #f2f3f5; color: #333; font-size: 18px; line-height: 1;
}
.stepper button:disabled { color: #c8ccd2; cursor: default; }
.stepper .num { min-width: 38px; text-align: center; font-size: 14px; }

.param-row { display: flex; padding: 7px 0; font-size: 13px; }
.param-row .k { width: 76px; color: var(--muted); }
.param-row .v { flex: 1; color: #333; }
.desc-text { font-size: 13px; color: #555b64; line-height: 1.8; }
.desc-list { margin: 8px 0 0; padding-left: 18px; color: #555b64; font-size: 13px; line-height: 1.9; }

.detail-footer {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 40;
  display: flex; width: 100%; max-width: 480px; gap: 10px;
  padding: 8px 12px calc(8px + var(--safe-bottom));
  background: #fff; border-top: 1px solid var(--line);
}
.btn {
  height: 42px; border-radius: 22px; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-outline { flex: 1; border: 1px solid var(--primary); color: var(--primary); background: #fff; }
.btn-primary { flex: 1; background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-green { background: var(--green); color: #fff; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- 购物车 ---------- */
.cart-list { padding: 10px 12px 110px; }
.cart-item { display: flex; gap: 10px; padding: 12px; margin-bottom: 10px; background: #fff; border-radius: var(--radius); }
.cart-item img { width: 82px; height: 82px; border-radius: 8px; object-fit: cover; background: #f2f3f5; }
.cart-info { flex: 1; min-width: 0; }
.cart-info .n { font-size: 14px; font-weight: 600; line-height: 1.35; }
.cart-info .s { margin-top: 3px; font-size: 11px; color: var(--muted); }
.cart-info .bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.cart-info .p { color: var(--primary); font-weight: 700; font-size: 16px; }
.cart-info .stepper button { width: 26px; height: 26px; font-size: 16px; }
.cart-info .stepper .num { min-width: 30px; font-size: 13px; }
.del { background: none; color: #b6bbc2; font-size: 17px; padding: 0 2px; }

.empty { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty .e-ico { font-size: 46px; opacity: .35; }
.empty .e-txt { margin-top: 12px; font-size: 14px; }
.empty .btn { margin-top: 18px; padding: 0 24px; width: auto; }

.check-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; width: 100%; max-width: 480px;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: #fff; border-top: 1px solid var(--line);
}
.check-bar .sum { flex: 1; font-size: 13px; color: #555b64; }
.check-bar .sum b { display: block; font-size: 19px; color: var(--primary); }
.check-bar .btn { width: 120px; height: 42px; border-radius: 21px; }

/* ---------- 确认订单 ---------- */
.form-card, .field-card { margin: 12px; padding: 14px 16px; background: #fff; border-radius: var(--radius); }
.address-card { display: flex; align-items: center; gap: 10px; }
.address-card .addr-main { flex: 1; }
.address-card .a1 { font-size: 15px; font-weight: 600; }
.address-card .a1 span { margin-left: 8px; font-weight: 400; color: #555b64; font-size: 13px; }
.address-card .a2 { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.address-card .edit { color: var(--muted); font-size: 12px; }

.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 6px; font-size: 12px; color: #555b64; }
.field input, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fafafa; color: var(--text); outline: none; resize: none;
}
.field input:focus, .field textarea:focus { border-color: var(--primary); background: #fff; }
.field input::placeholder, .field textarea::placeholder { color: #b6bbc2; }
.field textarea { height: 60px; }
.field.error input, .field.error textarea { border-color: var(--primary); }
.field .err { display: none; margin-top: 4px; color: var(--primary); font-size: 11px; }
.field.error .err { display: block; }

.order-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.order-item:last-child { border-bottom: 0; }
.order-item img { width: 60px; height: 60px; border-radius: 6px; object-fit: cover; }
.order-item .oi-main { flex: 1; }
.order-item .oi-n { font-size: 13px; font-weight: 600; }
.order-item .oi-s { font-size: 11px; color: var(--muted); margin-top: 2px; }
.order-item .oi-p { text-align: right; font-size: 13px; }
.order-item .oi-p .q { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }

.kv { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { color: #333; }
.kv.total { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.kv.total .v { color: var(--primary); font-size: 18px; font-weight: 700; }
.tip { padding: 4px 18px 100px; font-size: 11px; color: var(--muted); }

/* ---------- 成功 / 收银台 ---------- */
.result-head { padding: 34px 16px 26px; text-align: center; background: #fff; }
.check-ico {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 30px; line-height: 56px; text-align: center;
}
.result-head .r1 { font-size: 18px; font-weight: 600; }
.result-head .r2 { margin-top: 5px; font-size: 12px; color: var(--muted); }
.result-head .amount { margin-top: 14px; color: var(--primary); font-size: 28px; font-weight: 700; }
.result-head .amount small { font-size: 15px; }

.cashier-head { padding: 30px 16px; text-align: center; background: #fff; }
.cashier-head .c1 { font-size: 13px; color: var(--muted); }
.cashier-head .c2 { margin-top: 6px; font-size: 32px; font-weight: 700; color: var(--text); }
.cashier-head .c2 small { font-size: 16px; }
.pay-methods { margin: 12px; background: #fff; border-radius: var(--radius); overflow: hidden; }
.pay-method { display: flex; align-items: center; gap: 10px; padding: 14px 16px; }
.pay-method + .pay-method { border-top: 1px solid var(--line); }
.wx-ico {
  width: 34px; height: 34px; border-radius: 8px; background: var(--green);
  color: #fff; font-size: 18px; font-weight: 700; text-align: center; line-height: 34px;
}
.pay-method .pm-n { flex: 1; font-size: 14px; }
.pay-method .pm-t { font-size: 12px; color: var(--green); }
.cashier-foot { padding: 18px 16px 40px; }

/* ---------- 订单列表 ---------- */
.order-tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); }
.order-tabs .ot { flex: 1; text-align: center; padding: 12px 0; font-size: 13px; color: var(--muted); position: relative; }
.order-tabs .ot.active { color: var(--primary); font-weight: 600; }
.order-tabs .ot.active::after {
  content: ""; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 2px; border-radius: 2px; background: var(--primary);
}
.orders { padding: 12px 12px 80px; }
.order-card { margin-bottom: 10px; padding: 12px 14px; background: #fff; border-radius: var(--radius); }
.oc-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.oc-head .st { color: var(--primary); }
.oc-items { display: flex; gap: 8px; padding: 12px 0; }
.oc-items img { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; }
.oc-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.oc-foot .amt { flex: 1; font-size: 13px; }
.oc-foot .amt b { color: var(--primary); font-size: 16px; }
.mini-btn { padding: 6px 14px; border-radius: 16px; font-size: 12px; border: 1px solid var(--line); background: #fff; color: #555b64; }
.mini-btn.primary { border-color: var(--primary); color: var(--primary); }

/* ---------- 提示 / 弹窗 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 10px);
  z-index: 100; padding: 10px 18px; border-radius: 20px;
  background: rgba(0,0,0,.78); color: #fff; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: 80%; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal-mask {
  position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 30px;
}
.modal {
  width: 100%; max-width: 320px; padding: 22px 20px 18px;
  border-radius: 14px; background: #fff; text-align: center;
}
.modal .m-t { font-size: 16px; font-weight: 600; }
.modal .m-c { margin-top: 10px; font-size: 13px; color: #555b64; line-height: 1.7; }
.modal .m-b { margin-top: 18px; height: 38px; border-radius: 19px; padding: 0 26px; width: auto; }

@media (min-width: 520px) {
  .phone { box-shadow: 0 0 30px rgba(0,0,0,.08); min-height: 100vh; }
}
