/**
 * Limpia Total PRO - Estilos del Asistente Virtual ChatGPT (LimpiaBot)
 * Widget flotante, burbujas de mensaje, píldoras interactivas y tarjeta de derivación WhatsApp
 */

.limpiabot-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    font-family: var(--font-body);
}

/* Botón Launcher Flotante */
.limpiabot-toggle-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #00874e 100%);
    color: var(--white);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(14, 167, 79, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.limpiabot-toggle-btn:hover {
    transform: scale(1.08);
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--primary);
    animation: ringPulse 2.5s infinite;
}

@keyframes ringPulse {
    0% { transform: scale(1); opacity: 0.8; }
    70% { transform: scale(1.4); opacity: 0; }
    100% { transform: scale(1.4); opacity: 0; }
}

.bot-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border: 2px solid var(--white);
    border-radius: 50%;
}

/* Tooltip / Burbuja de Bienvenida */
.limpiabot-badge-bubble {
    position: absolute;
    bottom: 75px;
    right: 0;
    background: var(--white);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--dark);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.badge-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
}

@keyframes bounceIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Ventana del Chat */
.limpiabot-chat-window {
    position: absolute;
    bottom: 78px;
    right: 0;
    width: 380px;
    height: 560px;
    max-height: 82vh;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(20px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Cabecera del Chat */
.chat-header {
    background: linear-gradient(135deg, var(--secondary) 0%, #063857 100%);
    color: var(--white);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bot-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    position: relative;
}

.avatar-online {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #4ade80;
    border: 2px solid var(--white);
    border-radius: 50%;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: var(--white);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.header-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Barra Superior de Llamada Rápida */
.chat-quick-contact-bar {
    background: #f0fdf4;
    border-bottom: 1px solid #bbf7d0;
    padding: 0.5rem 1rem;
    font-size: 0.78rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #166534;
}

.quick-call-link {
    font-weight: 700;
    color: #16a34a;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.quick-call-link:hover {
    text-decoration: underline;
}

/* Cuerpo de Mensajes */
.chat-messages-body {
    flex-grow: 1;
    padding: 1.25rem 1rem;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    gap: 0.6rem;
    max-width: 88%;
}

.message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-bot {
    align-self: flex-start;
}

.bot-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--secondary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.message-bubble {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    line-height: 1.5;
}

.message-user .message-bubble {
    background: var(--secondary);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.message-bot .message-bubble {
    background: var(--white);
    color: #1e293b;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    border-bottom-left-radius: 4px;
}

/* Píldoras de Sugerencias dentro del Bot */
.bot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.suggestion-btn {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(14, 167, 79, 0.3);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.suggestion-btn:hover {
    background: var(--primary);
    color: var(--white);
}

/* Indicador de Escritura */
.typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.6rem 1rem;
}

.typing-bubble span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingPulse 1.4s infinite ease-in-out;
}

.typing-bubble span:nth-child(1) { animation-delay: 0s; }
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

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

/* Tarjeta de Derivación a WhatsApp */
.escalation-bubble {
    background: #f0fdf4 !important;
    border: 1.5px solid #86efac !important;
}

.escalation-title {
    color: #166534;
    font-size: 0.95rem;
    font-weight: 800;
}

/* Píldoras Rápidas Inferiores */
.chat-quick-pills {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.chat-quick-pills::-webkit-scrollbar {
    display: none;
}

.quick-pill {
    background: #f1f5f9;
    color: var(--dark);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.quick-pill:hover {
    background: var(--secondary-light);
    border-color: var(--secondary);
    color: var(--secondary);
}

/* Input Form */
.chat-input-form {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    gap: 0.5rem;
}

.chat-input-text {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    padding: 0.65rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition);
}

.chat-input-text:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 167, 79, 0.15);
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

@media (max-width: 480px) {
    .limpiabot-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}
