
<script setup>
defineProps({ event: Object })
const emit = defineEmits(['next'])
</script>

<template>
    <div>
        <h3 style="margin: 0 0 6px 0; color: #111827;">Wer nimmt teil?</h3>
        <p style="margin: 0 0 24px 0; color: #6b7280; font-size: 0.95rem;">Bitte wähle deine Altersgruppe aus.</p>

        <div class="age-card-row">

            <!-- Kind / Jugendliche:r -->
            <div class="age-card" @click="emit('next', 2)">
                <div class="age-card__badge">
                    <img :src="'/images/children.png'" alt="Abzeichen Kind" class="age-card__img" onerror="this.style.display='none'" />
                    <div class="age-card__badge-fallback">👦</div>
                </div>
                <div class="age-card__body">
                    <h4 class="age-card__title">Mein Kind anmelden:</h4>
                    <p class="age-card__desc">Mein Kind ist <strong>jünger als {{ event.alcoholicsAge }} Jahre.</strong></p>
                </div>
            </div>

            <!-- Erwachsene:r -->
            <div class="age-card" @click="emit('next', 3)">
                <div class="age-card__badge">
                    <img :src="'/images/adults.png'" alt="Abzeichen Erwachsene" class="age-card__img" onerror="this.style.display='none'" />
                    <div class="age-card__badge-fallback">🧑</div>
                </div>
                <div class="age-card__body">
                    <h4 class="age-card__title">Mich selbst anmelden</h4>
                    <p class="age-card__desc">Ich bin <strong>18 Jahre oder älter</strong>.</p>
                </div>
            </div>

        </div>
    </div>
</template>

<style scoped>
.age-card-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.age-card {
    flex: 1 1 280px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 28px 20px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    text-align: center;
}
.age-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
    transform: translateY(-2px);
}

.age-card__badge {
    position: relative;
    width: 100%;
    max-width: 350px;
    aspect-ratio: 350 / 200;
    margin-bottom: 16px;
}
.age-card__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.age-card__badge-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: #e0f2fe;
    border-radius: 50%;
}
/* Fallback ausblenden wenn Bild geladen ist */
.age-card__img:not([style*="display:none"]) + .age-card__badge-fallback {
    display: none;
}

.age-card__body { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.age-card__title { margin: 0; font-size: 1.1rem; font-weight: 700; color: #111827; }
.age-card__desc { margin: 0; font-size: 0.9rem; color: #374151; }
.age-card__hint { margin: 0; font-size: 0.8rem; color: #6b7280; }
.age-card__cta {
    margin-top: 10px;
    display: inline-block;
    padding: 6px 18px;
    background: #2563eb;
    color: white;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ─── Smartphone ─── */
@media (max-width: 639px) {
    .age-card-row {
        flex-direction: column;
        gap: 12px;
    }

    .age-card {
        flex: 1 1 100%;
        padding: 18px 14px;
        flex-direction: row;
        text-align: left;
        align-items: center;
        gap: 14px;
    }

    .age-card__badge {
        flex: 0 0 90px;
        width: 90px;
        max-width: 90px;
        aspect-ratio: 1;
        margin-bottom: 0;
    }

    .age-card__body {
        flex: 1;
        align-items: flex-start;
        text-align: left;
    }

    .age-card__title {
        font-size: 1rem;
    }

    .age-card__desc {
        font-size: 0.85rem;
    }
}
</style>
