/* =====================================================================
 * 鸿玉灯饰 H5 全局样式 - 暖色调（米白 / 金 / 暖黄）
 * ===================================================================== */
:root {
  --bg: #faf6f0;          /* 米白背景 */
  --card: #ffffff;
  --primary: #c8902f;     /* 主金 */
  --primary-dark: #a9741d;
  --accent: #e8920c;      /* 暖黄点缀 */
  --warm-bg: #fff6e6;     /* 浅暖底 */
  --text: #3a2e22;
  --text-2: #8c7b68;
  --text-3: #bcae9d;
  --line: #f0e7d9;
  --price: #e0531f;       /* 暖橙红价格 */
  --green: #3a9d5d;
  --radius: 10px;
  --tabbar-h: 52px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
input, button, textarea { font-family: inherit; font-size: inherit; outline: none; }
button { cursor: pointer; border: none; }

#app { min-height: 100vh; padding-bottom: var(--tabbar-h); }
#app.no-tabbar { padding-bottom: 0; }

/* ---------- 通用 ---------- */
.page { padding: 10px; }
.card { background: var(--card); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.flex { display: flex; }
.flex-1 { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ellipsis2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.price { color: var(--price); font-weight: 700; }
.price .sym { font-size: 12px; }
.price .int { font-size: 18px; }
.price-origin { color: var(--text-3); text-decoration: line-through; font-size: 12px; margin-left: 6px; }

.tag { display: inline-block; font-size: 10px; color: var(--accent); border: 1px solid var(--accent); border-radius: 3px; padding: 0 4px; margin-right: 4px; line-height: 16px; }

.btn { display: inline-block; border-radius: 999px; padding: 9px 20px; font-size: 14px; text-align: center; background: var(--primary); color: #fff; }
.btn.block { display: block; width: 100%; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.gray { background: #eee; color: #666; }
.btn:active { opacity: .85; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: rgba(40,30,20,.9); color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 999; max-width: 80%; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: rgba(180,40,20,.92); }

/* ---------- 顶部导航栏 ---------- */
.navbar { position: sticky; top: 0; z-index: 50; height: 46px; background: #fff; display: flex; align-items: center; padding: 0 8px; border-bottom: 1px solid var(--line); }
.navbar .back { width: 34px; height: 46px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--text); }
.navbar .title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-right: 34px; }
.navbar.right { position: absolute; right: 10px; }

/* ---------- 底部 TabBar ---------- */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; height: var(--tabbar-h); background: #fff; border-top: 1px solid var(--line); display: flex; z-index: 60; }
.tabbar .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-2); font-size: 11px; position: relative; }
.tabbar .tab .ic { font-size: 20px; line-height: 1; margin-bottom: 3px; }
.tabbar .tab.active { color: var(--primary); }
.tabbar .badge { position: absolute; top: 2px; right: calc(50% - 18px); background: var(--price); color: #fff; font-size: 10px; min-width: 16px; height: 16px; line-height: 16px; border-radius: 8px; padding: 0 4px; }

/* ---------- 搜索栏 ---------- */
.searchbar { display: flex; align-items: center; background: #fff; border-radius: 999px; padding: 7px 12px; margin: 10px; box-shadow: 0 1px 4px rgba(180,140,80,.08); }
.searchbar input { flex: 1; border: none; background: transparent; }
.searchbar .cam { font-size: 18px; padding: 0 8px; color: var(--primary); }

/* ---------- 首页 banner ---------- */
.banner { margin: 10px; border-radius: 10px; overflow: hidden; position: relative; }
.banner .slide { width: 100%; }
.banner .slide img { width: 100%; height: 150px; object-fit: cover; }
.banner .dots { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; }
.banner .dots i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.6); margin: 0 2px; }
.banner .dots i.on { background: #fff; }

/* ---------- 宫格导航 ---------- */
.navgrid { background: #fff; border-radius: 10px; margin: 0 10px 10px; padding: 12px 6px; display: flex; flex-wrap: wrap; }
.navgrid .item { width: 20%; text-align: center; margin-bottom: 12px; }
.navgrid .item img { width: 46px; height: 46px; border-radius: 12px; margin: 0 auto 5px; object-fit: cover; background: var(--warm-bg); }
.navgrid .item span { font-size: 12px; color: var(--text); }

/* ---------- 公告 ---------- */
.notice { margin: 0 10px 10px; border-radius: 10px; padding: 8px 12px; display: flex; align-items: center; font-size: 12px; }
.notice .bell { margin-right: 6px; }

/* ---------- 优惠券模块 ---------- */
.coupon-entry { margin: 0 10px 10px; display: flex; gap: 10px; overflow-x: auto; }
.coupon-entry .cp { flex: 1; min-width: 100px; border-radius: 10px; padding: 10px; color: #fff; background: linear-gradient(135deg,#e8920c,#c8902f); position: relative; }
.coupon-entry .cp .v { font-size: 18px; font-weight: 700; }
.coupon-entry .cp .n { font-size: 11px; opacity: .9; }

/* ---------- 商品组标题 ---------- */
.group-head { display: flex; align-items: baseline; justify-content: center; margin: 16px 0 8px; }
.group-head .t { font-size: 17px; font-weight: 700; position: relative; padding: 0 16px; }
.group-head .t::before, .group-head .t::after { content: ''; position: absolute; top: 50%; width: 18px; height: 1px; background: var(--accent); }
.group-head .t::before { left: -14px; } .group-head .t::after { right: -14px; }
.group-head .s { font-size: 12px; color: var(--text-3); margin-left: 8px; }

/* ---------- 商品卡片（双列） ---------- */
.prod-grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 10px; }
.prod-card { width: calc(50% - 5px); background: #fff; border-radius: 10px; overflow: hidden; }
.prod-card .ph { width: 100%; aspect-ratio: 1; background: var(--warm-bg); }
.prod-card .ph img { width: 100%; height: 100%; object-fit: cover; }
.prod-card .bd { padding: 8px; }
.prod-card .nm { font-size: 13px; height: 36px; }
.prod-card .sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* 列表行（单列） */
.prod-row { display: flex; background: #fff; border-radius: 10px; padding: 10px; margin: 0 10px 10px; }
.prod-row .ph { width: 100px; height: 100px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--warm-bg); }
.prod-row .ph img { width: 100%; height: 100%; object-fit: cover; }
.prod-row .bd { flex: 1; margin-left: 10px; display: flex; flex-direction: column; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 50px 20px; color: var(--text-3); }
.empty .ic { font-size: 46px; margin-bottom: 10px; }

/* ---------- 商品详情 ---------- */
.detail-gallery { width: 100%; aspect-ratio: 1; background: #000; }
.detail-gallery img { width: 100%; height: 100%; object-fit: contain; }
.detail-price-bar { background: linear-gradient(135deg,#fff8ec,#fff); padding: 12px; }
.spec-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.spec-chips .chip { padding: 6px 14px; border-radius: 999px; background: var(--warm-bg); font-size: 13px; border: 1px solid transparent; }
.spec-chips .chip.on { background: #fff; border-color: var(--primary); color: var(--primary); font-weight: 600; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.qty button { width: 28px; height: 28px; background: #fafafa; font-size: 16px; }
.qty input { width: 40px; height: 28px; text-align: center; border: none; }

/* 底部操作栏 */
.actionbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: #fff; border-top: 1px solid var(--line); display: flex; align-items: center; padding: 8px 10px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 55; }
.actionbar .ai { display: flex; flex-direction: column; align-items: center; font-size: 10px; color: var(--text-2); padding: 0 10px; }
.actionbar .ai .ic { font-size: 18px; }
.actionbar .buttons { flex: 1; display: flex; gap: 10px; margin-left: 10px; }
.actionbar .buttons .btn { flex: 1; border-radius: 999px; }
.btn-cart { background: linear-gradient(135deg,#f5b041,#e8920c); color:#fff; }
.btn-buy { background: linear-gradient(135deg,#e0531f,#d1400f); color:#fff; }

/* ---------- 表单 ---------- */
.field { background: #fff; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; display: flex; align-items: center; }
.field label { width: 80px; color: var(--text-2); }
.field input, .field textarea { flex: 1; border: none; background: transparent; }
.link-btn { color: var(--primary); }

/* ---------- 订单/列表状态条 ---------- */
.status-tabs { display: flex; background: #fff; padding: 8px 0; position: sticky; top: 46px; z-index: 40; }
.status-tabs .st { flex: 1; text-align: center; font-size: 13px; color: var(--text-2); position: relative; }
.status-tabs .st.on { color: var(--primary); font-weight: 600; }
.status-tabs .st.on::after { content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); width: 18px; height: 2px; background: var(--primary); }

.order-card { background: #fff; border-radius: 10px; margin: 0 10px 10px; padding: 12px; }
.order-card .hd { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); padding-bottom: 8px; border-bottom: 1px dashed var(--line); margin-bottom: 8px; }
.order-status { color: var(--price); }

/* ---------- 个人中心 ---------- */
.profile-head { background: linear-gradient(135deg,#c8902f,#e8920c); color: #fff; padding: 24px 16px 40px; }
.profile-head .avatar { width: 60px; height: 60px; border-radius: 50%; background: #fff3; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.stat-row { display: flex; background: #fff; border-radius: 10px; margin: -26px 10px 10px; padding: 14px 0; position: relative; box-shadow: 0 2px 10px rgba(180,140,80,.12); }
.stat-row .s { flex: 1; text-align: center; }
.stat-row .s .n { font-size: 18px; font-weight: 700; }
.stat-row .s .l { font-size: 12px; color: var(--text-2); }
.menu-list { background: #fff; border-radius: 10px; margin: 0 10px 10px; overflow: hidden; }
.menu-list .mi { display: flex; align-items: center; padding: 13px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.menu-list .mi:last-child { border-bottom: none; }
.menu-list .mi .ic { margin-right: 10px; font-size: 18px; }
.menu-list .mi .arrow { margin-left: auto; color: var(--text-3); }

/* ---------- AI 聊天 ---------- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 46px); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 12px; }
.bubble { max-width: 78%; padding: 9px 12px; border-radius: 12px; margin-bottom: 12px; font-size: 14px; }
.bubble.me { background: var(--primary); color: #fff; margin-left: auto; }
.bubble.ai { background: #fff; }
.chat-input { display: flex; padding: 8px; background: #fff; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; }

/* ---------- AI 装修画布 ---------- */
.decorate-stage { position: relative; margin: 10px; background: #fff; border-radius: 10px; overflow: hidden; }
.decorate-stage canvas { display: block; width: 100%; touch-action: none; }
.lamp-tray { display: flex; gap: 8px; overflow-x: auto; padding: 8px 10px; background: #fff; margin: 0 10px 10px; border-radius: 10px; }
.lamp-tray img { width: 54px; height: 54px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; padding: 3px; }

.loading { text-align: center; color: var(--text-3); padding: 14px; font-size: 13px; }
