/* ===== 小微交易 H5 全局样式 ===== */
:root {
    --primary: #2b7de9;
    --primary-dark: #1f63c0;
    --danger: #e54d42;
    --ok: #19be6b;
    --warn: #ff9900;
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #1f2329;
    --muted: #8a919f;
    --line: #ebedf0;
    --radius: 12px;
}

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

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }

.container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
}

/* 顶部栏 */
.header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--primary);
    color: #fff;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.header .back, .header .right {
    position: absolute;
    color: #fff;
    font-size: 14px;
    padding: 0 14px;
    cursor: pointer;
}
.header .back { left: 0; }
.header .right { right: 0; }

/* 主体 */
.body { padding: 14px; padding-bottom: 80px; }

/* 卡片 */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card h3 { margin: 0 0 12px; font-size: 16px; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, .textarea, select.input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 15px;
    background: #fff;
    color: var(--text);
    outline: none;
}
.input:focus, .textarea:focus { border-color: var(--primary); }
.textarea { min-height: 84px; resize: vertical; }

/* 按钮 */
.btn {
    display: block;
    width: 100%;
    border: none;
    border-radius: 24px;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    cursor: pointer;
}
.btn:active { background: var(--primary-dark); }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.danger { background: var(--danger); }
.btn.warn { background: var(--warn); }
.btn.sm { display: inline-block; width: auto; padding: 6px 14px; font-size: 13px; border-radius: 16px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* 标签 / 徽章 */
.badge {
    display: inline-block;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #eef3ff;
    color: var(--primary);
    margin-left: 6px;
}
.badge.green { background: #e8f9f0; color: var(--ok); }
.badge.gray  { background: #f0f1f3; color: var(--muted); }
.badge.red   { background: #fdecea; color: var(--danger); }
.badge.warn  { background: #fff4e5; color: var(--warn); }

/* 底部导航 */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: 56px;
    background: #fff;
    border-top: 1px solid var(--line);
    display: flex;
    z-index: 20;
}
.tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 12px;
    gap: 2px;
}
.tabbar a.active { color: var(--primary); }
.tabbar a .ic { font-size: 20px; line-height: 1; }

/* 产品网格 */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.prod {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    cursor: pointer;
    transition: transform .08s ease;
}
.prod:active { transform: scale(.98); }
.prod img { width: 100%; height: 130px; object-fit: cover; display: block; background: #f0f1f3; }
.prod .meta { padding: 8px 10px 10px; }
.prod .title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod .price { color: var(--danger); font-weight: 700; margin-top: 4px; }
.prod .price small { font-size: 11px; font-weight: 400; }

/* 我的产品行 */
.prow {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.prow:last-child { border-bottom: none; }
.prow img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; }
.prow .info { flex: 1; min-width: 0; }
.prow .info .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .info .s { font-size: 12px; color: var(--muted); }
.prow .ops { flex: none; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

/* 收款码 */
.codelist { display: flex; flex-wrap: wrap; gap: 12px; }
.codebox { width: 130px; text-align: center; }
.codebox img { width: 120px; height: 120px; object-fit: cover; border: 1px solid var(--line); border-radius: 10px; background:#fff; }
.codebox .cap { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 二维码占位 */
.qr-hint { font-size: 13px; color: var(--muted); margin: 8px 0; }

/* 提示条 */
.toast {
    position: fixed;
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%);
    background: rgba(0,0,0,.82);
    color: #fff;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 100;
    max-width: 80%;
    text-align: center;
    opacity: 0;
    transition: opacity .2s;
}
.toast.show { opacity: 1; }

/* 空状态 */
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }

/* 产品详情 */
.detail { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.detail .dimg { margin-bottom: 12px; }
.detail .dimg img { width: 100%; max-height: 360px; object-fit: contain; border-radius: 10px; background: #f0f1f3; display: block; }
.detail .dtitle { font-size: 18px; font-weight: 700; margin-bottom: 6px; word-break: break-all; }
.detail .dprice { color: var(--danger); font-weight: 700; font-size: 20px; margin-bottom: 6px; }
.detail .dprice small { font-size: 12px; font-weight: 400; }
.detail .dblock { margin-top: 14px; }
.detail .dh { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.detail .ddesc { font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-break: break-all; }

/* 订单记录 */
.order { padding: 12px 0; border-bottom: 1px solid var(--line); }
.order:last-child { border-bottom: none; }
.order .ot { font-size: 15px; margin-bottom: 6px; }
.order .orow { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 13px; }
.order .orow .k { color: var(--muted); flex: none; }
.order .orow .v { text-align: right; word-break: break-all; }
.order .ops { display: flex; gap: 8px; justify-content: flex-end; }

/* 免责声明 */
.disclaimer {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.7;
    padding: 16px 14px 30px;
    border-top: 1px dashed var(--line);
    margin-top: 10px;
}
.disclaimer b { color: var(--text); }

/* 登录页背景 */
.auth { padding: 30px 24px; }
.auth .logo { text-align: center; margin: 20px 0 26px; }
.auth .logo .name { font-size: 26px; font-weight: 800; color: var(--primary); letter-spacing: 2px; }
.auth .logo .sub { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* tabs */
.tabs { display: flex; background:#fff; border-radius: 10px; overflow:hidden; margin-bottom: 18px; }
.tabs div { flex:1; text-align:center; padding: 12px; color: var(--muted); cursor:pointer; }
.tabs div.active { color: var(--primary); font-weight: 700; background:#eef3ff; }

.row { display:flex; justify-content: space-between; align-items:center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.row .k { color: var(--muted); font-size: 14px; }
.row .v { font-weight: 600; max-width: 60%; text-align: right; word-break: break-all; }

/* ===== 商城首页（游客可浏览） ===== */
.shop-hd {
    position: sticky; top: 0; z-index: 20;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; gap: 8px;
    padding: 9px 12px;
}
.shop-hd .brand { font-size: 17px; font-weight: 800; letter-spacing: 1px; flex: none; }
.shop-hd .brand span { color: #ffd88a; }
.shop-hd .sbox { flex: 1; min-width: 0; }
.shop-hd .sinput {
    width: 100%; height: 32px;
    border: none; border-radius: 16px;
    padding: 0 12px; font-size: 13px;
    background: rgba(255,255,255,.94); color: var(--text);
    outline: none;
}
.shop-hd .uentry { flex: none; }
.ubtn {
    display: inline-block;
    padding: 5px 12px; border-radius: 14px;
    font-size: 13px; color: #fff;
    border: 1px solid rgba(255,255,255,.75);
    cursor: pointer;
}
.ubtn.primary { background: #fff; color: var(--primary); border-color: #fff; font-weight: 600; }

/* 横幅 */
.banner { padding: 12px 12px 0; }
.banner .b-in {
    border-radius: var(--radius);
    padding: 16px 16px 18px;
    color: #fff;
    background: linear-gradient(135deg, #2b7de9 0%, #6aa8f5 60%, #8fc0ff 100%);
    box-shadow: 0 2px 8px rgba(43,125,233,.18);
}
.banner .b-t { font-size: 19px; font-weight: 800; letter-spacing: 1px; }
.banner .b-s { font-size: 12px; margin-top: 6px; opacity: .93; }

/* 排序筛选栏 */
.filterbar { display: flex; align-items: center; gap: 8px; padding: 12px; }
.filterbar .chip {
    padding: 5px 12px; border-radius: 14px;
    font-size: 13px; color: var(--muted);
    background: #fff; border: 1px solid var(--line);
    cursor: pointer;
}
.filterbar .chip.active {
    color: #fff; background: var(--primary); border-color: var(--primary); font-weight: 600;
}
.filterbar .fcount { margin-left: auto; font-size: 12px; color: var(--muted); }

/* 商品网格 */
.shop-main { padding: 0 12px 12px; }
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shop-card {
    background: var(--card); border-radius: var(--radius);
    overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.05);
    cursor: pointer; transition: transform .12s;
}
.shop-card:active { transform: scale(.98); }
.shop-card .imgbox { background: #f2f3f5; }
.shop-card .imgbox img { width: 100%; height: 150px; object-fit: cover; display: block; }
.shop-card .info { padding: 8px 10px 10px; }
.shop-card .tt {
    font-size: 13px; line-height: 1.4; height: 2.8em;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.shop-card .pp { color: var(--danger); font-weight: 800; font-size: 17px; margin-top: 4px; }
.shop-card .pp small { font-size: 11px; font-weight: 400; }
.shop-card .sl {
    font-size: 11px; color: var(--muted); margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 通用弹层（详情 / 登录） */
.modal {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 60;
    background: rgba(0,0,0,.45);
    display: none; align-items: flex-end; justify-content: center;
}
.modal.show { display: flex; }
.modal .mwrap {
    width: 100%; max-width: 480px; max-height: 86vh;
    background: var(--bg); border-radius: 16px 16px 0 0;
    display: flex; flex-direction: column;
    animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(28px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal .mtop {
    flex: none; display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; font-weight: 700; font-size: 16px;
    background: var(--card); border-radius: 16px 16px 0 0; border-bottom: 1px solid var(--line);
}
.modal .mtop .mx { color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; }
.modal .mbody { padding: 14px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* 登录弹层 tab */
.atabs { display: flex; background: #fff; border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.atabs div { flex: 1; text-align: center; padding: 11px; color: var(--muted); cursor: pointer; font-size: 15px; }
.atabs div.active { color: var(--primary); font-weight: 700; background: #eef3ff; }
.atip { text-align: center; font-size: 12px; color: var(--muted); margin-top: 12px; }

/* 商城底部导航 */
.shop-tab {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    max-width: 480px; margin: 0 auto;
    display: flex; background: #fff; border-top: 1px solid var(--line);
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.shop-tab a {
    flex: 1; text-align: center; color: var(--muted); font-size: 12px;
    display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer;
}
.shop-tab a .ic { font-size: 20px; line-height: 1; }
.shop-tab a.on { color: var(--primary); font-weight: 600; }

/* ===== 商城首页 v2（轮播 / 快捷分类 / 自适应卡片 / PC 宽屏适配） ===== */

/* 顶栏：加大留白，搜索框更显眼 */
.shop-hd { padding: 10px 12px; gap: 10px; }
.shop-hd .brand { font-size: 18px; }
.shop-hd .sinput { height: 34px; font-size: 13px; box-shadow: inset 0 1px 2px rgba(0,0,0,.06); }

/* 轮播 Banner */
.slider {
    position: relative;
    margin: 12px 12px 0;
    height: 172px;
    border-radius: var(--radius);
    overflow: hidden;
    background: linear-gradient(135deg, #2b7de9 0%, #6aa8f5 60%, #8fc0ff 100%);
    box-shadow: 0 2px 10px rgba(43,125,233,.18);
}
.slider .slide {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    opacity: 0; transition: opacity .5s ease;
    overflow: hidden; cursor: pointer;
}
.slider .slide.on { opacity: 1; z-index: 2; }
.slider .slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slider .scap {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 26px 12px 10px; color: #fff;
    background: linear-gradient(to top, rgba(0,0,0,.6), rgba(0,0,0,0));
    display: flex; justify-content: space-between; align-items: flex-end; gap: 10px;
}
.slider .scap b {
    font-size: 14px; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.slider .scap em { font-style: normal; font-weight: 800; font-size: 17px; color: #ffd88a; flex: none; }
.slider .dots { position: absolute; right: 12px; bottom: 36px; z-index: 3; display: flex; gap: 5px; }
.slider .dots i {
    width: 6px; height: 6px; border-radius: 3px;
    background: rgba(255,255,255,.55); transition: width .25s;
}
.slider .dots i.on { background: #fff; width: 14px; }
/* 无商品时的默认横幅 */
.slider .slide.def { opacity: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 18px; }
.slider .slide.def .b-t { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: 1px; }
.slider .slide.def .b-s { font-size: 12px; color: rgba(255,255,255,.92); margin-top: 6px; }

/* 快捷分类（金刚区） */
.cats {
    display: flex; margin: 12px; padding: 13px 0;
    background: var(--card); border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.cats a { flex: 1; text-align: center; font-size: 12px; color: var(--text); cursor: pointer; }
.cats a i { display: block; font-style: normal; font-size: 22px; line-height: 1; margin-bottom: 5px; }
.cats a:active { opacity: .6; }

/* 区块标题 */
.sec-hd { display: flex; align-items: baseline; justify-content: space-between; padding: 4px 12px 8px; }
.sec-t { font-size: 17px; font-weight: 800; }
.sec-n { font-size: 12px; color: var(--muted); }

/* 商品网格：默认双列 */
.shop-main { padding: 0 12px 12px; }
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* 商品少时切成单列横向大卡，页面更饱满 */
.shop-grid.one { grid-template-columns: 1fr; gap: 12px; }

.shop-card {
    background: var(--card); border-radius: var(--radius);
    overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.05);
    display: flex; flex-direction: column;
    cursor: pointer; transition: transform .12s;
}
.shop-card:active { transform: scale(.985); }
.shop-card .imgbox { position: relative; background: #fff; }
/* 商品图完整展示（contain），不再被裁切 */
.shop-card .imgbox img {
    width: 100%; height: auto; aspect-ratio: 1 / 1;
    object-fit: contain; display: block; padding: 8px; background: #fff;
}
.tag-new {
    position: absolute; left: 0; top: 0;
    background: var(--danger); color: #fff;
    font-size: 10px; padding: 2px 7px; border-radius: 0 0 8px 0;
}
.shop-card .info { padding: 6px 10px 8px; flex: 1; }
.shop-card .tt {
    font-size: 13px; line-height: 1.45; height: 2.9em;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.shop-card .pp { color: var(--danger); font-weight: 800; font-size: 18px; margin-top: 4px; }
.shop-card .pp small { font-size: 11px; font-weight: 400; }
.shop-card .sl {
    font-size: 11px; color: var(--muted); margin-top: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.shop-card .buy { margin: 0 10px 10px; align-self: flex-start; }

/* 单列模式：左侧方图 + 右侧信息 + 右侧购买按钮 */
.shop-grid.one .shop-card { flex-direction: row; align-items: center; padding: 10px; gap: 12px; }
.shop-grid.one .shop-card .imgbox {
    width: 116px; flex: none; border-radius: 10px; overflow: hidden; background: #f7f8fa;
}
.shop-grid.one .shop-card .info { padding: 0; flex: 1; min-width: 0; }
.shop-grid.one .shop-card .tt { font-size: 14px; }
.shop-grid.one .shop-card .buy { margin: 0; flex: none; }

/* 骨架屏 */
.sk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sk-card {
    height: 210px; border-radius: var(--radius);
    background: linear-gradient(100deg, #eceef1 30%, #f7f8fa 50%, #eceef1 70%);
    background-size: 200% 100%;
    animation: skMove 1.2s infinite linear;
}
@keyframes skMove { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* PC / 宽屏适配：不再只有中间一条窄栏 */
@media (min-width: 768px) {
    .container { max-width: 1080px; box-shadow: 0 0 24px rgba(0,0,0,.06); }
    body { background: #eef0f3; }
    .shop-hd { padding: 14px 24px; }
    .shop-hd .brand { font-size: 21px; }
    .shop-hd .sbox { max-width: 460px; }
    .shop-hd .sinput { height: 38px; font-size: 14px; }
    .slider { height: 280px; margin: 18px 24px 0; border-radius: 16px; }
    .slider .scap { padding: 34px 20px 16px; }
    .slider .scap b { font-size: 17px; }
    .slider .scap em { font-size: 21px; }
    .cats { margin: 16px 24px; padding: 18px 0; }
    .cats a { font-size: 13px; }
    .cats a i { font-size: 26px; }
    .sec-hd { padding: 8px 24px 10px; }
    .filterbar { padding: 4px 24px 14px; }
    .shop-main { padding: 0 24px 20px; }
    .shop-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
    .shop-grid.one { grid-template-columns: repeat(2, 1fr); }
    .shop-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.09); }
    .modal { align-items: center; }
    .modal .mwrap { border-radius: 14px; max-width: 560px; max-height: 82vh; }
    .shop-tab { display: none; }
    .disclaimer { margin-bottom: 24px !important; }
}
