/* ============================================
   购物车 & 支付页面样式
   ============================================ */

/* 购物车页面 */
.cart-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg);
    min-height: calc(100vh - 64px - 300px);
}

.cart-header {
    margin-bottom: var(--space-xl);
}

.cart-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-xl);
    align-items: start;
}

/* 购物车商品列表 */
.cart-items {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.empty-cart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    color: var(--text-tertiary);
}

.empty-cart svg {
    width: 80px;
    height: 80px;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.empty-cart p {
    font-size: 16px;
    margin-bottom: var(--space-lg);
}

.btn-shop-now {
    padding: var(--space-md) var(--space-xl);
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 15px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.btn-shop-now:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.cart-list {
    padding: var(--space-md);
}

.cart-item {
    display: grid;
    grid-template-columns: 100px 1fr auto auto auto;
    gap: var(--space-lg);
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item:hover {
    background: var(--bg-hover);
    border-radius: var(--radius-lg);
}

.cart-item-image {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-secondary);
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-info {
    min-width: 0;
}

.cart-item-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-spec {
    font-size: 13px;
    color: var(--text-tertiary);
}

.cart-item-price {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.cart-qty-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 16px;
    transition: all var(--transition-fast);
}

.cart-qty-btn:hover {
    background: var(--border-default);
}

.cart-qty-input {
    width: 50px;
    height: 32px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--border-default);
    border-right: 1px solid var(--border-default);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card);
}

.cart-qty-input::-webkit-inner-spin-button,
.cart-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-item-subtotal {
    font-size: 16px;
    font-weight: 700;
    color: var(--danger);
    white-space: nowrap;
}

.cart-item-remove {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.cart-item-remove:hover {
    background: rgba(245, 63, 63, 0.1);
    color: var(--danger);
}

.cart-item-remove svg {
    width: 18px;
    height: 18px;
}

/* 购物车结算栏 */
.cart-summary {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    padding: var(--space-xl);
    position: sticky;
    top: 100px;
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-light);
}

.cart-summary h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* 清空购物车按钮 */
.btn-clear-cart {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: var(--radius-md);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-clear-cart svg {
    width: 14px;
    height: 14px;
}

.btn-clear-cart:hover {
    background: var(--danger);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 77, 79, 0.3);
}

.btn-clear-cart:active {
    transform: translateY(0);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    font-size: 14px;
}

.summary-row span:first-child {
    color: var(--text-secondary);
}

.summary-row span:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

.summary-row .highlight {
    color: var(--success);
}

.summary-divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-lg) 0;
}

.summary-row.total {
    font-size: 16px;
}

.summary-row.total span:first-child {
    color: var(--text-primary);
    font-weight: 600;
}

.total-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--danger);
}

.btn-checkout {
    width: 100%;
    padding: var(--space-lg);
    margin-top: var(--space-lg);
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.3);
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(22, 119, 255, 0.4);
}

.btn-checkout svg {
    width: 20px;
    height: 20px;
}

/* 支付页面 */
.checkout-page {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg);
    min-height: calc(100vh - 64px - 300px);
}

.checkout-header {
    margin-bottom: var(--space-xl);
}

.checkout-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.checkout-order {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    padding: var(--space-xl);
}

.checkout-order h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
}

.order-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.order-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.order-item-image {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.order-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.order-item-info {
    flex: 1;
    min-width: 0;
}

.order-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-item-spec {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-xs);
}

.order-item-qty {
    font-size: 12px;
    color: var(--text-secondary);
}

.order-item-price {
    font-size: 15px;
    font-weight: 600;
    color: var(--danger);
    white-space: nowrap;
}

.order-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-light);
}

.order-total span:first-child {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.order-total .amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--danger);
}

.checkout-payment {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    padding: var(--space-xl);
}

.checkout-payment h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
}

.payment-methods {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.payment-option {
    cursor: pointer;
}

.payment-option input {
    display: none;
}

.payment-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    border: 2px solid var(--border-default);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.payment-option input:checked + .payment-card {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

.payment-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.payment-icon.alipay::before {
    content: '支';
    color: #1677ff;
    font-weight: 700;
}

.payment-icon.wechat::before {
    content: '微';
    color: #07c160;
    font-weight: 700;
}

.payment-icon.card::before {
    content: '卡';
    color: var(--warning);
    font-weight: 700;
}

.payment-card span {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.btn-pay-confirm {
    width: 100%;
    padding: var(--space-lg);
    background: var(--success);
    color: white;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(0, 181, 120, 0.3);
}

.btn-pay-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 181, 120, 0.4);
}

.btn-pay-confirm svg {
    width: 20px;
    height: 20px;
}

/* 响应式适配 */
@media (max-width: 1024px) {
    .cart-container {
        grid-template-columns: 1fr;
    }
    
    .cart-summary {
        position: static;
    }
}

@media (max-width: 768px) {
    .cart-item {
        grid-template-columns: 80px 1fr auto;
        gap: var(--space-md);
    }
    
    .cart-item-price,
    .cart-item-subtotal {
        grid-column: 2;
        text-align: left;
    }
    
    .cart-item-qty {
        grid-column: 3;
        grid-row: 1 / 3;
    }
    
    .cart-item-remove {
        position: absolute;
        top: var(--space-md);
        right: var(--space-md);
    }
    
    .order-item {
        flex-wrap: wrap;
    }
    
    .order-item-price {
        width: 100%;
        text-align: right;
        margin-top: var(--space-sm);
    }
}

@media (max-width: 480px) {
    .cart-item {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .cart-item-image {
        width: 120px;
        height: 120px;
        margin: 0 auto;
    }
    
    .cart-item-qty {
        justify-content: center;
        margin: 0 auto;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}