<!DOCTYPE html>
<html lang="en" class="bg-gray-100">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Verify OTP</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css">
</head>

<body class="bg-gray-100">
<!-- Include the navbar from mainlayout -->
<div th:replace="layouts/mainLayout1"></div>

<!-- Display any error or success messages -->
<div th:if="${error}" class="alert alert-danger" role="alert">
    <p th:text="${error}"></p>
</div>
<div th:if="${success}" class="alert alert-success" role="alert">
    <p th:text="${success}"></p>
</div>

<div class="container mx-auto p-4 flex justify-center items-center h-screen">
    <div class="w-full max-w-md">

        <!-- OTP verification form -->
        <form th:action="@{/profile/verify-otp}" method="post">

            <!-- Hidden input fields for username and newPhoneNumber -->
            <input type="text" name="username" th:value="${username}" readonly />
            <input type="text" name="newPhoneNumber" th:value="${newPhoneNumber}" readonly />

            <p class="text-center text-lg font-semibold mb-4" th:text="'Verify OTP for ' + ${username}"></p>

            <!-- OTP input field -->
            <div class="mb-4">
                <label for="enteredOtp" class="block text-sm font-medium text-gray-600">Enter OTP:</label>
                <input type="text" id="enteredOtp" name="enteredOtp" required
                       class="mt-1 p-2 w-full border rounded focus:outline-none focus:ring focus:border-blue-300">
            </div>

            <!-- Submit button -->
            <button type="submit"
                    class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded w-full">
                Verify OTP
            </button>
            <div class="flex justify-center items-center mb-4">
                <!-- Button to redirect to the home page -->
                <button onclick="window.location.href='/'"
                        class="px-4 py-2 text-sm font-semibold text-gray-600 bg-blue-500 hover:bg-blue-700 text-white rounded-md focus:outline-none focus:ring focus:ring-blue-200">
                    Go Home
                </button>
            </div>
        </form>

    </div>
</div>
</body>
<div th:replace="layouts/footerLayout"></div>
</html>
