           .then(response => response.json())
                .then(data => {
                    // Hide loading once we have data
                    document.getElementById('loading-container').classList.add('hidden');
                    
                    if (data.connected) {
                        // If connected, show success message and dashboard
                        document.getElementById('pairing-container').classList.add('hidden');
                        document.getElementById('success-