{% extends 'base.html' %}
{% load i18n %}
{% load allauth account %}

{% block head_title %}{% trans "Sign In" %}{% endblock head_title %}

{% block content %}
<div class="container mx-auto max-w-md mt-6">
  <h1 class="text-3xl font-bold text-center mb-6">{% trans "Send me a sign-in code" %}</h1>
  <p class="mb-4 text-center">
    {% trans "You will receive a special code for a password-free sign-in." %}
  </p>
  {% url 'account_request_login_code' as login_url %}
  <form method="post" action="{{ login_url }}" class="space-y-4">
    {% csrf_token %}
    {{ form.non_field_errors }}
    {% for field in form %}
      <div>
        <label for="{{ field.id_for_label }}" class="block font-medium>{{ field.label }}</label>
        {{ field }}
        {{ field.errors }}
      </div>
    {% endfor %}
    {{ redirect_field }}
    <button type="submit" class="btn btn-primary w-full">{% trans "Request Code" %}</button>
  </form>
  {% url 'account_login' as login_url %}
  <div class="mt-4 text-center">
    <a href="{{ login_url }}" class="text-primary underline">{% trans "Other sign-in options" %}</a>
  </div>
</div>
{% endblock content %}
