{% extends 'base.html' %}
{% load static %}

{% block title %}Error - Reports{% endblock %}

{% block content %}
<div class="container-fluid mt-4">
    <div class="row justify-content-center">
        <div class="col-md-8 col-lg-6">
            <div class="card border-danger">
                <div class="card-header bg-danger text-white">
                    <h4 class="mb-0">
                        <i class="fas fa-exclamation-triangle"></i>
                        {{ error_title|default:"Error" }}
                    </h4>
                </div>
                <div class="card-body">
                    <div class="alert alert-danger" role="alert">
                        <h5 class="alert-heading">{{ error_message|default:"An error occurred" }}</h5>
                        {% if suggestion %}
                        <hr>
                        <p class="mb-0">
                            <strong>Suggestion:</strong> {{ suggestion }}
                        </p>
                        {% endif %}
                    </div>
                    
                    {% if details %}
                    <div class="mt-3">
                        <h6>Error Details:</h6>
                        <ul class="list-unstyled">
                            {% for detail in details %}
                            <li><i class="fas fa-info-circle text-info"></i> {{ detail }}</li>
                            {% endfor %}
                        </ul>
                    </div>
                    {% endif %}
                    
                    <div class="mt-4">
                        <a href="javascript:history.back()" class="btn btn-secondary">
                            <i class="fas fa-arrow-left"></i> Go Back
                        </a>
                        <a href="{% url 'dashboard' %}" class="btn btn-primary">
                            <i class="fas fa-home"></i> Go to Dashboard
                        </a>
                    </div>
                </div>
                <div class="card-footer text-muted">
                    <small>
                        If this problem persists, please contact support with the following information:
                        <br>
                        <strong>Time:</strong> {{ request.timestamp|default:"N/A" }}
                        <br>
                        <strong>Page:</strong> {{ request.path }}
                    </small>
                </div>
            </div>
        </div>
    </div>
</div>

<style>
    .card-header {
        font-weight: bold;
    }
    
    .alert-heading {
        font-size: 1.1rem;
    }
    
    .list-unstyled li {
        padding: 0.25rem 0;
    }
    
    .card-footer {
        background-color: #f8f9fa;
        font-size: 0.875rem;
    }
</style>
{% endblock %}
