<script setup lang="ts">
// Home page - MVP placeholder with shadcn-nuxt test
const { loggedIn, user } = useAuth()

// Sample button click handler
const handleClick = () => {
  console.log('shadcn-nuxt Button clicked!')
}
</script>

<template>
  <NuxtLayout name="default">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
      <!-- Welcome Section -->
      <div class="mb-8">
        <h1 class="text-4xl font-bold mb-4">
          <template v-if="loggedIn">
            Willkommen zurück, {{ user?.firstName }}!
          </template>
          <template v-else>
            Welcome to my.experimenta
          </template>
        </h1>
        <p class="text-lg text-white/90">
          Your gateway to Makerspace annual passes and more.
        </p>
      </div>

      <!-- Login Button for guests -->
      <div v-if="!loggedIn" class="card-glass mb-8 text-center">
        <h2 class="text-2xl font-semibold mb-3 text-experimenta-accent">
          Melde dich an
        </h2>
        <p class="text-white/80 mb-6">
          Um Makerspace-Jahreskarten zu kaufen, musst du dich zuerst anmelden.
        </p>
        <NuxtLink to="/auth">
          <Button variant="experimenta" size="experimenta">
            Jetzt anmelden
          </Button>
        </NuxtLink>
      </div>

      <div class="card-info card-accent-border mb-8">
        <h2 class="text-xl font-semibold mb-2 text-experimenta-accent">MVP Development in Progress</h2>
        <p>
          This is a placeholder page. The full e-commerce functionality will be implemented in
          upcoming phases.
        </p>
      </div>

      <!-- Example: Card with Safrangold Accent Border -->
      <div class="card-progress card-accent-border mb-8">
        <div class="progress-header">
          <h3 class="progress-title">Verlängerungsfortschritt</h3>
          <div class="progress-stats">2963 / 4931</div>
        </div>
        <div class="progress-bar-wrapper">
          <div class="progress-bar" style="width: 60.1%"></div>
          <div class="progress-percentage">60.1%</div>
        </div>
      </div>

      <!-- experimenta Button Showcase -->
      <div class="card-glass mb-8">
        <h3 class="text-xl font-semibold mb-4 text-experimenta-accent">experimenta Button</h3>
        <p class="mb-6 text-white/90">
          Der offizielle experimenta-Button mit animiertem Gradient-Effekt beim Hovern:
        </p>

        <div class="flex flex-wrap gap-4 items-center">
          <Button variant="experimenta" size="experimenta" as="a" href="https://www.experimenta.science/">
            Zur experimenta Startseite
          </Button>

          <Button variant="experimenta" size="experimenta" @click="handleClick">
            Mit Click Handler
          </Button>
        </div>

        <p class="mt-6 text-sm text-white/70">
          Hinweis: Der Button hat einen animierten Gradient-Effekt von Pink zu Rot beim Hovern.
        </p>
      </div>

      <!-- shadcn-nuxt Button Component Test -->
      <div class="card-glass">
        <h3 class="text-xl font-semibold mb-4 text-experimenta-accent">shadcn-nuxt Components Test</h3>
        <p class="mb-6 text-white/90">Testing shadcn-nuxt Button component integration:</p>

        <div class="flex flex-wrap gap-4">
          <Button variant="default" @click="handleClick"> Default Button </Button>

          <Button variant="destructive" @click="handleClick"> Destructive </Button>

          <Button variant="outline" @click="handleClick"> Outline </Button>

          <Button variant="secondary" @click="handleClick"> Secondary </Button>

          <Button variant="ghost" @click="handleClick"> Ghost </Button>

          <Button variant="link" @click="handleClick"> Link </Button>
        </div>

        <p class="mt-6 text-sm text-white/70">Open browser console to see button click events.</p>
      </div>
    </div>
  </NuxtLayout>
</template>
