/* XXJ 移动端公共样式 - 仿 uniapp H5 风格 */
:root {
  --primary: #ff2c3c;
  --primary-dark: #e01f2e;
  --bg: #f5f6f7;
  --card: #ffffff;
  --text: #333333;
  --text2: #909399;
  --border: #e5e5e5;
  --gold: #f29100;
  --success: #18b566;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
img { display: block; }
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: inherit; font-size: 14px; outline: none; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* ---------- 顶部导航 ---------- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; height: 44px; padding: 0 12px;
  background: #fff; border-bottom: 1px solid var(--border);
}
.navbar .nav-back { font-size: 22px; padding: 0 6px; color: #666; }
.navbar .nav-title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; }
.navbar .nav-right { min-width: 44px; text-align: right; font-size: 13px; color: var(--primary); }

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  height: 52px; background: #fff; border-top: 1px solid var(--border);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .tb-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #999; font-size: 10px; gap: 2px;
}
.tabbar .tb-item.active { color: var(--primary); }
.tabbar .tb-item .tb-icon { font-size: 20px; line-height: 1; }
.page-with-tab { padding-bottom: 70px; }

/* ---------- 页面容器 ---------- */
.page { min-height: 100vh; padding-bottom: 20px; }
.card { background: var(--card); border-radius: 8px; margin: 10px 12px; padding: 12px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---------- 登录页 ---------- */
.login-page { background: #fff; }
.login-wrap { padding: 60px 28px 30px; }
.login-logo { display: flex; justify-content: center; margin: 10px 0 8px; }
.login-logo img { width: 120px; height: 120px; border-radius: 16px; object-fit: cover; }
.logo-text { font-size: 26px; font-weight: 800; color: var(--primary); }
.login-title { text-align: center; font-size: 20px; font-weight: 700; margin: 6px 0 28px; }
.login-err { background: #fef0f0; color: #dd6161; border-radius: 6px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px; }
.login-form .form-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 24px; padding: 10px 16px; margin-bottom: 14px; background: #fff;
}
.form-label { color: #666; font-size: 14px; white-space: nowrap; }
.form-item input { flex: 1; border: none; background: transparent; }
.form-item input::placeholder { color: #bbb; }
.captcha-img { width: 96px; height: 34px; border-radius: 6px; }
.login-btn {
  width: 100%; border: none; border-radius: 24px; padding: 13px 0; margin-top: 8px;
  background: linear-gradient(90deg, #ff4d5a, var(--primary)); color: #fff; font-size: 16px; font-weight: 600;
}
.login-btn:active { opacity: .85; }
.login-links { margin-top: 16px; text-align: center; }
.login-links a { color: #666; font-size: 13px; }
.login-links a:first-child { color: #576b95; }

/* ---------- 首页 ---------- */
.search-bar {
  margin: 10px 12px; display: flex; align-items: center; gap: 8px;
  background: #fff; border-radius: 20px; padding: 9px 14px; color: #bbb; font-size: 13px;
}
.search-bar input { flex: 1; border: none; background: transparent; }
.banner-swiper { margin: 0 12px; border-radius: 8px; overflow: hidden; position: relative; }
.banner-swiper img { width: 100%; height: 140px; object-fit: cover; }
.swiper-dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; }
.swiper-dots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.6); transition: .2s; }
.swiper-dots i.on { width: 14px; background: #fff; }

.game-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 6px; padding: 12px 10px; }
.game-grid .gi { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.game-grid .gi img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; }
.game-grid .gi span { font-size: 12px; color: #444; }

.notice-bar {
  margin: 0 12px; background: #fff; border-radius: 8px; padding: 10px 12px;
  display: flex; align-items: center; gap: 8px; font-size: 13px;
}
.notice-bar .stock-icon { color: var(--primary); font-weight: 700; }

/* ---------- 商品卡片 ---------- */
.goods-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 10px 12px; }
.goods-card { background: #fff; border-radius: 8px; overflow: hidden; }
.goods-card img { width: 100%; height: 150px; object-fit: cover; }
.goods-card .g-info { padding: 8px 10px 10px; }
.goods-card .g-name { font-size: 13px; height: 36px; line-height: 18px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.goods-card .g-bottom { display: flex; align-items: baseline; justify-content: space-between; margin-top: 6px; }
.g-price { color: var(--primary); font-weight: 700; font-size: 15px; }
.g-price small { font-size: 11px; }
.g-sales { color: var(--text2); font-size: 11px; }
.section-title { display: flex; align-items: center; gap: 6px; margin: 14px 12px 4px; font-size: 16px; font-weight: 700; }
.section-title::before { content: ""; width: 4px; height: 15px; background: var(--primary); border-radius: 2px; }

/* ---------- 分类页 ---------- */
.cate-left {
  position: sticky; top: 0; float: left; width: 88px; height: calc(100vh - 44px);
  overflow-y: auto; background: #f7f8fa;
}
.cate-left .cate-item { padding: 14px 8px; text-align: center; font-size: 13px; color: #666; }
.cate-left .cate-item.on { background: #fff; color: var(--primary); font-weight: 700; }
.cate-right { margin-left: 88px; padding: 10px; }

/* ---------- 商品详情 ---------- */
.gd-swiper { position: relative; }
.gd-swiper img { width: 100%; height: 300px; object-fit: cover; }
.gd-info { background: #fff; padding: 14px 12px; }
.gd-info .g-price-big { color: var(--primary); font-size: 22px; font-weight: 800; }
.gd-info .g-name-big { font-size: 16px; font-weight: 600; margin: 6px 0; line-height: 22px; }
.gd-info .g-meta { color: var(--text2); font-size: 12px; }
.gd-desc { background: #fff; margin-top: 10px; padding: 12px; font-size: 13px; line-height: 1.8; white-space: pre-wrap; color: #444; }
.sku-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sku-item { border: 1px solid var(--border); border-radius: 16px; padding: 7px 14px; font-size: 13px; color: #555; }
.sku-item.on { border-color: var(--primary); color: var(--primary); background: #fff5f6; }
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; align-items: center; padding: 8px 12px; padding-bottom: calc(8px + env(safe-area-inset-bottom));
  gap: 10px;
}
.btn-primary { background: linear-gradient(90deg, #ff4d5a, var(--primary)); color: #fff; border: none; border-radius: 20px; padding: 9px 22px; font-size: 14px; }
.btn-primary:disabled { opacity: .5; }
.btn-plain { background: #fff; color: var(--primary); border: 1px solid var(--primary); border-radius: 20px; padding: 8px 18px; font-size: 14px; }
.btn-gray { background: #f0f0f0; color: #666; border: none; border-radius: 20px; padding: 8px 18px; }
.btn-block { display: block; width: 100%; padding: 12px 0; border-radius: 22px; border: none; font-size: 15px; font-weight: 600; color: #fff; background: linear-gradient(90deg,#ff4d5a,var(--primary)); }
.btn-block:disabled { opacity: .55; }

/* ---------- 订单列表 ---------- */
.order-card { background: #fff; border-radius: 8px; margin: 10px 12px; padding: 12px; }
.order-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text2); padding-bottom: 10px; border-bottom: 1px solid #f2f2f2; }
.order-status { color: var(--primary); font-weight: 600; }
.order-body { display: flex; gap: 10px; padding: 12px 0; }
.order-body img { width: 64px; height: 64px; border-radius: 6px; object-fit: cover; }
.order-body .ob-info { flex: 1; min-width: 0; }
.order-body .ob-name { font-size: 14px; line-height: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.order-body .ob-meta { color: var(--text2); font-size: 12px; margin-top: 4px; }
.order-foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.order-foot .of-price { color: var(--primary); font-weight: 700; }
.order-foot .of-actions { display: flex; gap: 8px; }
.mini-btn { border: 1px solid var(--border); border-radius: 14px; padding: 5px 12px; font-size: 12px; color: #555; background: #fff; }
.mini-btn.primary { color: var(--primary); border-color: var(--primary); }
.mini-btn.gray { color: #999; }

/* ---------- 表单 ---------- */
.form-card { background: #fff; margin: 10px 12px; border-radius: 8px; overflow: hidden; }
.form-cell { display: flex; align-items: center; padding: 13px 12px; border-bottom: 1px solid #f2f2f2; gap: 10px; }
.form-cell:last-child { border-bottom: none; }
.form-cell .fc-label { width: 86px; color: #666; flex-shrink: 0; }
.form-cell .fc-input { flex: 1; border: none; background: transparent; text-align: right; }
.form-cell .fc-input::placeholder { color: #ccc; }
.form-cell .fc-arrow { color: #ccc; }
.selector { flex: 1; text-align: right; border: none; background: transparent; color: #444; }

/* ---------- 按钮行 ---------- */
.fixed-bottom-space { height: 76px; }

/* ---------- Tag ---------- */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.tag-red { background: #fef0f0; color: #dd6161; }
.tag-green { background: #f0f9eb; color: #67c23a; }
.tag-blue { background: #ecf5ff; color: #409eff; }
.tag-orange { background: #fdf6ec; color: #e6a23c; }
.tag-gray { background: #f4f4f5; color: #909399; }

/* ---------- 钱包 ---------- */
.wallet-head { background: linear-gradient(135deg, #ff4d5a, #d81e2c); color: #fff; padding: 24px 16px 20px; }
.wallet-amount { font-size: 30px; font-weight: 800; margin-top: 6px; }
.wallet-sub { opacity: .9; font-size: 12px; margin-top: 4px; }

/* ---------- 聊天 ---------- */
.chat-box { display: flex; flex-direction: column; height: calc(100vh - 44px - 54px - env(safe-area-inset-bottom)); overflow-y: auto; padding: 12px; }
.chat-item { display: flex; margin-bottom: 12px; }
.chat-item.me { justify-content: flex-end; }
.chat-item .avatar { width: 34px; height: 34px; border-radius: 50%; background: #ddd; margin-right: 8px; }
.chat-item .bubble { max-width: 70%; padding: 9px 12px; border-radius: 10px; font-size: 14px; line-height: 20px; }
.chat-item .bubble { background: #fff; border: 1px solid var(--border); }
.chat-item.me .bubble { background: var(--primary); color: #fff; border-color: var(--primary); }
.chat-time { text-align: center; color: #bbb; font-size: 11px; margin: 8px 0; }
.chat-input {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: #fff; border-top: 1px solid var(--border); padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
.chat-input input { flex: 1; border: 1px solid var(--border); border-radius: 18px; padding: 8px 12px; }
.chat-input .send-btn { background: var(--primary); color: #fff; border: none; border-radius: 18px; padding: 8px 16px; }

/* ---------- 其他 ---------- */
.empty { text-align: center; color: #bbb; padding: 60px 0; font-size: 13px; }
.list-row { display: flex; align-items: center; gap: 10px; }
.avatar-sm { width: 40px; height: 40px; border-radius: 50%; background: #eee; color: #999; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.badge { background: var(--primary); color: #fff; border-radius: 10px; font-size: 10px; padding: 1px 6px; }

/* Toast */
#toast {
  position: fixed; top: 45%; left: 50%; transform: translate(-50%, -50%); z-index: 9999;
  background: rgba(0,0,0,.75); color: #fff; border-radius: 8px; padding: 12px 18px;
  font-size: 13px; max-width: 80%; text-align: center; display: none;
}
/* Modal */
#modal-mask {
  position: fixed; inset: 0; z-index: 9998; background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center;
}
#modal-box { background: #fff; width: 82%; max-width: 320px; border-radius: 12px; overflow: hidden; }
#modal-title { padding: 16px 16px 6px; font-size: 16px; font-weight: 600; text-align: center; }
#modal-body { padding: 10px 16px 16px; font-size: 14px; color: #666; line-height: 1.7; text-align: center; max-height: 50vh; overflow-y: auto; }
#modal-actions { display: flex; border-top: 1px solid var(--border); }
#modal-actions button { flex: 1; border: none; background: #fff; padding: 12px 0; font-size: 15px; }
#modal-actions .m-cancel { color: #999; border-right: 1px solid var(--border); }
#modal-actions .m-ok { color: var(--primary); font-weight: 600; }

/* 列表 */
.page-list { background: #fff; margin: 10px 12px; border-radius: 8px; overflow: hidden; }
.pl-row { display: flex; align-items: center; padding: 12px; border-bottom: 1px solid #f2f2f2; }
.pl-row:last-child { border-bottom: none; }
.pl-row .pl-label { color: #666; width: 90px; flex-shrink: 0; }
.pl-row .pl-value { flex: 1; text-align: right; color: #333; word-break: break-all; }

/* ---------- 首页大分类Tabs ---------- */
.main-tabs {
  position: sticky; top: 44px; z-index: 60;
  display: flex; gap: 4px; overflow-x: auto; white-space: nowrap;
  background: #fff; padding: 8px 12px; border-bottom: 1px solid #f2f2f2;
}
.main-tabs::-webkit-scrollbar { display: none; }
.mt-item {
  flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 64px; padding: 6px 4px; color: #666; font-size: 13px; border-radius: 8px;
}
.mt-item img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid transparent; }
.mt-item.on { color: var(--primary); font-weight: 700; }
.mt-item.on img { border-color: var(--primary); }

.sub-tabs {
  display: flex; gap: 8px; overflow-x: auto; white-space: nowrap;
  padding: 10px 12px 2px;
}
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tabs a { flex-shrink: 0; }
.sub-tabs .chip {
  display: inline-block; padding: 5px 14px; border-radius: 14px;
  background: #fff; color: #666; font-size: 12px; border: 1px solid var(--border);
}
.sub-tabs .chip.on { background: #fff5f6; color: var(--primary); border-color: var(--primary); }

/* ---------- 功能卡片网格(我的页) ---------- */
.func-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 6px; padding: 12px; }
.func-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 4px;
  background: #fff; border-radius: 10px; font-size: 11px; color: #555; position: relative;
}
.func-item .fi-icon { font-size: 22px; line-height: 1; }
.func-item .fi-badge {
  position: absolute; top: 4px; right: 8px; background: var(--primary); color: #fff;
  border-radius: 8px; font-size: 10px; padding: 0 5px; min-width: 16px; text-align: center;
}
.func-item:active { background: #f7f7f9; }

/* 商品卡快速购买 */
.goods-card .g-buy-btn {
  margin-top: 8px; width: 100%; text-align: center; padding: 6px 0;
  background: linear-gradient(90deg, #ff4d5a, var(--primary)); color: #fff;
  border-radius: 16px; font-size: 12px;
}

/* ---------- 下拉刷新指示器 ---------- */
#ptr {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  display: flex; justify-content: center; align-items: flex-end;
  height: 0; overflow: hidden; pointer-events: none;
  transition: height .15s;
}
#ptr .ptr-inner {
  background: rgba(0,0,0,.78); color: #fff; font-size: 12px;
  border-radius: 0 0 12px 12px; padding: 6px 22px 10px;
  opacity: 0; transition: opacity .2s;
}
#ptr.on { height: 64px; }
#ptr.on .ptr-inner { opacity: 1; }
#ptr.loading .ptr-inner::before { content: "🔄 "; }
