Error: ${result.error}`;
                    messageDiv.className = 'mt-4 text-center text-red-600';
                }
            } catch (error) {
                const messageDiv = document.getElementById('message');
                messageDiv.classList.remove('hidden');
                messageDiv.textContent = 'An error occurred while submitting the application.';
                messageDiv.className = 'mt-4 text-center text-red-600';
            }
        });
    </script>
</body>
</html> 