// add a message to UI (type: 'user' or 'bot') function addMessage(text, sender) const messageDiv = document.createElement('div'); messageDiv.classList.add('message'); messageDiv.classList.add(sender === 'user' ? 'user-message' : 'bot-message');
// Optional: Focus input on page load messageInput.focus(); website chat script
/* typing indicator (bot) */ .typing-indicator display: flex; align-items: center; gap: 5px; padding: 10px 16px; background: #e5e7eb; width: fit-content; border-radius: 24px; border-bottom-left-radius: 4px; // add a message to UI (type: 'user'
.chat-input-area button:hover background: #0f172a; transform: scale(0.96); sender) const messageDiv = document.createElement('div')
.user-message align-self: flex-end;
.status-dot width: 8px; height: 8px; background: #10b981; border-radius: 50%; display: inline-block; animation: pulse 1.8s infinite;