@php
    $noticiasDestaque = $noticiasDestaque ?? collect();
    $noticiasStructureNome = $noticiasStructure?->name ?? $secretaria?->name;
    $verTodasUrl = ! empty($secretaria?->slug)
        ? route('paginas.details', $secretaria->slug)
        : route('paginas.noticias', ['secretaria_id' => config('mobiangra.structure_id')]);
@endphp

<section class="ma-news" aria-labelledby="ma-news-title">
    <div class="container">
        <div class="ma-news__header">
            <div class="ma-news__heading">
                <h2 id="ma-news-title" class="ma-news__title">
                    <i class="fa-solid fa-newspaper ma-news__title-icon" aria-hidden="true"></i>
                    {{ __('Notícias') }}
                </h2>
                @if (! empty($noticiasStructureNome))
                    <span class="badge rounded-pill ma-news__structure-badge"
                          title="{{ __('Fonte das notícias') }}">
                        {{ $noticiasStructureNome }}
                    </span>
                @endif
            </div>
            <a href="{{ $verTodasUrl }}" class="ma-news__see-all">
                {{ __('Ver todas') }}
                <i class="fa-solid fa-arrow-right" aria-hidden="true"></i>
            </a>
        </div>

        @if ($noticiasDestaque->isNotEmpty())
            <div class="row g-4">
                @foreach ($noticiasDestaque as $noticia)
                    <div class="col-12 col-md-6 col-lg-4">
                        <x-mobiangra.news-card :noticia="$noticia" />
                    </div>
                @endforeach
            </div>
        @else
            <p class="ma-news__empty text-muted mb-0">{{ __('Nenhuma notícia publicada no momento.') }}</p>
        @endif
    </div>
</section>
