/**
 * 购物车页面样式 - 简洁左右两栏布局
 * 配色：#1a1f36 (深蓝) / #ff6b35 (珊瑚橙) / #faf8f3 (米白)
 */

/* ===== 容器与标题 ===== */
.cart-wrapper {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
}

.cart-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.cart-title {
    font-size: 1.85rem;
    font-weight: 800;
    color: #1a1f36;
    margin: 0;
    letter-spacing: -0.02em;
}

.cart-count-badge {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ff6b35;
    background: #fff3ed;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

/* ===== 左右布局 ===== */
.cart-layout {
    display: flex;
    gap: 1.75rem;
    align-items: flex-start;
}

.cart-left {
    flex: 1 1 auto;
    min-width: 0;
}

.cart-right {
    flex: 0 0 360px;
    max-width: 360px;
}

/* ===== 左侧商品卡片 ===== */
.cart-products-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    border: 1px solid #eeebe3;
}

.cart-table-responsive {
    overflow-x: auto;
}

/* 表格 */
.shop_table.cart {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 0 !important;
}

.shop_table.cart thead th {
    background: #faf8f3 !important;
    color: #6b7280 !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    padding: 0.85rem 1.25rem !important;
    text-align: left !important;
    border-bottom: 1px solid #eeebe3 !important;
    white-space: nowrap !important;
}

.shop_table.cart .product-remove    { width: 40px !important; text-align: center !important; }
.shop_table.cart .product-thumbnail { width: 72px !important; text-align: center !important; }
.shop_table.cart .product-name      { width: auto !important; }
.shop_table.cart .product-price    { width: 90px !important; text-align: center !important; }
.shop_table.cart .product-quantity  { width: 110px !important; text-align: center !important; }
.shop_table.cart .product-subtotal { width: 100px !important; text-align: right !important; }

.shop_table.cart tbody tr {
    border-bottom: 1px solid #f3f0e8 !important;
    transition: background 0.15s !important;
}

.shop_table.cart tbody tr:last-child {
    border-bottom: none !important;
}

.shop_table.cart tbody tr:hover {
    background: #fdfcfa !important;
}

.shop_table.cart td {
    padding: 1.15rem 1.25rem !important;
    vertical-align: middle !important;
    border: none !important;
}

/* 删除按钮 */
.shop_table.cart .remove {
    color: #d1d5db !important;
    font-size: 1.3rem !important;
    font-weight: 300 !important;
    text-decoration: none !important;
    width: 26px !important;
    height: 26px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    transition: all 0.2s !important;
    line-height: 1 !important;
}

.shop_table.cart .remove:hover {
    color: #ef4444 !important;
    background: #fef2f2 !important;
}

/* 商品图 */
.shop_table.cart .product-thumbnail img {
    width: 68px !important;
    height: 68px !important;
    object-fit: cover !important;
    border-radius: 12px !important;
    border: 1px solid #eeebe3 !important;
    background: #faf8f3 !important;
    display: block !important;
    margin: 0 auto !important;
}

/* 商品名 */
.shop_table.cart .product-name a {
    color: #1a1f36 !important;
    font-weight: 600 !important;
    font-size: 0.92rem !important;
    text-decoration: none !important;
    line-height: 1.4 !important;
    transition: color 0.2s !important;
}

.shop_table.cart .product-name a:hover {
    color: #ff6b35 !important;
}

.shop_table.cart .product-name .variation {
    font-size: 0.75rem !important;
    color: #9ca3af !important;
    margin-top: 0.3rem !important;
    display: block !important;
}

/* 价格 */
.shop_table.cart .product-price {
    color: #6b7280 !important;
    font-weight: 500 !important;
    font-size: 0.88rem !important;
    text-align: center !important;
}

.shop_table.cart .product-subtotal {
    color: #1a1f36 !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    text-align: right !important;
}

/* 数量输入 */
.shop_table.cart .quantity input {
    width: 56px !important;
    padding: 0.4rem 0.3rem !important;
    border-radius: 8px !important;
    border: 1.5px solid #e5e7eb !important;
    text-align: center !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    color: #1a1f36 !important;
    outline: none !important;
    transition: border-color 0.2s !important;
    background: #fff !important;
}

.shop_table.cart .quantity input:focus {
    border-color: #ff6b35 !important;
}

