<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Two-factor challenge · Epelcon Hospitality</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <script src="https://cdn.tailwindcss.com?plugins=forms"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
    <script>tailwind.config = { theme: { extend: { fontFamily: { sans: ['"Plus Jakarta Sans"', 'sans-serif'], serif: ['"Playfair Display"', 'serif'] }, colors: { gold: { 400: '#d4af37', 500: '#c9a227', 600: '#a8871f' } } } } };</script>
</head>
<body class="min-h-screen bg-slate-950 font-sans text-slate-800 antialiased">
<div class="absolute inset-0 opacity-30" style="background-image: radial-gradient(circle at 15% 15%, #c9a22740 0, transparent 40%), radial-gradient(circle at 85% 80%, #4f46e540 0, transparent 40%)"></div>

<div class="relative flex min-h-screen items-center justify-center p-4">
    <div class="w-full max-w-md">
        <a href="{{ route('home') }}" class="mb-8 flex flex-col items-center gap-2">
            <div class="flex h-14 w-14 items-center justify-center rounded-2xl bg-gradient-to-br from-gold-400 to-gold-600 text-2xl font-extrabold text-slate-950 shadow-xl shadow-gold-500/20">E</div>
            <span class="font-serif text-2xl font-bold text-white">Epelcon Hospitality</span>
            <span class="text-[10px] font-bold uppercase tracking-[0.35em] text-gold-400">Two-factor challenge</span>
        </a>

        <div class="rounded-3xl bg-white p-7 shadow-2xl sm:p-9" x-data="{ tab: 'code' }">
            <h1 class="text-xl font-extrabold text-slate-900">Verify it's you</h1>
            <p class="mt-1 text-sm text-slate-500">Enter the 6-digit code from your authenticator app.</p>

            @if ($errors->any())
                <div class="mt-4 rounded-2xl border border-rose-200 bg-rose-50 px-4 py-3 text-sm text-rose-800">{{ $errors->first() }}</div>
            @endif

            <div class="mt-5 flex gap-2 rounded-xl bg-slate-100 p-1 text-xs font-bold">
                <button type="button" @click="tab = 'code'" :class="tab === 'code' ? 'bg-white text-slate-900 shadow' : 'text-slate-500'" class="flex-1 rounded-lg py-2">Authenticator code</button>
                <button type="button" @click="tab = 'recovery'" :class="tab === 'recovery' ? 'bg-white text-slate-900 shadow' : 'text-slate-500'" class="flex-1 rounded-lg py-2">Recovery code</button>
            </div>

            <form method="POST" action="{{ route('2fa.verify') }}" class="mt-5 space-y-4" x-show="tab === 'code'">
                @csrf
                <label class="block">
                    <span class="mb-1 block text-xs font-bold uppercase tracking-wide text-slate-500">6-digit code</span>
                    <input type="text" inputmode="numeric" pattern="[0-9]*" maxlength="6" name="code" required autofocus autocomplete="one-time-code" class="w-full rounded-xl border-slate-200 text-center font-mono text-2xl tracking-[0.5em] focus:border-gold-500 focus:ring-gold-500">
                </label>
                <button class="w-full rounded-xl bg-slate-950 py-3.5 text-sm font-extrabold text-white shadow-lg hover:bg-slate-800">Verify →</button>
            </form>

            <form method="POST" action="{{ route('2fa.verify') }}" class="mt-5 space-y-4" x-show="tab === 'recovery'" x-cloak>
                @csrf
                <label class="block">
                    <span class="mb-1 block text-xs font-bold uppercase tracking-wide text-slate-500">Recovery code</span>
                    <input type="text" name="code" maxlength="11" required autocomplete="off" class="w-full rounded-xl border-slate-200 font-mono text-sm focus:border-gold-500 focus:ring-gold-500" placeholder="xxxxxxxxxx">
                </label>
                <button class="w-full rounded-xl bg-slate-950 py-3.5 text-sm font-extrabold text-white shadow-lg hover:bg-slate-800">Use recovery code</button>
                <p class="text-xs text-slate-500">Each recovery code can be used only once.</p>
            </form>

            <p class="mt-5 text-center text-sm text-slate-500"><a href="{{ route('login') }}" class="font-bold text-gold-600 hover:underline">Back to sign in</a></p>
        </div>
        <p class="mt-6 text-center text-xs text-slate-500">© {{ date('Y') }} Epelcon Hospitality</p>
    </div>
</div>
<style>[x-cloak]{display:none !important}</style>
</body>
</html>
