{% extends "base.html" %}

{% block title %}Arcane Disruption - Code of Conquest{% endblock %}

{% block content %}
<div class="error-container">
    <div class="error-content">
        <!-- Error Code -->
        <div class="error-code">500</div>

        <!-- Error Title -->
        <h1 class="error-title">Arcane Disruption</h1>

        <!-- Flavor Text -->
        <div class="error-description">
            <p class="lead">The magical wards have been breached!</p>
            <p>A powerful enchantment has gone awry, causing a disturbance in the realm's core magic. Our court wizards are investigating the anomaly and working to restore balance.</p>
        </div>

        <!-- Decorative Divider -->
        <div class="error-divider">🔮</div>

        <!-- Navigation Options -->
        <div class="error-actions">
            <a href="/" class="btn btn-primary">
                Return to Safety
            </a>
            <a href="javascript:window.location.reload()" class="btn btn-secondary">
                Attempt Restoration
            </a>
        </div>

        <!-- Additional Help -->
        <div class="error-help">
            <p class="help-text">
                If this disruption persists, the kingdom's mages (our support team) may need to intervene.
                Please try again in a few moments, or <a href="/" class="text-link">retreat to the main hall</a>.
            </p>
        </div>

        <!-- Technical Details (for development) -->
        {% if config.get('app', {}).get('debug', False) %}
        <div class="error-debug">
            <details>
                <summary class="debug-summary">Arcane Runes (Debug Info)</summary>
                <div class="debug-content">
                    <p><strong>Spell Component:</strong> Internal Server Error</p>
                    <p><strong>Magical Signature:</strong> {{ request.url }}</p>
                    <p><strong>Timestamp:</strong> {{ moment().format('YYYY-MM-DD HH:mm:ss') if moment else 'Unknown' }}</p>
                </div>
            </details>
        </div>
        {% endif %}
    </div>
</div>

<style>
.error-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    padding: 2rem;
}

.error-content {
    max-width: 600px;
    text-align: center;
    background: var(--bg-secondary);
    padding: 3rem 2rem;
    border-radius: 8px;
    border: 2px solid var(--border-ornate);
    box-shadow: var(--shadow-lg);
}

.error-code {
    font-family: var(--font-heading);
    font-size: 8rem;
    font-weight: 700;
    color: var(--accent-red-light);
    text-shadow: 0 0 30px rgba(231, 76, 60, 0.5);
    line-height: 1;
    margin-bottom: 1rem;
}

.error-title {
    font-family: var(--font-heading);
    font-size: var(--text-4xl);
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.error-description {
    margin-bottom: 2rem;
}

.error-description .lead {
    font-size: var(--text-xl);
    color: var(--accent-red-light);
    font-style: italic;
    margin-bottom: 1rem;
}

.error-description p {
    color: var(--text-secondary);
    line-height: 1.8;
}

.error-divider {
    font-size: var(--text-2xl);
    color: var(--border-ornate);
    margin: 2rem 0;
}

.error-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.error-actions .btn {
    width: 100%;
}

.error-help {
    padding-top: 2rem;
    border-top: 1px solid var(--border-primary);
}

.help-text {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.6;
}

.text-link {
    color: var(--accent-gold);
    text-decoration: none;
    transition: color 0.2s;
}

.text-link:hover {
    color: var(--accent-gold-hover);
    text-decoration: underline;
}

.error-debug {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-primary);
}

.debug-summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-family: var(--font-mono);
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    user-select: none;
}

.debug-summary:hover {
    color: var(--text-secondary);
}

.debug-content {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    text-align: left;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

.debug-content p {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.debug-content strong {
    color: var(--accent-gold);
}

@media (min-width: 640px) {
    .error-actions {
        flex-direction: row;
        justify-content: center;
    }

    .error-actions .btn {
        width: auto;
    }
}
</style>
{% endblock %}
