/* cart.css */
.cart-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.cart-container h1 {
    font-size: 28px;
    margin-bottom: 30px;
    color: #333;
    text-align: center;
}

.cart-items {
    margin-bottom: 30px;
    border: 1px solid #e1e1e1;
    border-radius: 5px;
    padding: 20px;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    margin-right: 20px;
}

.cart-item-details {
    flex-grow: 1;
}

.cart-item-name {
    font-size: 16px;
    margin-bottom: 5px;
    color: #333;
}

.cart-item-price {
    font-size: 14px;
    color: #666;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.quantity-btn {
    width: 25px;
    height: 25px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    cursor: pointer;
    /* 保持按钮风格一致 */
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-input {
    width: 80px; /* 从40px增加到80px */
    height: 25px;
    text-align: center;
    margin: 0 5px;
    border: 1px solid #ddd;
    /* 移除数字输入框的上下箭头 */
    -moz-appearance: textfield;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.remove-item {
    color: #ff0000;
    cursor: pointer;
    font-size: 14px;
    margin-left: 20px;
}

.cart-summary {
    border: 1px solid #e1e1e1;
    border-radius: 5px;
    padding: 20px;
    background: #f9f9f9;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 16px;
}

.summary-row.total {
    font-weight: bold;
    font-size: 18px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e1e1e1;
}

.checkout-btn {
    width: 100%;
    padding: 12px;
    background: #0066cc;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.3s;
}

.checkout-btn:hover {
    background: #0055aa;
}

.continue-shopping {
    display: block;
    text-align: center;
    margin-top: 15px;
    color: #0066cc;
    text-decoration: none;
}

.empty-cart-message {
    text-align: center;
    padding: 30px;
    color: #666;
}
/* Mobile Styles (max-width: 768px) */
/* Mobile Styles (max-width: 768px) */
@media (max-width: 768px) {
    .cart-container {
        padding: 0 15px;
        margin: 20px auto;
        width: 100%;
        box-sizing: border-box; /* 添加这个确保padding包含在宽度内 */
    }

    .cart-items {
        padding: 15px;
        overflow: hidden; /* 防止内容溢出 */
    }

    .cart-item {
        flex-direction: row; /* 保持水平布局但会调整 */
        flex-wrap: wrap; /* 允许内容换行 */
        align-items: center;
        padding: 15px 0;
        position: relative;
        width: 100%;
    }

    .cart-item-image {
        width: 60px;
        height: 60px;
        margin-right: 10px;
        margin-bottom: 0;
        flex-shrink: 0; /* 防止图片被压缩 */
    }

    .cart-item-details {
        width: calc(100% - 70px); /* 减去图片宽度和margin */
        min-width: 0; /* 允许内容收缩 */
    }

    .cart-item-name {
        font-size: 15px;
        padding-right: 40px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis; /* 长文本显示省略号 */
    }

    .cart-item-price {
        font-size: 13px;
    }

    .cart-item-quantity {
        margin-top: 8px;
        width: 100%; /* 数量控制占据整行 */
    }

    .remove-item {
        position: absolute;
        top: 15px;
        right: 0;
        margin-left: 0;
    }

    /* 确保数量输入框不会太大 */
    .quantity-input {
        max-width: 40px;
    }
}

/* Small Mobile Styles (max-width: 480px) */
@media (max-width: 480px) {
    .cart-item {
        padding: 10px 0;
    }
    
    .cart-item-image {
        width: 50px;
        height: 50px;
    }
    
    .cart-item-details {
        width: calc(100% - 60px);
    }
    
    .cart-item-name {
        font-size: 14px;
    }
    
    .quantity-btn, .quantity-input {
        height: 20px;
    }
    
    .quantity-input {
        width: 30px;
    }
}