/* 购物车页面样式 */

.cart-main {
    padding: 40px 0;
    min-height: 60vh;
}

/* 购物车头部 */
.cart-header {
    margin-bottom: 40px;
}

.cart-header h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 24px;
}

/* 购物流程步骤 */
.cart-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    max-width: 600px;
    margin: 0 auto;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
}

.step.active .step-number {
    background-color: var(--primary-color);
    color: white;
}

.step.completed .step-number {
    background-color: #27ae60;
    color: white;
}

.step-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.step.active .step-text {
    color: var(--primary-color);
}

.step-line {
    width: 80px;
    height: 2px;
    background-color: var(--border-color);
    margin: 0 20px;
}

.step.active + .step-line,
.step.completed + .step-line {
    background-color: var(--primary-color);
}

/* 空购物车状态 */
.empty-cart {
    text-align: center;
    padding: 80px 20px;
    background-color: var(--background-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

.empty-cart-icon {
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-cart-icon svg {
    color: var(--text-secondary);
}

.empty-cart h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.empty-cart p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.empty-cart .btn-primary {
    padding: 12px 32px;
    font-size: 16px;
}

/* 购物车列表 */
.cart-list {
    background-color: var(--background-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    overflow: hidden;
    margin-bottom: 40px;
}

.cart-table {
    width: 100%;
}

.cart-header-row {
    display: grid;
    grid-template-columns: 60px 1fr 120px 150px 120px 100px;
    gap: 16px;
    padding: 20px;
    background-color: var(--background-light);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    align-items: center;
}

.cart-col-select {
    display: flex;
    align-items: center;
}

.cart-col-product {
    text-align: left;
}

.cart-col-price,
.cart-col-quantity,
.cart-col-total,
.cart-col-actions {
    text-align: center;
}

/* 复选框样式 */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

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

.checkbox-wrapper .checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 3px;
    position: relative;
    transition: var(--transition);
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 3px;
    height: 6px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-text {
    color: var(--text-primary);
    font-weight: 500;
}

/* 购物车商品项 */
.cart-item {
    display: grid;
    grid-template-columns: 60px 1fr 120px 150px 120px 100px;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    transition: var(--transition);
}

.cart-item:hover {
    background-color: var(--background-light);
}

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

.cart-item-select {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-product {
    display: flex;
    gap: 16px;
    align-items: center;
}

.cart-item-image {
    width: 80px;
    height: 100px;
    border-radius: var(--border-radius);
    overflow: hidden;
    flex-shrink: 0;
    background-color: var(--background-light);
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-item-specs {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.cart-item-stock {
    font-size: 12px;
    color: #27ae60;
}

.cart-item-stock.low {
    color: #e74c3c;
}

.cart-item-price {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

.cart-item-original-price {
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: line-through;
    margin-top: 4px;
}

/* 数量选择器 */
.cart-item-quantity {
    display: flex;
    justify-content: center;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--background-white);
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background-color: var(--background-white);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover:not(:disabled) {
    background-color: var(--background-light);
}

.qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.qty-input {
    width: 50px;
    height: 32px;
    border: none;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    background-color: var(--background-white);
}

.qty-input:focus {
    outline: none;
    background-color: var(--background-light);
}

.cart-item-total {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.cart-item-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    padding: 4px 8px;
    border-radius: 4px;
}

.action-btn:hover {
    color: var(--primary-color);
    background-color: var(--background-light);
}

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

/* 购物车底部 */
.cart-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    background-color: var(--background-light);
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 20px;
}

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

.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: underline;
}

.btn-text:hover {
    color: var(--primary-color);
}

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

.cart-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: right;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-primary);
}

.summary-item.total {
    font-size: 16px;
    font-weight: 600;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
}

.price-text {
    color: var(--primary-color);
    font-weight: 500;
}

.total-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.checkout-btn {
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    min-width: 150px;
    position: relative;
}

.checkout-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--text-light);
}

/* 推荐商品区域 */
.recommended-section {
    margin-top: 60px;
}

.recommended-section h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 32px;
    text-align: center;
}

.recommended-products {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

/* 删除确认弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--background-white);
    border-radius: var(--border-radius);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

.close-modal {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
}

.close-modal:hover {
    color: var(--primary-color);
}

.modal-body {
    padding: 20px;
    text-align: center;
}

.modal-body p {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 0;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

.modal-footer button {
    padding: 10px 20px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .cart-header-row,
    .cart-item {
        grid-template-columns: 50px 1fr 100px 120px 100px 80px;
        gap: 12px;
        padding: 16px;
    }
    
    .cart-item-image {
        width: 60px;
        height: 75px;
    }
    
    .cart-item-name {
        font-size: 14px;
    }
    
    .cart-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .cart-footer-right {
        justify-content: space-between;
        gap: 20px;
    }
    
    .cart-summary {
        text-align: left;
    }
    
    .summary-item {
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .cart-main {
        padding: 20px 0;
    }
    
    .cart-header h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .cart-steps {
        max-width: 100%;
    }
    
    .step-line {
        width: 60px;
        margin: 0 10px;
    }
    
    .step-text {
        font-size: 12px;
    }
    
    /* 移动端购物车表格 */
    .cart-header-row {
        display: none;
    }
    
    .cart-item {
        display: block;
        padding: 16px;
        border-radius: var(--border-radius);
        margin-bottom: 12px;
        background-color: var(--background-white);
        box-shadow: var(--shadow-light);
    }
    
    .cart-item-select {
        position: absolute;
        top: 16px;
        right: 16px;
    }
    
    .cart-item-product {
        margin-bottom: 16px;
        padding-right: 40px;
    }
    
    .cart-item-image {
        width: 80px;
        height: 100px;
    }
    
    .cart-item-details {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .cart-item-price-section {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cart-item-controls {
        display: flex;
        align-items: center;
        gap: 16px;
    }
    
    .cart-item-actions {
        flex-direction: row;
        justify-content: flex-end;
        margin-top: 12px;
    }
    
    .cart-footer-left {
        justify-content: center;
    }
    
    .recommended-products {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .cart-steps {
        gap: 0;
    }
    
    .step-line {
        width: 40px;
        margin: 0 8px;
    }
    
    .step-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .step-text {
        font-size: 11px;
    }
    
    .cart-item-product {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        text-align: left;
    }
    
    .cart-item-image {
        width: 100%;
        height: 200px;
        align-self: center;
        max-width: 160px;
    }
    
    .cart-item-details {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .cart-item-controls {
        justify-content: space-between;
        width: 100%;
    }
    
    .cart-summary {
        width: 100%;
    }
    
    .checkout-btn {
        width: 100%;
        margin-top: 16px;
    }
    
    .recommended-products {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }
}

/* 动画效果 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-item {
    animation: slideIn 0.3s ease;
}

/* 加载状态 */
.loading-cart {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
}

.loading-item {
    display: flex;
    gap: 16px;
    padding: 20px;
    background-color: var(--background-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

.loading-image {
    width: 80px;
    height: 100px;
    background-color: #f0f0f0;
    border-radius: var(--border-radius);
    animation: loading 1.5s infinite;
}

.loading-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loading-text {
    height: 16px;
    background-color: #f0f0f0;
    border-radius: 4px;
    animation: loading 1.5s infinite;
}

.loading-text.short {
    width: 60%;
}

.loading-text.medium {
    width: 80%;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 优惠券和促销信息 */
.cart-promotions {
    background-color: var(--background-light);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 20px;
}

.promotion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.promotion-icon {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

.promotion-text {
    flex: 1;
}

.promotion-action {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
}

.promotion-action:hover {
    opacity: 0.8;
}