<div class="modal fade" id="addMatchModal" tabindex="-1">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">{{ __('Add Match') }}</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>
            <div class="modal-body">
                <form id="addMatchForm">
                    <div class="mb-3">
                        <label class="form-label">{{ __('Team A') }}</label>
                        <select name="team_a_id" class="form-select team-a-select">
                            <option value="">{{ __('TBD') }}</option>
                        </select>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">{{ __('Team B') }}</label>
                        <select name="team_b_id" class="form-select team-b-select">
                            <option value="">{{ __('TBD') }}</option>
                        </select>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">{{ __('Stage') }}</label>
                        <select name="stage" class="form-select" required>
                            @foreach(\App\Enums\ChampionshipMatchStageEnum::options() as $opt)
                                <option value="{{ $opt['value'] }}">{{ $opt['label'] }}</option>
                            @endforeach
                        </select>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">{{ __('Match Date') }}</label>
                        <input type="date" name="match_date" class="form-control">
                    </div>
                    <div class="row">
                        <div class="col-6 mb-3">
                            <label class="form-label">{{ __('Start Time') }}</label>
                            <input type="time" name="start_time" class="form-control">
                        </div>
                        <div class="col-6 mb-3">
                            <label class="form-label">{{ __('End Time') }}</label>
                            <input type="time" name="end_time" class="form-control">
                        </div>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">{{ __('Court') }}</label>
                        <select name="court_id" class="form-select">
                            <option value="">{{ __('Select Court') }}</option>
                            @foreach($courts as $court)
                                <option value="{{ $court->id }}">{{ $court->name }}</option>
                            @endforeach
                        </select>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">{{ __('Parent Match') }}</label>
                        <select name="parent_match_id" class="form-select">
                            <option value="">{{ __('None') }}</option>
                            @foreach($championship->matches as $m)
                                <option value="{{ $m->id }}">#{{ $m->id }} {{ $m->round ?? __('Match') }}</option>
                            @endforeach
                        </select>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">{{ __('Round Label') }}</label>
                        <input type="text" name="round" class="form-control" placeholder="{{ __('e.g. Match 1') }}">
                    </div>
                    <div class="mb-3">
                        <label class="form-label">{{ __('Sort Order') }}</label>
                        <input type="number" name="sort_order" class="form-control" value="0" min="0">
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ __('Close') }}</button>
                <button type="button" class="btn btn-success" id="saveMatchBtn">{{ __('Save Match') }}</button>
            </div>
        </div>
    </div>
</div>
