/* ----------------------------------------------------------------
   cart.css - 底部购物车栏、购物车弹窗、购物车列表
---------------------------------------------------------------- */

/* --- 底部购物车栏 (Cart Bar) --- */
.cart-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    padding: 8px 15px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 999;
    gap: 10px;
}
.cart-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.cart-icon { font-size: 24px; position: relative; }
.cart-total { font-size: 18px; font-weight: 800; color: #333; }
.cart-total span { color: #ff6b35; }
.action-buttons { display: flex; gap: 8px; }

/* 电脑端限制条 (内嵌在 Cart Bar 中) */
.desktop-restriction-content {
    display: none; 
    align-items: center;
    gap: 8px;
    background: #f0f0f0;
    border-radius: 24px;
    padding: 4px;
}
.restriction-message-bar {
    flex: 1;
    font-size: 12px;
    color: #666;
    font-weight: 500;
    padding-left: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- 购物车弹窗 (Cart Modal) --- */
.cart-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6); 
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
    touch-action: none;
}
.cart-modal.show {
    display: flex;
    flex-direction: column;
    justify-content: flex-end; 
    opacity: 1;
}

.cart-content {
    background: white;
    width: 100%;
    max-height: 80vh; 
    border-radius: 24px 24px 0 0; 
    display: flex;
    flex-direction: column;
    box-shadow: 0 -5px 30px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}
.cart-modal.show .cart-content {
    transform: translateY(0);
}

.cart-header {
    padding: 18px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 24px 24px 0 0;
    flex-shrink: 0;
}
.cart-title { font-size: 16px; font-weight: bold; color: #333; }
.cart-close { font-size: 24px; color: #999; cursor: pointer; padding: 5px; }

/* --- 购物车列表项 (Cart Items) --- */
.cart-items {
    overflow-y: auto;
    padding: 0 20px 20px 20px;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid #f9f9f9;
    align-items: center;
}

.cart-item-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: #f5f5f5;
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
    min-width: 0; 
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 60px;
}

.cart-item-name {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-spec {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.cart-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
}

.cart-item-price {
    font-size: 16px;
    color: #ff6b35;
    font-weight: bold;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cart-item-quantity button {
    width: 28px;
    height: 28px;
    border-radius: 50%; 
    border: 1px solid #ddd;
    background: white;
    font-size: 16px;
    line-height: 1;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-item-quantity button.plus {
    background: #ff6b35;
    border-color: #ff6b35;
    color: white;
}
.cart-item-quantity span {
    font-size: 14px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.cart-footer {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #f5f5f5;
    padding-bottom: max(15px, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
    z-index: 10;
}
.cart-modal-total { font-size: 14px; color: #666; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: flex-end; }
.cart-modal-total span:last-child { font-size: 24px; color: #ff6b35; font-weight: 800; line-height: 1; }

.customer-name {
    width: 100%;
    padding: 12px 15px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 12px;
    font-size: 15px;
    margin-bottom: 12px;
    outline: none;
    transition: border 0.2s;
}
.customer-name:focus { border-color: #ff6b35; background: white; }

/* 桌面端适配 - 购物车栏 */
@media (min-width: 1024px) {
    .cart-bar {
        position: fixed; 
        top: 0; 
        bottom: auto; 
        left: 85px; 
        right: 0;
        height: 70px;
        padding: 0 20px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        z-index: 998;
        border-top: none;
        border-bottom: 1px solid #f0f0f0;
        background: #fcfcfc;
    }
    
    .cart-info { display: none; } 
    #mobileActionButtons { display: none !important; }
    .desktop-restriction-content {
        display: flex; 
        position: absolute; 
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        width: auto;
        max-width: none;
    }
}