# templates/registration/signup.html
{% extends 'base.html' %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <h2 class="text-center">Sign Up</h2>
            </div>
            <div class="card-body">
                <form method="post">
                    {% csrf_token %}
                    
                    {% if form.errors %}
                        <div class="alert alert-danger">
                            <ul class="mb-0">
                                {% for field in form %}
                                    {% for error in field.errors %}
                                        <li>{{ error }}</li>
                                    {% endfor %}
                                {% endfor %}
                            </ul>
                        </div>
                    {% endif %}

                    <div class="mb-3">
                        <label for="username" class="form-label">Username</label>
                        <input type="text" name="username" class="form-control {% if form.username.errors %}is-invalid{% endif %}" 
                               id="username" required>
                    </div>
                    
                    <div class="mb-3">
                        <label for="email" class="form-label">Email</label>
                        <input type="email" name="email" class="form-control {% if form.email.errors %}is-invalid{% endif %}" 
                               id="email" required>
                    </div>
                    
                    <div class="mb-3">
                        <label for="password1" class="form-label">Password</label>
                        <input type="password" name="password1" class="form-control {% if form.password1.errors %}is-invalid{% endif %}" 
                               id="password1" required>
                    </div>
                    
                    <div class="mb-3">
                        <label for="password2" class="form-label">Confirm Password</label>
                        <input type="password" name="password2" class="form-control {% if form.password2.errors %}is-invalid{% endif %}" 
                               id="password2" required>
                    </div>
                    
                    <div class="d-grid">
                        <button type="submit" class="btn btn-primary">Sign Up</button>
                    </div>
                </form>
                
                <div class="text-center mt-3">
                    Already have an account? <a href="{% url 'login' %}">Login</a>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}