<app-navbar></app-navbar>
<div class="container mx-auto px-4 py-6 space-y-8">
  <div class="flex justify-between items-center">
    <div class="flex items-center space-x-4"></div>
  </div>

  <div class="grid grid-cols-1 lg:grid-cols-4 gap-6">
    <div class="lg:col-span-3">
      <div class="flex justify-between items-center mb-6">
        <h3 class="section-heading text-2xl">Beliebte Spiele</h3>
        <div class="flex space-x-2">
          <button class="nav-button left-0">
            <span class="material-icons">chevron_left</span>
          </button>
          <button class="nav-button right-0">
            <span class="material-icons">chevron_right</span>
          </button>
        </div>
      </div>

      <div class="slider-container">
        <div class="slider-grid">
          <div class="card group" *ngFor="let game of featuredGames">
            <div class="relative overflow-hidden rounded-lg">
              <img
                [src]="game.image"
                [alt]="game.name"
                class="w-full aspect-[4/3] object-cover transition-transform duration-300 group-hover:scale-105"
              />
              <div
                class="absolute inset-0 bg-gradient-to-t from-deep-blue/95 via-deep-blue/50 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-300 ease-in-out"
              >
                <div
                  class="absolute bottom-4 left-4 right-4 transform translate-y-4 group-hover:translate-y-0 transition-transform duration-300"
                >
                  <h4 class="game-heading">{{ game.name }}</h4>
                  <button class="button-primary w-full py-2" (click)="navigateToGame(game.route)">
                    Jetzt Spielen
                  </button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="mt-8">
        <h3 class="section-heading text-2xl mb-6">Alle Spiele</h3>
        <div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4">
          <div class="card group" *ngFor="let game of allGames">
            <div class="relative overflow-hidden rounded-lg">
              <img
                [src]="game.image"
                [alt]="game.name"
                class="w-full aspect-[4/3] object-cover transition-transform duration-300 group-hover:scale-105"
              />
              <div
                class="absolute inset-0 bg-gradient-to-t from-deep-blue/95 via-deep-blue/50 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-300 ease-in-out"
              >
                <div
                  class="absolute bottom-4 left-4 right-4 transform translate-y-4 group-hover:translate-y-0 transition-transform duration-300"
                >
                  <h4 class="game-heading">{{ game.name }}</h4>
                  <button class="button-primary w-full py-2" (click)="navigateToGame(game.route)">
                    Jetzt Spielen
                  </button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="lg:col-span-1 space-y-6">
      <div class="card p-4">
        <h3 class="section-heading text-xl mb-4">Konto</h3>
        <div class="space-y-4">
          <button class="button-primary w-full py-2" (click)="openDepositModal()">Einzahlen</button>
          <app-deposit
            [isOpen]="isDepositModalOpen"
            (closeModalEmitter)="closeDepositModal()"
          ></app-deposit>
          <button
            class="bg-deep-blue-light hover:bg-deep-blue-contrast w-full py-2 rounded"
            (click)="openTransactionModal()"
          >
            Transaktionen
          </button>
          <app-transaction-history
            [isOpen]="isTransactionModalOpen"
            (closeEventEmitter)="closeTransactionModal()"
          />
        </div>
      </div>

      <app-confirmation
        [successful]="isDepositSuccessful"
        (closeConfirmation)="closeDepositConfirmationModal()"
      ></app-confirmation>

      <div class="card p-4">
        <h3 class="section-heading text-xl mb-4">Letzte Transaktionen</h3>
        <div class="space-y-3">
          <div
            class="flex justify-between items-center"
            *ngFor="let transaction of (recentTransactionData | async)?.transactions"
          >
            <div>
              <p class="text-sm font-medium">{{ transaction.status }}</p>
              <p class="text-xs text-text-secondary">
                {{ transaction.createdAt | date: 'd.m.Y H:m' }}
              </p>
            </div>
            <span [class]="transaction.amount > 0 ? 'text-emerald' : 'text-accent-red'">
              {{ transaction.amount | currency: 'EUR' }}
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
