/* 购物车页面样式 - 全新现代化设计 */

/* 基础样式重置 */
* {
    box-sizing: border-box;
}

/* 购物车页面容器 */
.cart-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding-top: 80px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.cart-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 购物车头部 */
.cart-header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease-out;
}

.cart-header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cart-header p {
    color: #7f8c8d;
    font-size: 1.1rem;
    margin: 0;
}

/* 购物车内容布局 */
.cart-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease-out;
}

/* 购物车商品区域 */
.cart-items-section {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.cart-items-section:hover {
    transform: translateY(-5px);
}

/* 购物车商品头部 */
.cart-items-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-items-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.items-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* 购物车商品项 */
.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto auto auto;
    gap: 20px;
    padding: 25px;
    border-bottom: 1px solid #f1f3f4;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cart-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.cart-item:hover::before {
    left: 100%;
}

.cart-item:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.cart-item:last-child {
    border-bottom: none;
}

/* 商品图片 */
.item-image {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.cart-item:hover .item-image {
    transform: scale(1.05);
}

/* 商品详情 */
.item-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.item-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
    line-height: 1.3;
}

.item-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #e74c3c;
}

/* 数量控制 */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-btn {
    width: 35px;
    height: 35px;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    color: #6c757d;
    position: relative;
    overflow: hidden;
}

.quantity-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: #007bff;
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.quantity-btn:hover::before {
    width: 100%;
    height: 100%;
}

.quantity-btn:hover {
    color: white;
    border-color: #007bff;
    transform: scale(1.1);
}

.quantity-btn i {
    position: relative;
    z-index: 1;
}

.quantity-input {
    width: 60px;
    text-align: center;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 8px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.quantity-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* 商品总价 */
.item-total {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e50;
    text-align: right;
}

/* 商品操作按钮 */
.item-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: currentColor;
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.action-btn:hover::before {
    width: 100%;
    height: 100%;
}

.action-btn i {
    position: relative;
    z-index: 1;
}

.remove-btn {
    background: #ff6b6b;
    color: white;
}

.remove-btn:hover {
    background: #ff5252;
    transform: scale(1.1);
}

.favorite-btn {
    background: #f8f9fa;
    color: #6c757d;
    border: 2px solid #e9ecef;
}

.favorite-btn:hover {
    background: #ff6b6b;
    color: white;
    border-color: #ff6b6b;
    transform: scale(1.1);
}

/* 购物车操作区域 */
.cart-actions {
    background: #f8f9fa;
    padding: 25px;
    display: flex;
    justify-content: center;
    gap: 20px;
    border-top: 1px solid #e9ecef;
}

.cart-btn {
    padding: 12px 30px;
    border: 2px solid;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.cart-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: currentColor;
    transition: left 0.3s ease;
}

.cart-btn:hover::before {
    left: 0;
}

.cart-btn span,
.cart-btn i {
    position: relative;
    z-index: 1;
}

.btn-clear {
    background: white;
    color: #dc3545;
    border-color: #dc3545;
}

.btn-clear:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.3);
}

.btn-continue {
    background: white;
    color: #28a745;
    border-color: #28a745;
}

.btn-continue:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

/* 购物车汇总 */
.cart-summary {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 30px;
    position: sticky;
    top: 100px;
    height: fit-content;
    animation: fadeInRight 0.8s ease-out;
}

.summary-header {
    text-align: center;
    margin-bottom: 25px;
}

.summary-header h3 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.summary-details {
    margin-bottom: 25px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f4;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-row.total {
    border-top: 2px solid #e9ecef;
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-top: 10px;
    padding-top: 15px;
}

.checkout-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.checkout-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transition: left 0.3s ease;
}

.checkout-btn:hover::before {
    left: 0;
}

.checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.checkout-btn span,
.checkout-btn i {
    position: relative;
    z-index: 1;
}

/* 空购物车 */
.empty-cart {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.8s ease-out;
}

.empty-cart i {
    font-size: 4rem;
    color: #e9ecef;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

.empty-cart h2 {
    color: #6c757d;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.empty-cart p {
    color: #adb5bd;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.btn-shop {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-shop::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transition: left 0.3s ease;
}

.btn-shop:hover::before {
    left: 0;
}

.btn-shop:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-shop span,
.btn-shop i {
    position: relative;
    z-index: 1;
}

/* 动画效果 */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .cart-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .cart-summary {
        position: static;
        order: -1;
    }
}

@media (max-width: 768px) {
    .cart-container {
        padding: 15px;
    }
    
    .cart-header h1 {
        font-size: 2rem;
    }
    
    .cart-item {
        grid-template-columns: 1fr;
        gap: 15px;
        text-align: center;
        padding: 20px;
    }
    
    .item-details {
        order: 1;
    }
    
    .quantity-controls {
        order: 2;
        justify-content: center;
    }
    
    .item-total {
        order: 3;
        text-align: center;
        font-size: 1.5rem;
    }
    
    .item-actions {
        order: 4;
        justify-content: center;
    }
    
    .cart-actions {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .cart-btn {
        width: 200px;
        justify-content: center;
    }
    
    .cart-items-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .cart-page {
        padding-top: 70px;
    }
    
    .cart-header h1 {
        font-size: 1.8rem;
    }
    
    .cart-item {
        padding: 15px;
    }
    
    .item-image {
        width: 60px;
        height: 60px;
    }
    
    .quantity-controls {
        flex-direction: column;
        gap: 5px;
    }
    
    .quantity-input {
        width: 80px;
    }
    
    .cart-summary {
        padding: 20px;
    }
    
    .empty-cart {
        padding: 40px 15px;
    }
    
    .empty-cart i {
        font-size: 3rem;
    }
}

/* 加载状态 */
.cart-item.updating {
    opacity: 0.6;
    pointer-events: none;
}

.cart-item.updating::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 滚动条样式 */
.cart-items::-webkit-scrollbar {
    width: 6px;
}

.cart-items::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}