// AI Brand Strategy Generator - Main Application Script // Modern ES6+ JavaScript with clean architecture class BrandStrategyApp { constructor() { this.currentStep = 1; this.totalSteps = 5; this.formData = {}; this.currentScreen = 'loginScreen'; this.demoScenarios = this.initializeDemoScenarios(); this.init(); } init() { this.initHeaderAnimations(); this.createFormSteps(); this.showFormStep(1); this.updateStepIndicator(); this.updateProgressBar(); this.setupAutoSave(); this.setupEventListeners(); } initHeaderAnimations() { // Initialize sophisticated header animations with staggered reveals const heroWords = document.querySelectorAll('.hero-word'); const heroLines = document.querySelectorAll('.hero-line'); const heroDecoration = document.querySelector('.hero-decoration'); // Animate words with staggered delays heroWords.forEach((word, index) => { const delay = parseInt(word.dataset.delay) || index * 100; word.style.animationDelay = `${delay}ms`; // Add hover interaction for extra sophistication word.addEventListener('mouseenter', () => { word.style.transform = 'scale(1.05) rotateX(-5deg)'; word.style.transition = 'transform 0.3s cubic-bezier(0.16, 1, 0.3, 1)'; }); word.addEventListener('mouseleave', () => { word.style.transform = 'scale(1) rotateX(0deg)'; }); }); // Animate subtitle lines heroLines.forEach((line, index) => { const delay = parseInt(line.dataset.delay) || (600 + index * 200); line.style.animationDelay = `${delay}ms`; }); // Animate decoration element if (heroDecoration) { const delay = parseInt(heroDecoration.dataset.delay) || 1000; heroDecoration.style.animationDelay = `${delay}ms`; // Add click interaction for decoration heroDecoration.addEventListener('click', () => { heroDecoration.style.animation = 'decorationShine 1s ease-in-out'; setTimeout(() => { heroDecoration.style.animation = ''; }, 1000); }); } // Add parallax effect to header background this.initParallaxEffect(); } initParallaxEffect() { const header = document.querySelector('.app-header'); if (!header) return; window.addEventListener('scroll', () => { const scrolled = window.pageYOffset; const rate = scrolled * -0.5; if (header) { header.style.transform = `translateY(${rate}px)`; } }); } initializeDemoScenarios() { return { tech: { companyName: "QuantumFlow AI", industry: "technology", companySize: "startup", website: "https://quantumflow.ai", description: "Revolutionary AI-powered workflow automation platform for enterprises seeking to transform their operational efficiency and reduce manual processes by up to 80%.", challenges: "Limited brand awareness in competitive market, high customer acquisition costs, difficulty communicating complex AI value proposition to non-technical decision makers", objectives: "Increase brand recognition by 300% in enterprise market, acquire 1000+ enterprise customers, achieve $10M ARR within 18 months, establish thought leadership in AI automation space", targetAudience: "Enterprise CTOs, IT Directors, and Operations Managers at companies with 500+ employees, typically aged 35-55, focused on digital transformation and operational efficiency", competitors: "Zapier, Microsoft Power Automate, UiPath, Automation Anywhere, ServiceNow", budget: "50k-100k", revenueGrowth: "100-200", timeline: "18-months", customerPains: "Manual repetitive tasks consuming 40% of employee time, disconnected systems requiring manual data transfer, lack of real-time operational visibility", geography: "national", advantages: "Advanced AI that learns from user patterns, 90% faster implementation than competitors, enterprise-grade security with SOC2 compliance", positioning: "innovation" }, healthcare: { companyName: "SmileCare Dental Group", industry: "healthcare", companySize: "medium", website: "https://smilecare.com", description: "Premier multi-location dental practice focused on comprehensive family and cosmetic dentistry, serving over 15,000 patients across 5 locations with state-of-the-art technology.", challenges: "Patient acquisition in digital-first environment, competing with corporate dental chains, managing online reputation across multiple locations, inconsistent brand messaging", objectives: "Increase new patient bookings by 150% across all locations, improve online reviews to 4.8+ stars, expand to 3 new locations within 2 years, launch comprehensive digital patient experience", targetAudience: "Health-conscious families with children, young professionals aged 25-45, seniors seeking specialized care, patients interested in cosmetic dentistry and wellness", competitors: "Aspen Dental, Heartland Dental, Pacific Dental Services, local independent practices, dental chains like Western Dental", budget: "25k-50k", revenueGrowth: "50-100", timeline: "2-years", customerPains: "Difficulty finding convenient appointment times, anxiety about dental procedures, confusion about insurance coverage, inconsistent care quality experiences", geography: "local", advantages: "Personalized care relationships, advanced pain-free technology, comprehensive family treatment under one roof, flexible scheduling and payment options", positioning: "service" }, retail: { companyName: "EcoStyle Fashion", industry: "retail", companySize: "small", website: "https://ecostyle.com", description: "Sustainable fashion brand creating ethically-made, eco-friendly apparel for conscious consumers, focusing on timeless designs and transparent supply chain practices.", challenges: "Transition from physical retail to online-first strategy, building brand trust in digital space, competing with fast fashion pricing, educating consumers about sustainable fashion value", objectives: "Achieve 70% online sales mix, build email list of 50,000 engaged subscribers, launch brand story campaign highlighting sustainability impact, increase average order value by 40%", targetAudience: "Environmentally conscious millennials and Gen Z consumers aged 18-40, income $50k+, values-driven shopping behavior, active on social media and sustainability communities", competitors: "Patagonia, Everlane, Reformation, Eileen Fisher, Organic Basics, local sustainable fashion brands", budget: "10k-25k", revenueGrowth: "50-100", timeline: "1-year", customerPains: "Difficulty finding stylish sustainable options, higher prices compared to fast fashion, uncertainty about true sustainability claims, limited size inclusivity in eco-fashion", geography: "national", advantages: "Fully transparent supply chain, carbon-neutral shipping, lifetime repair guarantee, inclusive sizing 0-24, partnership with environmental nonprofits", positioning: "value" } }; } setupEventListeners() { // Prevent form submission on Enter key document.addEventListener('keydown', (e) => { if (e.key === 'Enter' && e.target.tagName !== 'TEXTAREA') { e.preventDefault(); if (this.currentScreen === 'formScreen') { this.nextStep(); } } }); // Add smooth scrolling for better UX document.addEventListener('scroll', this.debounce(this.updateScrollProgress.bind(this), 100)); } setupAutoSave() { setInterval(() => { if (this.currentScreen === 'formScreen') { this.saveCurrentStepData(); console.log('Auto-saved form data:', this.formData); // Show subtle save indicator this.showSaveIndicator(); } }, 30000); // Auto-save every 30 seconds } showSaveIndicator() { // Create and show a subtle save indicator const indicator = document.createElement('div'); indicator.textContent = 'πΎ Draft saved'; indicator.style.cssText = ` position: fixed; top: 20px; right: 20px; background: var(--success); color: white; padding: 8px 16px; border-radius: 8px; font-size: 14px; z-index: 1000; opacity: 0; transition: opacity 0.3s ease; `; document.body.appendChild(indicator); // Animate in setTimeout(() => indicator.style.opacity = '1', 100); // Remove after 2 seconds setTimeout(() => { indicator.style.opacity = '0'; setTimeout(() => document.body.removeChild(indicator), 300); }, 2000); } updateScrollProgress() { const scrolled = (window.scrollY / (document.documentElement.scrollHeight - window.innerHeight)) * 100; document.documentElement.style.setProperty('--scroll-progress', `${scrolled}%`); } showScreen(screenId) { // Add exit animation to current screen const currentScreenEl = document.querySelector('.screen.active'); if (currentScreenEl) { currentScreenEl.style.animation = 'fadeOut 0.3s ease-out'; setTimeout(() => { currentScreenEl.classList.remove('active'); currentScreenEl.style.animation = ''; }, 300); } // Show new screen with entrance animation setTimeout(() => { document.querySelectorAll('.screen').forEach(screen => { screen.classList.remove('active'); }); document.getElementById(screenId).classList.add('active'); this.currentScreen = screenId; }, 300); } login() { const username = document.getElementById('username').value; const password = document.getElementById('password').value; // Simple validation for demo if (username && password) { this.showScreen('dashboardScreen'); this.trackEvent('user_login', { demo_mode: true }); } else { this.showNotification('Please enter both username and password', 'warning'); } } logout() { this.showScreen('loginScreen'); this.resetForm(); this.trackEvent('user_logout'); } startNewStrategy() { this.showScreen('formScreen'); this.resetForm(); this.trackEvent('strategy_started'); } backToDashboard() { this.showScreen('dashboardScreen'); } loadDemoScenario(scenario) { const data = this.demoScenarios[scenario]; if (!data) { this.showNotification('Demo scenario not found', 'error'); return; } this.formData = { ...data }; // Fill form with demo data this.populateFormFields(data); // Track demo usage this.trackEvent('demo_scenario_loaded', { scenario }); // Show notification this.showNotification(`Loaded ${data.companyName} demo scenario`, 'success'); // Skip to processing screen setTimeout(() => this.showProcessingScreen(), 500); } populateFormFields(data) { const fieldMap = { 'companyName': data.companyName, 'industry': data.industry, 'companySize': data.companySize, 'website': data.website, 'description': data.description, 'challenges': data.challenges, 'budget': data.budget, 'objectives': data.objectives, 'revenueGrowth': data.revenueGrowth, 'timeline': data.timeline, 'targetAudience': data.targetAudience, 'customerPains': data.customerPains, 'geography': data.geography, 'competitors': data.competitors, 'advantages': data.advantages, 'positioning': data.positioning }; Object.entries(fieldMap).forEach(([fieldId, value]) => { const element = document.getElementById(fieldId); if (element && value) { element.value = value; } }); } resetForm() { this.currentStep = 1; this.formData = {}; const form = document.getElementById('clientForm'); if (form) form.reset(); this.updateStepIndicator(); this.updateProgressBar(); this.showFormStep(1); } nextStep() { if (this.validateCurrentStep()) { this.saveCurrentStepData(); if (this.currentStep < this.totalSteps) { this.currentStep++; this.showFormStep(this.currentStep); this.updateStepIndicator(); this.updateProgressBar(); this.trackEvent('form_step_completed', { step: this.currentStep - 1 }); } else { // Form completed, start processing this.trackEvent('form_completed', { data: this.formData }); this.showProcessingScreen(); } } } previousStep() { if (this.currentStep > 1) { this.currentStep--; this.showFormStep(this.currentStep); this.updateStepIndicator(); this.updateProgressBar(); } } validateCurrentStep() { const currentStepElement = document.querySelector(`.form-step:nth-child(${this.currentStep})`); if (!currentStepElement) return false; const requiredFields = currentStepElement.querySelectorAll('input[required], select[required], textarea[required]'); let isValid = true; let firstInvalidField = null; requiredFields.forEach(field => { const isFieldValid = field.value.trim() !== ''; if (!isFieldValid) { field.style.borderColor = 'var(--danger)'; field.style.boxShadow = '0 0 0 3px rgba(239, 68, 68, 0.1)'; isValid = false; if (!firstInvalidField) firstInvalidField = field; } else { field.style.borderColor = 'var(--glass-border)'; field.style.boxShadow = ''; } }); if (!isValid) { this.showNotification('Please fill in all required fields', 'warning'); if (firstInvalidField) { firstInvalidField.focus(); firstInvalidField.scrollIntoView({ behavior: 'smooth', block: 'center' }); } } return isValid; } saveCurrentStepData() { const currentStepElement = document.querySelector(`.form-step:nth-child(${this.currentStep})`); if (!currentStepElement) return; const inputs = currentStepElement.querySelectorAll('input, select, textarea'); inputs.forEach(input => { if (input.id) { this.formData[input.id] = input.value; } }); } showFormStep(step) { this.createFormSteps(); // Ensure steps exist document.querySelectorAll('.form-step').forEach((stepEl, index) => { stepEl.style.display = index + 1 === step ? 'block' : 'none'; }); // Update navigation buttons const prevBtn = document.getElementById('prevBtn'); const nextBtn = document.getElementById('nextBtn'); if (prevBtn) prevBtn.style.display = step > 1 ? 'inline-flex' : 'none'; if (nextBtn) nextBtn.textContent = step === this.totalSteps ? 'Generate Strategy π' : 'Next Step β'; } createFormSteps() { const form = document.getElementById('clientForm'); if (!form) return; // Check if steps already exist if (form.querySelectorAll('.form-step').length >= this.totalSteps) return; form.innerHTML = this.generateFormHTML(); } generateFormHTML() { return `
Tell us about your company and what industry you're in
Help us understand your current market position and challenges
Define your goals and growth targets for the next 12-24 months
Tell us about your ideal customers and their needs
Help us understand your competitive environment and advantages
Company Overview: ${data.description || 'A forward-thinking company positioned for growth in the competitive marketplace.'}
Current Challenges: ${data.challenges || 'Limited brand awareness and market penetration in target segments.'}
SWOT Analysis:
Primary Goals (${data.timeline || '12-month'} timeline):
Key Performance Indicators:
Brand Positioning Statement:
${companyName} is the ${data.positioning || 'innovative'} choice for ${data.targetAudience || 'forward-thinking businesses'} seeking ${data.advantages || 'superior solutions and exceptional value'} in the ${data.industry || 'technology'} space. We deliver measurable results through our unique approach that combines cutting-edge innovation with personalized service.
Value Proposition Framework:
Target Audience Segmentation:
π― REACH - Build Awareness & Drive Traffic:
π¬ ACT - Drive Engagement & Interest:
π° CONVERT - Generate Quality Leads & Sales:
β€οΈ ENGAGE - Build Loyalty & Advocacy:
Month 1 - Foundation & Setup:
Month 2 - Campaign Launch & Amplification:
Month 3 - Optimization & Scale:
Resource Requirements:
Monitoring Schedule:
Analytics & Reporting Tools:
Success Benchmarks & Milestones:
Optimization Framework:
Recommended Investment Allocation:
Financial Projections:
Risk Mitigation: