/* ============ 购物车（抽屉 + 角标 + 结算 + 收款码弹层）============ */
/* 配色沿用站点令牌：主色 #C8964A，深蓝文字 #1B3A5B，边框 #E3DCCB，底色 #F7F3EC */

/* ---------- 头部购物车图标 + 角标 ---------- */
.hl-cart-trigger { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.hl-cart-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #C8964A;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    box-sizing: border-box;
}

/* ---------- 加入购物车按钮（详情/卡片通用） ---------- */
.hl-add-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 22px;
    border: none;
    border-radius: 6px;
    background: #C8964A;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    font-family: inherit;
}
.hl-add-cart-btn:hover { background: #B5853A; }
.hl-add-cart-btn:active { transform: scale(0.98); }
.hl-add-cart-btn.is-added { background: #1c7c43; }
.hl-add-cart-btn--ghost {
    background: transparent;
    color: #C8964A;
    border: 1px solid #C8964A;
    padding: 8px 14px;
    font-size: 13px;
}
.hl-add-cart-btn--ghost:hover { background: #F7F3EC; }
.hl-add-cart-btn--ghost.is-added { background: #1c7c43; border-color: #1c7c43; color: #fff; }
.hl-add-check { font-weight: bold; }

/* ---------- 抽屉遮罩 ---------- */
.hl-cart-overlay,
.hl-cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 9998;
}
.hl-cart-overlay[hidden],
.hl-cart-drawer[hidden] { display: none; }
.hl-cart-overlay {
    background: rgba(15, 28, 45, 0.5);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.hl-cart-overlay.is-open { opacity: 1; }
.hl-cart-drawer {
    pointer-events: none;
}
.hl-cart-drawer.is-open { pointer-events: auto; }

/* 抽屉面板 */
.hl-cart-drawer .hl-cart-head,
.hl-cart-drawer .hl-cart-body,
.hl-cart-drawer .hl-cart-foot {
    position: absolute;
    right: 0;
    width: 100%;
    max-width: 440px;
    background: #fff;
    box-shadow: -12px 0 40px rgba(15, 28, 45, 0.18);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
    box-sizing: border-box;
}
.hl-cart-drawer.is-open .hl-cart-head,
.hl-cart-drawer.is-open .hl-cart-body,
.hl-cart-drawer.is-open .hl-cart-foot { transform: translateX(0); }

.hl-cart-head {
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #E3DCCB;
    z-index: 3;
    height: 60px;
}
.hl-cart-head h3 { margin: 0; font-size: 18px; color: #1B3A5B; }
.hl-cart-close {
    width: 32px; height: 32px;
    border: none; background: transparent;
    font-size: 24px; line-height: 1; color: #536678;
    cursor: pointer; border-radius: 50%;
    transition: background 0.15s ease;
}
.hl-cart-close:hover { background: #F7F3EC; color: #1B3A5B; }

.hl-cart-body {
    top: 60px;
    bottom: 130px;
    overflow-y: auto;
    padding: 16px 18px;
    z-index: 2;
}
.hl-cart-foot {
    bottom: 0;
    padding: 16px 22px;
    border-top: 1px solid #E3DCCB;
    background: #FBFAF6;
    z-index: 3;
    min-height: 130px;
}

/* ---------- 空状态 ---------- */
.hl-cart-empty { padding: 60px 0; text-align: center; color: #9aa7b5; }
.hl-cart-empty p { margin: 0; font-size: 14px; }

/* ---------- 商品行 ---------- */
.hl-cart-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #EFE9D8;
}
.hl-cart-item:last-child { border-bottom: none; }
.hl-cart-item__img {
    width: 64px; height: 64px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #F7F3EC;
}
.hl-cart-item__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hl-cart-item__main { flex: 1; min-width: 0; }
.hl-cart-item__name {
    font-size: 14px; color: #1B3A5B; font-weight: 600;
    line-height: 1.4;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hl-cart-item__spec { font-size: 12px; color: #8a97a5; margin-top: 2px; }
.hl-cart-item__price { font-size: 13px; color: #C8964A; margin-top: 4px; }
.hl-cart-item__sub {
    font-size: 14px; color: #1B3A5B; font-weight: 600;
    white-space: nowrap; align-self: flex-start;
}
.hl-cart-item__ctrl {
    display: flex; align-items: center; gap: 6px;
    margin-top: 8px;
}
.hl-qty-btn {
    width: 26px; height: 26px;
    border: 1px solid #E3DCCB;
    background: #fff;
    color: #1B3A5B;
    font-size: 15px; line-height: 1;
    cursor: pointer; border-radius: 4px;
    transition: background 0.15s ease;
}
.hl-qty-btn:hover { background: #F7F3EC; }
.hl-qty-input {
    width: 40px; height: 26px;
    text-align: center;
    border: 1px solid #E3DCCB; border-radius: 4px;
    font-size: 13px; color: #1B3A5B;
    box-sizing: border-box;
}
.hl-cart-item__del {
    margin-left: 8px;
    width: 26px; height: 26px;
    border: none; background: transparent;
    color: #c92a2a; font-size: 18px; line-height: 1;
    cursor: pointer; border-radius: 4px;
    transition: background 0.15s ease;
}
.hl-cart-item__del:hover { background: #fff1f1; }

/* ---------- 底部合计 + 按钮 ---------- */
.hl-cart-total {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 12px;
}
.hl-cart-total span { font-size: 14px; color: #536678; }
.hl-cart-total strong { font-size: 22px; color: #C8964A; }
.hl-cart-checkout-btn {
    display: block; width: 100%;
    padding: 12px;
    border: none; border-radius: 6px;
    background: #C8964A; color: #fff;
    font-size: 15px; cursor: pointer;
    transition: background 0.15s ease;
}
.hl-cart-checkout-btn:hover { background: #B5853A; }
.hl-cart-clear {
    display: block; width: 100%;
    margin-top: 8px;
    padding: 8px;
    border: none; background: transparent;
    color: #9aa7b5; font-size: 13px;
    cursor: pointer;
    transition: color 0.15s ease;
}
.hl-cart-clear:hover { color: #c92a2a; }

/* ---------- 结算表单 ---------- */
.hl-checkout-form { display: flex; flex-direction: column; gap: 12px; }
.hl-checkout-form__title { font-size: 15px; font-weight: 600; color: #1B3A5B; margin-bottom: 2px; }
.hl-checkout-form .hl-field { display: flex; flex-direction: column; }
.hl-checkout-form .hl-field label { font-size: 13px; color: #536678; margin-bottom: 5px; }
.hl-checkout-form .hl-field input,
.hl-checkout-form .hl-field textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #E3DCCB; border-radius: 6px;
    font-size: 14px; color: #1B3A5B; background: #fff;
    box-sizing: border-box; font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.hl-checkout-form .hl-field input:focus,
.hl-checkout-form .hl-field textarea:focus {
    outline: none; border-color: #C8964A;
    box-shadow: 0 0 0 3px rgba(200, 150, 74, 0.18);
}
.hl-field--summary {
    padding: 12px 14px;
    background: #FBFAF6; border-radius: 6px;
    font-size: 14px; color: #536678;
}
.hl-field--summary strong { color: #C8964A; }
.hl-checkout-feedback {
    padding: 10px 14px; border-radius: 6px;
    font-size: 13px; text-align: center;
    min-height: 0;
}
.hl-checkout-feedback.is-error { background: #fff1f1; color: #c92a2a; }
.hl-checkout-feedback.is-success { background: #e6f7ec; color: #1c7c43; }
.hl-checkout-feedback:empty { padding: 0; }

.hl-cart-back-btn {
    width: 100%; margin-bottom: 8px;
    padding: 10px; border: 1px solid #E3DCCB; border-radius: 6px;
    background: #fff; color: #536678;
    font-size: 14px; cursor: pointer;
    transition: background 0.15s ease;
}
.hl-cart-back-btn:hover { background: #F7F3EC; }
.hl-cart-submit-btn {
    width: 100%;
    padding: 12px; border: none; border-radius: 6px;
    background: #C8964A; color: #fff;
    font-size: 15px; cursor: pointer;
    transition: background 0.15s ease;
}
.hl-cart-submit-btn:hover { background: #B5853A; }
.hl-cart-submit-btn:disabled,
.hl-cart-back-btn:disabled { opacity: 0.6; cursor: default; }

body.hl-cart-open { overflow: hidden; }

/* ---------- 收款码弹层 ---------- */
.hl-pay-dialog {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    padding: 20px; box-sizing: border-box;
}
.hl-pay-backdrop {
    position: absolute; inset: 0;
    background: rgba(15, 28, 45, 0.55);
    opacity: 0; transition: opacity 0.2s ease;
}
.hl-pay-panel {
    position: relative;
    width: 100%; max-width: 400px;
    background: #fff; border-radius: 12px;
    box-shadow: 0 24px 60px rgba(15, 28, 45, 0.25);
    padding: 32px 28px 28px;
    box-sizing: border-box;
    text-align: center;
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    transition: transform 0.24s ease, opacity 0.24s ease;
}
.hl-pay-dialog.is-open .hl-pay-backdrop { opacity: 1; }
.hl-pay-dialog.is-open .hl-pay-panel { transform: translateY(0) scale(1); opacity: 1; }
.hl-pay-close {
    position: absolute; top: 12px; right: 14px;
    width: 34px; height: 34px;
    border: none; background: transparent;
    font-size: 26px; line-height: 1; color: #536678;
    cursor: pointer; border-radius: 50%;
    transition: background 0.15s ease;
}
.hl-pay-close:hover { background: #F7F3EC; color: #1B3A5B; }
.hl-pay-ok {
    width: 56px; height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: #e6f7ec;
    display: flex; align-items: center; justify-content: center;
}
.hl-pay-ok__icon { color: #1c7c43; font-size: 30px; font-weight: bold; }
.hl-pay-title { margin: 0 0 6px; font-size: 20px; color: #1B3A5B; }
.hl-pay-sub { margin: 0 0 18px; font-size: 14px; line-height: 1.6; color: #536678; }
.hl-pay-meta {
    border-top: 1px solid #EFE9D8;
    border-bottom: 1px solid #EFE9D8;
    padding: 12px 0; margin-bottom: 18px;
}
.hl-pay-meta__row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 4px 0;
}
.hl-pay-meta__row span { font-size: 13px; color: #8a97a5; }
.hl-pay-meta__row strong { font-size: 15px; color: #1B3A5B; }
.hl-pay-amount { color: #C8964A !important; font-size: 19px !important; }
.hl-pay-qr {
    /* 不再固定 200×200 正方形：按图片原始比例铺开，
       让竖图/方图都能完整显示，二维码尺寸最大化以保证可被微信扫描。 */
    width: 300px; max-width: 100%;
    margin: 0 auto 12px;
    padding: 12px;
    border: 1px solid #E3DCCB; border-radius: 8px;
    box-sizing: border-box;
}
.hl-pay-qr img {
    width: 100%; height: auto; max-height: 460px;
    object-fit: contain; display: block;
    cursor: zoom-in;
}
.hl-pay-hint { margin: 0 0 10px; font-size: 12px; color: #9aa7b5; line-height: 1.5; }

/* 点击二维码后的全屏放大层（长按可保存原图，扫码更清晰） */
.hl-pay-zoom {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    display: flex; align-items: center; justify-content: center;
    padding: 16px; box-sizing: border-box;
    opacity: 0; transition: opacity 0.2s ease;
}
.hl-pay-zoom.is-open { opacity: 1; }
.hl-pay-zoom img {
    max-width: 94vw; max-height: 86vh;
    object-fit: contain; display: block;
    border-radius: 6px;
}
.hl-pay-zoom__close {
    position: absolute; top: 14px; right: 18px;
    width: 40px; height: 40px;
    border: none; background: rgba(255,255,255,0.12);
    color: #fff; font-size: 26px; line-height: 1;
    border-radius: 50%; cursor: pointer;
}
.hl-pay-zoom__close:hover { background: rgba(255,255,255,0.22); }
.hl-pay-zoom__tip {
    position: absolute; bottom: 20px; left: 0; right: 0;
    text-align: center; color: rgba(255,255,255,0.7);
    font-size: 13px; line-height: 1.6;
}
.hl-pay-tip { margin: 0 0 10px; font-size: 13px; color: #536678; }
.hl-pay-noqr { padding: 20px; background: #FBFAF6; border-radius: 8px; margin-bottom: 12px; }
.hl-pay-noqr p { margin: 0; font-size: 13px; color: #8a97a5; line-height: 1.6; }
.hl-pay-note { margin: 0 0 18px; font-size: 12px; color: #9aa7b5; line-height: 1.6; }
.hl-pay-done {
    display: block; width: 100%;
    padding: 11px; border: none; border-radius: 6px;
    background: #C8964A; color: #fff;
    font-size: 15px; cursor: pointer;
    transition: background 0.15s ease;
}
.hl-pay-done:hover { background: #B5853A; }
body.hl-pay-open { overflow: hidden; }

/* ---------- 头部购物车图标（SVG） ---------- */
.hl-cart-icon {
    display: inline-block;
    vertical-align: middle;
    width: 20px; height: 20px;
}
.hl-cart-trigger { cursor: pointer; }

/* ---------- 详情页价格区 + 按钮布局 ---------- */
.xy-pd-price {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 10px 0 16px;
    padding: 10px 14px;
    background: #FBFAF6;
    border-radius: 6px;
    border-left: 3px solid #C8964A;
}
.xy-pd-price__label { font-size: 13px; color: #8a97a5; }
.xy-pd-price__value { font-size: 24px; color: #C8964A; font-weight: 700; }
.xy-pd-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

/* ---------- 列表卡片价格 + 加购 ---------- */
.xy-product-card__price {
    display: block;
    margin-top: 4px;
    font-size: 15px;
    color: #C8964A;
    font-weight: 600;
}
.xy-product-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}
.xy-product-card__foot .xy-product-card__link { flex-shrink: 0; }

/* ---------- 悬浮购物车按钮（移动端专用） ---------- */
/* 桌面端隐藏；移动端显示在右侧浮动按钮组（#go_top）顶部（回顶按钮上方）。
   尺寸/配色/间距完全对齐 .right-btn-group .to-top / .to-top2，与电话、邮件、
   回顶按钮融为一体。 */
.hl-float-cart { display: none; }
.hl-float-cart {
    position: relative;
    width: 58px;
    height: 58px;
    margin: 0 0 2px;
}
.hl-float-cart a {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin: 6px auto;
    border-radius: 50%;
    border: 0;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(145deg, #1B3A5B 0%, #0F2540 100%);
    box-shadow: 0 8px 20px rgba(15, 37, 64, .22);
    cursor: pointer;
    box-sizing: border-box;
    transition: transform .22s ease, box-shadow .22s ease, background .22s ease;
}
.hl-float-cart a:hover {
    transform: translateY(-2px) scale(1.04);
    background: linear-gradient(145deg, #254A6E 0%, #1B3A5B 100%);
    box-shadow: 0 12px 28px rgba(15, 37, 64, .28);
}
.hl-float-cart a svg { display: block; width: 20px; height: 20px; }
.hl-float-cart .hl-float-cart__badge {
    position: absolute;
    top: 0px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #e54848;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    border: 2px solid #fff;
    box-sizing: border-box;
    font-weight: 700;
    z-index: 2;
}

/* ---------- 移动端适配 ---------- */
/* 移动端：header 里的购物车图标隐藏（改用悬浮按钮），
   悬浮购物车按钮显示在右侧回到顶部按钮上方。 */
@media (max-width: 760px) {
    /* 隐藏 header 内的购物车图标，避免与悬浮按钮重复 */
    .preview-cart { display: none !important; }
    /* 悬浮购物车按钮显示（尺寸/配色已在基础规则里对齐 to-top） */
    .hl-float-cart { display: block; }
    /* 移动端按钮缩小，与 hualun-inner.css 的 .to-top/.to-top2 移动端尺寸一致 */
    .hl-float-cart { width: 50px; height: 50px; }
    .hl-float-cart a { width: 40px; height: 40px; margin: 5px auto; }
    /* 汉堡菜单里的购物车入口（点开菜单也能看到） */
    .preview-mobile-menu__cart {
        display: block;
        padding: 12px 18px;
        font-size: 15px;
        color: var(--ink, #243244);
        border-top: 1px solid #E3DCCB;
    }
    /* common/header（系统B）header 内购物车图标移动端隐藏 */
    .hl-top .hl-cart-trigger { display: none !important; }
}

/* 移动端抽屉全宽 + 结算表单优化 */
@media (max-width: 640px) {
    .hl-cart-drawer .hl-cart-head,
    .hl-cart-drawer .hl-cart-body,
    .hl-cart-drawer .hl-cart-foot { max-width: 100%; }
    .hl-cart-body { padding: 12px 14px; }
    .hl-cart-item__img { width: 56px; height: 56px; }
    .hl-pay-panel { padding: 26px 20px 22px; }
    .hl-pay-qr { width: 240px; }
    .hl-pay-qr img { max-height: 60vh; }
    .xy-pd-actions { gap: 10px; }
    .hl-add-cart-btn { padding: 10px 18px; font-size: 14px; }
    .xy-pd-price__value { font-size: 20px; }
}

