{{define "totp_setup.html"}}
<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Set up authenticator app - mailgoserver</title>
    <link href="/pymta-manager/static/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="/pymta-manager/static/vendor/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
    <style>
        body { background-color: #1a1a1a; color: #e0e0e0; }
        .card { background-color: #2d2d2d; border: 1px solid #404040; }
    </style>
</head>
<body>
    {{template "csrf_script" .}}
    <div class="container py-5">
        <div class="row justify-content-center">
            <div class="col-lg-6">
                <div class="card">
                    <div class="card-header"><h5 class="mb-0"><i class="bi bi-qr-code me-2"></i>Scan with your authenticator app</h5></div>
                    <div class="card-body text-center">
                        {{if .qr_data_uri}}
                        <img src="{{.qr_data_uri}}" alt="TOTP QR code" class="img-fluid mb-3" style="max-width: 256px; background: white; padding: 8px; border-radius: 8px;">
                        {{end}}
                        <p class="text-muted">Can't scan? Enter this key manually:</p>
                        <code class="d-block mb-4" style="word-break: break-all;">{{.secret}}</code>

                        <form method="POST" action="/pymta-manager/account/totp/confirm" class="text-start">
                            <div class="mb-3">
                                <label for="code" class="form-label">Enter the 6-digit code from your app to confirm</label>
                                <input type="text" class="form-control" id="code" name="code" inputmode="numeric" pattern="[0-9]{6}" maxlength="6" required autofocus>
                            </div>
                            <div class="d-flex justify-content-between">
                                <a href="/pymta-manager/account" class="btn btn-secondary">Cancel</a>
                                <button type="submit" class="btn btn-primary"><i class="bi bi-check-lg me-1"></i>Confirm and enable</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
{{end}}
