/* 一物一码溯源动销营销系统 · 手机端 H5 样式
 * 移动端优先：卡片、列表、底部 tabbar、顶部导航、扫码结果页
 */

:root {
  --primary: #2f6bff;
  --primary-dark: #1f52d0;
  --orange: #ff6a1f;
  --green: #12a150;
  --red: #e03e3e;
  --bg: #f2f3f5;
  --card: #ffffff;
  --text: #26292e;
  --text-2: #8a8f99;
  --text-3: #b0b4bd;
  --line: #eef0f4;
  --radius: 14px;
  --navbar-h: 46px;
  --tabbar-h: 56px;
}

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

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

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

#app, .h5-root { min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
p { margin: 0; }

/* ---------------- 页面容器 ---------------- */
.page {
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}
.page--flush { padding-bottom: calc(env(safe-area-inset-bottom) + 8px); }
/* 内嵌复用时（如扫码页内嵌结果）取消整页高度 */
.page--inline { min-height: 0; }
/* 固定导航占位：内容从导航下方开始 */
.page-body { padding: calc(var(--navbar-h) + env(safe-area-inset-top) + 12px) 0 0; }

/* ---------------- 顶部导航 ---------------- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: calc(var(--navbar-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.navbar-inner {
  flex: 1;
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  padding: 0 12px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}
.navbar-title {
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.navbar-side {
  width: 58px;
  display: flex;
  align-items: center;
  font-size: 14px;
  color: var(--text-2);
}
.navbar-side.left { justify-content: flex-start; }
.navbar-side.right { justify-content: flex-end; }
.navbar-back { display: inline-flex; align-items: center; gap: 2px; color: var(--text); }
.navbar-spacer { padding-top: calc(var(--navbar-h) + env(safe-area-inset-top)); }

/* ---------------- 底部 tabbar ---------------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  display: flex;
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(8px);
}
.tabbar-item {
  flex: 1;
  height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: var(--text-2);
  font-size: 11px;
  cursor: pointer;
}
.tabbar-item .tabbar-icon { font-size: 19px; line-height: 1; }
.tabbar-item.active { color: var(--primary); font-weight: 600; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  margin: 12px 12px 0;
  padding: 14px;
  box-shadow: 0 2px 10px rgba(20, 40, 80, 0.05);
}
.card--flat { box-shadow: none; border: 1px solid var(--line); }
.card--pad0 { padding: 0; overflow: hidden; }

.sec-title {
  font-size: 13px;
  color: var(--text-2);
  margin: 0 0 10px;
  font-weight: 600;
}
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 14px 0;
}
.sec-head .t { font-size: 15px; font-weight: 600; }
.sec-head .m { font-size: 12px; color: var(--text-2); }

/* ---------------- 行列表 ---------------- */
.rows .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}
.rows .row:last-child { border-bottom: 0; }
.rows .k { color: var(--text-2); flex: 0 0 auto; }
.rows .v { text-align: right; color: var(--text); word-break: break-all; }

