{% extends "base.html" %}

{% block title %}Page Not Found - {{ app_name }}{% endblock %}

{% block content %}
<div class="container">
    <div class="row justify-content-center min-vh-75 align-items-center">
        <div class="col-md-6 text-center">
            <div class="error-illustration mb-4">
                <i class="fas fa-search fa-5x text-muted mb-3"></i>
                <h1 class="display-1 fw-bold text-primary">404</h1>
            </div>
            
            <h2 class="mb-3">Page Not Found</h2>
            <p class="text-muted mb-4">
                The page you are looking for might have been removed, had its name changed, 
                or is temporarily unavailable.
            </p>
            
            <div class="d-grid gap-2 d-md-block">
                <a href="{{ url_for('main.index') }}" class="btn btn-primary">
                    <i class="fas fa-home me-2"></i>Go to Dashboard
                </a>
                <button class="btn btn-outline-secondary" onclick="history.back()">
                    <i class="fas fa-arrow-left me-2"></i>Go Back
                </button>
            </div>
            
            {% if current_user.is_authenticated and current_user.is_admin %}
            <div class="mt-4 pt-4 border-top">
                <h6 class="text-muted">Admin Information</h6>
                <small class="text-muted d-block">
                    Requested URL: <code>{{ request.url }}</code>
                </small>
                <small class="text-muted d-block">
                    Endpoint: <code>{{ request.endpoint }}</code>
                </small>
            </div>
            {% endif %}
        </div>
    </div>
</div>
{% endblock %}

{% block scripts %}
<script>
document.addEventListener('DOMContentLoaded', function() {
    // Auto-redirect after 10 seconds if user is inactive
    setTimeout(function() {
        if (confirm('Would you like to be redirected to the dashboard?')) {
            window.location.href = '{{ url_for("main.index") }}';
        }
    }, 10000);
});
</script>
{% endblock %}