/* 底部操作行 */
.cart-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid #eeebe3;
    background: #faf8f3;
    gap: 1rem;
    flex-wrap: wrap;
}

.continue-shopping-link {
    color: #6b7280 !important;
    font-weight: 600 !important;
    font-size: 0.88rem !important;
    text-decoration: none !important;
    transition: color 0.2s !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
}

.continue-shopping-link:hover {
    color: #ff6b35 !important;
}

.update-cart-btn {
    background: #1a1f36 !important;
    color: #fff !important;
    padding: 0.55rem 1.4rem !important;
    border-radius: 9999px !important;
    border: none !important;
    font-weight: 600 !important;
    font-size: 0.82rem !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
}

.update-cart-btn:hover {
    background: #2d3350 !important;
}

/* ===== 右侧订单摘要卡片 ===== */
.cart-summary-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    border: 1px solid #eeebe3;
    position: sticky;
    top: 1.5rem;
}

.cart-summary-title {
    font-size: 1.1rem !important;
    font-weight: 800 !important;
    color: #1a1f36 !important;
    margin: 0 0 1.25rem !important;
    padding-bottom: 0.85rem !important;
    border-bottom: 2px solid #f3f0e8 !important;
    letter-spacing: -0.01em !important;
}

/* 优惠券行 */
.cart-coupon-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.coupon-input {
    flex: 1;
    padding: 0.6rem 0.9rem !important;
    border-radius: 10px !important;
    border: 1.5px solid #e5e7eb !important;
    font-size: 0.85rem !important;
    outline: none !important;
    transition: border-color 0.2s !important;
    background: #faf8f3 !important;
    min-width: 0;
}

.coupon-input:focus {
    border-color: #ff6b35 !important;
    background: #fff !important;
}

.coupon-apply-btn {
    background: #1a1f36 !important;
    color: #fff !important;
    padding: 0.6rem 1.1rem !important;
    border-radius: 10px !important;
    border: none !important;
    font-weight: 600 !important;
    font-size: 0.82rem !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
    white-space: nowrap !important;
}

.coupon-apply-btn:hover {
    background: #2d3350 !important;
}

/* 总计表格 */
.cart_totals {
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
}

.cart_totals h2 {
    display: none !important;
}

.cart_totals table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 0 !important;
}

.cart_totals table th,
.cart_totals table td {
    padding: 0.65rem 0 !important;
    font-size: 0.9rem !important;
    border: none !important;
}

.cart_totals table th {
    text-align: left !important;
    font-weight: 500 !important;
    color: #6b7280 !important;
}

.cart_totals table td {
    text-align: right !important;
    font-weight: 600 !important;
    color: #1a1f36 !important;
}

.cart_totals table tr {
    border-bottom: 1px solid #f3f0e8 !important;
}

.cart_totals table tr:last-child {
    border-bottom: none !important;
}

.cart_totals table .order-total th,
.cart_totals table .order-total td {
    padding-top: 1rem !important;
    padding-bottom: 0.5rem !important;
    border-top: 2px solid #1a1f36 !important;
    border-bottom: none !important;
}

.cart_totals table .order-total th {
    font-size: 1rem !important;
    font-weight: 800 !important;
    color: #1a1f36 !important;
}

.cart_totals table .order-total td {
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    color: #ff6b35 !important;
}

/* 结算按钮 */
.cart_totals .wc-proceed-to-checkout {
    margin-top: 1rem !important;
    padding: 0 !important;
    text-align: center !important;
}

.cart_totals .checkout-button {
    background: #ff6b35 !important;
    color: #fff !important;
    padding: 0.85rem 2rem !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    text-decoration: none !important;
    transition: all 0.2s !important;
    box-shadow: 0 4px 14px rgba(255,107,53,0.3) !important;
    border: none !important;
}

.cart_totals .checkout-button:hover {
    background: #e85a28 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(255,107,53,0.35) !important;
    color: #fff !important;
}

/* 安全提示 */
.cart-security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid #f3f0e8;
    color: #9ca3af;
    font-size: 0.78rem;
    font-weight: 500;
}

.cart-security-note .lock-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ===== 空购物车 ===== */
.cart-empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    border: 1px solid #eeebe3;
    max-width: 520px;
    margin: 0 auto;
}

.cart-empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
    color: #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-empty-icon svg {
    width: 100%;
    height: 100%;
}

