{% extends '@Contao/fragment/_container.html.twig' %}

{# Auto-submitting interstitial for the e-mailed withdraw-confirmation link.
   Mirrors login_link_confirm: a GET (also done by inbox scanners / prefetchers)
   renders this page, whose form immediately POSTs the still-signed URL back so the
   withdrawal is only performed on a real interaction. #}

{% block container %}
    <div class="mx-auto max-w-[480px] py-16 lg:py-24">
        <div class="overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-lg dark:border-gray-700 dark:bg-gray-800">
            <div class="px-6 py-10 text-center">

                <div class="mx-auto mb-5 grid size-12 place-items-center rounded-xl bg-red-50 text-red-600 dark:bg-red-900/20 dark:text-red-300">
                    <twig:ux:icon name="lucide:log-out" class="size-6" />
                </div>

                <h1 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">{{ 'attendanceWithdrawConfirm.title'|trans({}, 'cms') }}</h1>

                <form method="post" action="{{ formAction }}" x-data x-init="$el.submit()" class="mt-2 flex flex-col items-center gap-4">
                    <input type="hidden" name="REQUEST_TOKEN" value="{{ contao_request_token() }}">

                    <p class="max-w-[36ch] text-[15px] leading-relaxed text-gray-600 dark:text-gray-300">
                        {% if attendance %}
                            {{ 'attendanceWithdrawConfirm.text'|trans({ name: attendance.participant.firstname|default(''), offer: attendance.offer.name }, 'cms') }}
                        {% else %}
                            {{ 'attendanceWithdrawConfirm.textGeneric'|trans({}, 'cms') }}
                        {% endif %}
                    </p>

                    {# `px-5` overrides the xl default `px-4` via tailwind_merge. #}
                    <twig:Cms:Button variant="destructive" size="xl" rounded="xl"
                            type="submit"
                            class="gap-2 px-5">
                        {{ 'attendanceWithdrawConfirm.submit'|trans({}, 'cms') }}
                    </twig:Cms:Button>
                </form>

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