<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>2FA Kurulum</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body { background: #f8fafc; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
        .card { max-width: 520px; width: 100%; border-radius: 14px; }
        pre { background: #0b1020; color: #e2e8f0; padding: 10px; border-radius: 8px; font-size: 12px; }
    </style>
</head>
<body>
    <div class="card shadow-sm">
        <div class="card-body p-4">
            <h4 class="mb-2">2FA Kurulum</h4>
            <p class="text-muted">Google Authenticator uygulamasini acin ve asagidaki QR ile secret'i ekleyin.</p>

            @if ($errors->any())
                <div class="alert alert-danger">{{ $errors->first() }}</div>
            @endif

            <div class="mb-3 text-center">
                <img src="https://api.qrserver.com/v1/create-qr-code/?size=200x200&data={{ urlencode($otpAuthUrl) }}" alt="2FA QR" />
            </div>

            <div class="mb-3">
                <div class="text-muted mb-1">Secret</div>
                <div class="p-2 bg-light border rounded">{{ $user->twofa_secret }}</div>
            </div>

            <div class="mb-3">
                <div class="text-muted mb-1">OTP Auth URI</div>
                <pre>{{ $otpAuthUrl }}</pre>
            </div>

            <form method="POST" action="{{ route('backoffice.2fa.enroll.verify') }}">
                @csrf
                <div class="mb-3">
                    <label class="form-label">6 haneli kod</label>
                    <input type="text" name="code" class="form-control" required placeholder="123456" autofocus>
                </div>
                <button type="submit" class="btn btn-primary w-100">Kurulumu Tamamla</button>
            </form>
        </div>
    </div>
</body>
</html>
