/* ============================================================
 * Cart.css — Cart.html 独立样式
 * ============================================================ */

body {
            display: flex;
            flex-direction: column;
            height: 100%;
            width: 100%;
            background: #f5f5f5;
            font-family: Arial, sans-serif;
            color: #222;
            -webkit-text-size-adjust: 100%;
            text-size-adjust: 100%;
            -webkit-tap-highlight-color: transparent;
            /* 底部固定层总高 = 合计栏 #cartFoot(1.88rem) + 底部导航 #bottom-nav(1.67rem) */
            padding-bottom: calc(3.55rem + env(safe-area-inset-bottom, 0px));
            box-sizing: border-box;
        }
        /* APP 内嵌 WebView：无底部导航，仅合计栏贴底，预留合计栏高度即可 */
        html.no-bottom-nav body,
        body.no-bottom-nav {
            padding-bottom: calc(1.88rem + env(safe-area-inset-bottom, 0px));
        }
.tab-bar .tab-btn.active::after { background: #2196f3; opacity: 0.5; }
/* ====== 列表头部：商品卡片标题 + 清空按钮 ====== */
        .cart-list-header {
            position: sticky; top: 0; z-index: 3;
            display: none;
            align-items: center;
            padding: 0.36rem 0.31rem 0.16rem 0.31rem;
            background: #fff;
            border-radius: 0.47rem 0.47rem 0 0;
            flex-shrink: 0;
        }
.cart-list-header .cart-list-title {
            font-size: 0.37rem;
            font-weight: 400;
            color: #555;
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            display: none;
        }
.cart-list-header .clear-btn { margin-left: auto; }
/* 列表头部左侧「分类」入口（九宫格图标，替换原「商品」标题） */
.cart-list-header .cart-header-category-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            color: #555;
            background: transparent;
            border: none;
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
            outline: none;
            flex-shrink: 0;
        }
.cart-list-header .cart-header-category-btn:focus,
        .cart-list-header .cart-header-category-btn:focus-visible,
        .cart-list-header .cart-header-category-btn:active { outline: none; }
.cart-list-header .cart-header-category-btn svg { width: 0.44rem; height: 0.44rem; display: block; flex-shrink: 0; }
.clear-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 0;
            font-size: 0.26rem;
            color: #555;
            background: transparent;
            border: none;
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
            outline: none;
            flex-shrink: 0;
        }
.clear-btn > * + * { margin-top: 2px; }
.clear-btn:focus,
        .clear-btn:focus-visible,
        .clear-btn:active { outline: none; }
.clear-btn svg { width: 0.44rem; height: 0.44rem; display: block; flex-shrink: 0; }
/* ====== 主内容区（PaidOrder 同款 #scroll-root） ====== */
/* 只覆盖 body 的 overflow，让 #scroll-root 处理滚动；html 保持 overflow:hidden（iOS 需要，否则 document 拦截手势） */
        html.scroll-root-page body { overflow: visible; }
#scroll-root {
            flex: 1;
            min-height: 0;
            height: auto;
            overflow-y: auto;
            /* iOS：整页滚动容器用 auto（对齐 Order/PaidOrder），避免与内层横向列表的手势冲突吞掉垂直滑动 */
            -webkit-overflow-scrolling: auto;
            background: #f5f5f5;
            display: flex;
            flex-direction: column;
            -ms-overflow-style: none;
            scrollbar-width: none;
            /* body 已用 padding-bottom 为底部固定层预留空间，滚动容器内不再重复预留 */
            padding-bottom: 0;
        }
#scroll-root::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* ====== 物品列表父级白框 ====== */
        .cart-list-wrap {
            margin: 0 0.31rem 0 0.31rem;
            background: #fff;
            border-radius: 0.47rem;
            overflow: hidden;
            flex-shrink: 0;
        }
/* ====== 物品列表 ====== */
        .cart-items { padding: 0 0.26rem 0.26rem 0.26rem; box-sizing: border-box; min-height: 2.25rem; }
