/* ============================================================
 * H5 点单共享样式(顶部 / 语言 / 底部 Tab)
 * 首页 index.php、分类页 category.php 等共用
 * 配色:深蓝 #1e3a5f 主色,金色 #d4af37 点缀,白底轻奢风
 * ============================================================ */

/* === 基础 === */
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
/* 顶部栏与底部 Tab 都是 fixed,上下各留 50px 避免内容被遮挡 */
body { font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif; background:#fff; color:#1a1a1a; padding-top:50px; padding-bottom:50px; }
img { display:block; }
button { font-family:inherit; }

/* === 顶部固定栏 === */
.h5-top { background:#fff; padding:7px 10px; display:flex; gap:8px; align-items:center; position:fixed; left:0; right:0; top:0; z-index:50; box-shadow:0 1px 2px rgba(0,0,0,.04); }
.search { flex:1; background:#f3f4f6; border-radius:20px; height:34px; display:flex; align-items:center; padding:0 14px; gap:6px; min-width:0; }
.search input { flex:1; border:0; background:transparent; outline:0; font-size:14px; min-width:0; }

/* === 语言下拉 === */
.lang-dropdown { position:relative; flex-shrink:0; }
.lang-current { display:flex; align-items:center; gap:4px; padding:0 10px; height:34px; border-radius:18px; background:#f3f4f6; font-size:12px; cursor:pointer; user-select:none; box-sizing:border-box; }
.lang-flag { font-size:16px; line-height:1; }
.lang-name { color:#333; font-weight:600; }
.lang-arrow { font-size:8px; color:#666; margin-top:1px; }
.lang-menu { position:absolute; top:calc(100% + 6px); right:0; background:#fff; border-radius:10px; box-shadow:0 6px 20px rgba(0,0,0,.15); padding:6px 0; display:none; z-index:100; min-width:140px; }
.lang-menu.show { display:block; }
.lang-option { padding:11px 14px; font-size:14px; display:flex; align-items:center; gap:10px; cursor:pointer; }
.lang-option:hover, .lang-option.active { background:#f5f5f7; color:#1e3a5f; font-weight:600; }

/* === 底部固定 Tab === */
.h5-tab { position:fixed; left:0; right:0; bottom:0; background:#fff; display:flex; padding-bottom:env(safe-area-inset-bottom); box-shadow:0 -2px 8px rgba(0,0,0,.05); z-index:100; }
.h5-tab a { flex:1; display:flex; flex-direction:column; align-items:center; gap:2px; padding:6px 0 4px; color:#9ca3af; text-decoration:none; font-size:11px; }
.h5-tab a.on { color:#1e3a5f; }
.h5-tab a.on .ic { color:#1e3a5f; }
.h5-tab a.on .ic svg { stroke-width:2.2; }
.h5-tab a .ic { width:26px; height:26px; color:#6b7280; }
.h5-tab a .ic svg { width:26px; height:26px; display:block; stroke-width:1.9; }
.h5-tab .badge { background:#dc2626; color:#fff; font-size:9px; min-width:14px; height:14px; border-radius:7px; display:flex; align-items:center; justify-content:center; padding:0 3px; position:relative; top:-32px; left:-8px; }

/* === 通用小工具 === */
.muted { color:#9ca3af; }
.empty { text-align:center; color:#9ca3af; padding:40px 0; font-size:13px; }

/* === 显示/隐藏(国家切换用) === */
.hide { display:none !important; }

/* ============================================================
 * 商城首页 home.php / 全部上新 new.php
 * 顶部(Logo+搜索+头像) · 轮播 · 分类入口(5×2) · 新品横滑 · 精选两列 · 下拉刷新
 * ============================================================ */

/* --- 顶部 Logo / 会员头像(_top.php 的 $topShowLogo / $topShowAvatar) --- */
.top-logo { flex-shrink:0; max-width:80px; display:flex; align-items:center; overflow:hidden; text-decoration:none; color:#1e3a5f; font-size:14px; font-weight:700; white-space:nowrap; }
.top-logo img { height:24px !important; width:auto; max-width:80px; object-fit:contain; }
.top-avatar { flex-shrink:0; width:32px; height:32px; border-radius:50%; background:#f3f4f6; border:1px solid #e5e7eb; display:flex; align-items:center; justify-content:center; font-size:16px; overflow:hidden; text-decoration:none; }
.top-avatar img { width:100%; height:100%; object-fit:cover; }

/* --- 轮播图 --- */
.mh-bn { position:relative; background:#f1f5f9; }
.mh-bn-track { display:flex; overflow-x:auto; scroll-snap-type:x mandatory; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
.mh-bn-track::-webkit-scrollbar { display:none; }
.mh-bn-item { flex:0 0 100%; scroll-snap-align:start; aspect-ratio:1280/717; min-height:140px; display:flex; align-items:center; justify-content:center; overflow:hidden; text-decoration:none; background:linear-gradient(135deg,#1e3a5f,#3b6ea5); }
.mh-bn-item > img { width:100%; height:100%; object-fit:cover; background:linear-gradient(135deg,#e2e8f0,#f8fafc); }
.mh-bn-item .ph { display:none; width:100%; color:#fff; font-size:15px; font-weight:600; padding:0 20px; text-align:center; }
.mh-bn-item.noimg .ph { display:flex; align-items:center; justify-content:center; }
.mh-bn-item.noimg img { display:none; }
/* 旧版微信 X5/WebView 不支持 aspect-ratio 时,用 padding-bottom 撑出高度 */
@supports not (aspect-ratio:1280/717) {
  .mh-bn-item { height:0; padding-bottom:55.86%; }
  .mh-bn-item > img { position:absolute; left:0; top:0; }
}
.mh-bn-dots { position:absolute; left:0; right:0; bottom:8px; display:flex; justify-content:center; gap:5px; pointer-events:none; }
.mh-bn-dots i { width:6px; height:6px; border-radius:3px; background:rgba(255,255,255,.6); transition:width .2s; }
.mh-bn-dots i.on { width:16px; background:#fff; }

/* --- 分类图标入口(一行 5 个 × 2 行) --- */
.mh-cats { display:grid; grid-template-columns:repeat(5,1fr); gap:12px 2px; padding:14px 6px 2px; }
.mh-cat { display:flex; flex-direction:column; align-items:center; gap:6px; text-decoration:none; color:#374151; min-width:0; }
.mh-cat-ic { width:46px; height:46px; border-radius:14px; background:#f3f4f6; display:flex; align-items:center; justify-content:center; overflow:hidden; font-size:20px; }
.mh-cat-ic img { width:100%; height:100%; object-fit:cover; }
.mh-cat-ic .ph { display:none; font-size:17px; font-weight:700; color:#1e3a5f; }
.mh-cat-ic.noimg .ph { display:block; }
.mh-cat-nm { font-size:12px; line-height:1.2; max-width:100%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* --- 提货券入口条 --- */
.mh-ventry { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:12px 10px 0; padding:10px 12px; border-radius:12px;
  background:linear-gradient(90deg,#fff7e6,#fffdf7); border:1px solid #f3e3c3; color:#8a6d1f; font-size:13px; text-decoration:none; }
.mh-ventry b { font-weight:600; }

/* --- 模块标题 --- */
.mh-hd { display:flex; align-items:center; justify-content:space-between; padding:16px 12px 8px; }
.mh-hd h3 { font-size:16px; font-weight:700; color:#1e3a5f; }
.mh-hd h3::before { content:''; display:inline-block; width:3px; height:14px; border-radius:2px; background:#d4af37; margin-right:6px; vertical-align:-1px; }
.mh-more { font-size:12px; color:#9ca3af; text-decoration:none; }

/* --- 新品上新:横向滑动 --- */
.mh-rail { display:flex; gap:10px; padding:0 12px 6px; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
.mh-rail::-webkit-scrollbar { display:none; }
.mh-rcard { flex:0 0 116px; background:#fff; border-radius:12px; box-shadow:0 1px 6px rgba(15,23,42,.07); overflow:hidden; text-decoration:none; color:inherit; }
.mh-rimg { position:relative; display:block; width:100%; aspect-ratio:1/1; background:#f8fafc; overflow:hidden; }
.mh-rimg img { width:100%; height:100%; object-fit:cover; }
.mh-rimg .ph { display:none; }
.mh-rimg.noimg .ph { display:flex; }
@supports not (aspect-ratio:1/1) {
  .mh-rimg { height:0; padding-bottom:100%; }
  .mh-rimg > img { position:absolute; left:0; top:0; }
}
.mh-rimg .ph, .mh-cimg .ph { width:100%; height:100%; align-items:center; justify-content:center; color:#94a3b8; font-size:22px; font-weight:700; background:linear-gradient(135deg,#eef2f7,#f8fafc); }
.mh-rnm { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; height:32px; padding:6px 8px 0; font-size:12px; line-height:1.35; }
/* 价格改两行后横滑小卡不能再横排(否则售价/会员价被 space-between 推到两端) */
.mh-rrow { display:block; padding:4px 8px 8px; }
.mh-rrow .p-cur { font-size:14px; }

/* --- 精选商品:两列瀑布流 --- */
.mh-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; padding:0 10px; }
.mh-card { display:flex; flex-direction:column; background:#fff; border-radius:14px; overflow:hidden; box-shadow:0 1px 6px rgba(15,23,42,.07); }
.mh-cimg { position:relative; display:block; width:100%; aspect-ratio:1/1; background:#f8fafc; overflow:hidden; }
.mh-cimg img { width:100%; height:100%; object-fit:cover; }
.mh-cimg.noimg img { display:none; }
@supports not (aspect-ratio:1/1) {
  .mh-cimg { height:0; padding-bottom:100%; }
  .mh-cimg > img { position:absolute; left:0; top:0; }
}
/* 有图时必须隐藏首字占位,否则它会以 inline 参与排版,把图片顶出几像素缝隙 */
.mh-cimg .ph { display:none; }
.mh-cimg.noimg .ph { display:flex; }
.mh-cnm { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; margin:8px 10px 0; font-size:13px; line-height:1.35; color:#1f2937; text-decoration:none; min-height:35px; }
/* 多规格商品会列出多个规格值(如「750ml 单瓶 / 750ml×6 整箱」),允许显示到两行再省略 */
.mh-csp { margin:4px 10px 0; font-size:11px; color:#9ca3af; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; line-height:1.4; }
/* 价格两行(2026-10-05):售价在上(划线),会员价在下(红) */
.mh-cpr { display:block; margin:6px 10px 0; }
.p-line { display:flex; align-items:baseline; gap:4px; }
.p-mline { margin-top:1px; flex-wrap:wrap; }
/* 兜底:页面 HTML 若还是旧结构(p-old/p-cur/p-mp 直接挂在 .mh-cpr 下),也强制呈现两行 */
.mh-cpr > .p-old { display:block; }
.mh-cpr > .p-cur, .mh-cpr > .p-mp { display:inline-block; vertical-align:baseline; }
/* margin-top:auto:名称一行/两行、有无规格行,按钮都钉在卡片底部,两列同行卡片的按钮才对齐 */
.mh-cbtn { margin:auto 10px 10px; height:32px; border:0; border-radius:16px; color:#fff; font-size:13px; font-weight:600;
  background:linear-gradient(90deg,#1e3a5f,#2f5a8f); }
.mh-cbtn:active { opacity:.85; }

/* --- 价格 / 标签 --- */
.p-cur { color:#dc2626; font-size:15px; font-weight:700; }
.p-old { color:#9ca3af; font-size:11px; text-decoration:line-through; }
.p-mp { color:#8a6d1f; background:#fff7e6; border:1px solid #f3e3c3; border-radius:4px; font-size:10px; padding:0 3px; white-space:nowrap; flex:none; }
.p-tag { position:absolute; font-size:10px; line-height:1; padding:3px 5px; border-radius:0 0 8px 0; }
.p-tag.etag { left:0; top:0; background:#fef3c7; color:#92400e; }
.p-tag.stag { right:0; top:0; border-radius:0 0 0 8px; }
.p-tag.stag.ok  { background:rgba(236,253,245,.95); color:#059669; }
.p-tag.stag.low { background:rgba(254,242,242,.95); color:#dc2626; }
.p-tag.stag.out { background:rgba(243,244,246,.95); color:#6b7280; }

/* --- 下拉刷新 / 加载更多 --- */
.mh-ptr { position:fixed; left:0; right:0; top:50px; height:0; overflow:hidden; display:flex; align-items:center; justify-content:center;
  background:#f8fafc; color:#1e3a5f; font-size:12px; transition:height .15s; z-index:40; }
.mh-ptr.show { height:36px; }
.mh-loadmore { text-align:center; color:#9ca3af; font-size:12px; padding:14px 0 6px; }
.mh-done { text-align:center; color:#cbd5e1; font-size:12px; padding:14px 0 6px; }
.mh-searchbar { display:flex; align-items:center; justify-content:space-between; padding:12px 12px 6px; font-size:13px; color:#1e3a5f; font-weight:600; }
.mh-searchbar a { font-size:12px; color:#9ca3af; text-decoration:none; font-weight:400; }
