@forelse($news as $item)
    <div class="col-lg-4 col-md-6 mb-4">
        <div class="card h-100 shadow-sm border-0 news-card">
            <div class="position-relative">
                @if ($item->image)
                    <img src="{{ asset($item->image) }}" class="card-img-top" alt="{{ $item->title }}"
                        style="height: 200px; object-fit: cover;">
                @else
                    <div class="card-img-top bg-light d-flex align-items-center justify-content-center"
                        style="height: 200px;">
                        <i class="bi bi-newspaper text-muted" style="font-size: 3rem;"></i>
                    </div>
                @endif
                <div class="position-absolute top-0 start-0 m-2">
                    {{-- PERUBAHAN DI SINI --}}
                    <span class="badge text-white" style="background-color: #077a7d;">{{ $item->category }}</span>
                </div>
            </div>
            <div class="card-body d-flex flex-column">
                <h5 class="card-title">{{ $item->title }}</h5>
                <p class="card-text text-muted flex-grow-1">
                    {{ Str::limit(strip_tags($item->content), 120) }}
                </p>
                <div class="d-flex justify-content-between align-items-center mt-auto">
                    <small class="text-muted">
                        <i class="bi bi-calendar3"></i> {{ $item->created_at->format('d M Y') }}
                    </small>
                    <small class="text-muted">
                        <i class="bi bi-eye"></i> {{ $item->views }}
                    </small>
                </div>
            </div>
            <div class="card-footer bg-transparent border-0">
                <a href="{{ route('news.show', $item->slug) }}" class="btn btn-outline-primary btn-sm w-100">
                    Baca Selengkapnya
                </a>
            </div>
        </div>
    </div>
@empty
    <div class="col-12 text-center py-5">
        <i class="bi bi-newspaper text-muted" style="font-size: 4rem;"></i>
        <h4 class="mt-3 text-muted">Belum ada berita</h4>
        <p class="text-muted">Berita akan ditampilkan di sini</p>
    </div>
@endforelse
