{% extends 'base.twig' %}

{# --- DÉFINITION DES VARIABLES (Assurez-vous que 'dons' est passé par votre contrôleur) --- #}
{% set donor_email = dons.email is defined ? dons.email : 'non-fourni' %}
{% set donation_amount = dons.amount is defined ? dons.amount : 0 %}

{# --- METADATA & SCHEMA --- #}
{% block title %}{{'thank_you.title'|trans}}{% endblock %}
{% block meta_description %}{{'thank_you.email_sent_info'|trans}}{% endblock %}

{% block canonical_url %}<link rel="canonical" href="{{ url('app_dons') }}" />{% endblock %}
{# Pas de breadcrumb nécessaire pour une page de confirmation de transaction #}

{# --- BODY AVEC TAILWIND CSS --- #}
{% block body %}
    <main class="py-12 md:py-20 bg-gray-50 min-h-screen">
        <div class="max-w-xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="bg-white shadow-2xl rounded-lg p-8 md:p-10 text-center border-t-8 border-green-500 transform hover:shadow-3xl transition duration-500">

                {# Icône de Succès #}
                <div class="mx-auto flex items-center justify-center h-16 w-16 rounded-full bg-green-100 mb-6">
                    <svg class="h-8 w-8 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
                    </svg>
                </div>

                <h1 class="text-3xl font-bold text-gray-800 mb-4">
                    {{ 'thank_you.title'|trans }}
                </h1>

                <p class="text-xl text-gray-700 mb-6">
                    {{ 'thank_you.message_main'|trans|raw }}
                </p>

                {# MONTANT DU DON #}
                {% if donation_amount > 0 %}
                    <div class="bg-green-50 p-4 rounded-lg mb-6 border border-green-200">
                        <p class="text-lg font-semibold text-green-700">
                            {{ 'thank_you.amount_received'|trans }}
                        </p>
                        <p class="text-4xl font-extrabold text-green-600 mt-1">
                            {# Utilisation du filtre pour le formatage monétaire #}
                            {{ donation_amount|format_currency('EUR', locale='fr') }}
                        </p>
                    </div>
                {% endif %}

                <hr class="my-6 border-gray-200">

                {# Informations sur l'email de confirmation (avec précision sur le paiement) #}
                <div class="p-4 bg-indigo-50 rounded-lg text-left">
                    <h2 class="text-lg font-semibold text-indigo-700 mb-2">
                        {{ 'thank_you.email_sent_title'|trans }}
                    </h2>
                    {# Cette clé de traduction contient le message de clarification #}
                    <p class="text-gray-600 text-sm">
                        {{ 'thank_you.email_sent_info'|trans }}
                    </p>

                    {# Afficher l'email du donateur #}
                    <p class="mt-2 text-indigo-600 font-medium text-sm truncate">
                        {{ 'thank_you.email_recipient'|trans }} :
                        <span class="font-bold">{{ donor_email }}</span>
                    </p>
                </div>

                {# Invitation à explorer #}
                <div class="mt-8">
                    <a href="{{ url('app_home') }}"
                       class="inline-flex items-center px-6 py-3 border border-transparent text-base font-medium rounded-md shadow-lg text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition duration-150 transform hover:scale-105">
                        <svg class="w-5 h-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
                        </svg>
                        {{ 'thank_you.back_home_button'|trans }}
                    </a>
                </div>

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