{% extends 'chat/base.html' %}
{% block title %}Register — DiscordClone{% endblock %}
{% block body %}
<div class="auth-wrapper">
  <div class="auth-card">
    <h1>Create Account</h1>
    <p class="sub">Join the server.</p>
    {% if form.errors %}
    <div class="alert alert-danger py-2" style="font-size:.85rem;">
      {% for field in form %}{% for e in field.errors %}<div>{{ e }}</div>{% endfor %}{% endfor %}
      {% for e in form.non_field_errors %}<div>{{ e }}</div>{% endfor %}
    </div>
    {% endif %}
    <form method="post" action="{% url 'register' %}">
      {% csrf_token %}
      <div class="mb-3">
        <label class="form-label" style="font-size:.8rem;font-weight:600;color:#b5bac1;text-transform:uppercase;letter-spacing:.5px;">Username</label>
        <input type="text" name="username" class="form-control" id="id_reg_username" required autofocus value="{{ form.username.value|default:'' }}">
      </div>
      <div class="mb-3">
        <label class="form-label" style="font-size:.8rem;font-weight:600;color:#b5bac1;text-transform:uppercase;letter-spacing:.5px;">Email</label>
        <input type="email" name="email" class="form-control" id="id_reg_email" required value="{{ form.email.value|default:'' }}">
      </div>
      <div class="mb-4">
        <label class="form-label" style="font-size:.8rem;font-weight:600;color:#b5bac1;text-transform:uppercase;letter-spacing:.5px;">Password</label>
        <input type="password" name="password" class="form-control" id="id_reg_password" required>
      </div>
      <button type="submit" class="btn btn-primary w-100" id="btn_register">Register</button>
    </form>
    <p class="text-center mt-3" style="font-size:.85rem;color:#b5bac1;">
      Have account? <a href="{% url 'login' %}" style="color:#00b0f4;">Login</a>
    </p>
  </div>
</div>
{% endblock %}
