﻿/* ============================================
   CHAT FLOTANTE MK_Toys
   ============================================ */

/* Botón flotante */
.btn-chat-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .btn-chat-float:hover {
        transform: scale(1.1) rotate(-5deg);
        box-shadow: 0 6px 30px rgba(37, 211, 102, 0.6);
    }

    .btn-chat-float .badge-notification {
        position: absolute;
        top: -5px;
        right: -5px;
        background: #ff4757;
        color: white;
        border-radius: 50%;
        width: 22px;
        height: 22px;
        font-size: 0.6rem;
        display: flex;
        align-items: center;
        justify-content: center;
        animation: pulse 1.5s infinite;
    }

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Popup del chat */
.chat-popup {
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 9998;
    width: 380px;
    max-width: 90vw;
    height: 520px;
    max-height: 80vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

    .chat-popup.open {
        display: flex;
    }

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header del chat */
.chat-popup-header {
    background: linear-gradient(135deg, #0686bd 0%, #055a7e 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

    .chat-header-content i {
        font-size: 1.8rem;
    }

    .chat-header-content h6 {
        margin: 0;
        font-weight: 600;
    }

    .chat-header-content small {
        opacity: 0.8;
        font-size: 0.75rem;
    }

.btn-close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.3s;
}

    .btn-close-chat:hover {
        transform: rotate(90deg);
    }

/* Cuerpo del chat */
.chat-popup-body {
    flex: 1;
    overflow: hidden;
    background: #f0f2f5;
}

.chat-messages {
    padding: 15px;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    .chat-messages::-webkit-scrollbar {
        width: 4px;
    }

    .chat-messages::-webkit-scrollbar-track {
        background: #e0e0e0;
        border-radius: 2px;
    }

    .chat-messages::-webkit-scrollbar-thumb {
        background: #0686bd;
        border-radius: 2px;
    }

/* Mensajes */
.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

    .message.user {
        align-self: flex-end;
    }

    .message.bot {
        align-self: flex-start;
    }

    .message .bubble {
        padding: 10px 15px;
        border-radius: 15px;
        word-wrap: break-word;
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .message.user .bubble {
        background: #0686bd;
        color: white;
        border-bottom-right-radius: 4px;
    }

    .message.bot .bubble {
        background: white;
        color: #333;
        border: 1px solid #e0e0e0;
        border-bottom-left-radius: 4px;
    }

    .message .time {
        font-size: 0.65rem;
        color: #999;
        margin-top: 4px;
    }

/* Sugerencias */
.suggestions-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

    .suggestions-chips .chip {
        background: #e6f4fa;
        color: #0686bd;
        padding: 4px 12px;
        border-radius: 20px;
        font-size: 0.75rem;
        cursor: pointer;
        transition: all 0.3s;
        border: none;
        white-space: nowrap;
    }

        .suggestions-chips .chip:hover {
            background: #0686bd;
            color: white;
        }

/* Footer del chat */
.chat-popup-footer {
    padding: 12px 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

    .chat-popup-footer input {
        flex: 1;
        padding: 10px 15px;
        border: 2px solid #e0e0e0;
        border-radius: 25px;
        font-size: 0.9rem;
        outline: none;
        transition: border-color 0.3s;
    }

        .chat-popup-footer input:focus {
            border-color: #0686bd;
        }

    .chat-popup-footer button {
        background: linear-gradient(135deg, #0686bd 0%, #055a7e 100%);
        color: white;
        border: none;
        border-radius: 50%;
        width: 42px;
        height: 42px;
        cursor: pointer;
        transition: all 0.3s;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

        .chat-popup-footer button:hover {
            transform: scale(1.05);
        }

        .chat-popup-footer button:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }

/* Productos sugeridos */
.product-suggestion {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px;
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

    .product-suggestion:hover {
        transform: translateX(5px);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }

    .product-suggestion img {
        width: 50px;
        height: 50px;
        object-fit: cover;
        border-radius: 8px;
    }

    .product-suggestion .info {
        flex: 1;
    }

    .product-suggestion .name {
        font-weight: 600;
        font-size: 0.85rem;
    }

    .product-suggestion .price {
        color: #0686bd;
        font-weight: bold;
        font-size: 0.85rem;
    }

    .product-suggestion i {
        color: #ccc;
    }

/* Indicador de escritura */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 5px 0;
}

    .typing-indicator span {
        width: 8px;
        height: 8px;
        background: #999;
        border-radius: 50%;
        animation: typing 1.4s infinite;
    }

        .typing-indicator span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-indicator span:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .chat-popup {
        bottom: 80px;
        right: 10px;
        width: calc(100% - 20px);
        height: calc(100vh - 120px);
        max-height: none;
        border-radius: 15px;
    }

    .btn-chat-float {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        bottom: 20px;
        right: 20px;
    }
}

/* Botón de limpiar historial */
.btn-close-chat.me-2 {
    margin-right: 8px;
}

.btn-close-chat .fa-trash-alt {
    font-size: 0.9rem;
}

.btn-close-chat:hover .fa-trash-alt {
    color: #ff6b6b;
}

/* Badge de notificación */
.badge-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 1.5s infinite;
}