// Validate redirect URL for security
            const isValidRedirectUrl = (url) => {
                if (!url || typeof url !== 'string') {
                    return false;
                }
                
                // Must start with "/" (relative path)
                if (!url.startsWith('/')) {
                    return false;
                }
                
                // Must not start with "//" (protocol-relative URL)
                if (url.startsWith('//')) {
                    