{{define "2fa_verify.html"}}
<!DOCTYPE html>
<html lang="fr" data-theme="light">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vérification 2FA - SOGOMS Admin</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
    <style>
        body {
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
        }
        .verify-card {
            width: 100%;
            max-width: 400px;
        }
        .logo {
            text-align: center;
            font-size: 2rem;
            font-weight: bold;
            margin-bottom: 1rem;
        }
        .logo span {
            color: var(--pico-primary);
        }
        .subtitle {
            text-align: center;
            color: var(--pico-muted-color);
            margin-bottom: 2rem;
        }
        .error-message {
            background: #fef2f2;
            border: 1px solid #fecaca;
            color: #dc2626;
            padding: 0.75rem 1rem;
            border-radius: var(--pico-border-radius);
            margin-bottom: 1rem;
        }
        .code-input {
            text-align: center;
            font-size: 1.5rem;
            letter-spacing: 0.5rem;
            font-family: monospace;
        }
        details {
            margin-top: 1.5rem;
        }
        details summary {
            cursor: pointer;
            color: var(--pico-muted-color);
            font-size: 0.9rem;
        }
    </style>
</head>
<body>
    <article class="verify-card">
        <div class="logo">SOGO<span>MS</span> Admin</div>
        <p class="subtitle">Vérification en deux étapes</p>

        {{if .Error}}
        <div class="error-message">
            {{.Error}}
        </div>
        {{end}}

        <p>Entrez le code à 6 chiffres de votre application d'authentification.</p>

        <form action="/admin/2fa/verify" method="post">
            <input type="hidden" name="csrf_token" value="{{.CSRFToken}}">

            <label for="code">
                Code d'authentification
                <input type="text" id="code" name="code" class="code-input"
                       inputmode="numeric" maxlength="6" pattern="[0-9]{6}"
                       placeholder="000000" required autofocus
                       autocomplete="one-time-code">
            </label>

            <button type="submit">Vérifier</button>
        </form>

        <details>
            <summary>Utiliser un code de secours</summary>
            <form action="/admin/2fa/verify" method="post" style="margin-top: 1rem;">
                <input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
                <input type="hidden" name="use_backup" value="true">

                <label for="backup_code">
                    Code de secours
                    <input type="text" id="backup_code" name="backup_code"
                           placeholder="XXXX-XXXX" style="font-family: monospace;">
                </label>

                <button type="submit" class="secondary">Utiliser le code</button>
            </form>
        </details>

        <footer style="text-align: center; margin-top: 2rem;">
            <a href="/admin/login" style="font-size: 0.9rem;">Annuler et se reconnecter</a>
        </footer>
    </article>
</body>
</html>
{{end}}
