Listener('click', function(e) {
            if (e.target === this) {
                hideAddLinkDialog();
            }
        });

        // Escape key to close dialog
        document.addEventListener('keydown', function(e) {
            if (e.key === 'Escape') {
                hideAddLinkDialog();
            }
        });

        // Load saved theme
        document.addEventListener('DOMContentLoaded', () => {
            const savedTheme = localStorage.getItem('theme');
            if (savedTheme =