@extends('layouts.auth')

@section('title', 'Two-Factor Authentication')

@section('content')
<div class="min-h-screen flex items-center justify-center gradient-bg p-4">
    <div class="w-full max-w-md animate-fade-in">
        <div class="bg-white rounded-2xl shadow-2xl p-8">
            <div class="text-center mb-8">
                <div class="inline-flex items-center justify-center w-16 h-16 bg-purple-100 rounded-full mb-4">
                    <i class="fas fa-mobile-alt text-2xl text-purple-600"></i>
                </div>
                <h2 class="text-2xl font-bold text-gray-800">Verify Your Identity</h2>
                <p class="text-gray-500 mt-2">Enter the code from your authenticator app</p>
            </div>

            @if(session('error'))
                <div class="mb-4 p-4 bg-red-100 text-red-700 rounded-lg">
                    <i class="fas fa-exclamation-circle mr-2"></i>{{ session('error') }}
                </div>
            @endif

            <form method="POST" action="{{ route('two-factor.verify') }}" class="space-y-5">
                @csrf
                
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-2">Authentication Code</label>
                    <div class="relative">
                        <input type="text" name="code" required autofocus maxlength="8"
                            class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent input-focus transition text-center text-2xl tracking-widest"
                            placeholder="000000">
                    </div>
                    <p class="mt-2 text-xs text-gray-500 text-center">
                        Enter the 6-digit code from your authenticator app or an 8-character recovery code
                    </p>
                    @error('code')
                        <p class="mt-1 text-sm text-red-600 text-center">{{ $message }}</p>
                    @enderror
                </div>

                <button type="submit" 
                    class="w-full bg-purple-600 text-white py-3 rounded-lg font-semibold hover:bg-purple-700 btn-hover transition duration-200">
                    Verify
                </button>
            </form>

            <div class="mt-6 text-center">
                <form method="POST" action="{{ route('logout') }}">
                    @csrf
                    <button type="submit" class="text-gray-500 hover:text-gray-700 text-sm">
                        <i class="fas fa-arrow-left mr-1"></i> Back to login
                    </button>
                </form>
            </div>
        </div>
    </div>
</div>
@endsection
