<template>
    <LandingLayout>
        <main class="flex flex-grow items-center justify-center">
            <div class="w-full max-w-2xl px-4 py-20 sm:px-6 lg:px-8">
                <div class="flex flex-col items-center rounded-2xl border border-[var(--linen)] bg-[var(--pure-white)] p-12 text-center shadow-xl">
                    <div class="mb-8 flex h-20 w-20 items-center justify-center rounded-full bg-[var(--soft-coral)] shadow-lg">
                        <svg
                            class="h-10 w-10 text-[var(--midnight-blue)]"
                            fill="currentColor"
                            viewBox="0 0 256 256"
                            xmlns="http://www.w3.org/2000/svg"
                        >
                            <path
                                d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"
                            ></path>
                        </svg>
                    </div>
                    <h1 class="text-4xl font-bold text-[var(--midnight-blue)] md:text-5xl">Paiement Échoué</h1>
                    <p class="mx-auto mt-4 max-w-md text-lg text-[var(--midnight-blue)]/80">
                        Une erreur est survenue lors du traitement de votre paiement, ou vous avez annulé la transaction.
                    </p>
                    <div class="mt-10 w-full border-t border-[var(--linen)]"></div>
                    <p class="mt-10 text-lg font-medium text-[var(--midnight-blue)]/90">
                        Veuillez réessayer ou contactez le support si le problème persiste.
                    </p>
                    <button
                        @click="tryAgain"
                        class="mt-8 flex h-12 max-w-[480px] min-w-[200px] cursor-pointer items-center justify-center overflow-hidden rounded-full bg-[var(--midnight-blue)] px-8 text-base font-bold tracking-wide text-[var(--pure-white)] transition-all duration-300 hover:bg-[var(--spiritual-earth)] hover:shadow-[var(--spiritual-earth)]/30 hover:shadow-lg"
                    >
                        <span class="truncate">Réessayer</span>
                    </button>
                </div>
            </div>
        </main>
    </LandingLayout>
</template>

<script setup lang="ts">
import LandingLayout from '@/layouts/app/LandingLayout.vue';
import { router } from '@inertiajs/vue3';

const tryAgain = () => {
    // Redirect back to the card selection page
    router.visit('/tirage');
};
</script>
