﻿/* 购物车页面样式 */
.cart-main {
    padding: 0 15px 120px; /* 底部留更多空间给结算栏 */
    background-color: #f5f5f5;
    min-height: calc(100vh - 120px);
}

/* 空购物车状态 */
.empty-cart {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 12px;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.empty-cart p {
    color: #666;
    font-size: 16px;
    margin-bottom: 30px;
}

.go-shopping-btn {
    display: inline-block;
    background: #00008B;
    color: white;
    padding: 12px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 16px;
    transition: all 0.3s ease;
}

.go-shopping-btn:hover {
    background: #00008B;
    transform: translateY(-2px);
}

/* 购物车商品列表 */
.cart-items {
    background: white;
    border-radius: 12px;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 购物车商品项 */
.cart-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item.select {
    background-color: #f9fff9;
}

.cart-item.select .item-info {
    border-left-color: #00008B;
}

/* 选择框 */
.item-select {
    margin-right: 12px;
}

.item-select input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #ddd;
    appearance: none;
    outline: none;
    cursor: pointer;
    position: relative;
}

.item-select input[type="checkbox"]:checked {
    background-color: #00008B;
    border-color: #00008B;
}

.item-select input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* 商品图片 */
.item-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 12px;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 商品信息 */
.item-info {
    flex: 1;
    padding-left: 12px;
    border-left: 2px solid transparent;
}

.item-name {
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-spec {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.item-price {
    font-size: 16px;
    color: #e4393c;
    font-weight: bold;
    margin-bottom: 8px;
}

/* 数量控制 */
.item-quantity {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-control button {
    width: 28px;
    height: 28px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.quantity-control button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity-control button:hover:not(:disabled) {
    border-color: #00008B;
    color: #00008B;
}

.quantity-control span {
    min-width: 30px;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
}

/* 删除按钮 */
.item-delete {
    margin-left: 10px;
}

.delete-btn {
    width: 30px;
    height: 30px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: #cc0000;
    transform: scale(1.1);
}

/* 底部结算栏 */
.cart-footer {
    position: fixed;
    bottom: 60px; /* 在导航栏上方 */
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #eee;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.select-all {
    display: flex;
    align-items: center;
    gap: 8px;
}

.select-all input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.select-all label {
    font-size: 14px;
    color: #333;
}

.total-info {
    flex: 1;
    text-align: right;
    margin-right: 15px;
}

.total-amount {
    font-size: 16px;
    font-weight: bold;
    color: #e4393c;
    margin-bottom: 2px;
}

.total-count {
    font-size: 12px;
    color: #666;
}

.checkout-btn {
    background: #00008B;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.checkout-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.checkout-btn:not(:disabled):hover {
    background: #00008B;
    transform: translateY(-2px);
}

/* 删除确认弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 0 15px;
    box-sizing: border-box;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    width: 100%;
    max-width: 280px;
    text-align: center;
}

.modal-content h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #333;
}

.modal-content p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

.modal-content button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    margin: 5px 0;
}

#confirmDeleteBtn {
    background: #ff4444;
    color: white;
}

#cancelDeleteBtn {
    background: #f5f5f5;
    color: #333;
}

/* 响应式设计 */
@media (max-width: 375px) {
    .cart-main {
        padding: 0 12px 120px;
    }
    
    .cart-item {
        padding: 12px;
    }
    
    .item-image {
        width: 70px;
        height: 70px;
    }
    
    .cart-footer {
        padding: 8px 12px;
    }
}

@media (min-width: 414px) {
    .cart-main {
        padding: 0 18px 120px;
    }
    
    .cart-item {
        padding: 18px;
    }
    
    .item-image {
        width: 90px;
        height: 90px;
    }
    
    .cart-footer {
        padding: 12px 18px;
    }
}