/* 购物车侧边栏样式 */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.active {
    right: 0;
	z-index:999999;
}

/* 购物车侧边栏头部 */
.cart-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e5e5;
    background: #f8f9fa;
}

.cart-sidebar-header h3 {
    margin: 0;
    font-size: 1.5em;
    color: #333;
}

.close-cart-sidebar {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-cart-sidebar:hover {
    background: #e9ecef;
    color: #333;
}

/* 购物车内容区域 */
.cart-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.empty-cart-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* 购物车商品项 */
.cart-sidebar-item {
    display: flex;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
    align-items: flex-start;
}

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

.item-image {
    flex: 0 0 80px;
    margin-right: 15px;
}

.item-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.item-details {
    flex: 1;
}

.item-title {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

.item-title a {
    color: #333;
    text-decoration: none;
}

.item-title a:hover {
    color: #007cba;
}

.item-price {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.item-quantity {
    font-size: 12px;
    color: #666;
}

.item-remove {
    margin-left: 10px;
}

.remove-from-cart {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.remove-from-cart:hover {
    background: #ff4444;
    color: white;
}

/* 购物车总计 */
.cart-sidebar-totals {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e5e5e5;
}

.cart-sidebar-totals > div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 5px 0;
}

.cart-sidebar-totals .total {
    font-weight: bold;
    font-size: 1.1em;
    border-top: 1px solid #e5e5e5;
    padding-top: 10px;
    margin-top: 10px;
}

/* 购物车底部 */
.cart-sidebar-footer {
    padding: 20px;
    border-top: 1px solid #e5e5e5;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-sidebar-footer .button {
    display: block;
    text-align: center;
    padding: 12px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.view-cart-btn {
    background: #6c757d;
    color: white;
}

.view-cart-btn:hover {
    background: #5a6268;
    color: white;
}

.checkout-btn {
    background: #007cba;
    color: white;
}

.checkout-btn:hover {
    background: #005a87;
    color: white;
}

/* 遮罩层 */
.cart-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cart-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .cart-sidebar.active {
        right: 0;
    }
    
    .cart-sidebar-item {
        flex-direction: column;
    }
    
    .item-image {
        flex: 0 0 auto;
        margin-right: 0;
        margin-bottom: 10px;
        align-self: center;
    }
    
    .item-image img {
        max-width: 100px;
    }
    
    .item-remove {
        margin-left: 0;
        margin-top: 10px;
        align-self: flex-end;
    }
}

/* 添加到购物车成功提示 */
.added_to_cart_message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 4px;
    z-index: 10000;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2s forwards;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        visibility: hidden;
    }
}
.cart-loading {
    display: none;
}
