{% extends 'layouts/base.html' %}

{% load i18n %}
{% load static %}
{% load pyaa %}

{% block content %}

<div class="container mx-auto px-4 py-8 max-w-xl">
    <h1 class="text-2xl font-bold text-center mb-6">
        {% translate "title.account-login" %}
    </h1>

    <form method="post" novalidate data-prevent-double-submit>
        {% csrf_token %}

        {% if next_url %}
        <input type="hidden" name="next" value="{{ next_url }}">
        {% endif %}

        {% element fields form=form %}
        {% endelement %}

        <button type="submit" class="btn btn-primary w-full mt-4">
            <i class="fa-solid fa-right-to-bracket mr-2"></i>
            {% translate "button.send" %}
        </button>
    </form>

    <div class="divider">{% translate "text.or" %}</div>

    <a href="{% url 'account_signup' %}{% if next_url %}?next={{ next_url|urlencode }}{% endif %}" class="btn btn-outline w-full">
        <i class="fa-solid fa-user-plus mr-2"></i>
        {% translate "message.account-login.signup" %}
    </a>

    <p class="text-center mt-6 text-sm text-base-content/70">
        {% translate "message.account-login.forgot-password" %}
        <a href="{% url 'account_password_recovery' %}" class="link link-primary">
            {% translate "button.recover-password" %}
        </a>
    </p>
</div>

{% endblock content %}
