{% extends 'base.html' %}

{% block title %}Join Referral Rewards{% endblock %}

{% block content %}
<div class="container py-5 mt-5">
    <div class="row justify-content-center">
        <div class="col-md-5">
            <div class="card border-0 shadow-lg p-4 p-md-5 rounded-4">
                <div class="text-center mb-4">
                    <h2 class="mb-3">Create Your Account</h2>
                    <p class="text-muted">Start earning rewards today.</p>
                </div>
                
                <form method="post">
                    {% csrf_token %}
                    {% for field in form %}
                        <div class="mb-3 {% if field.name == 'terms_accepted' %}form-check{% endif %}">
                            {% if field.name == 'terms_accepted' %}
                                {{ field }}
                                <label class="form-check-label ms-2" for="{{ field.id_for_label }}">
                                    {{ field.label }}
                                </label>
                                {{ field.errors }}
                            {% else %}
                                <label for="{{ field.id_for_label }}" class="form-label fw-600">{{ field.label }}</label>
                                {{ field.errors }}
                                <input type="{{ field.field.widget.input_type }}" 
                                       name="{{ field.name }}" 
                                       class="form-control {% if field.errors %}is-invalid{% endif %}" 
                                       id="{{ field.id_for_label }}"
                                       placeholder="Enter {{ field.label|lower }}">
                            {% endif %}
                            
                            {% if field.help_text %}
                                <div class="form-text opacity-75 small">{{ field.help_text|safe }}</div>
                            {% endif %}
                        </div>
                    {% endfor %}
                    
                    <button type="submit" class="btn btn-primary w-100 py-3 mt-4">Sign Up</button>
                </form>
                
                <div class="text-center mt-5">
                    <p class="text-muted mb-0">Already have an account? <a href="{% url 'login' %}" class="text-decoration-none fw-bold">Log In</a></p>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}