{% set current_theme = current_theme() %}
<!doctype html>
<html lang="{{ current_locale() }}" class="h-100">
    <head>
        {{ current_theme.headertags() }}
        <title>{{ _('Page Info - Development Information') }}</title>
        {{ current_theme.local_style() }}
        <style>
            .info-section {
                margin-bottom: 2rem;
            }
            .info-table {
                font-size: 0.9rem;
            }
            .info-table td:first-child {
                font-weight: bold;
                background-color: #f8f9fa;
                white-space: nowrap;
            }
            .route-table {
                font-size: 0.8rem;
            }
            .badge-method {
                font-size: 0.7rem;
            }
        </style>
    </head>

    <body>
        {{ current_theme.navbar() }}

        <main>
            {{ current_theme.notify() }}

            <div class="container-fluid mt-4">
                <div class="row">
                    <div class="col-12">
                        <h1 class="mb-4">
                            <i class="bi bi-info-circle"></i>
                            {{ _('Development Information') }}
                            <small class="text-muted">- {{ _('CI Environment Only') }}</small>
                        </h1>

                        <!-- Application Version -->
                        <div class="info-section">
                            <h3><i class="bi bi-tag"></i> {{ _('Application') }}</h3>
                            <div class="card">
                                <div class="card-body">
                                    <table class="table table-striped info-table">
                                        <tr>
                                            <td>{{ _('Version') }}</td>
                                            <td>{{ version }}</td>
                                        </tr>
                                        <tr>
                                            <td>{{ _('Code Name') }}</td>
                                            <td>{{ code_name }}</td>
                                        </tr>
                                        <tr>
                                            <td>{{ _('Database Engine') }}</td>
                                            <td>{{ app_data.DBENGINE or _("Unknown") }}</td>
                                        </tr>
                                        <tr>
                                            <td>{{ _('Cache Type') }}</td>
                                            <td>{{ app_data.CACHE }}</td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>

                        <!-- System Information -->
                        <div class="info-section">
                            <h3><i class="bi bi-cpu"></i> {{ _('System') }}</h3>
                            <div class="card">
                                <div class="card-body">
                                    <table class="table table-striped info-table">
                                        <tr>
                                            <td>{{ _('Operating System') }}</td>
                                            <td>{{ config_data.sys._system }}</td>
                                        </tr>
                                        <tr>
                                            <td>{{ _('System Version') }}</td>
                                            <td>{{ config_data.sys._system_version }}</td>
                                        </tr>
                                        <tr>
                                            <td>{{ _('Architecture') }}</td>
                                            <td>{{ config_data.sys._arch[0] }} ({{ config_data.sys._arch[1] }})</td>
                                        </tr>
                                        <tr>
                                            <td>{{ _('Python Version') }}</td>
                                            <td>{{ config_data.sys._python_version }}</td>
                                        </tr>
                                        <tr>
                                            <td>{{ _('Python Implementation') }}</td>
                                            <td>{{ config_data.sys._python_implementation }}</td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>

                        <!-- Configuration -->
                        <div class="info-section">
                            <h3><i class="bi bi-gear"></i> {{ _('Configuration') }}</h3>
                            <div class="card">
                                <div class="card-body">
                                    <table class="table table-striped info-table">
                                        <tr>
                                            <td>{{ _('Application Directory') }}</td>
                                            <td><code>{{ config_data._app_dir }}</code></td>
                                        </tr>
                                        <tr>
                                            <td>{{ _('Base Files Directory') }}</td>
                                            <td><code>{{ config_data._base_files_dir }}</code></td>
                                        </tr>
                                        <tr>
                                            <td>{{ _('Private Files Directory') }}</td>
                                            <td><code>{{ config_data._private_files_dir }}</code></td>
                                        </tr>
                                        <tr>
                                            <td>{{ _('Public Files Directory') }}</td>
                                            <td><code>{{ config_data._public_files_dir }}</code></td>
                                        </tr>
                                        <tr>
                                            <td>{{ _('Templates Directory') }}</td>
                                            <td><code>{{ config_data._templates_dir }}</code></td>
                                        </tr>
                                        <tr>
                                            <td>{{ _('Time Zone') }}</td>
                                            <td>{{ config_data._time_zone }}</td>
                                        </tr>
                                        <tr>
                                            <td>{{ _('Language') }}</td>
                                            <td>{{ config_data._language }}</td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>

                        <!-- LMS Statistics -->
                        <div class="info-section">
                            <h3><i class="bi bi-graph-up"></i> {{ _('LMS Statistics') }}</h3>
                            <div class="card">
                                <div class="card-body">
                                    <div class="row">
                                        <div class="col-md-6">
                                            <table class="table table-striped info-table">
                                                <tr>
                                                    <td>{{ _('Courses') }}</td>
                                                    <td>{{ lms_data.courses_count }}</td>
                                                </tr>
                                                <tr>
                                                    <td>{{ _('Students') }}</td>
                                                    <td>{{ lms_data.students_count }}</td>
                                                </tr>
                                                <tr>
                                                    <td>{{ _('Teachers') }}</td>
                                                    <td>{{ lms_data.teachers_count }}</td>
                                                </tr>
                                                <tr>
                                                    <td>{{ _('Moderators') }}</td>
                                                    <td>{{ lms_data.moderators_count }}</td>
                                                </tr>
                                                <tr>
                                                    <td>{{ _('Enrollments') }}</td>
                                                    <td>{{ lms_data.enrollments_count }}</td>
                                                </tr>
                                            </table>
                                        </div>
                                        <div class="col-md-6">
                                            <table class="table table-striped info-table">
                                                <tr>
                                                    <td>{{ _('Certificates') }}</td>
                                                    <td>{{ lms_data.certificates_count }}</td>
                                                </tr>
                                                <tr>
                                                    <td>{{ _('Programs') }}</td>
                                                    <td>{{ lms_data.programs_count }}</td>
                                                </tr>
                                                <tr>
                                                    <td>{{ _('Evaluations') }}</td>
                                                    <td>{{ lms_data.evaluations_count }}</td>
                                                </tr>
                                                <tr>
                                                    <td>{{ _('Blog Posts') }}</td>
                                                    <td>{{ lms_data.blog_posts_count }}</td>
                                                </tr>
                                                <tr>
                                                    <td>{{ _('Master Classes') }}</td>
                                                    <td>{{ lms_data.master_classes_count }}</td>
                                                </tr>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!-- Environment Variables -->
                        <div class="info-section">
                            <h3>
                                <i class="bi bi-list-task"></i> {{ _('Environment Variables') }}
                                <small class="text-muted">({{ _('filtered') }})</small>
                            </h3>
                            <div class="card">
                                <div class="card-body">
                                    {% if env_vars %}
                                    <div style="max-height: 300px; overflow-y: auto">
                                        <table class="table table-striped table-sm info-table">
                                            {% for key, value in env_vars.items() | sort %}
                                            <tr>
                                                <td>{{ key }}</td>
                                                <td><code>{{ value }}</code></td>
                                            </tr>
                                            {% endfor %}
                                        </table>
                                    </div>
                                    {% else %}
                                    <p class="text-muted">{{ _('No environment variables to display.') }}</p>
                                    {% endif %}
                                </div>
                            </div>
                        </div>

                        <!-- Routes -->
                        <div class="info-section">
                            <h3>
                                <i class="bi bi-signpost"></i> {{ _('Routes') }}
                                <small class="text-muted">({{ routes | length }} {{ _('total') }})</small>
                            </h3>
                            <div class="card">
                                <div class="card-body">
                                    <div style="max-height: 400px; overflow-y: auto">
                                        <table class="table table-striped table-sm route-table">
                                            <thead>
                                                <tr>
                                                    <th>{{ _('Endpoint') }}</th>
                                                    <th>{{ _('Route') }}</th>
                                                    <th>{{ _('Methods') }}</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                {% for route in routes %}
                                                <tr>
                                                    <td><code>{{ route.endpoint }}</code></td>
                                                    <td><code>{{ route.rule }}</code></td>
                                                    <td>
                                                        {% for method in route.methods %}
                                                        <span class="badge bg-secondary badge-method">{{ method }}</span>
                                                        {% endfor %}
                                                    </td>
                                                </tr>
                                                {% endfor %}
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>

        {{ current_theme.jslibs() }}
    </body>
</html>
