/* ==========================================================================
   自助发卡 · 前台样式
   配色集中在 :root 变量里，想换主题色只改这里即可
   ========================================================================== */

:root {
    --bg:          #f5f6f8;
    --white:       #ffffff;
    --text:        #1f2329;
    --text-sub:    #6b7280;
    --muted:       #9aa0a8;
    --border:      #eef0f3;

    --blue:        #3b7bf6;
    --blue-dark:   #2b64d8;
    --blue-grad:   linear-gradient(135deg, #5b8cfa 0%, #7aa5ff 100%);
    --blue-soft:   #eef4ff;

    --green:       #18a058;
    --green-soft:  #e8f7ef;
    --orange:      #f0883b;
    --orange-soft: #fff3e6;
    --gray-soft:   #f2f3f5;

    --radius:      12px;
    --radius-lg:   16px;
    --shadow:      0 2px 10px rgba(17, 24, 39, 0.04);
    --max-width:   560px;
}

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

/* 兜底：元素上写 hidden 就必须真的隐藏。
   否则像 .qrcode-mask 这种设了 display:flex 的元素会把 hidden 属性覆盖掉，
   导致"二维码已过期"遮罩一开始就盖在二维码上。 */
[hidden] { display: none !important; }

html { background: #e9ebef; }

body {
    margin: 0 auto;
    max-width: var(--max-width);
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    padding-bottom: 24px;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ============================ 店铺头部 ============================ */
.shop-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 16px 14px;
    background: var(--white);
}

.shop-logo {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(135deg, #ff8a3d, #ff6b2c);
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-logo img { width: 100%; height: 100%; object-fit: cover; }

.shop-logo-text {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
}

.shop-right { flex: 1 1 auto; min-width: 0; }

.shop-name {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    word-break: break-all;
}

.shop-verified {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 400;
    color: var(--green);
    background: var(--green-soft);
    border-radius: 4px;
    padding: 1px 6px 1px 4px;
    line-height: 1.6;
}

.shop-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.btn-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1;
    border: 1px solid var(--border);
    background: #fafbfc;
    color: var(--text-sub);
    cursor: pointer;
    font-family: inherit;
    transition: opacity .15s;
}

.btn-pill:active { opacity: .7; }
.btn-contact { color: var(--green); border-color: #cdeadd; background: var(--green-soft); font-weight: 500; }
.btn-more    { padding: 0 12px; letter-spacing: 1px; font-weight: 700; }

/* ============================ 店铺公告 ============================ */
.announce-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 10px 12px 0;
    padding: 10px 12px;
    background: var(--white);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-sub);
    overflow: hidden;
}

.announce-icon { color: #ff5f7e; flex: 0 0 auto; display: inline-flex; }
.announce-label { font-weight: 600; color: var(--text); flex: 0 0 auto; }
.announce-text {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================ 区块 ============================ */
.section { margin: 18px 12px 0; }

.section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

.section-bolt { color: #ff8b3d; font-size: 15px; }

.section-count {
    font-size: 13px;
    font-weight: 400;
    color: var(--muted);
}

/* ============================ 分类卡片 ============================ */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.cat-card {
    position: relative;
    display: block;
    padding: 12px 14px 16px;
    border-radius: var(--radius);
    /* 未选中态：白底 + 淡边框。不要用接近页面底色的灰，
       否则卡片会和 background 融成一片，看起来像浮空的文字 */
    background: var(--white);
    border: 1px solid #e9ecf1;
    overflow: hidden;
    transition: transform .12s;
}

.cat-card:active { transform: scale(.985); }

.cat-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    word-break: break-all;
}

.cat-sub { font-size: 12px; color: var(--muted); }

.cat-card.active {
    background: var(--blue-grad);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(91, 140, 250, .3);
}
.cat-card.active .cat-name { color: #fff; }
.cat-card.active .cat-sub  { color: rgba(255, 255, 255, .85); }

.cat-check {
    position: absolute;
    right: -10px;
    bottom: -14px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: none;
}
.cat-card.active .cat-check {
    display: block;
    background: rgba(255, 255, 255, .22);
}
.cat-card.active .cat-check::after {
    content: '';
    position: absolute;
    left: 17px;
    top: 15px;
    width: 12px;
    height: 7px;
    border-left: 3px solid rgba(255, 255, 255, .95);
    border-bottom: 3px solid rgba(255, 255, 255, .95);
    transform: rotate(-45deg);
}

/* ============================ 商品卡片 ============================ */
.product-list { display: flex; flex-direction: column; gap: 10px; }

.product-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform .12s;
}

.product-card:not(.disabled):active { transform: scale(.99); }
.product-card.disabled { opacity: .65; }

.product-info { flex: 1 1 auto; min-width: 0; }

.product-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.price {
    color: var(--blue);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}
.price i { font-style: normal; font-size: 13px; margin-right: 1px; }

.stock-badge {
    font-size: 11px;
    line-height: 1.7;
    padding: 0 7px;
    border-radius: 4px;
    white-space: nowrap;
}
.stock-high { color: var(--green);  background: var(--green-soft); }
.stock-mid  { color: var(--blue);   background: var(--blue-soft); }
.stock-low  { color: var(--orange); background: var(--orange-soft); }
.stock-none { color: var(--muted);  background: var(--gray-soft); }

.product-go {
    flex: 0 0 auto;
    font-size: 13px;
    color: var(--blue);
    border: 1px solid #d6e3ff;
    background: var(--blue-soft);
    border-radius: 14px;
    padding: 5px 14px;
    line-height: 1.2;
}
.product-card.disabled .product-go {
    color: var(--muted);
    border-color: var(--border);
    background: var(--gray-soft);
}

/* ============================ 空状态 ============================ */
.empty-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    color: var(--text-sub);
    box-shadow: var(--shadow);
}
.empty-emoji { font-size: 34px; margin-bottom: 8px; }
.empty-tip { font-size: 12px; color: var(--muted); margin-top: 6px; }
.empty-tip a { color: var(--blue); }

/* ============================ 页面导航条 ============================ */
.page-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--white);
}

.nav-back {
    display: inline-flex;
    align-items: center;
    color: var(--text-sub);
    font-size: 14px;
}
.nav-title { font-weight: 600; font-size: 15px; }

/* ============================ 通用卡片 ============================ */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 12px 12px 0;
    padding: 14px 16px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}

