/* ============ 智选商城 H5 · 科技感主题 ============ */
:root {
  --bg: #060914;
  --bg2: #0b1226;
  --card: rgba(255, 255, 255, 0.045);
  --card-strong: rgba(255, 255, 255, 0.07);
  --line: rgba(0, 240, 255, 0.18);
  --line-soft: rgba(255, 255, 255, 0.08);
  --cyan: #00f0ff;
  --purple: #a855f7;
  --pink: #ff4ecd;
  --text: #eaf1ff;
  --muted: #8a98c0;
  --up: #ff5a5f;   /* 涨/红（中国习惯：价格上涨用红） */
  --down: #2bd97a; /* 降/绿 */
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(168, 85, 247, 0.18), transparent 60%),
    radial-gradient(1000px 500px at -10% 10%, rgba(0, 240, 255, 0.14), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 顶部滚动光带 */
body::before {
  content: "";
  position: fixed; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(0,240,255,0.05) 50%, transparent 70%);
  background-size: 300% 100%;
  animation: sweep 9s linear infinite;
  pointer-events: none; z-index: 0;
}
@keyframes sweep { 0%{background-position:120% 0} 100%{background-position:-120% 0} }

.app { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; padding-bottom: calc(74px + var(--safe-b)); }

/* ---------- 头部 ---------- */
.header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 12px;
  background: linear-gradient(180deg, rgba(6,9,20,0.92), rgba(6,9,20,0.55));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header .logo {
  width: 38px; height: 38px; border-radius: 11px;
  object-fit: contain;
  background: rgba(0,240,255,0.08);
  padding: 4px;
  box-shadow: 0 0 18px rgba(0,240,255,0.35), inset 0 0 12px rgba(0,240,255,0.2);
}
.header .brand { display: flex; flex-direction: column; line-height: 1.15; }
.header .brand .name {
  font-size: 18px; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.header .brand .slogan { font-size: 10px; color: var(--muted); letter-spacing: .5px; }
.header .spacer { flex: 1; }
.header .cart-btn {
  position: relative; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center; cursor: pointer;
  transition: .25s;
}
.header .cart-btn:hover { box-shadow: 0 0 16px rgba(0,240,255,0.4); }
.header .cart-btn .badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; background: var(--pink); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 0 10px rgba(255,78,205,0.6);
}

/* ---------- 幻灯片 ---------- */
.slider { position: relative; margin: 14px 14px 6px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.slider .track { display: flex; transition: transform .55s cubic-bezier(.22,.61,.36,1); }
.slider .slide { min-width: 100%; position: relative; }
.slider .slide img { width: 100%; height: 170px; object-fit: cover; display: block; }
.slider .slide .cap {
  position: absolute; left: 0; bottom: 0; right: 0; padding: 26px 16px 12px;
  font-weight: 700; font-size: 15px; letter-spacing: .5px;
  background: linear-gradient(180deg, transparent, rgba(4,6,16,0.85));
}
.slider .dots { position: absolute; bottom: 8px; right: 12px; display: flex; gap: 6px; z-index: 2; }
.slider .dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.35); transition: .3s; }
.slider .dots span.on { width: 18px; border-radius: 4px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }

/* ---------- 区块标题 ---------- */
.section { padding: 14px 16px 4px; }
.section .title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; }
.section .title .bar { width: 4px; height: 16px; border-radius: 3px; background: linear-gradient(var(--cyan), var(--purple)); box-shadow: 0 0 10px var(--cyan); }
.section .title small { font-weight: 500; color: var(--muted); font-size: 11px; }

/* ---------- 商品网格 ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 10px 14px 16px; }
.card {
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius);
  overflow: hidden; position: relative; cursor: pointer;
  transition: transform .25s, box-shadow .25s, border-color .25s;
  animation: fadeUp .5s both;
}
.card:hover { transform: translateY(-4px); border-color: var(--line); box-shadow: 0 12px 30px rgba(0,240,255,0.12); }
.card .thumb { position: relative; aspect-ratio: 1/1; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover .thumb img { transform: scale(1.06); }
.card .badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 3px 8px; border-radius: 8px; font-size: 11px; font-weight: 700;
  background: linear-gradient(90deg, var(--pink), var(--purple)); color: #fff;
  box-shadow: 0 0 12px rgba(255,78,205,0.5);
}
.card .body { padding: 10px 11px 12px; }
.card .nm { font-size: 13.5px; font-weight: 700; line-height: 1.35; height: 2.7em; overflow: hidden; }
.card .cat { font-size: 10px; color: var(--muted); margin: 4px 0 6px; }
.card .price-row { display: flex; align-items: baseline; gap: 6px; }
.card .price { color: var(--cyan); font-weight: 800; font-size: 17px; }
.card .price .cur { font-size: 11px; }
.card .ori { color: var(--muted); font-size: 11px; text-decoration: line-through; }
.card .add {
  position: absolute; right: 10px; bottom: 10px; width: 34px; height: 34px; border-radius: 10px;
  border: none; cursor: pointer; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--purple)); color: #04121a; font-size: 20px; font-weight: 800;
  box-shadow: 0 0 16px rgba(0,240,255,0.45); transition: .2s;
}
.card .add:active { transform: scale(.88); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 40;
  width: 100%; max-width: 520px;
  display: flex; padding: 8px 6px calc(8px + var(--safe-b));
  background: rgba(6,9,20,0.92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted); font-size: 11px; cursor: pointer; transition: .2s; }
.tabbar .tab svg { width: 22px; height: 22px; }
.tabbar .tab.on { color: var(--cyan); filter: drop-shadow(0 0 6px var(--cyan)); }

/* ---------- 视图切换 ---------- */
.view { display: none; animation: fadeUp .35s both; }
.view.active { display: block; }