.cart-empty-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #1a1f36;
    margin: 0 0 0.6rem;
    letter-spacing: -0.01em;
}

.cart-empty-text {
    font-size: 0.92rem;
    color: #6b7280;
    line-height: 1.6;
    margin: 0 0 1.75rem;
}

.cart-empty-btn {
    display: inline-block;
    background: #ff6b35;
    color: #fff;
    padding: 0.75rem 2rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(255,107,53,0.3);
}

.cart-empty-btn:hover {
    background: #e85a28;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255,107,53,0.35);
    color: #fff;
}

.cart-empty.woocommerce {
    display: none !important;
}

/* ===== WooCommerce 通知（右上角悬浮弹窗） ===== */
.woocommerce-cart .woocommerce-message,
.woocommerce-cart .woocommerce-error,
.woocommerce-cart .woocommerce-info {
    position: fixed !important;
    top: 24px !important;
    right: 24px !important;
    z-index: 99999 !important;
    max-width: 380px !important;
    width: calc(100% - 48px) !important;
    border-radius: 14px !important;
    padding: 1rem 1.25rem !important;
    margin: 0 0 0.75rem 0 !important;
    font-size: 0.9rem !important;
    border: none !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12) !important;
    display: flex !important;
    align-items: flex-start !important;
    gap: 0.6rem !important;
    animation: wc-toast-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
    pointer-events: auto !important;
}

.woocommerce-cart .woocommerce-message {
    background: #f0fdf4 !important;
    color: #166534 !important;
    border-left: 4px solid #22c55e !important;
}

.woocommerce-cart .woocommerce-error {
    background: #fef2f2 !important;
    color: #991b1b !important;
    border-left: 4px solid #ef4444 !important;
}

.woocommerce-cart .woocommerce-info {
    background: #fff7ed !important;
    color: #9a3412 !important;
    border-left: 4px solid #f97316 !important;
}

.woocommerce-cart .woocommerce-message.wc-toast-out,
.woocommerce-cart .woocommerce-error.wc-toast-out,
.woocommerce-cart .woocommerce-info.wc-toast-out {
    animation: wc-toast-out 0.3s cubic-bezier(0.7, 0, 0.84, 0) forwards !important;
}

.woocommerce-cart .woocommerce-message::before,
.woocommerce-cart .woocommerce-error::before,
.woocommerce-cart .woocommerce-info::before {
    display: none !important;
}

.woocommerce-cart .woocommerce-message a,
.woocommerce-cart .woocommerce-error a,
.woocommerce-cart .woocommerce-info a {
    font-weight: 600 !important;
    text-decoration: underline !important;
}

.woocommerce-cart .woocommerce-message .button,
.woocommerce-cart .woocommerce-error .button,
.woocommerce-cart .woocommerce-info .button {
    display: inline-block !important;
    margin-top: 0.5rem !important;
    padding: 0.4rem 1rem !important;
    border-radius: 8px !important;
    font-size: 0.82rem !important;
    background: rgba(0,0,0,0.08) !important;
    color: inherit !important;
}

