@extends('layouts.app')

@section('title', 'My Game Profiles')

@section('content')
<div class="container-fluid px-4 py-4">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h1 class="display-md text-white mb-0">My Game Profiles</h1>
        <a href="{{ route('profile.games.create') }}" class="btn-arena btn-primary btn-sm">Add Game Profile</a>
    </div>

    @if (session('status'))
        <div class="alert alert-success">{{ session('status') }}</div>
    @endif

    <div class="row g-3">
        @forelse($profiles as $profile)
            <div class="col-md-6 col-lg-4">
                <div class="card-arena p-4 h-100">
                    <h3 class="text-white fs-5 mb-1">{{ $profile->game->name }}</h3>
                    <p class="text-muted fs-sm mb-2">{{ $profile->in_game_name }}</p>
                    @if($profile->currentRank)
                        <span class="badge-arena badge-muted">{{ $profile->currentRank->name }}</span>
                    @endif
                    <div class="d-flex gap-2 mt-3">
                        <a href="{{ route('profile.games.show', $profile) }}" class="btn-arena btn-sm btn-outline-light">View</a>
                        <a href="{{ route('profile.games.edit', $profile) }}" class="btn-arena btn-sm btn-outline-light">Edit</a>
                    </div>
                </div>
            </div>
        @empty
            <div class="col-12">
                <div class="card-arena p-4 text-muted">No game profiles yet.</div>
            </div>
        @endforelse
    </div>
</div>
@endsection