/* ---------- 商品详情弹层 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(2,4,10,0.7); backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center;
}
.overlay.show { display: flex; animation: fade .25s both; }
.sheet {
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  background: linear-gradient(180deg, #0c1430, #070b18);
  border-top-left-radius: 22px; border-top-right-radius: 22px;
  border: 1px solid var(--line); padding: 16px 16px 26px; animation: slideUp .35s both;
}
.sheet .close { position: absolute; top: 14px; right: 16px; font-size: 22px; color: var(--muted); cursor: pointer; }
.sheet .hero { width: 100%; height: auto; max-height: 70vh; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); display: block; }
.sheet .nm { font-size: 18px; font-weight: 800; margin: 12px 0 4px; }
.sheet .desc { font-size: 13px; color: var(--muted); line-height: 1.7; word-break: break-word; }
/* 商品图文描述内的富文本排版 */
.sheet .desc img { width: 100%; max-width: 100%; height: auto; border-radius: 10px; margin: 8px 0; display: block; }
.sheet .desc h3 { font-size: 15px; margin: 12px 0 6px; color: var(--text); }
.sheet .desc a { color: var(--cyan); text-decoration: underline; }
.sheet .desc ul, .sheet .desc ol { padding-left: 20px; margin: 8px 0; }
.sheet .desc li { margin: 4px 0; }
.sheet .priceline { display: flex; align-items: baseline; gap: 10px; margin: 12px 0; }
.sheet .price { color: var(--cyan); font-size: 26px; font-weight: 800; }
.sheet .ori { color: var(--muted); text-decoration: line-through; }
.sheet .disc { background: rgba(255,78,205,0.15); color: var(--pink); padding: 3px 9px; border-radius: 8px; font-size: 12px; font-weight: 700; }
.qty { display: flex; align-items: center; gap: 14px; margin: 16px 0; }
.qty button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 20px; cursor: pointer; }
.qty .num { font-size: 18px; font-weight: 700; min-width: 28px; text-align: center; }

/* ---------- 购物车 ---------- */
.cart-list { padding: 10px 14px; }
.cart-item { display: flex; gap: 12px; padding: 12px; background: var(--card); border: 1px solid var(--line-soft); border-radius: 14px; margin-bottom: 10px; animation: fadeUp .3s both; }
.cart-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
.cart-item .info { flex: 1; }
.cart-item .info .nm { font-size: 14px; font-weight: 700; }
.cart-item .info .pr { color: var(--cyan); font-weight: 800; margin-top: 6px; }
.cart-item .stepper { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.cart-item .stepper button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
.cart-item .del { color: var(--muted); font-size: 12px; cursor: pointer; align-self: flex-start; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.empty .big { font-size: 46px; }

/* ---------- 结算 / 表单 ---------- */
.form { padding: 12px 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-soft);
  background: var(--card); color: var(--text); font-size: 14px; outline: none; transition: .2s;
}
.field input:focus, .field textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,240,255,0.12); }
.summary { background: var(--card); border: 1px solid var(--line-soft); border-radius: 14px; padding: 14px; margin: 10px 16px; }
.summary .line { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; color: var(--muted); }
.summary .total { display: flex; justify-content: space-between; font-size: 16px; font-weight: 800; color: var(--text); border-top: 1px dashed var(--line-soft); padding-top: 10px; }
.summary .total b { color: var(--cyan); font-size: 22px; }

/* ---------- 按钮 ---------- */
.btn {
  display: block; width: calc(100% - 32px); margin: 12px 16px; padding: 14px;
  border: none; border-radius: 14px; cursor: pointer; font-size: 15px; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(135deg, var(--cyan), var(--purple)); color: #04121a;
  box-shadow: 0 8px 26px rgba(0,240,255,0.35); transition: .2s; position: relative; overflow: hidden;
}
.btn:active { transform: scale(.98); }
.btn::after { content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent); animation: shine 2.4s infinite; }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
@keyframes shine { 0%{left:-120%} 60%,100%{left:140%} }

/* ---------- 订单 ---------- */
.order-card { background: var(--card); border: 1px solid var(--line-soft); border-radius: 14px; padding: 14px; margin: 10px 14px; animation: fadeUp .3s both; }
.order-card .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.order-card .oid { font-size: 12px; color: var(--muted); }
.chip { padding: 3px 10px; border-radius: 9px; font-size: 12px; font-weight: 700; }
.order-card .prod { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px dashed var(--line-soft); }
.order-card .prod img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.order-card .prod .nm { font-size: 13px; }
.order-card .prod .q { color: var(--muted); font-size: 12px; }
.order-card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.order-card .amt { color: var(--cyan); font-weight: 800; font-size: 16px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 99;
  background: rgba(8,12,26,0.95); border: 1px solid var(--line); color: var(--text);
  padding: 11px 18px; border-radius: 12px; font-size: 13px; box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none; transition: .3s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(6px); }

/* ---------- 动画 ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(0,240,255,0.25); border-radius: 3px; }
