{{-- Tournament bracket / matches (styles live in partials/styles.blade.php via @stack('styles')) --}}
<div class="card mb-4">
    <div class="card-header d-flex justify-content-between align-items-center flex-wrap gap-2">
        <h5 class="card-title mb-0"><i class="ri-trophy-line me-1"></i>{{ __('Tournament Bracket') }}</h5>
        <div class="d-flex gap-2">
            <a href="{{ route('admin.championships.matches.builder', $championship->id) }}"
               class="btn btn-sm btn-primary">
                <i class="ri-drag-drop-line me-1"></i>{{ __('Matches Builder') }}
            </a>
            <button type="button" class="btn btn-sm btn-success" data-bs-toggle="modal" data-bs-target="#addMatchModal">
                <i class="ri-add-line"></i> {{ __('Add Match') }}
            </button>
        </div>
    </div>
    <div class="card-body">
        @if($championship->matches->isEmpty())
            <div class="text-center py-5 text-muted">
                <i class="ri-trophy-line fs-1 d-block mb-2"></i>
                {{ __('No matches created yet. Click "Add Match" to start building the bracket.') }}
            </div>
        @else
            <div class="bracket-container">
                <div class="bracket-wrapper">
                    @foreach($bracketData as $stageValue => $matches)
                        <div class="bracket-round">
                            <div class="bracket-round-title">
                                {{ \App\Enums\ChampionshipMatchStageEnum::label($stageValue) }}
                            </div>
                            @foreach($matches as $match)
                                @include('admin.championships.show.partials.match-box', ['match' => $match])
                            @endforeach
                        </div>
                    @endforeach
                </div>
            </div>
        @endif
    </div>
</div>