@keyframes wc-toast-in {
    from {
        opacity: 0;
        transform: translateX(120%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes wc-toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
        max-height: 200px;
        margin-bottom: 0.75rem;
    }
    to {
        opacity: 0;
        transform: translateX(120%);
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
}

@media (max-width: 640px) {
    .woocommerce-cart .woocommerce-message,
    .woocommerce-cart .woocommerce-error,
    .woocommerce-cart .woocommerce-info {
        top: 16px !important;
        right: 16px !important;
        left: 16px !important;
        width: auto !important;
        max-width: none !important;
    }
}

/* ===== 响应式 ===== */
@media (max-width: 968px) {
    .cart-layout {
        flex-direction: column;
    }

    .cart-right {
        flex: none;
        max-width: none;
        width: 100%;
    }

    .cart-summary-card {
        position: static;
    }
}

@media (max-width: 640px) {
    .cart-wrapper {
        padding: 0 12px;
    }

    .cart-header {
        margin-bottom: 1.25rem;
    }

    .cart-title {
        font-size: 1.4rem !important;
    }

    .cart-count-badge {
        font-size: 0.8rem !important;
        padding: 0.2rem 0.6rem !important;
    }

    .cart-products-card,
    .cart-summary-card {
        border-radius: 12px !important;
        padding: 1rem !important;
    }

    .cart-summary-title {
        font-size: 1rem !important;
        margin-bottom: 1rem !important;
    }

    /* ===== 移动端商品卡片布局 ===== */
    .shop_table.cart thead {
        display: none !important;
    }

    .shop_table.cart tbody tr {
        display: block !important;
        position: relative !important;
        padding: 1rem 0.75rem !important;
        border-bottom: 1px solid #f3f0e8 !important;
    }

    .shop_table.cart tbody tr:last-child {
        border-bottom: none !important;
    }

    .shop_table.cart tbody tr:hover {
        background: transparent !important;
    }

    /* 删除按钮：右上角绝对定位 */
    .shop_table.cart .product-remove {
        position: absolute !important;
        top: 0.6rem !important;
        right: 0.6rem !important;
        display: block !important;
        padding: 0 !important;
        width: auto !important;
        z-index: 2;
    }

    .shop_table.cart .product-remove::before {
        display: none !important;
    }

    /* 商品图片：左侧固定宽度 */
    .shop_table.cart .product-thumbnail {
        display: inline-block !important;
        width: 68px !important;
        padding: 0 !important;
        vertical-align: top !important;
    }

    .shop_table.cart .product-thumbnail::before {
        display: none !important;
    }

    .shop_table.cart .product-thumbnail img {
        width: 68px !important;
        height: 68px !important;
        border-radius: 10px !important;
    }

    /* 商品名称：和图片并排，右侧自适应 */
    .shop_table.cart .product-name {
        display: inline-block !important;
        width: calc(100% - 80px) !important;
        padding: 0 0 0 0.6rem !important;
        vertical-align: top !important;
        text-align: left !important;
        min-height: 68px !important;
    }

    .shop_table.cart .product-name::before {
        display: none !important;
    }

    .shop_table.cart .product-name a {
        font-size: 0.88rem !important;
        line-height: 1.35 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    .shop_table.cart .product-name .variation {
        font-size: 0.72rem !important;
        margin-top: 0.2rem !important;
    }

    /* 单价：隐藏（小计已显示总价） */
    .shop_table.cart .product-price {
        display: none !important;
    }

    /* 数量：底部左侧，带标签 */
    .shop_table.cart .product-quantity {
        display: inline-block !important;
        width: 50% !important;
        padding: 0.75rem 0 0 !important;
        text-align: left !important;
        vertical-align: bottom !important;
    }

    .shop_table.cart .product-quantity::before {
        content: 'Cantidad' !important;
        display: block !important;
        font-size: 0.7rem !important;
        font-weight: 600 !important;
        color: #9ca3af !important;
        text-transform: uppercase !important;
        letter-spacing: 0.04em !important;
        margin-bottom: 0.3rem !important;
        text-align: left !important;
    }

    .shop_table.cart .product-quantity .quantity input {
        width: 52px !important;
        padding: 0.3rem 0.2rem !important;
        font-size: 0.82rem !important;
    }

    /* 小计：底部右侧，带标签 */
    .shop_table.cart .product-subtotal {
        display: inline-block !important;
        width: 50% !important;
        padding: 0.75rem 0 0 !important;
        text-align: right !important;
        vertical-align: bottom !important;
    }

    .shop_table.cart .product-subtotal::before {
        content: 'Subtotal' !important;
        display: block !important;
        font-size: 0.7rem !important;
        font-weight: 600 !important;
        color: #9ca3af !important;
        text-transform: uppercase !important;
        letter-spacing: 0.04em !important;
        margin-bottom: 0.3rem !important;
        text-align: right !important;
    }

    .shop_table.cart .product-subtotal .woocommerce-Price-amount {
        font-size: 0.95rem !important;
        font-weight: 700 !important;
    }

    /* 底部操作行 */
    .cart-footer-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.85rem 1rem !important;
    }

    .continue-shopping-link {
        text-align: center;
        justify-content: center;
    }

    .update-cart-btn {
        width: 100%;
    }

    /* 订单摘要移动端 */
    .cart-coupon-row {
        flex-direction: column;
    }

    .coupon-apply-btn {
        width: 100%;
    }

    .cart_totals .checkout-button {
        padding: 0.8rem 1.5rem !important;
        font-size: 0.9rem !important;
    }
}
