<?php $__env->startSection('heading', $title); ?>
<?php $__env->startSection('content'); ?>
<div class="premium-page-head">
    <div>
        <span class="eyebrow">CONTENT LIBRARY</span>
        <h1><?php echo e($title); ?></h1>
        <p>Manage, search, publish and remove your <?php echo e(strtolower($title)); ?> from one clean workspace.</p>
    </div>
    <a class="premium-btn premium-btn-primary" href="<?php echo e(route('admin.'.$kind.'s.create')); ?>">
        <i class="fa-solid fa-plus"></i> Add <?php echo e(ucfirst($kind)); ?>

    </a>
</div>

<div class="premium-toolbar">
    <form method="get" class="premium-search">
        <i class="fa-solid fa-magnifying-glass"></i>
        <input name="q" value="<?php echo e(request('q')); ?>" placeholder="Search by title...">
        <?php if(request('q')): ?>
            <a href="<?php echo e(route('admin.'.$kind.'s.index')); ?>" title="Clear search"><i class="fa-solid fa-xmark"></i></a>
        <?php endif; ?>
        <button type="submit">Search</button>
    </form>
    <div class="result-count"><strong><?php echo e(number_format($items->total())); ?></strong> total items</div>
</div>

<div class="premium-admin-grid">
<?php $__empty_1 = true; $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $x): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
    <?php
        $img = app(\App\Services\MediaStorageService::class)->url($x->poster_path);
        $year = $kind === 'movie'
            ? optional($x->release_date)->format('Y')
            : optional($x->first_air_date)->format('Y');
    ?>
    <article class="premium-content-card">
        <div class="premium-poster">
            <img src="<?php echo e($img ?: 'https://placehold.co/500x750?text=No+Poster'); ?>" alt="<?php echo e($x->title); ?>">
            <div class="poster-shade"></div>
            <span class="status-pill <?php echo e($x->is_active ? 'is-live' : 'is-off'); ?>">
                <i class="fa-solid <?php echo e($x->is_active ? 'fa-circle-check' : 'fa-circle-pause'); ?>"></i>
                <?php echo e($x->is_active ? 'Published' : 'Draft'); ?>

            </span>
            <span class="type-pill"><?php echo e($kind === 'movie' ? 'MOVIE' : 'TV SHOW'); ?></span>
        </div>
        <div class="premium-card-body">
            <h3 title="<?php echo e($x->title); ?>"><?php echo e($x->title); ?></h3>
            <div class="meta-row">
                <span><i class="fa-regular fa-calendar"></i> <?php echo e($year ?: 'TBA'); ?></span>
                <span><i class="fa-solid fa-language"></i> <?php echo e(strtoupper($x->language ?: 'N/A')); ?></span>
            </div>
            <div class="id-row">
                <span>TMDB #<?php echo e($x->tmdb_id ?: 'N/A'); ?></span>
                <?php if($x->quality_badge ?? false): ?><span><?php echo e($x->quality_badge); ?></span><?php endif; ?>
            </div>
            <div class="premium-card-actions">
                <?php if($kind === 'movie'): ?>
                    <a class="premium-btn premium-btn-edit" href="<?php echo e(route('admin.movies.edit', $x)); ?>">
                        <i class="fa-solid fa-pen-to-square"></i> Edit
                    </a>
                <?php else: ?>
                    <a class="premium-btn premium-btn-view" href="<?php echo e(route('show', $x)); ?>" target="_blank">
                        <i class="fa-solid fa-arrow-up-right-from-square"></i> View
                    </a>
                <?php endif; ?>
                <form method="post" action="<?php echo e(route('admin.'.$kind.'s.toggle', $x)); ?>">
                    <?php echo csrf_field(); ?>
                    <button class="premium-btn <?php echo e($x->is_active ? 'premium-btn-live' : 'premium-btn-muted'); ?>" title="Toggle status">
                        <i class="fa-solid <?php echo e($x->is_active ? 'fa-toggle-on' : 'fa-toggle-off'); ?>"></i>
                    </button>
                </form>
                <form method="post" action="<?php echo e(route('admin.'.$kind.'s.destroy', $x)); ?>">
                    <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                    <button class="premium-btn premium-btn-delete" onclick="return confirm('Delete this item permanently?')" title="Delete">
                        <i class="fa-solid fa-trash-can"></i>
                    </button>
                </form>
            </div>
        </div>
    </article>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
    <div class="premium-empty"><i class="fa-solid fa-film"></i><h3>No content found</h3><p>Try another keyword or add a new item.</p></div>
<?php endif; ?>
</div>

<?php echo e($items->links('vendor.pagination.admin-premium')); ?>

<?php $__env->stopSection(); ?>


<?php echo $__env->make('admin.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/megashopltd/moviedocks.com/resources/views/admin/media-index.blade.php ENDPATH**/ ?>