{% extends 'base.html' %}

{% block title %}Register - Task Manager{% endblock %}

{% block content %}
<div class="container mt-5">
    <div class="row justify-content-center">
        <div class="col-md-6">
            <div class="card">
                <div class="card-header">
                    <h4 class="mb-0">Create an Account</h4>
                </div>
                <div class="card-body">
                    {% if messages %}
                        {% for message in messages %}
                            <div class="alert alert-{{ message.tags }}">
                                {{ message }}
                            </div>
                        {% endfor %}
                    {% endif %}
                    
                    <form method="post">
                        {% csrf_token %}
                        <div class="mb-3">
                            <label for="id_username" class="form-label">Username</label>
                            <input type="text" name="username" class="form-control" id="id_username" required>
                            <div class="form-text">Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.</div>
                        </div>
                        <div class="mb-3">
                            <label for="id_password1" class="form-label">Password</label>
                            <input type="password" name="password1" class="form-control" id="id_password1" required>
                            <div class="form-text">
                                <ul class="list-unstyled">
                                    <li>Your password can't be too similar to your other personal information.</li>
                                    <li>Your password must contain at least 8 characters.</li>
                                    <li>Your password can't be a commonly used password.</li>
                                    <li>Your password can't be entirely numeric.</li>
                                </ul>
                            </div>
                        </div>
                        <div class="mb-3">
                            <label for="id_password2" class="form-label">Password confirmation</label>
                            <input type="password" name="password2" class="form-control" id="id_password2" required>
                            <div class="form-text">Enter the same password as before, for verification.</div>
                        </div>
                        <div class="d-grid gap-2">
                            <button type="submit" class="btn btn-primary">Register</button>
                        </div>
                    </form>
                    
                    <div class="mt-3 text-center">
                        <p>Already have an account? <a href="{% url 'login' %}">Sign in</a></p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