/* ── 仓库卡片 ── */
        .warehouse-card, .condition-box {
            background: #fff; border: none; border-radius: 0.21rem;
            box-shadow: none; padding: 0.08rem 0 0.1rem 0;
            margin: 0.18rem 0 0.16rem 0; position: relative; overflow: hidden;
            /* 不能加 overscroll-behavior: contain —— 会阻断垂直滚动链，导致手指在卡片/列表项上时整页无法上下滚（参考首页） */
            touch-action: pan-y;
            transition: height 0.28s ease;
        }
/* 已加载完毕 - 分割线 + 提示文字 */
        .cart-end-divider {
            height: 1px;
            margin: 0 0.16rem;
            background: #eee;
        }
.cart-end-text {
            padding: 0.37rem 0;
            text-align: center;
            color: #999;
            font-size: 0.31rem;
            flex-shrink: 0;
        }
.cart-items > :last-child::after { display: none; }
.warehouse-card-inner {
            width: 200%; display: flex; align-items: flex-start;
            transition: transform .28s ease; transform: translateX(0);
            position: relative; top: 0;
        }
.warehouse-card-page {
            width: 50%; flex: 0 0 50%; box-sizing: border-box;
            padding-right: 0; align-self: flex-start;
            margin-top: 0; padding-top: 0; position: relative; top: 0;
        }
.warehouse-card-page.page-1 .condition-footer {
            text-align: right; font-size: 0.26rem; color: #444;
            padding: 0 0.16rem 0.26rem 0.16rem; margin-top: 0;
            border-top: none; line-height: 1.8;
        }
