File size: 9,598 Bytes
4e917b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82385fc
4e917b1
82385fc
4e917b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
class CustomNavbar extends HTMLElement {
    connectedCallback() {
        this.attachShadow({ mode: 'open' });
        this.shadowRoot.innerHTML = `
            <style>
                * {
                    margin: 0;
                    padding: 0;
                    box-sizing: border-box;
                }
                
                nav {
                    background: white;
                    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
                    position: fixed;
                    width: 100%;
                    top: 0;
                    z-index: 1000;
                    transition: all 0.3s ease;
                }
                
                .nav-container {
                    max-width: 1280px;
                    margin: 0 auto;
                    padding: 0 1rem;
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    height: 80px;
                }
                
                .logo {
                    display: flex;
                    align-items: center;
                    font-size: 1.5rem;
                    font-weight: 800;
                    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
                    -webkit-background-clip: text;
                    -webkit-text-fill-color: transparent;
                    background-clip: text;
                    text-decoration: none;
                    transition: transform 0.3s ease;
                }
                
                .logo:hover {
                    transform: scale(1.05);
                }
                
                .logo-icon {
                    width: 40px;
                    height: 40px;
                    margin-right: 0.5rem;
                }
                
                .nav-links {
                    display: flex;
                    gap: 2rem;
                    align-items: center;
                    list-style: none;
                }
                
                .nav-link {
                    color: #4a5568;
                    text-decoration: none;
                    font-weight: 500;
                    position: relative;
                    transition: color 0.3s ease;
                    padding: 0.5rem 0;
                }
                
                .nav-link::after {
                    content: '';
                    position: absolute;
                    bottom: 0;
                    left: 0;
                    width: 0;
                    height: 2px;
                    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
                    transition: width 0.3s ease;
                }
                
                .nav-link:hover {
                    color: #667eea;
                }
                
                .nav-link:hover::after {
                    width: 100%;
                }
                
                .nav-link.active {
                    color: #667eea;
                }
                
                .nav-link.active::after {
                    width: 100%;
                }
                
                .cta-button {
                    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
                    color: white;
                    padding: 0.75rem 1.5rem;
                    border-radius: 50px;
                    text-decoration: none;
                    font-weight: 600;
                    transition: all 0.3s ease;
                    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
                }
                
                .cta-button:hover {
                    transform: translateY(-2px);
                    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
                }
                
                .mobile-menu-toggle {
                    display: none;
                    background: none;
                    border: none;
                    cursor: pointer;
                    padding: 0.5rem;
                }
                
                .mobile-menu-toggle svg {
                    width: 24px;
                    height: 24px;
                    color: #4a5568;
                }
                
                .mobile-menu {
                    display: none;
                    position: absolute;
                    top: 100%;
                    left: 0;
                    right: 0;
                    background: white;
                    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
                    padding: 1rem;
                    transform: translateY(-100%);
                    opacity: 0;
                    transition: all 0.3s ease;
                }
                
                .mobile-menu.active {
                    transform: translateY(0);
                    opacity: 1;
                }
                
                .mobile-menu-links {
                    list-style: none;
                    display: flex;
                    flex-direction: column;
                    gap: 1rem;
                }
                
                .mobile-menu-link {
                    color: #4a5568;
                    text-decoration: none;
                    font-weight: 500;
                    padding: 0.75rem;
                    border-radius: 0.5rem;
                    transition: all 0.3s ease;
                }
                
                .mobile-menu-link:hover {
                    background: #f7fafc;
                    color: #667eea;
                }
                
                .mobile-menu-link.active {
                    color: #667eea;
                    background: #f7fafc;
                }
                
                @media (max-width: 768px) {
                    .nav-links {
                        display: none;
                    }
                    
                    .mobile-menu-toggle {
                        display: block;
                    }
                    
                    .mobile-menu {
                        display: block;
                    }
                }
            </style>
            
            <nav>
                <div class="nav-container">
                    <a href="index.html" class="logo">
                        <span class="logo-icon">πŸ€–</span>
                        MixTAO Lab
                    </a>
<ul class="nav-links">
                        <li><a href="index.html" class="nav-link active">Home</a></li>
                        <li><a href="products.html" class="nav-link">Products</a></li>
                        <li><a href="about.html" class="nav-link">About</a></li>
                        <li><a href="contact.html" class="nav-link">Contact</a></li>
                        <li><a href="contact.html" class="cta-button">Get Started</a></li>
                    </ul>
                    
                    <button class="mobile-menu-toggle" onclick="toggleMobileMenu()">
                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
                        </svg>
                    </button>
                </div>
                
                <div class="mobile-menu" id="mobileMenu">
                    <ul class="mobile-menu-links">
                        <li><a href="index.html" class="mobile-menu-link active">Home</a></li>
                        <li><a href="products.html" class="mobile-menu-link">Products</a></li>
                        <li><a href="about.html" class="mobile-menu-link">About</a></li>
                        <li><a href="contact.html" class="mobile-menu-link">Contact</a></li>
                        <li><a href="contact.html" class="mobile-menu-link" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white;">Get Started</a></li>
                    </ul>
                </div>
            </nav>
        `;
        
        // Set active link based on current page
        this.setActiveLink();
        
        // Add scroll effect
        this.addScrollEffect();
    }
    
    setActiveLink() {
        const currentPath = window.location.pathname.split('/').pop() || 'index.html';
        const links = this.shadowRoot.querySelectorAll('.nav-link, .mobile-menu-link');
        
        links.forEach(link => {
            link.classList.remove('active');
            const href = link.getAttribute('href');
            if (href === currentPath) {
                link.classList.add('active');
            }
        });
    }
    
    addScrollEffect() {
        const nav = this.shadowRoot.querySelector('nav');
        
        window.addEventListener('scroll', () => {
            if (window.scrollY > 50) {
                nav.style.boxShadow = '0 4px 6px rgba(0,0,0,0.1)';
                nav.style.background = 'rgba(255, 255, 255, 0.95)';
                nav.style.backdropFilter = 'blur(10px)';
            } else {
                nav.style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)';
                nav.style.background = 'white';
                nav.style.backdropFilter = 'none';
            }
        });
    }
}

// Mobile menu toggle function
window.toggleMobileMenu = function() {
    const mobileMenu = document.querySelector('custom-navbar').shadowRoot.getElementById('mobileMenu');
    mobileMenu.classList.toggle('active');
};

customElements.define('custom-navbar', CustomNavbar);