/* ================================================================
   弓老师内部营养 · 私域商城
   设计语言对齐 member.gonglaoshi.cn（紫色主色 #667eea）
   ================================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }

/* === 顶部容器（最大宽度 480 居中）=== */
.page {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 14px 80px;
  min-height: 100vh;
}

/* === 顶部头部（带返回按钮的页面用）=== */
.page-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px 0;
}
.page-header .back-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #555;
  margin-left: -6px;
}
.page-header .page-title {
  font-size: 17px; font-weight: 700; color: #1a1a2e;
  flex: 1;
}

/* === 商城首页 hero === */
.shop-hero {
  text-align: center;
  padding: 24px 16px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-radius: 16px;
  margin-bottom: 18px;
}
.shop-hero-title {
  font-size: 22px; font-weight: 700; margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.shop-hero-subtitle {
  font-size: 13px; opacity: 0.92; line-height: 1.6;
}

/* === 引导提示条 === */
.hint-banner {
  background: #fff8e1;
  border: 1px solid #ffd54f;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: #8d6e00;
  margin-bottom: 16px;
  line-height: 1.6;
}

/* === 产品列表 === */
.product-list {
  display: flex; flex-direction: column; gap: 14px;
}
.product-card {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  border: 1px solid #eee;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  display: flex; gap: 14px;
  align-items: flex-start;
}
.product-card:active { transform: scale(0.99); transition: transform 0.1s; }

.product-image {
  width: 88px; height: 88px; flex-shrink: 0;
  border-radius: 10px; overflow: hidden;
  background: #f5f5f5;
  display: flex; align-items: center; justify-content: center;
}
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.product-image-placeholder {
  font-size: 11px; color: #aaa; text-align: center; padding: 8px;
}

.product-title-block { flex: 1; min-width: 0; }
.product-name {
  font-size: 16.5px; font-weight: 700; color: #1a1a2e;
  margin-bottom: 4px;
}
.product-subtitle {
  font-size: 12px; color: #667eea; font-weight: 600;
  margin-bottom: 6px;
}
.product-intro {
  font-size: 13px; color: #666; line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.product-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.product-status-badge.in-stock {
  background: #e8f5e9; color: #2e7d32;
}
.product-status-badge.preorder {
  background: #fff3e0; color: #e65100;
}

/* === 产品详情页 === */
.product-detail .product-banner {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid #eee;
}
.product-detail .product-banner-image {
  width: 100%; aspect-ratio: 4 / 3;
  background: #f5f5f5;
  border-radius: 12px;
  margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.product-detail .product-banner-image img {
  width: 100%; height: 100%; object-fit: cover;
}
.product-detail .product-banner-image .placeholder {
  font-size: 13px; color: #aaa;
}

.product-detail .product-name-large {
  font-size: 20px; font-weight: 700; color: #1a1a2e;
  margin-bottom: 4px;
}
.product-detail .product-tagline {
  font-size: 13px; color: #667eea; font-weight: 600;
  margin-bottom: 10px;
}
.product-detail .product-pitch {
  font-size: 14px; color: #555; line-height: 1.6;
  padding: 10px 12px;
  background: #f9fafc;
  border-radius: 8px;
  border-left: 3px solid #667eea;
}

.section-card {
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid #eee;
}
.section-card-title {
  font-size: 14px; font-weight: 700; color: #333;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.section-card-title::before {
  content: ''; width: 3px; height: 14px;
  background: #667eea; border-radius: 2px;
}
.section-card-content { font-size: 13.5px; color: #555; line-height: 1.7; }
.section-card-content .meta-row {
  display: flex; gap: 10px; padding: 4px 0; font-size: 13px;
}
.section-card-content .meta-row .label {
  color: #999; flex-shrink: 0; min-width: 60px;
}
.section-card-content ul { list-style: none; padding: 0; }
.section-card-content ul li {
  padding: 5px 0;
  padding-left: 18px;
  position: relative;
  font-size: 13.5px;
}
.section-card-content ul li::before {
  content: '·';
  position: absolute;
  left: 6px;
  color: #667eea;
  font-weight: 700;
}

/* === 套餐选择 === */
.sku-list {
  display: flex; flex-direction: column; gap: 10px;
}
.sku-card {
  border: 2px solid #eee;
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
  display: flex; align-items: center; gap: 12px;
  transition: all 0.2s;
  position: relative;
}
.sku-card.selected {
  border-color: #667eea;
  background: #f5f7ff;
}
.sku-card-radio {
  width: 18px; height: 18px;
  border: 2px solid #ccc;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}
.sku-card.selected .sku-card-radio {
  border-color: #667eea;
}
.sku-card.selected .sku-card-radio::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 10px; height: 10px;
  background: #667eea;
  border-radius: 50%;
}
.sku-card-info { flex: 1; min-width: 0; }
.sku-card-name { font-size: 15px; font-weight: 700; color: #1a1a2e; margin-bottom: 2px; }
.sku-card-meta { font-size: 12px; color: #999; }
.sku-card-price {
  font-size: 18px; font-weight: 700; color: #e65100;
  flex-shrink: 0;
}
.sku-card-tag {
  position: absolute;
  top: -8px; right: 12px;
  background: linear-gradient(135deg, #ff8a65, #e65100);
  color: #fff;
  font-size: 10.5px; font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

/* === 表单 === */
.form-card {
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid #eee;
}
.form-row { margin-bottom: 12px; }
.form-row:last-child { margin-bottom: 0; }
.form-label {
  display: block; font-size: 13px; color: #333;
  margin-bottom: 6px; font-weight: 600;
}
.form-label .required { color: #e65100; margin-left: 2px; }
.form-input, .form-textarea {
  width: 100%;
  font-size: 15px; line-height: 1.5;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  color: #333;
  transition: border 0.15s;
}
.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: #667eea;
  background: #fff;
}
.form-textarea { min-height: 64px; resize: vertical; }
.form-hint { font-size: 11.5px; color: #999; margin-top: 4px; }

/* === 底部固定按钮（提交订单/支付）=== */
.bottom-action-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid #eee;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 10;
}
.bottom-action-bar .price-block {
  flex: 1;
}
.bottom-action-bar .price-label {
  font-size: 11px; color: #888;
}
.bottom-action-bar .price-value {
  font-size: 20px; font-weight: 700; color: #e65100;
}
.bottom-action-bar .btn {
  flex-shrink: 0;
  min-width: 130px;
}

.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600;
  padding: 11px 20px;
  border-radius: 22px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled, .btn:disabled {
  opacity: 0.5; cursor: not-allowed;
}
.btn-secondary {
  background: #f0f0f0; color: #555;
}
.btn-block { width: 100%; }

/* === 收款页 === */
.checkout-section {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid #eee;
}
.order-summary {
  background: linear-gradient(135deg, #fff8e1, #ffecb3);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}
.order-summary-row {
  display: flex; justify-content: space-between;
  font-size: 13px; padding: 3px 0;
  color: #5d4a00;
}
.order-summary-row.amount {
  font-size: 16px; font-weight: 700;
  border-top: 1px dashed #d4a700;
  padding-top: 8px; margin-top: 6px;
  color: #5d4a00;
}
.order-summary-row.amount .price { color: #e65100; font-size: 22px; }

.qrcode-section {
  text-align: center;
}
.qrcode-tabs {
  display: flex;
  border: 1px solid #eee;
  border-radius: 22px;
  margin: 0 auto 14px;
  width: fit-content;
  background: #f5f5f5;
  padding: 3px;
}
.qrcode-tab {
  padding: 7px 22px;
  font-size: 13px; font-weight: 600;
  color: #888;
  border-radius: 19px;
  transition: all 0.15s;
}
.qrcode-tab.active {
  background: #fff;
  color: #1a1a2e;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.qrcode-image-wrapper {
  display: inline-block;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}
.qrcode-image-wrapper img {
  width: 200px; height: 200px;
  display: block;
  margin: 0 auto;
  background: #fff;
}
.qrcode-image-wrapper .placeholder {
  width: 200px; height: 200px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #aaa;
  background: #fff;
  border: 1px dashed #ddd;
}
.qrcode-hint {
  font-size: 12.5px; color: #888;
  line-height: 1.7;
  padding: 0 14px;
  margin-bottom: 6px;
}
.qrcode-hint strong { color: #e65100; }

/* === 老年人入口（发微信加好友）=== */
.elder-section {
  margin-top: 18px;
  padding: 14px;
  background: #f0f7ff;
  border: 1px dashed #90caf9;
  border-radius: 12px;
}
.elder-section .title {
  font-size: 13px; font-weight: 700; color: #1565c0;
  margin-bottom: 8px;
}
.elder-section .desc {
  font-size: 12.5px; color: #555; line-height: 1.7;
  margin-bottom: 10px;
}
.elder-section .add-friend-qr {
  text-align: center;
}
.elder-section .add-friend-qr img,
.elder-section .add-friend-qr .placeholder {
  width: 160px; height: 160px;
  display: inline-block;
  background: #fff;
  border-radius: 10px;
}

/* === 我的订单列表 === */
.order-list {
  display: flex; flex-direction: column; gap: 10px;
}
.order-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  border: 1px solid #eee;
}
.order-card-head {
  display: flex; justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #f0f0f0;
}
.order-card-id { font-size: 12px; color: #999; }
.order-card-status {
  font-size: 12px; font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}
.status-pending-pay { background: #fff8e1; color: #f57c00; }
.status-pending-ship { background: #e3f2fd; color: #1565c0; }
.status-in-customs {
  background: #fff4e6; color: #d84315;
  max-width: 60%; white-space: normal; line-height: 1.35; text-align: right;
}
.status-shipped { background: #ede7f6; color: #5e35b1; }
.status-completed { background: #f5f5f5; color: #777; }
.status-cancelled { background: #ffebee; color: #c62828; }
.status-pre-register { background: #f5f5f5; color: #777; }

.order-card-body {
  font-size: 13.5px; color: #555;
  line-height: 1.6;
}
.order-card-product {
  font-weight: 600; color: #1a1a2e; margin-bottom: 2px;
}
.order-card-meta {
  display: flex; justify-content: space-between;
  margin-top: 6px;
}
.order-card-amount { color: #e65100; font-weight: 700; font-size: 15px; }
.order-card-tracking {
  margin-top: 6px;
  padding: 6px 10px;
  background: #f5f7fa;
  border-radius: 6px;
  font-size: 12px; color: #555;
}
/* 订单卡片上的最新物流状态（异步填充后替换掉快递公司+单号） */
.order-card-tracking .track-state {
  font-weight: 700; color: #5e35b1; margin-right: 6px;
}
.order-card-tracking .track-context { color: #666; }

/* === 物流轨迹时间线（订单详情页）=== */
.tracking-timeline { margin-top: 14px; text-align: left; }
.tracking-current {
  font-size: 15px; font-weight: 700; color: #5e35b1;
  margin-bottom: 14px;
}
.tracking-loading { font-size: 13px; color: #999; padding: 8px 0; }
.tracking-steps {
  position: relative;
  padding-left: 4px;
}
.tracking-step {
  position: relative;
  padding: 0 0 16px 22px;
  border-left: 2px solid #e6e0f2;
}
.tracking-step:last-child { border-left-color: transparent; padding-bottom: 0; }
.tracking-dot {
  position: absolute;
  left: -6px; top: 2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #d6cce8;
}
.tracking-step.is-latest .tracking-dot {
  background: #5e35b1;
  box-shadow: 0 0 0 4px rgba(94, 53, 177, 0.15);
}
.tracking-step-context {
  font-size: 13px; line-height: 1.5;
  color: #999;
}
.tracking-step.is-latest .tracking-step-context {
  color: #333; font-weight: 600;
}
.tracking-step-time {
  font-size: 11px; color: #bbb; margin-top: 3px;
}

/* === 加载/空状态 === */
.loading-wrapper, .error-wrapper, .empty-wrapper {
  text-align: center; padding: 60px 20px;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid #e0e0e0;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrapper p, .error-wrapper p, .empty-wrapper p {
  color: #888; font-size: 13px;
}
.empty-wrapper .empty-icon {
  font-size: 40px; margin-bottom: 10px; opacity: 0.6;
}
.error-icon { font-size: 36px; margin-bottom: 10px; }
.error-title { font-size: 15px; font-weight: 700; color: #333; margin-bottom: 4px; }

/* === Toast === */
.toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.toast.show { opacity: 1; }

.hidden { display: none !important; }

/* 安全区适配 */
@supports(padding: max(0px)) {
  .page { padding-bottom: max(80px, env(safe-area-inset-bottom)); }
}
