/* ============ 移动商城 - 前台样式 ============ */
:root {
  --primary: #a97142;
  --primary-2: #b8865a;
  --grad: linear-gradient(135deg, #8b5a2b 0%, #c08a5a 100%);
  --gold: #c9a227;
  --text: #3e2f24;
  --text-2: #8a7a68;
  --text-3: #b3a188;
  --border: #efe4d2;
  --bg: #f6efe3;
  --danger: #c0392b;
  --price: #b5451f;
  --radius: 14px;
  --shadow: 0 6px 18px rgba(122, 78, 45, 0.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* 主内容容器（给底部导航留白） */
.page-wrap { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 96px; background: var(--bg); }
@media (min-width: 768px) {
  .page-wrap { max-width: 720px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

/* ============ 顶部栏 ============ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: #fff; position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; }
.topbar .brand .logo {
  width: 30px; height: 30px; border-radius: 8px; background: var(--grad);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.topbar .brand .logo img { width: 22px; height: 22px; display: block; }
.topbar .actions { display: flex; gap: 10px; }
.topbar .icon-btn {
  width: 34px; height: 34px; border-radius: 50%; background: var(--bg);
  display: flex; align-items: center; justify-content: center; font-size: 16px; cursor: pointer;
}

/* ============ 轮播 ============ */
.swiper { position: relative; padding: 14px 16px 0; }
.swiper-track { overflow: hidden; border-radius: var(--radius); }
.swiper-slides { display: flex; transition: transform .4s ease; }
.swiper-slide {
  min-width: 100%; height: 150px; display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center; padding: 24px;
  background: linear-gradient(135deg, #7a4e2d 0%, #a97142 60%, #d2b48c 100%);
  color: #fff; position: relative; overflow: hidden;
}
.swiper-slide::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(255, 255, 255, .4), transparent 70%);
}
.swiper-slide .s-title { font-size: 20px; font-weight: 800; margin-bottom: 6px; z-index: 1; }
.swiper-slide .s-sub { font-size: 13px; opacity: .85; margin-bottom: 12px; z-index: 1; }
.swiper-slide .s-btn {
  background: #fff; color: #8b5a2b; padding: 6px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 600; z-index: 1;
}
.swiper-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.swiper-dots span { width: 16px; height: 4px; border-radius: 4px; background: #d1d5db; transition: all .3s; }
.swiper-dots span.active { width: 24px; background: var(--primary); }

/* ============ 分类宫格 ============ */
.cat-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
  padding: 18px 16px; background: #fff; margin: 12px 16px 0; border-radius: var(--radius);
}
.cat-item { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.cat-icon {
  width: 46px; height: 46px; border-radius: 14px; display: flex;
  align-items: center; justify-content: center; font-size: 22px; color: #fff;
}
.cat-name { font-size: 12px; color: var(--text-2); }

/* ============ 区块标题 ============ */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 16px 12px;
}
.section-head .s-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-head .s-title::before { content: ""; width: 4px; height: 16px; background: var(--grad); border-radius: 2px; }
.section-head .more { font-size: 13px; color: var(--text-3); }

/* ============ 商品卡片 ============ */
.product-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 0 16px;
}
.product-card {
  background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  cursor: pointer; transition: transform .15s ease;
}
.product-card:active { transform: scale(.98); }
.product-img {
  height: 150px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f1e8d8 0%, #e6d9c2 100%);
  font-size: 40px; color: #c8b28a; font-weight: 700;
}
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-info { padding: 12px; }
.product-name { font-size: 14px; font-weight: 600; line-height: 1.4; height: 40px; overflow: hidden; }
.product-price-row { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.product-price { color: var(--price); font-size: 18px; font-weight: 800; }
.product-price::before { content: "¥"; font-size: 12px; }
.product-original { color: var(--text-3); font-size: 12px; text-decoration: line-through; }
.product-sales { color: var(--text-3); font-size: 12px; margin-top: 4px; }

/* ============ 空状态 ============ */
.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty .big { font-size: 48px; margin-bottom: 12px; }
.empty a { color: var(--primary); }

/* ============ 底部导航 ============ */
.tabbar {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  width: calc(100% - 28px); max-width: 452px; background: #fff;
  border-radius: 999px; box-shadow: 0 8px 26px rgba(122, 78, 45, .16), 0 2px 8px rgba(122, 78, 45, .06);
  display: flex; z-index: 50; padding: 6px;
}
@media (min-width: 768px) { .tabbar { max-width: 692px; } }
.tab-indicator {
  position: absolute; top: 6px; bottom: 6px; left: 0; width: 0;
  background: #f6ecdb; border-radius: 999px; z-index: 0;
  transition: transform .3s cubic-bezier(.42, 0, .58, 1), width .3s cubic-bezier(.42, 0, .58, 1);
  will-change: transform, width;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-3); font-size: 11px; cursor: pointer; position: relative; z-index: 1;
  padding: 6px 0; border-radius: 999px; transition: color .2s ease;
}
.tab .tab-icon { font-size: 20px; line-height: 1; }
.tab.active { color: var(--primary); font-weight: 600; }
.tab .badge {
  position: absolute; top: -2px; right: calc(50% - 24px); background: var(--danger); color: #fff;
  font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; padding: 0 4px; z-index: 2;
}

/* ============ 商品详情 ============ */
.detail-img { height: 280px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#f1e8d8,#e6d9c2); font-size: 80px; color: #c8b28a; }
.detail-img img { width: 100%; height: 100%; object-fit: cover; }
.detail-body { background: #fff; margin: -16px 12px 12px; border-radius: var(--radius); padding: 18px; position: relative; box-shadow: var(--shadow); }
.detail-price { color: var(--price); font-size: 26px; font-weight: 800; }
.detail-price::before { content: "¥"; font-size: 15px; }
.detail-name { font-size: 18px; font-weight: 700; margin: 8px 0; }
.detail-meta { display: flex; gap: 16px; color: var(--text-3); font-size: 13px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.detail-desc { margin-top: 14px; font-size: 14px; color: var(--text-2); white-space: pre-wrap; }
.detail-footer {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: #fff; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; z-index: 50;
}
@media (min-width: 768px) { .detail-footer { max-width: 720px; } }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: none;
  transition: transform .12s ease, opacity .12s ease, box-shadow .12s ease;
  will-change: transform;
}
.btn:active { opacity: .88; transform: scale(.94); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(169, 113, 66, .35); }
.btn-primary:active { box-shadow: 0 2px 6px rgba(169, 113, 66, .25); transform: scale(.95) translateY(1px); }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-gold { background: linear-gradient(135deg,#b8860b,#d4a017); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-danger { background: #fef2f2; color: var(--danger); }
.btn-ghost { background: transparent; color: var(--text-2); }

/* ============ 表单 ============ */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit; color: var(--text); outline: none; background: #fff;
}
.field input:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(169, 113, 66, .16); }
.field textarea { resize: vertical; }
.alert { padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 12px; }
.alert-error { background: #fef2f2; color: #b91c1c; }
.alert-success { background: #ecfdf5; color: #059669; }

/* ============ 购物车 ============ */
.cart-item {
  display: flex; align-items: center; gap: 12px; background: #fff;
  padding: 12px; border-radius: var(--radius); margin-bottom: 10px; box-shadow: var(--shadow);
}
.cart-img { width: 70px; height: 70px; border-radius: 10px; background: linear-gradient(135deg,#f1e8d8,#e6d9c2); display: flex; align-items: center; justify-content: center; font-size: 26px; color: #c8b28a; flex-shrink: 0; overflow: hidden; }
.cart-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-info { flex: 1; min-width: 0; }
.cart-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-price { color: var(--price); font-weight: 700; margin-top: 4px; }
.cart-qty { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.cart-qty button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 14px; }
.cart-qty span { min-width: 24px; text-align: center; font-size: 14px; }

/* ============ 结算条 ============ */
.settle-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: #fff; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; z-index: 50;
}
@media (min-width: 768px) { .settle-bar { max-width: 720px; } }
.settle-total { font-size: 14px; color: var(--text-2); }
.settle-total b { color: var(--price); font-size: 20px; }

/* ============ 订单列表 ============ */
.order-card { background: #fff; border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.order-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.order-no { font-family: monospace; }
.order-status { font-weight: 600; }
.order-status.pending { color: #d97706; }
.order-status.processing { color: var(--primary); }
.order-status.shipped { color: #0891b2; }
.order-status.completed { color: #059669; }
.order-status.cancelled { color: var(--text-3); }
.order-items { display: flex; flex-direction: column; gap: 8px; }
.order-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.order-item .oi-img { width: 44px; height: 44px; border-radius: 8px; background: linear-gradient(135deg,#f1e8d8,#e6d9c2); display: flex; align-items: center; justify-content: center; color: #c8b28a; flex-shrink: 0; overflow: hidden; }
.order-item .oi-img img { width: 100%; height: 100%; object-fit: cover; }
.order-item .oi-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-item .oi-price { color: var(--text-2); }
.order-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.order-total { font-size: 13px; color: var(--text-2); }
.order-total b { color: var(--price); font-size: 16px; }

/* ============ 我的 / 登录 ============ */
.profile-card { background: #fff; margin: 12px 16px; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.profile-user { display: flex; align-items: center; gap: 14px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; overflow: hidden; flex-shrink: 0; }
.avatar-img { padding: 0; }
.avatar-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pu-info { flex: 1; min-width: 0; }
.pu-name { font-size: 17px; font-weight: 700; }
.pu-sub { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.role-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.role-admin { background: linear-gradient(135deg, #8b5a2b 0%, #c08a5a 100%); color: #fff; }
.role-user { background: #efe6d6; color: #8a7a68; }
.edit-btn { background: #f3ecdf; border: none; border-radius: 999px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer; flex-shrink: 0; transition: transform .12s ease, background .12s ease; -webkit-tap-highlight-color: transparent; }
.edit-btn:active { transform: scale(.9); background: #ead9c0; }
.menu-list { background: #fff; margin: 12px 16px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.menu-item { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--border); font-size: 14px; cursor: pointer; }
.menu-item:last-child { border-bottom: none; }
.menu-item .mi-left { display: flex; align-items: center; gap: 10px; }
.menu-item .arrow { color: var(--text-3); }

.tabs { display: flex; background: #fff; border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.tabs .tab-item { flex: 1; text-align: center; padding: 12px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.tabs .tab-item.active { color: var(--primary); font-weight: 600; border-bottom: 2px solid var(--primary); }

.notice-item { background: #fff; margin: 0 16px 10px; border-radius: 12px; padding: 14px; box-shadow: var(--shadow); }
.notice-item .n-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.notice-item .n-content { font-size: 13px; color: var(--text-2); white-space: pre-wrap; }
.notice-item .n-time { font-size: 12px; color: var(--text-3); margin-top: 8px; }

/* ============ 注册 / 登录页 ============ */
.register-body { background: var(--bg); min-height: 100vh; }
.register-wrap { max-width: 420px; margin: 0 auto; padding: 60px 24px 48px; }
.register-brand { text-align: center; margin-bottom: 36px; }
.register-logo {
  display: inline-flex; width: 72px; height: 72px; border-radius: 22px;
  background: rgba(255, 255, 255, .5);
  border: 1px solid rgba(255, 255, 255, .65);
  box-shadow: 0 10px 28px rgba(122, 78, 45, .2);
  align-items: center; justify-content: center;
  font-size: 34px; margin-bottom: 18px;
}
.register-logo img { width: 52px; height: 52px; display: block; }
.register-brand h1 { font-size: 26px; font-weight: 800; margin-bottom: 8px; color: #8b5a2b; }
.register-brand p { font-size: 14px; color: #a8967e; }
.register-card {
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 24px; padding: 32px 28px 18px;
  box-shadow: 0 16px 40px rgba(122, 78, 45, .16);
}
.register-card .tabs { display: flex; gap: 16px; margin-bottom: 28px; position: relative; }
.register-card .tabs .tab-item {
  flex: 1; text-align: center; padding: 14px 0; font-size: 16px; font-weight: 600;
  color: var(--text-2); cursor: pointer;
}
.register-card .tabs .tab-item.active { color: #8b5a2b; }
.register-card .tabs .tab-indicator {
  position: absolute; bottom: 0; left: 0; width: calc(50% - 8px); height: 3px;
  background: #8b5a2b; border-radius: 3px;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}
.register-card .tabs .tab-indicator.right { transform: translateX(calc(100% + 16px)); }
.register-card .form-panels { position: relative; overflow: hidden; transition: height .32s cubic-bezier(.25, .8, .25, 1); }
.register-card .tab-panel {
  position: absolute; top: 0; left: 0; right: 0;
  opacity: 0; visibility: hidden;
}
.register-card .tab-panel.active { position: relative; opacity: 1; visibility: visible; }
.register-card .field { margin-bottom: 18px; }
.register-card .field label { margin-bottom: 8px; }
.register-card .field input {
  padding: 13px 14px; font-size: 15px;
  background: rgba(255, 255, 255, .7);
  border: 1px solid rgba(255, 255, 255, .6); border-radius: 14px;
}
.register-card .field input:focus { background: rgba(255, 255, 255, .7); border-color: rgba(255, 255, 255, .6); box-shadow: none; }
.register-card .field .pwd-wrap { position: relative; }
.register-card .field .pwd-wrap input { padding-right: 44px; }
.register-card .field .pwd-eye {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  cursor: pointer; font-size: 18px; line-height: 1; color: var(--text-3);
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.register-card .field .pwd-eye svg { display: block; }
.register-card .captcha-row { position: relative; }
.register-card .captcha-row input { width: 100%; padding-right: 142px; }
.register-card .captcha-img {
  position: absolute; right: 0; top: 0; height: 100%;
  width: 130px; border-radius: 12px; cursor: pointer;
  background: #ffffff; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.register-action { margin-top: 22px; }
.register-action .btn-block { padding: 15px 20px; font-size: 16px; border-radius: 999px; box-shadow: 0 10px 24px rgba(122, 78, 45, .38); }
.register-action .reg-tip { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-3); }
.register-action .reg-tip a { color: #8b5a2b; }

/* ============ 触感按压 ============ */
.register-logo { transition: transform .18s ease; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.register-logo:active { transform: scale(.93); }
.icon-btn { transition: transform .12s ease; }
.icon-btn:active { transform: scale(.85); }
.tab { transition: transform .12s ease; }
.tab:active { transform: scale(.9); }
.tab .tab-icon { transition: transform .12s ease; }
.tab:active .tab-icon { transform: scale(1.15); }
.cat-item { transition: transform .12s ease; }
.cat-item:active { transform: scale(.92); }
.menu-item { transition: background .12s ease; }
.menu-item:active { background: #f0e6d6; }
.cart-qty button { transition: transform .1s ease, background .1s ease; }
.cart-qty button:active { transform: scale(.86); background: #ead9c0; }
.tabs .tab-item { transition: opacity .12s ease; }
.tabs .tab-item:active { opacity: .55; }

/* ============ 编辑资料弹窗 ============ */
.modal-mask { display: none; position: fixed; inset: 0; background: rgba(62, 47, 36, .5); z-index: 100; align-items: center; justify-content: center; padding: 24px; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 420px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .2); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; color: var(--text-2); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.avatar-picker { display: flex; align-items: center; gap: 16px; }
.ap-current { width: 72px; height: 72px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 700; overflow: hidden; flex-shrink: 0; }
.ap-current img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ap-side { flex: 1; }
.ap-upload { display: inline-flex; align-items: center; gap: 6px; background: var(--grad); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ap-upload:active { transform: scale(.95); }
.ap-tip { font-size: 12px; color: var(--text-3); margin-top: 8px; }
.ap-presets-title { font-size: 13px; color: var(--text-2); margin: 18px 0 10px; }
.ap-presets { display: flex; gap: 10px; flex-wrap: wrap; }
.ap-preset { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; cursor: pointer; transition: transform .12s ease; -webkit-tap-highlight-color: transparent; }
.ap-preset:active { transform: scale(.85); }

/* ============ SPA Tab 面板切换 ============ */
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab { -webkit-tap-highlight-color: transparent; }
.tab .tab-icon { pointer-events: none; }
