@extends('layouts.app')

@section('title', $profile->game->name)

@section('content')
<div class="container-fluid px-4 py-4">
    <div class="d-flex justify-content-between align-items-start mb-4">
        <div>
            <h1 class="display-md text-white mb-1">{{ $profile->game->name }}</h1>
            <p class="text-muted mb-0">{{ $profile->in_game_name }}</p>
        </div>
        <div class="d-flex gap-2">
            <a href="{{ route('profile.games.edit', $profile) }}" class="btn-arena btn-sm btn-outline-light">Edit</a>
            <form action="{{ route('profile.games.destroy', $profile) }}" method="POST" onsubmit="return confirm('Delete this profile?')">
                @csrf
                @method('DELETE')
                <button type="submit" class="btn-arena btn-sm btn-outline-danger">Delete</button>
            </form>
        </div>
    </div>

    <div class="card-arena p-4">
        <dl class="row mb-0">
            <dt class="col-sm-3 text-muted">Current Rank</dt>
            <dd class="col-sm-9 text-white">{{ $profile->currentRank?->name ?? '—' }}</dd>
            <dt class="col-sm-3 text-muted">Highest Rank</dt>
            <dd class="col-sm-9 text-white">{{ $profile->highestRank?->name ?? '—' }}</dd>
            <dt class="col-sm-3 text-muted">Platform</dt>
            <dd class="col-sm-9 text-white">{{ $profile->primaryPlatform?->name ?? '—' }}</dd>
            <dt class="col-sm-3 text-muted">Region</dt>
            <dd class="col-sm-9 text-white">{{ $profile->region?->name ?? '—' }}</dd>
            <dt class="col-sm-3 text-muted">Roles</dt>
            <dd class="col-sm-9 text-white">{{ $profile->gameRoles->pluck('gameRole.name')->join(', ') ?: '—' }}</dd>
            <dt class="col-sm-3 text-muted">Biography</dt>
            <dd class="col-sm-9 text-white">{{ $profile->biography ?? '—' }}</dd>
        </dl>
    </div>
</div>
@endsection
