{% extends 'base.html' %}
{% block title %}Connexion{% endblock %}
{% block fullpage %}
<div class="min-h-screen flex items-center justify-center">
    <div class="card p-8 w-96">
        <div class="text-center mb-6">
            <img src="/static/logo_sanef.jpg" alt="SANEF" class="h-12 mx-auto mb-3 rounded" style="opacity:0.9">
            <h1 class="text-2xl font-bold text-cyber-accent">PatchCenter</h1>
            <p class="text-sm text-gray-500 mt-1">v{{ version }} — SecOps</p>
        </div>
        {% if error %}
        <div class="bg-cyber-red/20 text-cyber-red text-sm p-3 rounded mb-4">{{ error }}</div>
        {% endif %}
        <form method="POST" action="/login" class="space-y-4">
            <div>
                <label class="text-xs text-gray-400 block mb-1">Utilisateur</label>
                <input type="text" name="username" required autofocus class="w-full" placeholder="username">
            </div>
            <div>
                <label class="text-xs text-gray-400 block mb-1">Mot de passe</label>
                <input type="password" name="password" required class="w-full" placeholder="password">
            </div>
            <div>
                <label class="text-xs text-gray-400 block mb-1">Mode</label>
                <div class="flex gap-4">
                    <label class="flex items-center gap-1 text-sm text-gray-300 cursor-pointer">
                        <input type="radio" name="mode" value="reel" checked class="accent-cyan-500"> Production
                    </label>
                    <label class="flex items-center gap-1 text-sm text-gray-300 cursor-pointer">
                        <input type="radio" name="mode" value="demo" class="accent-yellow-500"> Demo
                    </label>
                </div>
            </div>
            {% if ldap_enabled %}
            <div>
                <label class="text-xs text-gray-400 block mb-1">Méthode</label>
                <div class="flex gap-4">
                    <label class="flex items-center gap-1 text-sm text-gray-300 cursor-pointer">
                        <input type="radio" name="auth_method" value="local" checked class="accent-cyan-500"> Locale
                    </label>
                    <label class="flex items-center gap-1 text-sm text-gray-300 cursor-pointer">
                        <input type="radio" name="auth_method" value="ldap" class="accent-cyan-500"> LDAP/AD
                    </label>
                </div>
            </div>
            {% else %}
            <input type="hidden" name="auth_method" value="local">
            {% endif %}
            <button type="submit" class="btn-primary w-full py-2 rounded-md">Connexion</button>
        </form>
        <p class="text-center text-xs text-gray-600 mt-4">SANEF — Direction des Systèmes d'Information</p>
    </div>
</div>
{% endblock %}
