@extends('admin.layouts.app')

@section('title', __('Match Details'))

@push('styles')
    @include('admin.championship-matches.partials.match-show-styles')
@endpush

@section('content')
<x-admin.page-header
    title="{{ __('Match Details') }}"
    :breadcrumbs="[
        __('Matches') => route('admin.championship-matches.index'),
        __('Details') => '',
    ]"
/>

<div class="match-show-page">
    <div class="match-show-poster-wrap">
        @include('admin.championship-matches.partials.match-poster-detail', ['match' => $match])
    </div>

    <div class="card">
        <div class="card-header">
            <h5 class="card-title mb-0"><i class="ri-information-line me-1"></i>{{ __('Match information') }}</h5>
        </div>
        <div class="card-body match-detail-meta">
            <div class="detail-row">
                <span class="detail-label">{{ __('Championship') }}</span>
                <span class="detail-value">
                    @if($match->championship)
                        <a href="{{ route('admin.championships.show', $match->championship_id) }}">{{ $match->championship->name }}</a>
                    @else
                        —
                    @endif
                </span>
            </div>
            <div class="detail-row">
                <span class="detail-label">{{ __('Court') }}</span>
                <span class="detail-value">{{ $match->court?->name ?? '—' }}</span>
            </div>
            <div class="detail-row">
                <span class="detail-label">{{ __('Schedule') }}</span>
                <span class="detail-value">
                    @if($match->match_date)
                        {{ $match->match_date->format('Y-m-d') }}
                    @else
                        —
                    @endif
                    @if($match->start_time || $match->end_time)
                        <span class="text-muted"> · </span>
                        {{ $match->start_time ?? '—' }} → {{ $match->end_time ?? '—' }}
                    @endif
                </span>
            </div>
            <div class="detail-row">
                <span class="detail-label">{{ __('Winner') }}</span>
                <span class="detail-value fw-semibold">{{ $match->winnerTeam?->name ?? '—' }}</span>
            </div>
            @if($match->parentMatch)
                <div class="detail-row">
                    <span class="detail-label">{{ __('Parent match') }}</span>
                    <span class="detail-value">
                        #{{ $match->parentMatch->id }}
                        @if($match->parentMatch->round)
                            — {{ $match->parentMatch->round }}
                        @endif
                    </span>
                </div>
            @endif
        </div>
    </div>
</div>
@endsection
