<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}{{ status_code }} - {{ status_name }}{% endblock %} | Admin Portal</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #1f2937;
            padding: 2rem;
        }

        .error-container {
            background: white;
            border-radius: 1rem;
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
            max-width: 600px;
            width: 100%;
            padding: 3rem;
            text-align: center;
        }

        .error-icon {
            font-size: 5rem;
            margin-bottom: 1rem;
        }

        .status-code {
            font-size: 6rem;
            font-weight: 700;
            color: #667eea;
            line-height: 1;
            margin-bottom: 0.5rem;
        }

        .status-name {
            font-size: 1.5rem;
            font-weight: 600;
            color: #374151;
            margin-bottom: 1rem;
        }

        .error-message {
            font-size: 1.1rem;
            color: #6b7280;
            margin-bottom: 2rem;
            line-height: 1.6;
        }

        .error-code {
            display: inline-block;
            background: #f3f4f6;
            padding: 0.5rem 1rem;
            border-radius: 0.5rem;
            font-family: 'Courier New', monospace;
            font-size: 0.875rem;
            color: #6b7280;
            margin-bottom: 2rem;
        }

        .action-buttons {
            display: flex;
            gap: 1rem;
            justify-content: center;
            flex-wrap: wrap;
        }

        .btn {
            display: inline-flex;
            align-items: center;
            padding: 0.75rem 1.5rem;
            border-radius: 0.5rem;
            font-weight: 600;
            text-decoration: none;
            transition: all 0.3s ease;
            border: none;
            cursor: pointer;
            font-size: 1rem;
        }

        .btn-primary {
            background: #667eea;
            color: white;
        }

        .btn-primary:hover {
            background: #5568d3;
            transform: translateY(-2px);
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        }

        .btn-secondary {
            background: #f3f4f6;
            color: #374151;
        }

        .btn-secondary:hover {
            background: #e5e7eb;
            transform: translateY(-2px);
        }

        .debug-info {
            margin-top: 2rem;
            padding: 1.5rem;
            background: #fef3c7;
            border-left: 4px solid #f59e0b;
            border-radius: 0.5rem;
            text-align: left;
        }

        .debug-info h3 {
            color: #92400e;
            font-size: 1rem;
            margin-bottom: 0.5rem;
        }

        .debug-info pre {
            background: white;
            padding: 1rem;
            border-radius: 0.25rem;
            overflow-x: auto;
            font-size: 0.875rem;
            color: #374151;
            margin-top: 0.5rem;
        }

        .debug-item {
            margin-bottom: 0.75rem;
        }

        .debug-label {
            font-weight: 600;
            color: #92400e;
            display: inline-block;
            min-width: 100px;
        }

        .debug-value {
            color: #1f2937;
            font-family: 'Courier New', monospace;
            font-size: 0.875rem;
        }

        .support-link {
            margin-top: 2rem;
            padding-top: 2rem;
            border-top: 1px solid #e5e7eb;
            font-size: 0.875rem;
            color: #6b7280;
        }

        .support-link a {
            color: #667eea;
            text-decoration: none;
            font-weight: 600;
        }

        .support-link a:hover {
            text-decoration: underline;
        }

        {% block extra_styles %}{% endblock %}
    </style>
</head>
<body>
    <div class="error-container">
        {% block content %}
        <div class="error-icon">{% block icon %}⚠️{% endblock %}</div>
        <div class="status-code">{{ status_code }}</div>
        <div class="status-name">{{ status_name }}</div>
        <div class="error-message">{{ message }}</div>
        <div class="error-code">Error Code: {{ error_code }}</div>

        <div class="action-buttons">
            {% block action_buttons %}
            <a href="/admin/dashboard" class="btn btn-primary">Go to Dashboard</a>
            <a href="javascript:history.back()" class="btn btn-secondary">Go Back</a>
            {% endblock %}
        </div>

        {% if show_debug %}
        <div class="debug-info">
            <h3>🔧 Debug Information (Admin Only)</h3>
            <div class="debug-item">
                <span class="debug-label">Path:</span>
                <span class="debug-value">{{ path }}</span>
            </div>
            <div class="debug-item">
                <span class="debug-label">Error Code:</span>
                <span class="debug-value">{{ error_code }}</span>
            </div>
            {% if details %}
            <div class="debug-item">
                <span class="debug-label">Details:</span>
                <pre>{{ details | tojson(indent=2) }}</pre>
            </div>
            {% endif %}
        </div>
        {% endif %}

        {% block extra_content %}{% endblock %}

        <div class="support-link">
            {% block support_link %}
            Need help? <a href="/admin/support">Contact Support</a>
            {% endblock %}
        </div>
        {% endblock %}
    </div>
</body>
</html>