.card-body { font-size: 14px; color: var(--text-sub); }
.rich-text { white-space: normal; word-break: break-word; }

.card-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }

/* ============================ 商品详情 ============================ */
.detail-card { padding: 16px; }

.detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.detail-name { font-size: 17px; font-weight: 700; line-height: 1.45; word-break: break-all; }

.detail-price {
    color: var(--blue);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}
.detail-price i { font-style: normal; font-size: 14px; }

.detail-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.tag {
    font-size: 12px;
    color: var(--text-sub);
    background: var(--gray-soft);
    border-radius: 4px;
    padding: 1px 8px;
}

/* ============================ 表单 ============================ */
.input {
    width: 100%;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fafbfc;
    outline: none;
    transition: border-color .15s, background .15s;
}
.input:focus { border-color: var(--blue); background: #fff; }

.field-label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }

.form-tip { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.7; }

.alert-error {
    background: #fff1f0;
    color: #d4380d;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 14px;
}

/* ============================ 底部购买栏 ============================ */
.buy-bar {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--white);
    box-shadow: 0 -2px 12px rgba(17, 24, 39, .06);
    z-index: 20;
}

.buy-price {
    color: var(--blue);
    font-size: 22px;
    font-weight: 700;
    flex: 0 0 auto;
}
.buy-price i { font-style: normal; font-size: 14px; }

.btn-buy {
    flex: 1 1 auto;
    height: 44px;
    border: none;
    border-radius: 22px;
    background: var(--blue-grad);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity .15s;
    box-shadow: 0 4px 12px rgba(91, 140, 250, .3);
}
.btn-buy:active { opacity: .85; }
.btn-buy.disabled,
.btn-buy[disabled] {
    background: #c9cdd4;
    box-shadow: none;
    cursor: not-allowed;
}