.warehouse-card-page.page-2 {
            font-size: 0.29rem; padding-top: 0; margin-top: 0;
            align-self: flex-start;
            max-height: 60vh;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
.warehouse-card-page.page-2 .warehouse-summary-text {
            padding: 0.13rem 0.08rem 0.37rem 0.08rem; color: #333;
            line-height: 1.6; white-space: pre-line;
            margin: 0; display: block;
        }
.warehouse-cangku { color: #1976d2; font-weight: bold; }
.warehouse-baoguo { color: #1976d2; }
.warehouse-note { color: #aaa; font-size: 0.26rem; }
/* ── 商品卡片（与 HtmlPage2 .product-card 完全一致） ── */
        .product-card {
            display: flex; flex-direction: row; align-items: stretch;
            border-radius: 0.08rem; min-width: 0; box-sizing: border-box;
            padding: 0.34rem 0; left: 0;
        }
.product-info {
            font-size: 0.31rem; display: flex; flex-direction: column;
            align-items: flex-start; text-align: left; position: relative;
            margin-right: 0; margin-left: 0.26rem; flex: 1; min-width: 0;
            min-height: 2.2rem; box-sizing: border-box; padding-right: 0.5em;
            overflow: hidden;
        }
.img-crop-box {
            width: 2.3rem; height: 2.76rem; overflow: hidden;
            border: 1px solid #eee; border-radius: 0.21rem;
            position: relative; left: 1px;
        }
.img-crop-box .product-img,
.img-crop-box .cart-img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            object-position: top;
            display: block;
        }
.product-img.no-image {
            background: #f5f5f5; display: flex; align-items: center;
            justify-content: center; width: 2.3rem; height: 2.76rem;
            border: 1px solid #eee; margin-bottom: 0; margin-right: 0.37rem;
            font-size: 0.31rem; text-align: center; line-height: 3.35rem;
            color: #b0b0b0; font-weight: bold; border-radius: 0.13rem;
        }
.img-qty-badge {
            position: absolute; top: 0.08rem; right: 0.08rem;
            width: 0.39rem; height: 0.39rem; border-radius: 50%;
            background: #2196f3; color: #fff; font-size: 0.26rem;
            font-weight: bold; display: flex; align-items: center;
            justify-content: center; line-height: 1; z-index: 2;
            box-shadow: 0 2px 0.21rem rgba(0,0,0,0.12);
            pointer-events: none; user-select: none;
        }
.product-guige { font-size: 0.31rem; margin: 0 0 0.21rem 0; line-height: 1.15; display: flex; justify-content: space-between; align-items: baseline; align-self: stretch; color: #222; }
.product-guige > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.product-meta { font-size: 0.29rem; margin: 0 0 0.21rem 0; line-height: 1.15; color: #b0b0b0; }
.product-price { font-size: 0.39rem; font-weight: bold; margin: 0 0 0.21rem 0; }
.product-yunfei { font-size: 0.29rem; }
.product-qty-badge {
            position: static;
            color: #606a74;
            font-size: 0.31rem; font-weight: 500; line-height: 1;
            flex-shrink: 0;
        }
/* ── 赠品卡片（商品列表外框下方，独立白框，可左右滑动 + 右上角圆角选框） ── */
.cart-gift-strip {
            margin: 0.26rem 0.31rem 0 0.31rem;
            background: #fff;
            border-radius: 0.47rem;
            padding: 0.53rem 0.31rem 0.26rem 0.31rem;
            box-sizing: border-box;
            flex-shrink: 0;
        }
.cart-gift-strip-head {
            font-size: 0.34rem;
            color: #555;
            font-weight: 400;
            margin-bottom: 0.32rem;
        }
.cart-gift-scroll {
            display: flex;
            flex-wrap: nowrap;
            overflow-x: auto;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
            -ms-overflow-style: none;
            padding: 0.02rem 0.02rem 0.22rem 0.02rem;
            touch-action: pan-x pan-y;
        }
.cart-gift-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* iOS Safari < 14.5 不支持 flex gap，用 margin 间隔 */
.cart-gift-scroll > .cart-gift-card + .cart-gift-card { margin-left: 0.18rem; }
.cart-gift-card {
            position: relative;
            flex: 0 0 auto;
            width: 2.1rem;
            box-sizing: border-box;
            background: #fff;
            border: none;
            border-radius: 0.16rem;
            padding: 0.1rem 0.1rem 0.12rem 0.1rem;
            display: flex;
            flex-direction: column;
            align-items: stretch;
            transition: background .15s, border-color .15s;
        }
.cart-gift-card.is-selected {
            background: #fff;
        }
.cart-gift-img {
            width: 100%;
            aspect-ratio: 5 / 6;
            border-radius: 0.12rem;
            overflow: hidden;
            background: #f5f5f5;
            display: flex;
            align-items: flex-start;
            justify-content: center;
            cursor: pointer;
        }
.cart-gift-img img {
            width: 100%;
            height: auto;
            object-position: top;
            display: block;
        }
.cart-gift-title {
            font-size: 0.26rem;
            color: #333;
            line-height: 1.25;
            margin-top: 0.1rem;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            min-height: 0.65rem;
        }
.cart-gift-spec {
            font-size: 0.22rem;
            color: #999;
            line-height: 1.2;
            word-break: break-all;
            margin-top: 0.06rem;
            display: -webkit-box;
            -webkit-line-clamp: 1;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
.cart-gift-price {
            font-size: 0.34rem;
            color: #f44336;
            font-weight: bold;
            margin-top: 0.06rem;
        }
.cart-gift-noimg {
            width: 100%;
            height: 100%;
            min-height: 1.6rem;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #b0b0b0;
            font-size: 0.24rem;
            background: #f5f5f5;
        }
.cart-gift-check {
            position: absolute;
            top: 0.2rem;
            right: 0.12rem;
            width: 0.42rem;
            height: 0.42rem;
            border-radius: 50%;
            border: 0.03rem solid #d0d0d0;
            background: rgba(255,255,255,0.92);
            box-sizing: border-box;
            cursor: pointer;
            z-index: 2;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background .15s, border-color .15s;
        }
/* 选框隐藏外圈：扩大点击热区，防止点选框外围误触图片跳详情 */
.cart-gift-check::before {
            content: '';
            position: absolute;
            top: -0.18rem;
            left: -0.18rem;
            right: -0.18rem;
            bottom: -0.18rem;
            border-radius: 50%;
        }
.cart-gift-check.checked {
            background: #2196f3;
            border-color: #2196f3;
        }
.cart-gift-check.checked::after {
            content: '';
            width: 0.2rem;
            height: 0.11rem;
            border-left: 0.04rem solid #fff;
            border-bottom: 0.04rem solid #fff;
            transform: rotate(-45deg) translate(0.01rem, -0.02rem);
        }
/* ====== 空态 ====== */
        .cart-empty {
            display: flex; flex-direction: column; align-items: center;
            justify-content: center; height: 3.2rem;
            color: #b0b0b0; font-size: 0.31rem;
        }
.cart-empty > * + * { margin-top: 0.21rem; }
.cart-empty .cart-empty-category-btn {
    display: flex; align-items: center; justify-content: center;
    color: #b0b0b0;
    background: transparent; border: none; cursor: pointer;
    padding: 0.1rem; border-radius: 50%;
    -webkit-tap-highlight-color: transparent; outline: none;
}
.cart-empty .cart-empty-category-btn svg { width: 0.6rem; height: 0.6rem; display: block; }
.cart-empty .cart-empty-category-btn:focus,
.cart-empty .cart-empty-category-btn:focus-visible,
.cart-empty .cart-empty-category-btn:active { outline: none; }
.cart-spinner {
    display: block; width: 0.53rem; height: 0.53rem;
    border: 0.05rem solid #e0e0e0;
    border-top-color: #999;
    border-radius: 50%;
    animation: cart-spin 0.8s linear infinite;
}
@keyframes cart-spin { to { transform: rotate(360deg); } }
/* ====== 优惠券面板 ====== */
        .coupon-panel { padding: 0.26rem; }
.coupon-panel .cp-empty {
            display: flex; flex-direction: column; align-items: center;
            justify-content: center; height: 45vh; color: #b0b0b0;
            font-size: 0.39rem;
        }
.coupon-panel .cp-empty > * + * { margin-top: 0.16rem; }
.coupon-panel .cp-empty .ico { font-size: 0.91rem; }
.coupon-panel .cp-empty .sub { font-size: 0.31rem; color: #ccc; }
/* ====== 价格面板（与 CPC 购物车抽屉完全一致） ====== */
        .price-panel { padding: 0.31rem 0.31rem; }
.pb-formula {
            display: flex; align-items: center; justify-content: center;
            flex-wrap: wrap; padding: 0.26rem 0.37rem;
            background: #fff; border-radius: 0.26rem;
            font-size: 0.37rem; font-weight: 700; color: #f44336;
            margin-bottom: 0.21rem;
        }
.pb-formula > * { margin-right: 0.13rem; margin-bottom: 0.13rem; }
.pb-formula .pb-fm-symbol { color: #bbb; font-weight: 400; margin: 0 2px; }
.pb-formula .pb-fm-deduct { color: #1976d2; }
.pb-formula .pb-fm-add { color: #999; }
.pb-formula .pb-fm-equal { color: #ff9800; font-weight: 700; }
.pb-card { background: #fff; border-radius: 0.26rem; padding: 0; overflow: hidden; margin-bottom: 0; }
.pb-row {
            display: flex; justify-content: space-between; align-items: center;
            padding: 0.21rem 0.37rem; font-size: 0.34rem; color: #333;
        }
.pb-divider { display: none; }
.pb-label { color: #666; font-size: 0.34rem; }
.pb-row-tag {
            display: inline-block; font-size: 0.26rem; font-weight: 500;
            border-radius: 0.08rem; padding: 1px 0.1rem;
            margin-left: 0.1rem; vertical-align: middle;
        }
.pb-row-tag.green { background: #e8f5e9; color: #4caf50; }
.pb-row-tag.orange { background: #e3f2fd; color: #1976d2; }
.pb-val { font-weight: 600; color: #f44336; font-size: 0.34rem; }
.pb-val.discount { color: #1976d2; }
.pb-val.shipping { color: #999; }
.pb-divider-final { height: 1px; background: #f0f0f0; margin: 0.21rem 0.37rem; }
.pb-final-card {
            background: #fff; border-radius: 0.26rem;
            padding: 0.26rem 0.37rem; margin-bottom: 0.21rem;
            display: flex; justify-content: space-between; align-items: center;
        }
.pb-final-card .pb-footer-label { font-size: 0.37rem; font-weight: 500; color: #666; }
.pb-final-card .pb-footer-val { font-size: 0.42rem; font-weight: 700; color: #ff9800; }
.pb-final-card .pb-footer-val .pb-yuan { font-size: 0.31rem; font-weight: 500; }
/* ====== 优惠券卡片 ====== */
        .cp-use-btn {
            background: #ff9800; color: #fff; border: none;
            border-radius: 0.31rem; padding: 0.08rem 0.26rem;
            font-size: 0.29rem; font-weight: 600; cursor: pointer;
            white-space: nowrap; line-height: 1.5;
        }
.cp-use-btn:active { background: #e68900; }
/* ====== 底部栏（HtmlPage2 风格） ====== */
        #cartFoot {
            position: fixed; left: 0; bottom: calc(1.67rem + env(safe-area-inset-bottom, 0px)); width: 100vw; height: 1.88rem;
            background: #fff;
            border-top: 1px solid #F5F5F5;
            display: flex; align-items: center; justify-content: space-between;
            z-index: 100; padding: 0 0.5rem; box-sizing: border-box;
            will-change: transform;
        }
        /* 推荐区不再为底部栏预留大间距（scroll-root/body 已统一预留） */
        .cart-body .home-recommend-section {
            padding-bottom: 0.4rem;
        }
#cartFoot .total-wrap {
            display: flex; flex-direction: column;
        }
#cartFoot .total-price {
            font-size: 0.42rem; font-weight: 700; line-height: 1.3;
            color: #f44336;
        }
#cartFoot .total-price .total-label {
            color: #1976d2; font-size: 0.37rem; font-weight: 700;
        }
#cartFoot .total-sub {
            font-size: 0.31rem; color: #b0b0b0;
            font-weight: normal; margin-top: 0.08rem;
        }
#cartFoot .checkout-btn {
            background: #2196f3; color: #fff;
            border: none; border-radius: 0.68rem 0 0 0.68rem;
            font-size: 0.34rem; font-weight: 700;
            padding: 0.31rem 0.73rem 0.31rem 0.84rem;
            cursor: pointer;
            box-shadow: 0 1px 0.08rem rgba(33,150,243,.12);
            transition: background .2s;
            -webkit-tap-highlight-color: transparent;
            outline: none;
            margin-right: -0.5rem;
        }
#cartFoot .checkout-btn:focus,
        #cartFoot .checkout-btn:focus-visible,
        #cartFoot .checkout-btn:active { outline: none; background: #2196f3; }
#cartFoot .checkout-btn:disabled {
            background: #bbdefb; color: #fff; cursor: not-allowed; box-shadow: none;
        }
/* ── 同仓库商品推荐（横向滑动 + 右上角圆形选择框，与 Order.css 一致）── */
.same-warehouse { padding: 0 0.16rem 0.12rem 0.16rem; }
.same-warehouse:empty { display: none; }
.same-wh-label {
            font-size: 0.28rem;
            color: #888;
            margin-bottom: 0.16rem;
            padding-left: 0.04rem;
        }
.same-wh-scroll {
            display: flex;
            gap: 0.20rem;
            overflow-x: auto;
            overflow-y: hidden;
            scrollbar-width: none;
            /* 不加 -webkit-overflow-scrolling: touch —— iOS 上嵌套的 touch 动量容器会吞掉垂直手势，导致从列表上开始的上下滑无法滚整页 */
            padding: 0.04rem 0.04rem 0.16rem;
            /* pan-x pan-y：左右滑列表、上下滑整页（仅 pan-x 会拦截垂直手势导致整页无法上下滚） */
            touch-action: pan-x pan-y;
            overscroll-behavior-x: contain;
        }
.same-wh-scroll::-webkit-scrollbar { display: none; }
.same-wh-card {
            position: relative;
            flex: 0 0 auto;
            width: 2.2rem;
            background: #fff;
            border: 1px solid #f0f0f0;
            border-radius: 0.16rem;
            padding: 0.14rem;
            box-sizing: border-box;
        }
.same-wh-check {
            position: absolute;
            top: 0.2rem;
            right: 0.2rem;
            width: 0.4rem;
            height: 0.4rem;
            border-radius: 50%;
            border: 0.04rem solid #d0d0d0;
            background: rgba(255, 255, 255, 0.8);
            z-index: 2;
            cursor: pointer;
            box-sizing: border-box;
            transition: all .15s;
        }
.same-wh-check::before {
            content: '';
            position: absolute;
            top: -0.2rem;
            left: -0.2rem;
            right: -0.2rem;
            bottom: -0.2rem;
            border-radius: 50%;
        }
.same-wh-check.checked {
            border-color: #2196f3;
            background: #2196f3;
        }
.same-wh-check.checked::after {
            content: '';
            position: absolute;
            left: 50%;
            top: 46%;
            width: 0.17rem;
            height: 0.09rem;
            border-left: 0.04rem solid #fff;
            border-bottom: 0.04rem solid #fff;
            transform: translate(-50%, -50%) rotate(-45deg);
        }
.same-wh-img {
            width: 100%;
            height: 2.2rem;
            object-fit: cover;
            object-position: top;
            border-radius: 0.10rem;
            display: block;
            margin-bottom: 0.12rem;
        }
.same-wh-noimg {
            display: flex;
            align-items: center;
            justify-content: center;
            background: #f5f5f5;
            color: #b0b0b0;
            font-size: 0.26rem;
        }
.same-wh-title {
            font-size: 0.26rem;
            color: #333;
            line-height: 1.3;
            word-break: break-all;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            min-height: 0.68rem;
            margin-bottom: 0.06rem;
        }
.same-wh-spec {
            font-size: 0.22rem;
            color: #999;
            line-height: 1.2;
            word-break: break-all;
            margin-bottom: 0.08rem;
            display: -webkit-box;
            -webkit-line-clamp: 1;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
.same-wh-price {
            font-size: 0.28rem;
            color: #f44336;
            font-weight: bold;
        }

/* ── 商品卡片：框高度对齐左边图片，文字与加购组件上下间距自适应（与 Order.css 一致）── */
.warehouse-card-page.page-1 .product-info {
            height: 2.76rem;
            min-height: 2.76rem;
            justify-content: flex-start;
            overflow: hidden;
        }
.warehouse-card-page.page-1 .product-title {
            margin: 0 0 0.12rem 0 !important;
            line-height: 1.3;
        }
.warehouse-card-page.page-1 .product-guige {
            margin: 0 0 0.12rem 0 !important;
        }
.warehouse-card-page.page-1 .product-meta {
            margin: 0 0 0.12rem 0 !important;
        }
.warehouse-card-page.page-1 .cart-action-wrap {
            margin-top: auto !important;
            margin-bottom: 0 !important;
        }

/* PC 宽屏：bottom-nav 隐藏，清除 body 为底部导航预留的 padding；
   为底部固定层（合计栏 #cartFoot 1.88rem + 备案栏 #home-filing-bar 约 0.74rem）预留空间，
   避免内容滚动到底时被遮挡；#cartFoot 初始贴底，JS 接管后随备案栏推拉上下移动 */
@media (min-width: 1070px) {
    body {
        padding-bottom: 0 !important;
    }
    #scroll-root {
        padding-bottom: 2.62rem !important;
        width: 96vw;
        max-width: 96vw;
        margin-left: auto;
        margin-right: auto;
    }
    #cartFoot {
        bottom: -2px;
    }
}