// Smooth scrolling 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' }); } }); }); // Mobile menu toggle const hamburger = document.querySelector('.hamburger'); const navMenu = document.querySelector('.nav-menu'); if (hamburger && navMenu) { hamburger.addEventListener('click', () => { hamburger.classList.toggle('active'); navMenu.classList.toggle('active'); }); // Close mobile menu when clicking on a link document.querySelectorAll('.nav-link').forEach(n => n.addEventListener('click', () => { hamburger.classList.remove('active'); navMenu.classList.remove('active'); })); } // Navbar background on scroll window.addEventListener('scroll', () => { const navbar = document.querySelector('.navbar'); if (window.scrollY > 50) { navbar.style.background = 'rgba(255, 255, 255, 0.98)'; } else { navbar.style.background = 'rgba(255, 255, 255, 0.95)'; } }); // User profile dropdown simulation const userProfile = document.querySelector('.user-profile'); if (userProfile) { userProfile.addEventListener('click', () => { alert('User menu would open here with options like:\n• Profile Settings\n• Account Preferences\n• Logout'); }); } // Notification icon click const notificationIcon = document.querySelector('.notification-icon'); if (notificationIcon) { notificationIcon.addEventListener('click', () => { alert('Notifications:\n• Sarah completed "UI Design"\n• New comment on "Backend API"\n• Project deadline approaching'); }); } // Project card interactions document.querySelectorAll('.project-card').forEach(card => { card.addEventListener('click', () => { const projectName = card.querySelector('h3').textContent; alert(`Opening project: ${projectName}\n\nThis would navigate to the detailed project view.`); }); }); // Team member interactions document.querySelectorAll('.team-member').forEach(member => { member.addEventListener('click', () => { const memberName = member.querySelector('h3').textContent; alert(`Opening profile for: ${memberName}\n\nThis would show detailed team member information.`); }); }); // Button click handlers document.querySelectorAll('.btn').forEach(btn => { btn.addEventListener('click', (e) => { const buttonText = btn.textContent; if (buttonText.includes('Create') || buttonText.includes('New')) { e.stopPropagation(); alert(`${buttonText} functionality would open here.\n\nThis would typically open a modal or navigate to a creation form.`); } else if (buttonText.includes('View')) { e.stopPropagation(); alert(`${buttonText} functionality would open here.\n\nThis would navigate to a detailed view or listing page.`); } }); }); // Intersection Observer for animations const observerOptions = { threshold: 0.1, rootMargin: '0px 0px -50px 0px' }; const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.style.opacity = '1'; entry.target.style.transform = 'translateY(0)'; } }); }, observerOptions); // Observe elements for animation document.querySelectorAll('.project-card, .team-member, .report-card, .stat-card').forEach(el => { el.style.opacity = '0'; el.style.transform = 'translateY(30px)'; el.style.transition = 'opacity 0.6s ease, transform 0.6s ease'; observer.observe(el); }); // Hero section fade-in animation window.addEventListener('load', () => { const heroTitle = document.querySelector('.hero-title'); const heroSubtitle = document.querySelector('.hero-subtitle'); const quickStats = document.querySelector('.quick-stats'); const heroButtons = document.querySelector('.hero-buttons'); [heroTitle, heroSubtitle, quickStats, heroButtons].forEach((element, index) => { if (element) { element.style.opacity = '0'; element.style.transform = 'translateY(30px)'; element.style.transition = 'opacity 0.8s ease, transform 0.8s ease'; setTimeout(() => { element.style.opacity = '1'; element.style.transform = 'translateY(0)'; }, 300 + (index * 200)); } }); }); // Simulate real-time updates setInterval(() => { const activityItems = document.querySelectorAll('.activity-item'); if (activityItems.length > 0) { const randomItem = activityItems[Math.floor(Math.random() * activityItems.length)]; randomItem.style.background = '#f0f9ff'; setTimeout(() => { randomItem.style.background = 'transparent'; }, 2000); } }, 10000); // Add mobile menu styles dynamically const style = document.createElement('style'); style.textContent = ` @media (max-width: 768px) { .nav-menu.active { display: flex; position: absolute; top: 100%; left: 0; width: 100%; background: white; flex-direction: column; padding: 1rem 2rem; box-shadow: var(--shadow); border-top: 1px solid var(--border); } .hamburger.active span:nth-child(1) { transform: rotate(-45deg) translate(-5px, 6px); } .hamburger.active span:nth-child(2) { opacity: 0; } .hamburger.active span:nth-child(3) { transform: rotate(45deg) translate(-5px, -6px); } } `; document.head.appendChild(style);