class CustomNavbar extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = ` `; // Mobile menu toggle const menuBtn = this.shadowRoot.getElementById('menuBtn'); const navLinks = this.shadowRoot.getElementById('navLinks'); menuBtn.addEventListener('click', () => { navLinks.classList.toggle('active'); }); // Initialize feather icons after a short delay to ensure DOM is ready setTimeout(() => { const featherScript = document.createElement('script'); featherScript.src = 'https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js'; featherScript.onload = () => { if (typeof feather !== 'undefined') { feather.replace(); } }; this.shadowRoot.appendChild(featherScript); }, 100); } } customElements.define('custom-navbar', CustomNavbar);