<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Registration Page</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }
        .registration-container {
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 300px;
            text-align: center;
        }
        .registration-container h2 {
            margin-bottom: 20px;
        }
    .registration-container input, .registration-container select {
        width: 80%;
        padding: 10px;
        margin: 10px 0;
        border: 1px solid #ccc;
        border-radius: 4px;
        box-sizing: border-box;
    }
    
    .registration-container select {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-repeat: no-repeat;
        background-position: right 10px center;
        background-size: 1em;
    }

        .registration-container button {
            width: 80%;
            padding: 10px;
            background-color: #2d2db0;
            color: #fff;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .registration-container button:hover {
            background-color: #2d2db0;
        }

		.error {
            color: red;
            margin-top: 10px;
        }

    </style>
</head>
<body>
    <div class="registration-container">
        <h2>Register</h2>
        <form th:action="@{/register}" method="post" class="form-group">
            <!-- Username -->
            <input type="text" name="username" placeholder="Username" required>
            
            <!-- Password -->
            <input type="password" name="password" placeholder="Password" required>

            <!-- Email -->
            <input type="email" name="email" placeholder="Email" required>
            
            <!-- Role Dropdown -->
            <select name="role" required>
                <option value="" disabled selected>Select your role</option>
                <option value="ADMIN">Admin</option>
                <option value="USER">User</option>
            </select>
            
            <!-- Submit Button -->
            <button type="submit">Register</button>
        </form>
        <!-- Error Message -->
		<div th:if="${param.error}" class="error">
			Invalid username.
		</div>
		
        <p>Already have an account? <a href="/login">Login here</a></p>
    </div>
</body>
</html>