/* 有底部购买栏时给内容留出空间 */
body.has-buy-bar { padding-bottom: 80px; }

/* ============================ 收银台 ============================ */
.order-head-card { text-align: center; padding: 20px 16px; }

.order-product { font-size: 15px; font-weight: 600; margin-bottom: 10px; word-break: break-all; }

.order-amount {
    color: var(--blue);
    font-size: 34px;
    font-weight: 700;
    line-height: 1.15;
}
.order-amount i { font-style: normal; font-size: 18px; margin-right: 2px; }

.order-no-line {
    font-size: 12px;
    color: var(--muted);
    margin-top: 10px;
    word-break: break-all;
}
.order-no-line b { color: var(--text-sub); font-weight: 500; }

/* 查询码行（收银台顶部，用于换设备/清 cookie 后重新打开订单） */
.order-code-line {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}
.order-code-line b {
    /* 与上方「订单号」的数值保持同一颜色变量，改主题时会一起变 */
    color: var(--text-sub);
    font-weight: 600;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 15px;
    letter-spacing: 1px;
    word-break: break-all;
}
.order-code-tip {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 6px;
    line-height: 1.6;
}

.pay-card { text-align: center; padding: 20px 16px 22px; }

.pay-tip {
    /* 必须是块级 flex：inline-flex 会在宽屏下和下面的二维码挤在同一行
       （560px 容器装得下「提示文字 + 二维码」，两个 inline 元素就并排了） */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-sub);
    margin-bottom: 16px;
}
.pay-tip b { color: var(--blue); }

/* 两行提示：图标和第一行横排，带 .pay-tip-note 的那行独占一整行
   （flex 子元素默认横排，靠 flex-wrap + 100% 基准宽把它挤到下一行） */
.pay-tip-stack {
    flex-wrap: wrap;
    gap: 4px 6px;
}
.pay-tip-stack .pay-tip-note {
    flex: 1 1 100%;
    font-size: 12px;
    line-height: 1.6;
    color: var(--muted);
}

.qrcode-wrap {
    position: relative;
    display: inline-block;
    padding: 12px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid var(--border);
}

.qrcode-box { width: 200px; height: 200px; display: flex; align-items: center; justify-content: center; }
.qrcode-box img, .qrcode-box canvas { display: block; }

.qrcode-error { font-size: 13px; color: #d4380d; padding: 0 10px; }

.qrcode-mask {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .93);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-sub);
    font-weight: 600;
}

.pay-countdown { margin-top: 16px; font-size: 14px; color: var(--text-sub); }
.pay-countdown b { color: var(--orange); font-size: 16px; font-variant-numeric: tabular-nums; }

.pay-hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

.pay-loading { text-align: center; padding: 10px 0; color: var(--text-sub); font-size: 14px; }

/* ============================ 成功 / 卡密 ============================ */
.success-card { text-align: center; padding: 20px 16px; }

.success-head {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 16px;
}

.success-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.card-secret {
    background: #f7f8fa;
    border: 1px dashed #d3d7de;
    border-radius: 10px;
    padding: 16px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
    word-break: break-all;
    white-space: pre-wrap;
    text-align: left;
    user-select: all;
}

