Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Mobile menu toggle
+ const menuToggle = document.querySelector('.menu-toggle');
+ const navLinks = document.querySelector('.nav-links');
+
+ menuToggle.addEventListener('click', () => {
+ navLinks.classList.toggle('active');
+
+ // Animate hamburger to X
+ const spans = menuToggle.querySelectorAll('span');
+ spans.forEach(span => span.classList.toggle('active'));
+ });
+
+ // Smooth scroll for navigation links
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
+ anchor.addEventListener('click', function (e) {
+ e.preventDefault();
+ const target = document.querySelector(this.getAttribute('href'));
+ if (target) {
+ target.scrollIntoView({
+ behavior: 'smooth',
+ block: 'start'
+ });
+ // Close mobile menu if open
+ navLinks.classList.remove('active');
+ }
+ });
+ });
+
+ // Chat demo functionality
+ const chatMessages = document.querySelector('.chat-messages');
+ const chatInput = document.querySelector('.chat-input input');
+ const sendButton = document.querySelector('.send-button');
+
+ function addMessage(message, isUser = true) {
+ const messageDiv = document.createElement('div');
+ messageDiv.classList.add('message', isUser ? 'user-message' : 'bot-message');
+ messageDiv.style.padding = '0.5rem';
+ messageDiv.style.margin = '0.5rem';
+ messageDiv.style.borderRadius = '5px';
+ messageDiv.style.maxWidth = '80%';
+ messageDiv.style.alignSelf = isUser ? 'flex-end' : 'flex-start';
+ messageDiv.style.background = isUser ? '#10a37f' : '#f0f0f0';
+ messageDiv.style.color = isUser ? 'white' : 'black';
+ messageDiv.textContent = message;
+ chatMessages.appendChild(messageDiv);
+ chatMessages.scrollTop = chatMessages.scrollHeight;
+ }
+
+ function handleMessage() {
+ const message = chatInput.value.trim();
+ if (message) {
+ addMessage(message, true);
+ chatInput.value = '';
+
+ // Simulate bot response
+ setTimeout(() => {
+ addMessage('Thanks for your message! This is a demo response.', false);
+ }, 1000);
+ }
+ }
+
+ sendButton.addEventListener('click', handleMessage);
+ chatInput.addEventListener('keypress', (e) => {
+ if (e.key === 'Enter') {
+ handleMessage();
+ }
+ });
+
+ // Intersection Observer for animations
+ const observer = new IntersectionObserver((entries) => {
+ entries.forEach(entry => {
+ if (entry.isIntersecting) {
+ entry.target.style.opacity = '1';
+ entry.target.style.transform = 'translateY(0)';
+ }
+ });
+ }, { threshold: 0.1 });
+
+ document.querySelectorAll('.feature-card, .step').forEach(element => {
+ element.style.opacity = '0';
+ element.style.transform = 'translateY(20px)';
+ element.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
+ observer.observe(element);
+ });
+ });