<?php $__env->startSection('title', 'News'); ?>
<?php $__env->startSection('page-title', '📰 News & Highlights'); ?>

<?php $__env->startSection('header-actions'); ?>
    <a href="<?php echo e(route('admin.news.create')); ?>"
       class="bg-wc-green text-white text-sm font-bold px-4 py-2 rounded-xl hover:bg-wc-green-dark transition-colors">
        + Post Article
    </a>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="bg-white rounded-2xl border border-gray-200 shadow-sm overflow-hidden">
    <table class="w-full text-sm">
        <thead class="bg-gray-50 border-b border-gray-200">
            <tr>
                <th class="px-6 py-3 text-left font-semibold text-gray-600">Article</th>
                <th class="px-6 py-3 text-left font-semibold text-gray-600">Category</th>
                <th class="px-6 py-3 text-left font-semibold text-gray-600">Team</th>
                <th class="px-6 py-3 text-left font-semibold text-gray-600">Status</th>
                <th class="px-6 py-3 text-left font-semibold text-gray-600">Posted</th>
                <th class="px-6 py-3 text-right font-semibold text-gray-600">Actions</th>
            </tr>
        </thead>
        <tbody class="divide-y divide-gray-100">
            <?php $__empty_1 = true; $__currentLoopData = $news; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $article): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <tr class="hover:bg-gray-50 transition-colors">
                <td class="px-6 py-4 max-w-xs">
                    <div class="font-semibold text-gray-800 truncate"><?php echo e($article->title); ?></div>
                    <div class="text-xs text-gray-400 truncate mt-0.5"><?php echo e($article->summary); ?></div>
                </td>
                <td class="px-6 py-4">
                    <?php
                        $catColors = [
                            'breaking'  => 'bg-red-100 text-red-700',
                            'preview'   => 'bg-blue-100 text-blue-700',
                            'review'    => 'bg-green-100 text-green-700',
                            'team'      => 'bg-purple-100 text-purple-700',
                            'highlight' => 'bg-yellow-100 text-yellow-700',
                        ];
                    ?>
                    <span class="text-xs px-2.5 py-1 rounded-full font-semibold <?php echo e($catColors[$article->category] ?? 'bg-gray-100 text-gray-600'); ?>">
                        <?php echo e(ucfirst($article->category)); ?>

                    </span>
                </td>
                <td class="px-6 py-4 text-gray-500 text-xs">
                    <?php echo e($article->relatedTeam?->name ?? '—'); ?>

                </td>
                <td class="px-6 py-4">
                    <span class="text-xs px-2.5 py-1 rounded-full font-bold
                                 <?php echo e($article->is_published ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-500'); ?>">
                        <?php echo e($article->is_published ? 'Published' : 'Draft'); ?>

                    </span>
                </td>
                <td class="px-6 py-4 text-gray-400 text-xs">
                    <?php echo e($article->created_at->diffForHumans()); ?>

                </td>
                <td class="px-6 py-4">
                    <div class="flex items-center justify-end gap-2">
                        <a href="<?php echo e(route('admin.news.edit', $article->id)); ?>"
                           class="text-xs bg-wc-green/10 text-wc-green hover:bg-wc-green/20 px-3 py-1.5 rounded-lg font-semibold transition-colors">
                            ✏️ Edit
                        </a>
                        <form method="POST" action="<?php echo e(route('admin.news.destroy', $article->id)); ?>"
                              onsubmit="confirmDelete(event, this)">
                            <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                            <button type="submit"
                                    class="text-xs bg-red-50 text-red-600 hover:bg-red-100 px-3 py-1.5 rounded-lg font-semibold transition-colors">
                                🗑
                            </button>
                        </form>
                    </div>
                </td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <tr>
                <td colspan="6" class="px-6 py-16 text-center text-gray-400">
                    <div class="text-4xl mb-3">📰</div>
                    <p class="font-medium">No articles yet.</p>
                    <a href="<?php echo e(route('admin.news.create')); ?>" class="text-wc-green font-semibold hover:underline mt-1 inline-block">
                        Post first article →
                    </a>
                </td>
            </tr>
            <?php endif; ?>
        </tbody>
    </table>
    <?php if($news->hasPages()): ?>
        <div class="px-6 py-4 border-t border-gray-100"><?php echo e($news->links()); ?></div>
    <?php endif; ?>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\MatchDay\resources\views/admin/news/index.blade.php ENDPATH**/ ?>