{% extends "base.html" %}
{% block title %}Defense - AUTARCH{% endblock %}

{% block content %}
<div class="page-header">
    <h1>System Defense</h1>
    <p style="margin:0;font-size:0.85rem;color:var(--text-secondary)">
        Security hardening, firewall management, and threat monitoring.
    </p>
</div>

<!-- Platform Info -->
<div class="section">
    <h2>System Overview</h2>
    <table class="data-table" style="max-width:500px">
        <tbody>
            <tr><td>Platform</td><td><strong>{{ sys_info.platform }}</strong></td></tr>
            <tr><td>Hostname</td><td>{{ sys_info.hostname }}</td></tr>
            <tr><td>OS</td><td>{{ sys_info.os_version }}</td></tr>
            <tr><td>IP</td><td>{{ sys_info.ip }}</td></tr>
        </tbody>
    </table>
</div>

<!-- Sub-page Cards -->
<div class="section">
    <h2>Defense Tools</h2>
    <div class="tool-grid">
        <div class="tool-card">
            <h4>Linux Defense</h4>
            <p>iptables firewall, SSH hardening, systemd services, auth logs, SELinux/AppArmor checks.</p>
            <a href="{{ url_for('defense.linux_index') }}" class="btn btn-primary btn-small">Open</a>
        </div>
        <div class="tool-card">
            <h4>Windows Defense</h4>
            <p>Windows Firewall, UAC, Defender AV, event logs, OpenSSH, services, NTFS permissions.</p>
            <a href="{{ url_for('defense.windows_index') }}" class="btn btn-primary btn-small">Open</a>
        </div>
        <div class="tool-card" style="border-color:var(--danger)">
            <h4 style="color:var(--danger)">Threat Monitor</h4>
            <p>Real-time connection monitoring, port scan detection, suspicious process alerts, and counter-attack tools.</p>
            <a href="{{ url_for('defense.monitor_index') }}" class="btn btn-danger btn-small">Open</a>
        </div>
    </div>
</div>

{% if modules %}
<div class="section">
    <h2>Defense Modules</h2>
    <ul class="module-list">
    {% for name, info in modules.items() %}
        <li class="module-item">
            <div>
                <div class="module-name">{{ name }}</div>
                <div class="module-desc">{{ info.description }}</div>
            </div>
            <div class="module-meta">v{{ info.version }}</div>
        </li>
    {% endfor %}
    </ul>
</div>
{% endif %}
{% endblock %}
