/* 购物车页面样式 */
.cart-page {
    max-width: 1440px;
    margin: 20px auto;
    padding: 0 20px;
    font-family: Arial, sans-serif;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e11111;
}

.cart-header h1 {
    color: #333;
    margin: 0;
    font-size: 28px;
}

.cart-header h1 i {
    color: #e11111;
    margin-right: 10px;
}

.cart-stats {
    font-size: 16px;
    color: #666;
    font-weight: bold;
}

.cart-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* 左侧商品列表 */
.cart-items-container {
    flex: 1;
    min-width: 0;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cart-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
}

/* 随机背景色 */
.cart-item:nth-child(6n+1) { background-color: rgba(255, 240, 245, 0.6); }
.cart-item:nth-child(6n+2) { background-color: rgba(240, 248, 255, 0.6); }
.cart-item:nth-child(6n+3) { background-color: rgba(240, 255, 240, 0.6); }
.cart-item:nth-child(6n+4) { background-color: rgba(255, 250, 240, 0.6); }
.cart-item:nth-child(6n+5) { background-color: rgba(245, 240, 255, 0.6); }
.cart-item:nth-child(6n+6) { background-color: rgba(240, 255, 255, 0.6); }

/* 左侧商品信息 */
.item-info {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.item-image {
    width: 100px;
    height: 100px;
    margin-right: 20px;
    flex-shrink: 0;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
}

.item-details {
    flex: 1;
    min-width: 0;
}

.item-sku {
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
}

.item-name {
    font-size: 16px;
    font-weight: bold;
    color: #343434;
    margin-bottom: 8px;
    line-height: 1.4;
    word-wrap: break-word;
}

.item-price {
    font-size: 18px;
    font-weight: bold;
    color: #222222;
}

/* 右侧操作区域 */
.item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
    flex-shrink: 0;
}

.delete-btn {
    background: none;
    border: none;
    color: #ff4444;
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
    transition: color 0.3s;
}

.delete-btn:hover {
    color: #cc0000;
}

.delete-btn i {
    margin-right: 5px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 6px;
    border: 1px solid #ddd;
    overflow: hidden;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.3s;
}

.quantity-btn:hover {
    background: #e9e9e9;
}

.quantity-btn:disabled {
    background: #f9f9f9;
    color: #ccc;
    cursor: not-allowed;
}

.quantity-display {
    width: 50px;
    height: 32px;
    text-align: center;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    font-size: 14px;
}

/* 右侧汇总信息 */
.cart-summary {
    width: 300px;
    background: #f9f9f9;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #eee;
    flex-shrink: 0;
}

.discount-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 16px;
    color: #666;
}

.summary-row.total {
    font-size: 20px;
    font-weight: bold;
    color: #e11111;
    border-top: 1px solid #ddd;
    padding-top: 15px;
    margin-top: 15px;
}

.original-price {
    text-decoration: line-through;
    color: #999;
    font-size: 14px;
    font-weight: normal;
    margin-left: 8px;
}

.final-price {
    color: #e11111;
    font-size: 24px;
}

.cart-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    gap: 15px;
}

.clear-cart-btn {
    background: #666;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    flex: 1;
}

.clear-cart-btn:hover {
    background: #555;
}

.checkout-btn {
    background: #e11111;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s;
    flex: 2;
}

.checkout-btn:hover:not(:disabled) {
    background: #c50f0f;
}

.checkout-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 空购物车状态 */
.empty-cart {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 12px;
    border: 2px dashed #ddd;
}

.empty-icon {
    font-size: 80px;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-cart h3 {
    color: #666;
    margin-bottom: 10px;
    font-size: 24px;
}

.empty-cart p {
    color: #999;
    margin-bottom: 30px;
    font-size: 16px;
}

.continue-shopping-btn {
    background: #e11111;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.continue-shopping-btn:hover {
    background: #c50f0f;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .cart-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .cart-summary {
        width: 100%;
        order: -1;
    }
    
    .cart-items-container {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .cart-page {
        padding: 0 15px;
    }
    
    .cart-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .cart-header h1 {
        font-size: 24px;
    }
    
    .cart-item {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        text-align: center;
    }
    
    .item-info {
        flex-direction: column;
        text-align: center;
    }
    
    .item-image {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .item-actions {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 20px;
    }
    
    .cart-actions {
        flex-direction: column;
    }
    
    .clear-cart-btn,
    .checkout-btn {
        flex: none;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .cart-page {
        padding: 0 10px;
    }
    
    .cart-header h1 {
        font-size: 20px;
    }
    
    .cart-item {
        padding: 15px;
    }
    
    .item-image {
        width: 80px;
        height: 80px;
    }
    
    .item-name {
        font-size: 14px;
    }
    
    .item-price {
        font-size: 16px;
    }
    
    .cart-summary {
        padding: 20px;
    }
    
    .summary-row {
        font-size: 14px;
    }
    
    .summary-row.total {
        font-size: 18px;
    }
    
    .final-price {
        font-size: 20px;
    }
}

/* 加载状态 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #e11111;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}