/* ==========================================================================
   Chatbot Leads — Estilos del front-end
   ========================================================================== */

/* Botón flotante para abrir/cerrar el chat */
.chatbot-leads-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 28px;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.chatbot-leads-toggle:hover {
    background-color: #1d4ed8;
    transform: scale(1.05);
}

.chatbot-leads-toggle.is-hidden {
    display: none;
}

/* Ventana de chat */
.chatbot-leads-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.chatbot-leads-window.is-open {
    display: flex;
}

/* Cabecera */
.chatbot-leads-header {
    background-color: #2563eb;
    color: #ffffff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-leads-header-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0;
}

.chatbot-leads-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

/* Lista de mensajes */
.chatbot-leads-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background-color: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chatbot-leads-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chatbot-leads-message--bot {
    align-self: flex-start;
    background-color: #e5e7eb;
    color: #111827;
    border-bottom-left-radius: 4px;
}

.chatbot-leads-message--user {
    align-self: flex-end;
    background-color: #2563eb;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.chatbot-leads-message--system {
    align-self: center;
    background-color: transparent;
    color: #6b7280;
    font-size: 12px;
    font-style: italic;
}

/* Formulario de envío */
.chatbot-leads-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    background-color: #ffffff;
}

.chatbot-leads-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.chatbot-leads-input:focus {
    border-color: #2563eb;
}

.chatbot-leads-send {
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    padding: 0 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.chatbot-leads-send:hover {
    background-color: #1d4ed8;
}

.chatbot-leads-send:disabled {
    background-color: #93c5fd;
    cursor: not-allowed;
}

/* Indicador de escritura */
.chatbot-leads-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background-color: #e5e7eb;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.chatbot-leads-typing span {
    width: 6px;
    height: 6px;
    background-color: #6b7280;
    border-radius: 50%;
    animation: chatbot-leads-bounce 1.2s infinite ease-in-out;
}

.chatbot-leads-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.chatbot-leads-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes chatbot-leads-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Adaptación a pantallas pequeñas */
@media (max-width: 480px) {
    .chatbot-leads-window {
        right: 10px;
        bottom: 80px;
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
    }

    .chatbot-leads-toggle {
        right: 10px;
        bottom: 10px;
    }
}