{% extends 'base.twig' %}

{% block title %}{{ 'events.forgot_password'|trans }}{% endblock %}

{% block body %}
    <div class="min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8">
        <div class="max-w-md w-full space-y-8 p-10 bg-white rounded-xl shadow-lg">
            <img src="{{ asset('provider/images/logo.png') }}"/>

            <h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900">
                {{ 'events.forgot_password'|trans }}
            </h2>

            <p class="mt-2 text-center text-sm text-gray-600">
                {{ 'text.enter_email_for_reset'|trans }}
            </p>

            {# Affichage des messages flash (succès ou erreur) #}
            {% for flash_error in app.flashes('reset_password_error') %}
                <div class="p-4 text-sm text-red-700 bg-red-100 rounded-lg" role="alert">
                    {{ flash_error }}
                </div>
            {% endfor %}

            {% for message in app.flashes('success') %}
                <div class="p-4 text-sm text-green-700 bg-green-100 rounded-lg" role="alert">
                    {{ message }}
                </div>
            {% endfor %}


            {# Le formulaire Symfony #}
            {{ form_start(form, {'attr': {'class': 'mt-8 space-y-6'}}) }}

            <div class="rounded-md shadow-sm -space-y-px">
                {# Champ Email #}
                <div>
                    {{ form_label(form.email, 'label.email'|trans, {'label_attr': {'class': 'sr-only'}}) }}
                    {{ form_widget(form.email, {
                        'attr': {
                            'class': 'appearance-none rounded-md relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm',
                            'placeholder': 'label.email'|trans,
                            'autocomplete': 'email',
                            'required': 'required'
                        }
                    }) }}

                    {# Affichage des erreurs de champ spécifiques #}
                    {{ form_errors(form.email) }}
                </div>
            </div>

            {# Bouton Soumettre #}
            <div>
                <button type="submit"
                        class="group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
                    {{ 'button.send_reset_link'|trans }}
                </button>
            </div>

            {{ form_end(form) }}

            <div class="text-center text-sm">
                <a href="{{ path('app_home') }}" class="font-medium text-indigo-600 hover:text-indigo-500">
                    {{ 'link.back_to_login'|trans }}
                </a>
            </div>

        </div>
    </div>
{% endblock %}
