<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>500 - System Error</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script>
        tailwind.config = {
            darkMode: 'class',
            theme: { extend: { colors: { primary: '#1c70b4' } } }
        }
    </script>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');
        body { font-family: 'Plus Jakarta Sans', sans-serif; }
    </style>
</head>
<body class="bg-gray-100 text-gray-900 dark:bg-gray-900 dark:text-gray-100 min-h-screen flex flex-col items-center justify-center p-4">
    
    <div class="max-w-lg w-full bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700/50 p-8 md:p-12 text-center relative overflow-hidden">
        <div class="absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-red-600 to-red-400 shadow-[0_0_10px_rgba(239,68,68,0.5)]"></div>
        
        <div class="mx-auto flex items-center justify-center h-20 w-20 rounded-2xl bg-red-50 dark:bg-red-900/20 mb-6 border border-red-100 dark:border-red-800/30 shadow-inner">
            <svg class="h-10 w-10 text-red-600 dark:text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path>
            </svg>
        </div>
        
        <h1 class="text-3xl font-extrabold text-gray-900 dark:text-white mb-3 tracking-tight">System Error</h1>
        <p class="text-gray-600 dark:text-gray-400 mb-8 leading-relaxed text-sm">
            We're sorry, but something went wrong on our end. Our engineering team has automatically been notified of this issue and is working to resolve it.
        </p>
        
        <button onclick="window.location.href='/'" class="inline-flex items-center justify-center w-full bg-primary hover:opacity-90 text-white font-bold py-3.5 px-6 rounded-lg transition-all shadow-sm focus:ring-4 focus:ring-primary/50">
            <svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path>
            </svg>
            Return to Homepage
        </button>
    </div>

    <div class="mt-8 text-xs text-gray-400 dark:text-gray-500 font-mono text-center space-y-2">
        <span class="block">If this issue persists, please contact support.</span>
        <span class="block px-3 py-1.5 bg-gray-200 dark:bg-gray-800 border border-gray-300 dark:border-gray-700/50 rounded-lg inline-block font-bold">HTTP_500_INTERNAL_SERVER_ERROR</span>
    </div>

    <script>
        // Auto-detect system dark mode for standalone error page (Independent of theme.js)
        if (localStorage.getItem('theme') === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
            document.documentElement.classList.add('dark');
        }
    </script>
</body>
</html>