File size: 2,984 Bytes
963efaf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Handle input interactions
const mainInput = document.querySelector('.main-input');
const addBtn = document.querySelector('.add-btn');
const uploadBtn = document.querySelector('.upload-btn');

// Focus input when clicking add button
if (addBtn) {
    addBtn.addEventListener('click', () => {
        mainInput.focus();
    });
}

// Handle upload button click
if (uploadBtn) {
    uploadBtn.addEventListener('click', () => {
        // Create hidden file input
        const fileInput = document.createElement('input');
        fileInput.type = 'file';
        fileInput.accept = 'image/*,.pdf';
        fileInput.style.display = 'none';
        
        fileInput.addEventListener('change', (e) => {
            if (e.target.files && e.target.files[0]) {
                console.log('File selected:', e.target.files[0].name);
                // Handle file upload logic here
            }
        });
        
        document.body.appendChild(fileInput);
        fileInput.click();
        document.body.removeChild(fileInput);
    });
}

// Handle Enter key in input
if (mainInput) {
    mainInput.addEventListener('keypress', (e) => {
        if (e.key === 'Enter' && mainInput.value.trim()) {
            console.log('Generating:', mainInput.value);
            // Handle generation logic here
        }
    });
}

// Handle template card clicks
const templateCards = document.querySelectorAll('.template-card');
templateCards.forEach(card => {
    card.addEventListener('click', () => {
        const templateName = card.querySelector('.template-name').textContent;
        console.log('Template clicked:', templateName);
        // Handle template navigation here
    });
});

// Handle navigation dropdowns
const dropdowns = document.querySelectorAll('.nav-link.dropdown');
dropdowns.forEach(dropdown => {
    dropdown.addEventListener('click', (e) => {
        e.preventDefault();
        console.log('Dropdown clicked:', dropdown.textContent.trim());
        // Handle dropdown menu display here
    });
});

// Add smooth scroll behavior
document.documentElement.style.scrollBehavior = 'smooth';

// Add smooth animations on page load
window.addEventListener('load', () => {
    const hero = document.querySelector('.hero');
    if (hero) {
        hero.style.opacity = '0';
        hero.style.transform = 'translateY(10px)';
        
        setTimeout(() => {
            hero.style.transition = 'all 0.5s ease';
            hero.style.opacity = '1';
            hero.style.transform = 'translateY(0)';
        }, 100);
    }
    
    // Animate template cards
    const cards = document.querySelectorAll('.template-card');
    cards.forEach((card, index) => {
        card.style.opacity = '0';
        card.style.transform = 'translateY(20px)';
        
        setTimeout(() => {
            card.style.transition = 'all 0.4s ease';
            card.style.opacity = '1';
            card.style.transform = 'translateY(0)';
        }, 200 + (index * 50));
    });
});