/* 猕猴桃下单页样式：移动端优先，兼容微信内置浏览器 */

:root {
  --green: #4a7c2f;
  --green-dark: #3a6224;
  --green-light: #eef5e8;
  --kiwi: #8fbf5a;
  --text: #2b2b2b;
  --muted: #6f7671;
  --line: #e2e6dd;
  --bg: #f7f8f4;
  --card: #ffffff;
  --danger: #c0392b;
  --warn: #b8860b;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 14px 40px;
}

/* ---------- 顶部 ---------- */

.header {
  background: linear-gradient(135deg, var(--green) 0%, var(--kiwi) 100%);
  color: #fff;
  padding: 26px 14px 22px;
  text-align: center;
}

.header h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.header p {
  margin: 0;
  font-size: 13px;
  opacity: 0.93;
  line-height: 1.7;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- 卡片 ---------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--green-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card h2 .step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  flex: none;
}

/* ---------- 商品选择 ---------- */

.products { display: grid; gap: 10px; }

.product {
  display: block;
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.product input { position: absolute; opacity: 0; pointer-events: none; }

.product.on {
  border-color: var(--green);
  background: var(--green-light);
}

.product .row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.product .name { font-size: 16px; font-weight: 600; }

.product .price { font-size: 19px; font-weight: 700; color: var(--danger); white-space: nowrap; }

.product .price small { font-size: 12px; font-weight: 400; }

.product .free {
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-light);
  border-radius: 20px;
  padding: 1px 10px;
  white-space: nowrap;
  align-self: center;
}

.product .desc { font-size: 13px; color: var(--muted); margin-top: 2px; }

.product .tick {
  position: absolute;
  top: 10px;
  right: 12px;
  display: none;
}

/* ---------- 数量 ---------- */

.qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.qty-label { font-size: 15px; }

.stepper { display: flex; align-items: center; gap: 0; }

.stepper button {
  width: 38px;
  height: 38px;
  font-size: 20px;
  line-height: 1;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.stepper button:first-child { border-radius: 8px 0 0 8px; }
.stepper button:last-child { border-radius: 0 8px 8px 0; }
.stepper button:disabled { color: #c6cbc2; cursor: not-allowed; }

.stepper input {
  width: 52px;
  height: 38px;
  text-align: center;
  font-size: 16px;
  border: 1px solid var(--line);
  border-left: none;
  border-right: none;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}

/* ---------- 表单 ---------- */

.field { margin-bottom: 13px; }

.field:last-child { margin-bottom: 0; }

.field label {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 5px;
}

.field .req { color: var(--danger); }

.field input,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  font-size: 16px; /* 16px 以下 iOS 会自动放大页面 */
  font-family: inherit;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(74, 124, 47, 0.12);
}

.field textarea { resize: vertical; min-height: 62px; }

.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- 合计 & 按钮 ---------- */

.total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 16px;
  margin-top: 14px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.total .label { font-size: 15px; color: var(--muted); }

.total .amount { font-size: 26px; font-weight: 700; color: var(--danger); }

.total .amount small { font-size: 14px; font-weight: 400; }

.btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 15px;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--green);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.btn:active { background: var(--green-dark); }

.btn:disabled { background: #a9b5a0; cursor: not-allowed; }

.btn.ghost {
  background: #fff;
  color: var(--green-dark);
  border: 1.5px solid var(--green);
}

.btn.ghost:active { background: var(--green-light); }

/* ---------- 提示条 ---------- */

.alert {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 9px;
  font-size: 14px;
  line-height: 1.6;
  display: none;
}

.alert.show { display: block; }
.alert.err { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c0; }
.alert.ok { background: var(--green-light); color: var(--green-dark); border: 1px solid #cfe2c0; }
.alert.warn { background: #fdf6e3; color: var(--warn); border: 1px solid #f0e0b0; }

/* ---------- 付款页 ---------- */

.order-no {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 10px;
}

.order-no b {
  font-family: "SF Mono", Consolas, Monaco, monospace;
  font-size: 16px;
  color: var(--text);
  letter-spacing: 0.5px;
}

.pay-amount {
  text-align: center;
  font-size: 36px;
  font-weight: 700;
  color: var(--danger);
  line-height: 1.2;
  margin: 4px 0 2px;
}

.pay-amount small { font-size: 18px; font-weight: 400; }

.pay-sub { text-align: center; font-size: 13px; color: var(--muted); margin: 0 0 4px; }

.qr-box { text-align: center; padding: 6px 0 2px; }

.qr-box img {
  width: 100%;
  max-width: 300px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

/* 微信 / 支付宝 切换 */
.paytabs {
  display: flex;
  gap: 0;
  justify-content: center;
  margin: 0 auto 12px;
  max-width: 300px;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: #fff;
}

.paytabs:empty { display: none; }

.paytab {
  flex: 1;
  padding: 9px 6px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--muted);
  background: #fff;
  border: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.paytab + .paytab { border-left: 1px solid var(--line); }

.paytab.on {
  background: var(--green);
  color: #fff;
  font-weight: 600;
}

.qr-missing {
  padding: 30px 16px;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.summary { font-size: 14px; }

.summary div {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #f0f2ee;
}

.summary div:last-child { border-bottom: none; }

.summary .k { color: var(--muted); flex: none; width: 76px; }

.summary .v { flex: 1; word-break: break-all; }

.badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
}

.badge.pending { background: #fdf6e3; color: var(--warn); }
.badge.paid { background: var(--green-light); color: var(--green-dark); }
.badge.shipped { background: #e8f0fd; color: #2c5aa0; }
.badge.cancelled { background: #f0f0f0; color: #777; }

/* ---------- 上传 ---------- */

.upload-area { text-align: center; }

.upload-area input[type=file] { display: none; }

.preview {
  display: none;
  max-width: 200px;
  width: 100%;
  margin: 10px auto 0;
  border-radius: 9px;
  border: 1px solid var(--line);
}

.preview.show { display: block; }

.steps {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0;
  padding-left: 20px;
}

.steps li { margin-bottom: 4px; }

.footer {
  text-align: center;
  font-size: 12px;
  color: #9aa295;
  margin-top: 22px;
  line-height: 1.8;
}

.footer a { color: var(--muted); }

.center { text-align: center; }

.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }
