/* ========================================
   CART - CARRITO DE COMPRAS
======================================== */

/* Botón flotante del carrito */
.cart-floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.cart-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.cart-floating-btn.has-items {
    animation: pulse 2s infinite;
}

.cart-floating-btn .cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e91e63;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    border: 2px solid white;
}

.cart-floating-btn:not(.has-items) .cart-count {
    display: none;
}

/* Modal del carrito */
.cart-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.cart-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.cart-modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    pointer-events: auto;
}

.cart-modal-body {
    pointer-events: auto;
}

.cart-modal.active .cart-modal-content {
    transform: translateY(0);
}

.cart-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.cart-modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.cart-close-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.cart-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    min-height: 150px;
}

.cart-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.cart-empty-state i {
    margin-bottom: 20px;
    opacity: 0.5;
}

.cart-empty-state p {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #666;
}

.cart-empty-state small {
    color: #999;
    font-size: 0.9rem;
}

/* Item del carrito */
.cart-item {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 6px;
    align-items: center;
    position: relative;
    cursor: default;
    pointer-events: auto;
}

.cart-item-image {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

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

.cart-item-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cart-item-name {
    margin: 0 0 2px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.cart-item-price {
    font-size: 0.75rem;
    color: #666;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 0;
    flex-shrink: 0;
}

.cart-qty-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    background: white;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.cart-qty-btn:active {
    transform: scale(0.95);
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.cart-qty-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.cart-item-qty {
    font-weight: 700;
    min-width: 28px;
    text-align: center;
    font-size: 1rem;
    color: var(--text-dark);
}

.cart-item-total {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
    margin-right: 4px;
    flex-shrink: 0;
}

.cart-item-remove {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(233, 30, 99, 0.3);
    background: rgba(233, 30, 99, 0.1);
    color: #e91e63;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.cart-item-remove:active {
    transform: scale(0.9);
    background: #e91e63;
    color: white;
    border-color: #e91e63;
}

.cart-item-remove:hover {
    background: #e91e63;
    color: white;
    border-color: #e91e63;
    transform: scale(1.1);
}

/* Footer del carrito */
.cart-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.cart-summary {
    margin-bottom: 20px;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.95rem;
    color: #666;
}

.cart-summary-row.estimate {
    border-top: 2px solid #e0e0e0;
    padding-top: 12px;
    margin-top: 8px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-dark);
}

.cart-total-price {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.cart-actions {
    display: flex;
    gap: 10px;
}

.cart-clear-btn {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #666;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cart-clear-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.cart-whatsapp-btn {
    flex: 2;
    padding: 12px 20px;
    border: none;
    background: linear-gradient(135deg, #25D366 0%, #20BA5A 100%);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cart-whatsapp-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
}

/* Notificación de carrito */
.cart-notification {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    z-index: 1500;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
}

.cart-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.cart-notification i {
    font-size: 1.2rem;
}

/* Botones del modal del platillo */
.dish-modal-actions {
    display: flex;
    gap: 12px;
    flex: 1;
}

.btn-add-cart {
    flex: 1;
    padding: 18px 35px;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-add-cart:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-add-cart i {
    font-size: 1.1rem;
}

.dish-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-top: 25px;
}

/* Responsive */
@media (max-width: 768px) {
    .cart-floating-btn {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        font-size: 1.3rem;
    }
    
    .cart-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .cart-modal-body {
        padding: 10px;
    }
    
    .cart-modal-header {
        padding: 15px;
    }
    
    .cart-modal-header h2 {
        font-size: 1.2rem;
    }
    
    .cart-modal-footer {
        padding: 15px;
    }
    
    .cart-item {
        flex-wrap: nowrap;
        padding: 6px;
        gap: 6px;
        margin-bottom: 4px;
    }
    
    .cart-item-image {
        width: 45px;
        height: 45px;
        flex-shrink: 0;
    }
    
    .cart-item-details {
        flex: 1;
        min-width: 0;
    }
    
    .cart-item-name {
        font-size: 0.8rem;
        margin-bottom: 2px;
        line-height: 1.2;
    }
    
    .cart-item-price {
        font-size: 0.65rem;
    }
    
    .cart-item-controls {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-top: 0;
        flex-shrink: 0;
    }
    
    .cart-qty-btn {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
        font-size: 0.8rem;
        padding: 0;
    }
    
    .cart-item-qty {
        font-size: 0.9rem;
        min-width: 22px;
        font-weight: 700;
    }
    
    .cart-item-total {
        font-size: 0.9rem;
        margin-right: 2px;
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    .cart-item-remove {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }
    
    .dish-modal-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .dish-modal-actions {
        flex-direction: column;
    }
    
    .btn-add-cart,
    .btn-order {
        width: 100%;
        padding: 15px 25px;
        font-size: 1rem;
    }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(102, 126, 234, 0.7);
    }
}

