/* ==========================================
   购物车样式
   用于index.html的用户中心购物车模块
   ========================================== */

/* 购物车列表 */
.cart-items-list {
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.cart-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cart-item-image {
    flex-shrink: 0;
}

.cart-item-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
}

.cart-item-price {
    color: #ff6b6b;
    font-size: 14px;
    font-weight: 500;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    color: #666;
}

.quantity-btn:hover {
    border-color: #4CAF50;
    color: #4CAF50;
}

.quantity-btn:active {
    transform: scale(0.95);
}

.quantity-value {
    min-width: 30px;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
}

.cart-item-subtotal {
    font-size: 18px;
    font-weight: bold;
    color: #ff6b6b;
    min-width: 100px;
    text-align: right;
}

.cart-item-actions {
    flex-shrink: 0;
}

.btn-remove {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
    color: #999;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
    background: #fff5f5;
}

/* 空购物车 */
.empty-cart {
    text-align: center;
    padding: 60px 20px;
}

.empty-cart-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-cart-text {
    font-size: 16px;
    color: #999;
    margin-bottom: 30px;
}

.btn-go-shopping {
    padding: 12px 30px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-go-shopping:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.btn-go-shopping:active {
    transform: translateY(0);
}

/* 购物车底部 */
.cart-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f9f9f9;
    border-top: 2px solid #eee;
    border-radius: 0 0 8px 8px;
    margin-top: 15px;
}

.cart-summary {
    display: flex;
    gap: 30px;
    align-items: center;
}

.summary-item {
    font-size: 16px;
}

.summary-item span:first-child {
    color: #666;
    margin-right: 8px;
}

.total-price {
    color: #ff6b6b;
    font-size: 24px;
    font-weight: bold;
}

.cart-actions {
    flex-shrink: 0;
}

.btn-checkout {
    padding: 12px 40px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-checkout:hover {
    background: #ff5252;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.3);
}

.btn-checkout:active {
    transform: translateY(0);
}

/* 响应式 */
@media (max-width: 768px) {
    .cart-item {
        flex-wrap: wrap;
    }

    .cart-item-image {
        width: 100%;
    }

    .cart-item-image img {
        width: 100%;
        height: auto;
    }

    .cart-item-quantity {
        order: 4;
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }

    .cart-item-subtotal {
        order: 3;
        width: 100%;
        text-align: center;
        margin-top: 10px;
    }

    .cart-item-actions {
        position: absolute;
        top: 10px;
        right: 10px;
    }

    .cart-footer {
        flex-direction: column;
        gap: 15px;
    }

    .cart-summary {
        width: 100%;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .btn-checkout {
        width: 100%;
    }
}

/* 加载状态 */
.cart-loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.cart-loading::before {
    content: "";
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