/* ---------------- 通用列表项 ---------------- */
.list-item {
  display: flex;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.list-item:last-child { border-bottom: 0; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 15px; font-weight: 600; }
.list-sub { font-size: 12px; color: var(--text-2); margin-top: 3px; word-break: break-all; }
.list-right { text-align: right; flex: 0 0 auto; }

/* ---------------- 标签 / 徽标 ---------------- */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  line-height: 1.7;
  background: #eef3ff;
  color: var(--primary);
}
.tag.gray { background: #f0f1f3; color: var(--text-2); }
.tag.green { background: #e8f8ee; color: var(--green); }
.tag.red { background: #fdecec; color: var(--red); }
.tag.orange { background: #fff2e8; color: var(--orange); }
.tag.solid { background: var(--primary); color: #fff; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge.ok { background: #e8f8ee; color: var(--green); }
.badge.bad { background: #fdecec; color: var(--red); }
.badge.mid { background: #eef3ff; color: var(--primary); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 13px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #2f6bff, #5a97ff);
  text-align: center;
  cursor: pointer;
  font-family: inherit;
}
.btn.orange { background: linear-gradient(135deg, #ff7a36, #ff5a1f); }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.plain { background: #f0f1f3; color: var(--text); }
.btn:disabled { opacity: 0.55; }
.btn-sm { width: auto; display: inline-block; padding: 6px 14px; font-size: 13px; border-radius: 20px; }

/* ---------------- 统计卡片 ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 12px 12px 0;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 2px 10px rgba(20, 40, 80, 0.05);
}
.stat-card .num { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-card .num small { font-size: 12px; font-weight: 500; color: var(--text-2); margin-left: 2px; }
.stat-card .label { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ---------------- 宫格入口 ---------------- */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 12px 12px 0;
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 6px;
  box-shadow: 0 2px 10px rgba(20, 40, 80, 0.05);
}
.grid-4 .grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  cursor: pointer;
}
.grid-4 .grid-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  background: #eef3ff;
}
.grid-4 .grid-label { font-size: 12px; color: var(--text); }

/* ---------------- 店铺头部卡片 ---------------- */
.shop-card {
  margin: 12px;
  border-radius: var(--radius);
  padding: 18px 16px;
  color: #fff;
  background: linear-gradient(135deg, #2f6bff, #5a97ff);
  box-shadow: 0 6px 18px rgba(47, 107, 255, 0.28);
}
.shop-card .shop-name { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.shop-card .shop-sub { font-size: 12px; opacity: 0.9; margin-top: 4px; }
.shop-card .shop-nums { display: flex; gap: 28px; margin-top: 16px; }
.shop-card .shop-nums .n { font-size: 20px; font-weight: 700; }
.shop-card .shop-nums .l { font-size: 12px; opacity: 0.9; }

/* ---------------- 扫码结果 ---------------- */
.scan-hero {
  background: linear-gradient(135deg, #2f6bff, #5a97ff);
  color: #fff;
  padding: 22px 16px 26px;
  border-radius: 0 0 20px 20px;
}
.scan-hero h1 { margin: 0; font-size: 19px; font-weight: 600; }
.scan-hero .code { margin-top: 8px; font-size: 12px; opacity: 0.9; word-break: break-all; }

.warn-bar {
  margin: 12px 12px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fdecec;
  color: #c92a2a;
  border: 1px solid #ffd3d3;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.warn-bar.info { background: #eef3ff; color: var(--primary-dark); border-color: #d9e3ff; }

.prod { display: flex; gap: 12px; align-items: center; }
.prod img {
  width: 72px; height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: #f0f1f3;
  flex: 0 0 auto;
}
.prod .info { flex: 1; min-width: 0; }
.prod .name { font-size: 16px; font-weight: 600; }
.prod .meta { color: var(--text-2); font-size: 12px; margin-top: 3px; }

.timeline { margin: 0; padding: 0 0 0 18px; list-style: none; position: relative; }
.timeline:before {
  content: "";
  position: absolute; left: 5px; top: 6px; bottom: 6px;
  width: 2px; background: #e6e9f0;
}
.timeline li { position: relative; padding: 0 0 16px 6px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:before {
  content: "";
  position: absolute; left: -18px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff;
  box-shadow: 0 0 0 2px #d9e3ff;
}
.timeline .t { font-weight: 600; }
.timeline .c { color: var(--text-2); font-size: 12px; margin-top: 2px; white-space: pre-wrap; }
.timeline .m { color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* 中奖卡片与动画 */
.prize-card {
  margin: 12px;
  padding: 18px 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff4e6, #ffe6cc);
  border: 1px solid #ffd8a8;
  text-align: center;
  animation: prize-pop 0.5s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}
.prize-card .p-icon { font-size: 40px; }
.prize-card .p-name { font-size: 19px; font-weight: 700; color: #d9480f; margin-top: 6px; }
.prize-card .p-msg { font-size: 13px; color: #a15c1a; margin-top: 6px; }
@keyframes prize-pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------------- 表单 ---------------- */
.form-card { margin: 12px; background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 10px rgba(20, 40, 80, 0.05); }
.form-item { margin-bottom: 14px; }
.form-item:last-child { margin-bottom: 0; }
.form-label { font-size: 13px; color: var(--text-2); margin-bottom: 6px; display: block; }
.form-tip { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* 分段选择（身份 / 模式） */
.segment { display: flex; gap: 8px; flex-wrap: wrap; }
.segment .seg-item {
  padding: 7px 14px;
  border-radius: 20px;
  background: #f0f1f3;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
}
.segment .seg-item.active {
  background: #eef3ff;
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

/* ---------------- 登录品牌区 ---------------- */
.login-hero {
  padding: 48px 24px 8px;
  text-align: center;
}
.login-hero .logo {
  width: 66px; height: 66px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, #2f6bff, #5a97ff);
  color: #fff;
  font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(47, 107, 255, 0.3);
}
.login-hero h1 { font-size: 19px; margin: 0 0 6px; }
.login-hero .slogan { color: var(--text-2); font-size: 13px; }
.login-foot { text-align: center; padding: 4px 24px 26px; color: var(--text-2); font-size: 13px; }
.login-foot .demo {
  margin-top: 16px;
  background: #fff8e6;
  color: #a15c1a;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.7;
  text-align: left;
}

/* ---------------- 筛选 chips ---------------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 12px 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips .chip {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 20px;
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  border: 1px solid var(--line);
  cursor: pointer;
}
.chips .chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------------- 券卡片 ---------------- */
.coupon-card {
  display: flex;
  gap: 12px;
  align-items: stretch;
  background: #fff;
  border-radius: var(--radius);
  margin: 12px 12px 0;
  padding: 14px;
  box-shadow: 0 2px 10px rgba(20, 40, 80, 0.05);
}
.coupon-card .amount {
  flex: 0 0 78px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--orange);
  border-right: 1px dashed var(--line);
  padding-right: 10px;
}
.coupon-card .amount .v { font-size: 24px; font-weight: 700; }
.coupon-card .amount .v small { font-size: 12px; font-weight: 500; }
.coupon-card .amount .s { font-size: 11px; color: var(--text-3); }
.coupon-card .ci { flex: 1; min-width: 0; }
.coupon-card .ci .n { font-size: 15px; font-weight: 600; }
.coupon-card .ci .s { font-size: 12px; color: var(--text-2); margin-top: 4px; word-break: break-all; }

/* ---------------- 底部操作条 ---------------- */
.action-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(8px);
}
.action-bar.with-tab { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: 10px; }
.action-bar .info { flex: 1; font-size: 12px; color: var(--text-2); }
.action-bar .info b { color: var(--orange); font-size: 16px; }

/* ---------------- 空状态 / 加载 ---------------- */
.empty { color: var(--text-3); text-align: center; padding: 30px 0; font-size: 13px; }
.loading { text-align: center; color: var(--text-2); padding: 22px 0; font-size: 13px; }
.more { text-align: center; color: var(--text-2); font-size: 13px; padding: 14px 0; cursor: pointer; }

/* ---------------- 工具类 ---------------- */
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mx12 { margin-left: 12px; margin-right: 12px; }
.text-2 { color: var(--text-2); }
.text-sm { font-size: 12px; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-orange { color: var(--orange); }
.bold { font-weight: 600; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- Element Plus 移动端适配 ---------------- */
.el-input__wrapper, .el-select__wrapper { border-radius: 10px; }
.el-button { border-radius: 10px; font-size: 15px; }
.el-message { min-width: 240px; }
@media (max-width: 400px) {
  .el-input__inner, .el-textarea__inner { font-size: 14px; }
  .grid-4 .grid-icon { width: 38px; height: 38px; font-size: 19px; }
}

/* ---------------- 相机扫码遮罩 ---------------- */
.scan-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 200;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.scan-video {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.scan-frame {
  position: relative;
  width: 62vw;
  height: 62vw;
  max-width: 280px;
  max-height: 280px;
  border: 3px solid #fff;
  border-radius: 16px;
  box-shadow: 0 0 0 2200px rgba(0, 0, 0, 0.5);
}
.scan-tip {
  position: relative;
  color: #fff;
  font-size: 13px;
  margin-top: 22px;
}
.scan-close {
  position: relative;
  margin-top: 22px;
  width: auto;
  padding: 10px 26px;
}
