/* 购物车页 */

/* 购物车页有结算栏+tabbar，需要更多底部空间 */
body.has-tabbar { padding-bottom: 120px; }

/* 商品行 */
.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    transition: opacity .3s;
}
.cart-item img {
    width: 80px; height: 80px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}
.cart-check { width: 20px; height: 20px; flex-shrink: 0; cursor: pointer; accent-color: #e4393c; }

.cart-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cart-item-title { font-size: 14px; color: #333; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cart-item-spec  { font-size: 12px; color: #999; }
.cart-item-qty   { font-size: 15px; color: #333; font-weight: bold; }
.cart-item-price { font-size: 15px; color: #e4393c; font-weight: bold; }
.cart-item-ship  { font-size: 12px; color: #666; margin-top: 3px; }
.cart-item-ship .ship-updating { color: #f90; font-style: italic; }

.cart-item-del {
    background: none; border: none;
    color: #ccc; font-size: 20px; line-height: 1;
    cursor: pointer; flex-shrink: 0; padding: 4px;
}
.cart-item-del:hover { color: #e4393c; }

/* 底部结算栏 */
.cart-bar {
    position: fixed;
    bottom: 56px; left: 0; right: 0;
    background: #fff;
    border-top: 1px solid #eee;
    z-index: 91;
    box-shadow: 0 -2px 8px rgba(0,0,0,.08);
    display: flex;
    flex-direction: column;
}
.cart-bar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}
.cart-check-all {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; color: #333; cursor: pointer;
}
.cart-check-all input { width: 20px; height: 20px; cursor: pointer; accent-color: #e4393c; }
.cart-bar-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cart-bar-btns  { display: flex; gap: 8px; }
.cart-bar-total { font-size: 13px; color: #666; white-space: nowrap; }
.cart-bar-total strong { font-size: 17px; color: #e4393c; margin-left: 4px; }
.btn-checkout {
    background: #e4393c; color: #fff; border: none;
    border-radius: 6px; padding: 10px 22px;
    font-size: 15px; cursor: pointer; white-space: nowrap;
}
.btn-checkout:disabled { background: #ccc; cursor: not-allowed; }

/* 留出底部空间（多留一些给展开的 summary） */
#cart-list { padding-bottom: 80px; }

/* RTL */
[dir="rtl"] .cart-bar-right   { align-items: flex-start; }
[dir="rtl"] .cart-bar-btns    { direction: rtl; }
[dir="rtl"] .cart-bar-total strong { margin-left: 0; margin-right: 4px; }

/* ---- 加购/编辑浮层 ---- */
.cart-overlay {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 20px 16px 32px;
    z-index: 200;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform .3s ease;
}
.cart-overlay.open { transform: translateY(0); }

.cart-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.cart-overlay-title { font-size: 16px; font-weight: bold; color: #333; }
.cart-overlay-close {
    background: none; border: none;
    font-size: 20px; color: #999; cursor: pointer; padding: 4px;
}

.cart-overlay-img {
    width: 80px; height: 80px;
    object-fit: cover; border-radius: 8px;
    margin-bottom: 12px;
}

/* spec 组 */
.cart-overlay .tob-spec-group  { margin-bottom: 12px; }
.cart-overlay .tob-spec-label  { font-size: 13px; color: #666; margin-bottom: 8px; }
.cart-overlay .tob-spec-btns   { display: flex; flex-wrap: wrap; gap: 8px; }
.cart-overlay .tob-spec-btn    {
    border: 1px solid #ddd; border-radius: 4px;
    padding: 5px 12px; font-size: 13px; background: #fafafa;
    cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.cart-overlay .tob-spec-btn.selected {
    border-color: #e4393c; color: #e4393c; background: #fff5f5;
}
.cart-overlay .color-swatch {
    display: inline-block; width: 18px; height: 18px;
    border-radius: 3px; background-size: cover; border: 1px solid #eee;
}

/* 数量控件 */
.cart-overlay-qty {
    display: flex; align-items: center; gap: 12px;
    margin: 16px 0;
}
.cart-overlay-qty label { font-size: 14px; color: #666; }
.cart-overlay-qty .tob-qty-ctrl {
    display: flex; align-items: center; gap: 8px;
}
.cart-overlay-qty .tob-qty-btn {
    width: 32px; height: 32px; border: 1px solid #ddd;
    border-radius: 4px; background: #f5f5f5;
    font-size: 18px; line-height: 1; cursor: pointer;
}
.cart-overlay-qty input[type="number"] {
    width: 50px; text-align: center;
    border: none; border-bottom: 1px solid #ddd;
    border-radius: 0;
    padding: 6px 4px; font-size: 15px;
    outline: none; background: transparent;
}

/* 确认按钮 */
.cart-overlay-confirm {
    width: 100%; padding: 12px;
    background: #e4393c; color: #fff;
    border: none; border-radius: 8px;
    font-size: 16px; cursor: pointer; margin-top: 8px;
}
.cart-overlay-confirm:disabled { background: #ccc; cursor: not-allowed; }

/* 行内数量加减控件 */
.cart-item-qty-ctrl {
    display: flex; align-items: center; gap: 4px;
}
.cart-item-qty-btn {
    width: 26px; height: 26px;
    border: 1px solid #ddd; border-radius: 4px;
    background: #f5f5f5; color: #333;
    font-size: 16px; line-height: 1;
    cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.cart-item-qty-btn:active { background: #eee; }
.cart-item-qty-num {
    min-width: 28px; text-align: center;
    font-size: 14px; color: #333; font-weight: bold;
    user-select: none;
}

/* 批量删除按钮 */
.cart-bar-del {
    background: #fff; color: #e4393c;
    border: 1px solid #e4393c; border-radius: 6px;
    padding: 9px 14px; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.cart-bar-del:disabled { color: #ccc; border-color: #ccc; cursor: not-allowed; }

/* USD 参考价 */
.cart-bar-usd { font-size: 11px; color: #999; margin-top: 2px; }

/* spec 箭头触发区 */
.cart-item-spec-wrap {
    display: flex; align-items: center; gap: 6px; cursor: pointer;
}
.cart-item-spec-arrow {
    font-size: 14px; color: #aaa; user-select: none;
    padding: 2px 6px;
    min-width: 24px; text-align: center;
}

/* RTL */
[dir="rtl"] .cart-overlay { border-radius: 16px 16px 0 0; }

/* 结算弹窗 input 统一样式 */
.cart-order-modal input[type="text"],
.cart-order-modal input[type="tel"],
.cart-order-modal input[type="number"],
.cart-order-modal textarea { width:100%; border:1px solid #ddd; border-radius:6px; padding:10px 12px; font-size:14px; outline:none; margin-bottom:10px; display:block; box-sizing:border-box; }
.cart-order-modal textarea { resize:none; rows:2; }
.cart-order-modal input:focus,
.cart-order-modal textarea:focus { border-color:#e4393c; }

/* 验证码输入框 */
#cart-verify-code { width:100%; border:1px solid #ddd; border-radius:6px; padding:10px 12px; font-size:24px; letter-spacing:8px; text-align:center; outline:none; margin-bottom:10px; display:block; box-sizing:border-box; }
#cart-verify-code:focus { border-color:#e4393c; }
#ai-fab { display: none !important; }
.cart-summary {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 0 16px;
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease, padding .25s ease;
}
.cart-summary.open {
    max-height: 300px;
    padding: 10px 16px 6px;
}
.cart-summary:empty { display: none; }
.cart-summary-toggle {
    display: block;
    width: 100%;
    font-size: 13px;
    font-weight: 600;
    color: #e4393c;
    background: #fff5f5;
    border: none;
    border-bottom: 1px solid #f5d0d0;
    padding: 8px 16px;
    cursor: pointer;
    text-align: center;
    letter-spacing: 0.5px;
}
.cart-summary-toggle:disabled {
    color: #bbb;
    background: #fafafa;
    border-bottom-color: #eee;
    cursor: not-allowed;
}
.cart-summary-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #555; padding: 5px 0; border-bottom: 1px dashed #f0f0f0; }
.cart-summary-row:last-child { border-bottom: none; }
.cart-summary-freight span:last-child { color: #999; font-size: 12px; }
.cart-summary-total { font-weight: 700; font-size: 15px; color: #e4393c; border-top: 1px solid #eee; margin-top: 4px; padding-top: 8px; }

/* 预估重量/运费 */
.cart-item-est      { font-size: 11px; color: #6b7280; margin-top: 2px; }
.cart-item-est-note { font-size: 10px; color: #9ca3af; }
.cart-item-est-warn { font-size: 11px; color: #d97706; margin-top: 2px; font-weight: 500; }
.cart-bar-est-freight { font-size: 12px; color: #2563eb; margin-top: 3px; }
