<template>
	<div class="bg-red-50 border border-red-200 rounded-xl p-6 text-center max-w-md mx-auto">
		<div class="inline-flex items-center justify-center w-12 h-12 rounded-full bg-red-100 mb-4">
			<svg class="w-6 h-6 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
				<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
			</svg>
		</div>
		<h3 class="text-lg font-semibold text-red-800 mb-2">{{ title }}</h3>
		<p class="text-red-600 mb-6">{{ message }}</p>
		<div class="flex flex-col sm:flex-row gap-3 justify-center">
			<button
				v-if="showRetry"
				@click="$emit('retry')"
				class="px-6 py-2.5 bg-red-600 text-white rounded-full font-medium hover:bg-red-700 transition-colors"
			>
				Erneut versuchen
			</button>
			<NuxtLink
				to="/"
				class="px-6 py-2.5 bg-white border border-red-200 text-red-700 rounded-full font-medium hover:bg-red-50 transition-colors"
			>
				Zur Startseite
			</NuxtLink>
		</div>
	</div>
</template>

<script setup lang="ts">
withDefaults(
	defineProps<{
		title?: string;
		message?: string;
		showRetry?: boolean;
	}>(),
	{
		title: "Ein Fehler ist aufgetreten",
		message: "Dein Warenkorb konnte nicht geladen werden. Bitte versuche es erneut.",
		showRetry: true
	}
);

defineEmits<{
	retry: [];
}>();
</script>
