<div class="row">
    @foreach($contests as $contest)
        <div class="col-md-6 my-2">
            <div class="block block-rounded block-link-pop">
                @if(isset($contest->picture))
                    <div class="block-content pb-8 bg-image" style="background-image: url('{{$contest->picture}}');">
                        @if($contest->participated)
                            <span class="badge bg-danger fw-bold p-2 text-uppercase">
                                Participé
                            </span>
                        @endif
                    </div>
                @endif
                <div class="block-content text-center @if($contest->participated) bg-light @endif">
                    <h4 class="mb-1">{{$contest->name}}</h4>
                    <p class="fs-sm">
                        Fin le <span class="text-primary">{{ \Carbon\Carbon::parse($contest->fin)->format('d/m/y') }}</span>
                    </p>
                    <p>
                        {!! $contest->description !!}
                    </p>
                    <div class="mb-4">
                        <!-- Bouton pour supprimer -->
                        <button type="button" class="btn btn-alt-danger me-1 mb-3" wire:click="delete({{ $contest->id }})">
                            <i class="fa fa-fw fa-trash opacity-50 me-1"></i> Supprimer
                        </button>
                        <a href="{{$contest->url}}" target="_blank" class="btn btn-alt-info me-1 mb-3">
                            <i class="fa fa-fw fa-eye opacity-50 me-1"></i> Voir
                        </a>
                        <!-- Bouton pour participer -->
                        <button type="button" class="btn btn-alt-success me-1 mb-3" wire:click="auto({{ $contest->id }})">
                            <i class="fa fa-fw fa-gifts opacity-50 me-1"></i> Participer
                        </button>
                        <a href="https://myx.ovh/nova/resources/contests/{{$contest->id}}/edit" target="_blank" class="btn btn-alt-secondary me-1 mb-3">
                            <i class="fa fa-fw fa-pen opacity-50 me-1"></i> Editer
                        </a>
                    </div>
                </div>
                <div class="block-content block-content-full bg-body-light">
                    <div class="row g-0 fs-sm text-center">
                        <div class="col-4">
                            <span class="text-muted fw-semibold">
                                <i class="fa fa-fw fa-heart opacity-50 me-1"></i> {{$contest->nblike}}
                            </span>
                        </div>
                        <div class="col-4">
                            <span class="text-muted fw-semibold">
                                <i class="fa fa-retweet fa-heart opacity-50 me-1"></i> {{$contest->nbretweet}}
                            </span>
                        </div>
                        <div class="col-4">
                            <span class="text-muted fw-semibold">
                                <i class="fa fa-reply fa-comments opacity-50 me-1"></i> {{$contest->nbreply}}
                            </span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    @endforeach
    <!-- Pagination -->
    <div class="mb-3">
        {!! $contests->links() !!}
    </div>
</div>