/* 购物车页面样式 */

/* 返回按钮 */
.back-btn {
    color: #666;
    text-decoration: none;
    font-size: 16px;
    padding: 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.back-btn:hover {
    background-color: #f5f5f5;
    color: #e4393c;
}

/* 页面标题 */
.page-title h1 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* 编辑按钮 */
.edit-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 16px;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.edit-btn:hover {
    background-color: #f5f5f5;
    color: #e4393c;
}

/* 购物车容器 */
.cart-container {
    margin-top: 56px;
    padding-bottom: 70px;
    min-height: calc(100vh - 126px);
}

/* 空购物车 */
.empty-cart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-icon {
    font-size: 60px;
    color: #ddd;
    margin-bottom: 16px;
}

.empty-cart h2 {
    font-size: 18px;
    color: #666;
    margin-bottom: 8px;
}

.empty-cart p {
    color: #999;
    margin-bottom: 24px;
}

.go-shopping-btn {
    background: #e4393c;
    color: white;
    text-decoration: none;
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s;
}

.go-shopping-btn:hover {
    background: #d43333;
}

/* 购物车商品列表 */
.cart-items {
    padding: 12px;
}

.cart-item {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    border: 1px solid #f0f0f0;
}

.cart-item:hover {
    transform: translateY(-1px);
}

/* 复选框 */
.item-checkbox {
    margin-right: 12px;
}

.item-checkbox input[type="checkbox"] {
    display: none;
}

.item-checkbox label {
    display: block;
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.item-checkbox input[type="checkbox"]:checked + label {
    background: #e4393c;
    border-color: #e4393c;
}

.item-checkbox input[type="checkbox"]:checked + label::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
}

/* 商品图片 */
.item-image {
    width: 70px;
    height: 70px;
    margin-right: 12px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8f9fa;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 商品信息 */
.item-info {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-price {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.current-price {
    font-size: 14px;
    font-weight: 600;
    color: #e4393c;
}

.original-price {
    font-size: 11px;
    color: #999;
    text-decoration: line-through;
}

/* 数量控制 */
.item-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-btn {
    width: 26px;
    height: 26px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 10px;
    color: #666;
}

.quantity-btn:hover {
    border-color: #e4393c;
    color: #e4393c;
}

.quantity-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity-input {
    width: 44px;
    height: 26px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
    color: #333;
}

.quantity-input:focus {
    outline: none;
    border-color: #e4393c;
}

/* 商品操作 */
.item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    margin-left: 12px;
}

.item-subtotal {
    text-align: right;
}

.subtotal-price {
    font-size: 14px;
    font-weight: 600;
    color: #e4393c;
}

.remove-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.remove-btn:hover {
    background: #e4393c;
    color: white;
}

/* 购物车底部 */
.cart-footer {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    background: white;
    padding: 12px 16px;
    box-shadow: 0 -1px 3px rgba(0,0,0,0.1);
    z-index: 999;
    border-top: 1px solid #e5e5e5;
}

.cart-summary {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
}

.total-price {
    font-weight: 600;
    color: #e4393c;
}

.saved-price {
    font-weight: 600;
    color: #52c41a;
}

/* 结算区域 */
.checkout-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
}

.select-all input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #e4393c;
}

.checkout-info {
    flex: 1;
    text-align: right;
}

.selected-count {
    font-size: 11px;
    color: #666;
    margin-bottom: 2px;
}

.checkout-total {
    font-size: 12px;
    color: #333;
}

.checkout-price {
    font-size: 16px;
    font-weight: 600;
    color: #e4393c;
}

.checkout-btn {
    background: #e4393c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.checkout-btn:hover {
    background: #d43333;
}

.checkout-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .cart-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .item-checkbox {
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .item-image {
        width: 100%;
        height: 160px;
        margin-right: 0;
        margin-bottom: 12px;
    }
    
    .item-actions {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-left: 0;
    }
    
    .checkout-section {
        flex-direction: column;
        gap: 8px;
    }
    
    .checkout-info {
        text-align: center;
    }
}

/* 编辑模式 */
.cart-item.editing .item-actions {
    display: flex;
}

.cart-item:not(.editing) .remove-btn {
    display: none;
}

/* 动画效果 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-item {
    animation: slideIn 0.3s ease-out;
}

/* 删除确认对话框 */
.delete-confirm {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.delete-confirm-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin: 20px;
    text-align: center;
    max-width: 280px;
}

.delete-confirm h3 {
    margin-bottom: 12px;
    color: #333;
    font-size: 16px;
}

.delete-confirm-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.delete-confirm-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.delete-confirm-btn.cancel {
    background: #f5f5f5;
    color: #666;
}

.delete-confirm-btn.confirm {
    background: #e4393c;
    color: white;
}

.delete-confirm-btn:hover {
    opacity: 0.8;
} 