<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{ config('app.name') }} | OTP Verification</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    {{-- Google Font --}}
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">

    {{-- SweetAlert --}}
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>

    <style>
        * { box-sizing: border-box; }

        body {
            margin: 0;
            font-family: Inter, system-ui, sans-serif;
            background: linear-gradient(180deg, #ffffff, #f4f6f9);
        }

        .tech-bg {
            position: fixed;
            inset: 0;
            background: repeating-linear-gradient(
                to bottom,
                rgba(0, 0, 0, 0.025) 0px,
                rgba(0, 0, 0, 0.025) 1px,
                transparent 1px,
                transparent 4px
            );
            animation: scan 6s linear infinite;
            pointer-events: none;
        }

        @keyframes scan {
            from { background-position-y: 0; }
            to { background-position-y: 120px; }
        }

        .wrapper {
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .card {
            width: 420px;
            background: #fff;
            border-radius: 18px;
            padding: 40px;
            box-shadow: 0 40px 80px rgba(0,0,0,.15);
            z-index: 1;
        }

        .header {
            text-align: center;
            margin-bottom: 24px;
        }

        .header h3 {
            margin: 0;
            font-size: 1.4rem;
            font-weight: 700;
            color: #0f172a;
        }

        .header p {
            margin-top: 8px;
            font-size: .85rem;
            color: #64748b;
        }

        label {
            font-size: .8rem;
            font-weight: 600;
            margin-bottom: 6px;
            display: block;
        }

        .otp-input {
            width: 100%;
            padding: 14px;
            font-size: 1.2rem;
            letter-spacing: 6px;
            text-align: center;
            border-radius: 10px;
            border: 1px solid #d1d5db;
        }

        .btn {
            width: 100%;
            padding: 14px;
            border-radius: 10px;
            border: none;
            font-weight: 700;
            cursor: pointer;
            margin-top: 18px;
        }

        .btn.primary {
            background: linear-gradient(135deg, #000, #1f2937);
            color: #fff;
        }

        .error {
            margin-top: 8px;
            font-size: .75rem;
            font-weight: 600;
            color: #dc2626;
        }

        .resend {
            text-align: center;
            margin-top: 16px;
            font-size: .75rem;
        }

        .resend a {
            color: #000;
            text-decoration: none;
            font-weight: 600;
        }

        .resend a:hover {
            text-decoration: underline;
        }
    </style>
</head>

<body>

<div class="tech-bg"></div>

<div class="wrapper">
    <div class="card">

        <div class="header">
            <h3>OTP Verification</h3>
            <p>Enter the one-time code sent to your email</p>
        </div>

        <form method="POST" action="{{ route('otp.verify.post') }}">
            @csrf

            <label for="otp">One-Time Password</label>
            <input
                id="otp"
                type="text"
                name="otp"
                class="otp-input"
                maxlength="6"
                inputmode="numeric"
                autocomplete="one-time-code"
                required
                autofocus
            >

            @error('otp')
            <div class="error">{{ $message }}</div>
            @enderror

            <button type="submit" class="btn primary">
                Verify OTP
            </button>
        </form>

        {{-- Optional resend link --}}
        <div class="resend">
            Didn’t receive a code?
            <a href="#">Resend OTP</a>
        </div>

    </div>
</div>

{{-- UX polish --}}
<script>
    const otp = document.getElementById('otp');

    otp.addEventListener('input', () => {
        otp.value = otp.value.replace(/[^0-9]/g, '');
    });
</script>

</body>
</html>
