/* 购物车页面特有样式 */

/* 购物车主体 */
.cart-main {
    padding: 30px 0;
    min-height: 500px;
}

/* 购物车标题 */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e74c3c;
}

.cart-header h2 {
    font-size: 20px;
    color: #333;
    display: flex;
    align-items: center;
}

.cart-header h2 i {
    color: #e74c3c;
    margin-right: 10px;
}

.cart-summary {
    color: #666;
    font-size: 14px;
}

.cart-summary strong {
    color: #e74c3c;
    font-size: 16px;
}

/* 购物车内容区域 */
.cart-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
}

/* 表头 */
.cart-table-header {
    display: grid;
    grid-template-columns: 80px 2fr 120px 150px 120px 150px;
    align-items: center;
    padding: 15px 20px;
    background: #f8f8f8;
    border-bottom: 1px solid #e5e5e5;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* 购物车商品项 */
.cart-item {
    display: grid;
    grid-template-columns: 80px 2fr 120px 150px 120px 150px;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.3s;
}

.cart-item:hover {
    background: #fafafa;
}

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

/* 复选框样式 */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 3px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #e74c3c;
    border-color: #e74c3c;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: #fff;
    font-size: 12px;
}

/* 商品信息 */
.col-product .product-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.col-product .product-img {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    background: #f8f8f8;
    flex-shrink: 0;
}

.col-product .product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-detail {
    flex: 1;
}

.product-detail .product-name {
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.4;
}

.product-detail .product-name a {
    color: #333;
    transition: color 0.3s;
}

.product-detail .product-name a:hover {
    color: #e74c3c;
}

.product-detail .product-spec {
    font-size: 12px;
    color: #999;
}

/* 价格 */
.col-price .price {
    font-size: 14px;
    color: #666;
}

.col-subtotal .subtotal-price {
    font-size: 16px;
    color: #e74c3c;
    font-weight: bold;
}

/* 数量控制 */
.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    overflow: hidden;
    width: 110px;
}

.quantity-btn {
    width: 30px;
    height: 32px;
    border: none;
    background: #f8f8f8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    color: #666;
}

.quantity-btn:hover {
    background: #e5e5e5;
}

.quantity-btn i {
    font-size: 10px;
}

.quantity-input {
    width: 50px;
    height: 32px;
    border: none;
    border-left: 1px solid #e5e5e5;
    border-right: 1px solid #e5e5e5;
    text-align: center;
    font-size: 14px;
    color: #333;
    outline: none;
}

/* 操作按钮 */
.col-action {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.delete-btn,
.collect-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.delete-btn:hover {
    color: #e74c3c;
}

.collect-btn:hover {
    color: #e74c3c;
}

/* 空购物车 */
.empty-cart {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    font-size: 80px;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-text {
    font-size: 18px;
    color: #666;
    margin-bottom: 10px;
}

.empty-desc {
    font-size: 14px;
    color: #999;
    margin-bottom: 25px;
}

.go-shopping-btn {
    display: inline-block;
    padding: 12px 40px;
    background: #e74c3c;
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.3s;
}

.go-shopping-btn:hover {
    background: #c0392b;
}

/* 购物车底部结算区域 */
.cart-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    position: sticky;
    bottom: 20px;
}

.cart-footer-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.batch-delete-btn,
.batch-collect-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.batch-delete-btn:hover,
.batch-collect-btn:hover {
    color: #e74c3c;
}

.continue-shopping {
    color: #666;
    font-size: 14px;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.continue-shopping:hover {
    color: #e74c3c;
}

.cart-footer-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.total-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.selected-count {
    font-size: 14px;
    color: #666;
}

.selected-count strong {
    color: #e74c3c;
}

.total-price-label {
    font-size: 14px;
    color: #666;
}

.total-price {
    font-size: 24px;
    color: #e74c3c;
    font-weight: bold;
}

.checkout-btn {
    padding: 15px 50px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.checkout-btn:hover {
    background: #c0392b;
}

.checkout-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 推荐商品区域 */
.recommend-section {
    padding: 30px 0;
    background: #fff;
    margin-bottom: 20px;
}

.recommend-section .section-header {
    margin-bottom: 20px;
    padding: 0 0 15px 0;
    border-bottom: 2px solid #e74c3c;
}

.recommend-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.recommend-item {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
    background: #fff;
}

.recommend-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-5px);
}

.recommend-img {
    display: block;
    padding: 15px;
    background: #f8f8f8;
}

.recommend-img img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 4px;
}

.recommend-info {
    padding: 15px;
}

.recommend-name {
    font-size: 14px;
    color: #333;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recommend-name a {
    color: #333;
    transition: color 0.3s;
}

.recommend-name a:hover {
    color: #e74c3c;
}

.recommend-price {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.recommend-price .current-price {
    font-size: 16px;
    color: #e74c3c;
    font-weight: bold;
}

.recommend-price .original-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}

.add-cart-btn {
    width: 100%;
    padding: 10px;
    background: #fff;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.add-cart-btn:hover {
    background: #e74c3c;
    color: #fff;
}

/* 购物车链接激活状态 */
.cart-link.active {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

.cart-link.active .cart-count {
    background: #fff;
    color: #e74c3c;
}

/* 悬浮工具栏激活状态 */
.float-tools .tool-item.active {
    background: #e74c3c;
    color: #fff;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .cart-table-header,
    .cart-item {
        grid-template-columns: 60px 2fr 100px 130px 100px 120px;
    }

    .recommend-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .cart-table-header,
    .cart-item {
        grid-template-columns: 50px 1.5fr 90px 110px 90px 100px;
        padding: 15px;
    }

    .col-product .product-img {
        width: 60px;
        height: 60px;
    }

    .quantity-control {
        width: 90px;
    }

    .quantity-btn {
        width: 25px;
        height: 28px;
    }

    .quantity-input {
        width: 40px;
        height: 28px;
    }

    .recommend-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .cart-footer {
        flex-direction: column;
        gap: 15px;
    }

    .cart-footer-left,
    .cart-footer-right {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .cart-table-header {
        display: none;
    }

    .cart-item {
        grid-template-columns: 40px 1fr;
        gap: 15px;
        padding: 15px;
    }

    .cart-item .col-checkbox {
        grid-row: span 2;
    }

    .cart-item .col-product {
        grid-column: 2;
    }

    .cart-item .col-price,
    .cart-item .col-quantity,
    .cart-item .col-subtotal,
    .cart-item .col-action {
        grid-column: 2;
        display: flex;
        align-items: center;
        gap: 15px;
    }

    .cart-item .col-price::before {
        content: '单价：';
        color: #999;
        font-size: 12px;
    }

    .cart-item .col-quantity::before {
        content: '数量：';
        color: #999;
        font-size: 12px;
    }

    .cart-item .col-subtotal::before {
        content: '小计：';
        color: #999;
        font-size: 12px;
    }

    .cart-item .col-action {
        flex-direction: row;
    }

    .recommend-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cart-footer-left {
        flex-wrap: wrap;
        gap: 10px;
    }

    .total-price {
        font-size: 20px;
    }

    .checkout-btn {
        padding: 12px 30px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .cart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .recommend-grid {
        grid-template-columns: 1fr;
    }

    .cart-footer-right {
        flex-direction: column;
        gap: 15px;
    }

    .checkout-btn {
        width: 100%;
    }
}