.btn-copy {
    margin-top: 14px;
    height: 40px;
    padding: 0 28px;
    border-radius: 20px;
    border: 1px solid #d6e3ff;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.btn-copy:active { opacity: .8; }

.success-tip { font-size: 12px; color: var(--muted); margin-top: 12px; line-height: 1.7; }

.warn-card { text-align: center; }
.warn-head { font-size: 15px; font-weight: 700; color: var(--orange); margin-bottom: 8px; }
.warn-body { font-size: 13px; color: var(--text-sub); line-height: 1.8; }

/* ============================ 底部 ============================ */
.shop-footer {
    margin: 26px 12px 0;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    line-height: 2;
}
.footer-links a { color: var(--text-sub); }
.footer-links .dot { margin: 0 6px; color: #d0d3d8; }
.footer-icp { margin-top: 2px; }
.footer-copy { margin-top: 2px; }

/* ============================ 轻提示 ============================ */
.toast {
    position: fixed;
    left: 50%;
    bottom: 96px;
    transform: translateX(-50%) translateY(10px);
    max-width: 80vw;
    padding: 10px 18px;
    background: rgba(31, 35, 41, .9);
    color: #fff;
    font-size: 13px;
    border-radius: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s, transform .22s;
    z-index: 999;
    text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


/* ==========================================================================
   资料下载
   ========================================================================== */

/* ---------- 首页的下载入口卡片 ---------- */
.dl-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 12px 0;
    padding: 15px;
    background: var(--white);
    /* 描边比 --border(#eef0f3) 略深一点：那个色号在白底上几乎看不出框 */
    border: 1px solid #e2e8f1;
    border-radius: var(--radius);
    box-shadow: var(--shadow);          /* 与商品卡片同一套阴影 */
    text-decoration: none;
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}
.dl-entry:active { background: #fafbfd; }

.dl-entry-icon {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--blue-soft);
    color: var(--blue);
}

.dl-entry-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.dl-entry-title { font-size: 16px; font-weight: 600; line-height: 1.3; }
.dl-entry-sub {
    font-size: 13.5px;
    color: var(--text-sub);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dl-entry-go {
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--blue);
    background: var(--blue-soft);
    padding: 4px 10px;
    border-radius: 20px;
}

/* ---------- 下载页的文件列表 ---------- */
.dl-list { display: flex; flex-direction: column; gap: 10px; }

.dl-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}
.dl-item:active { background: #fafbfd; }

.dl-item-icon {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
}

.dl-item-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dl-item-name {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
    word-break: break-all;
}
.dl-item-meta { font-size: 12px; color: var(--muted); }

.dl-item-btn {
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    background: var(--blue-grad);
    padding: 7px 15px;
    border-radius: 20px;
    line-height: 1.2;
}

/* ---------- 下载页底部的使用提示 ---------- */
.dl-note {
    margin-top: 12px;
    padding: 11px 13px;
    background: var(--white);
    border-radius: var(--radius);
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-sub);
}

/* ============================ 收银台 · 双通道 ============================ */

/* 微信内支付的主按钮 */
.btn-pay-main {
    display: block;
    width: 100%;
    box-sizing: border-box;
    height: 48px;
    line-height: 48px;
    border-radius: 24px;
    background: var(--blue-grad);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(91, 140, 250, .32);
    transition: opacity .15s;
}
.btn-pay-main:active { opacity: .85; }

/* 「检测支付状态」小按钮 */
.btn-recheck {
    margin-top: 12px;
    height: 34px;
    padding: 0 18px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--white);
    color: var(--text-sub);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}
.btn-recheck:active { background: var(--gray-soft); }

/* 支付结果提示条（取消 / 失败） */.notice-card {
    padding: 11px 14px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-sub);
    background: var(--orange-soft);
    border-left: 3px solid var(--orange);
}
.notice-card.notice-warn {
    color: #a33a1f;
    background: #fff1ec;
    border-left-color: #e5533d;
}

/* ---------- 支付链接卡片（不想扫码时发到微信里打开） ---------- */
.link-card { padding: 14px 14px 12px; }

.link-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}
.link-head-icon { font-size: 15px; }

.link-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 9px 10px;
    background: var(--blue-soft);
    border-radius: var(--radius);
}

.link-label {
    flex: 0 0 auto;
    font-size: 12.5px;
    color: var(--text-sub);
}

.link-value {
    flex: 1 1 160px;
    min-width: 0;
    font-size: 12.5px;
    color: var(--blue-dark);
    line-height: 1.5;
    word-break: break-all;
    user-select: all;
    -webkit-user-select: all;
}

.btn-copy-link {
    flex: 0 0 auto;
    height: 32px;
    padding: 0 16px;
    border: none;
    border-radius: 16px;
    background: var(--blue);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.btn-copy-link:active { opacity: .85; }

.link-tip {
    margin-top: 10px;
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--text-sub);
}
.link-tip b { color: var(--text); font-weight: 600; }

.link-warn {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    line-height: 1.6;
    color: var(--muted);
}
