{% extends "base.html" %}
{% block title %}SooSeF — Soo Security Fieldkit{% endblock %}

{% block content %}
<div class="text-center mb-5">
    <h1 class="display-5 fw-bold">Soo Security Fieldkit</h1>
    <p class="lead text-muted">Offline-first security toolkit for field operations</p>
</div>

<div class="row g-4">
    {# ── Stegasoo Card ── #}
    <div class="col-md-6 col-lg-4">
        <div class="card h-100 bg-dark border-secondary">
            <div class="card-body">
                <h5 class="card-title"><i class="bi bi-lock me-2 text-primary"></i>Encode</h5>
                <p class="card-text text-muted">Hide encrypted messages in images or audio using Stegasoo's hybrid authentication.</p>
                <a href="/encode" class="btn btn-outline-primary btn-sm">Encode Message</a>
            </div>
        </div>
    </div>
    <div class="col-md-6 col-lg-4">
        <div class="card h-100 bg-dark border-secondary">
            <div class="card-body">
                <h5 class="card-title"><i class="bi bi-unlock me-2 text-success"></i>Decode</h5>
                <p class="card-text text-muted">Extract hidden messages from stego images using your credentials.</p>
                <a href="/decode" class="btn btn-outline-success btn-sm">Decode Message</a>
            </div>
        </div>
    </div>
    <div class="col-md-6 col-lg-4">
        <div class="card h-100 bg-dark border-secondary">
            <div class="card-body">
                <h5 class="card-title"><i class="bi bi-key me-2 text-warning"></i>Generate</h5>
                <p class="card-text text-muted">Generate secure passphrases, PINs, and RSA key pairs.</p>
                <a href="/generate" class="btn btn-outline-warning btn-sm">Generate Credentials</a>
            </div>
        </div>
    </div>

    {# ── Verisoo Cards ── #}
    {% if has_verisoo %}
    <div class="col-md-6 col-lg-4">
        <div class="card h-100 bg-dark border-secondary">
            <div class="card-body">
                <h5 class="card-title"><i class="bi bi-patch-check me-2 text-info"></i>Attest</h5>
                <p class="card-text text-muted">Create a cryptographic provenance attestation for an image — prove when and where it was captured.</p>
                <a href="/attest" class="btn btn-outline-info btn-sm">Attest Image</a>
            </div>
        </div>
    </div>
    <div class="col-md-6 col-lg-4">
        <div class="card h-100 bg-dark border-secondary">
            <div class="card-body">
                <h5 class="card-title"><i class="bi bi-search me-2 text-info"></i>Verify</h5>
                <p class="card-text text-muted">Verify an image against attestation records. Check provenance and detect modifications.</p>
                <a href="/verify" class="btn btn-outline-info btn-sm">Verify Image</a>
            </div>
        </div>
    </div>
    {% endif %}

    {# ── Fieldkit Card ── #}
    {% if has_fieldkit %}
    <div class="col-md-6 col-lg-4">
        <div class="card h-100 bg-dark border-secondary">
            <div class="card-body">
                <h5 class="card-title">
                    <i class="bi bi-shield-exclamation me-2 text-danger"></i>Fieldkit
                    {% if fieldkit_status == 'alarm' %}
                    <span class="badge bg-danger ms-2">ALARM</span>
                    {% elif fieldkit_status == 'warn' %}
                    <span class="badge bg-warning ms-2">OVERDUE</span>
                    {% endif %}
                </h5>
                <p class="card-text text-muted">Killswitch, dead man's switch, tamper detection, and USB monitoring.</p>
                <a href="/fieldkit" class="btn btn-outline-danger btn-sm">Fieldkit Status</a>
            </div>
        </div>
    </div>
    {% endif %}
</div>

{# ── System Status ── #}
<div class="row mt-5">
    <div class="col-12">
        <div class="card bg-dark border-secondary">
            <div class="card-body">
                <h6 class="card-title text-muted"><i class="bi bi-info-circle me-2"></i>System Status</h6>
                <div class="row g-3 mt-1">
                    <div class="col-auto">
                        <span class="badge bg-{{ 'success' if channel_configured else 'secondary' }}">
                            <i class="bi bi-shield-lock me-1"></i>Channel: {{ 'Active' if channel_configured else 'Public' }}
                        </span>
                    </div>
                    <div class="col-auto">
                        <span class="badge bg-{{ 'success' if identity_configured else 'secondary' }}">
                            <i class="bi bi-fingerprint me-1"></i>Identity: {{ 'Active' if identity_configured else 'None' }}
                        </span>
                    </div>
                    <div class="col-auto">
                        <span class="badge bg-{{ 'success' if has_dct else 'secondary' }}">
                            <i class="bi bi-image me-1"></i>DCT: {{ 'Available' if has_dct else 'Unavailable' }}
                        </span>
                    </div>
                    {% if has_verisoo %}
                    <div class="col-auto">
                        <span class="badge bg-success">
                            <i class="bi bi-patch-check me-1"></i>Verisoo: Active
                        </span>
                    </div>
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
