<?php $__env->startSection('title', 'Media Library'); ?>

<?php $__env->startSection('content'); ?>
    <div class="card mb-4">
        <div class="card-header bg-white"><h6 class="mb-0"><i class="bi bi-cloud-upload me-2"></i>Upload File</h6></div>
        <div class="card-body">
            <form action="<?php echo e(route('admin.media.store')); ?>" method="POST" enctype="multipart/form-data" class="row g-3">
                <?php echo csrf_field(); ?>
                <div class="col-md-5">
                    <input type="file" name="file" class="form-control" required>
                </div>
                <div class="col-md-5">
                    <input type="text" name="alt_text" class="form-control" placeholder="Alternative text (for images)">
                </div>
                <div class="col-md-2">
                    <button type="submit" class="btn btn-primary w-100"><i class="bi bi-upload"></i> Upload</button>
                </div>
                <div class="col-12 form-text">Supported: JPG, PNG, WebP, GIF, SVG, PDF, DOC. Max 10MB.</div>
            </form>
        </div>
    </div>

    <div class="row g-3 media-grid">
        <?php $__empty_1 = true; $__currentLoopData = $media; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <div class="col-6 col-sm-4 col-md-3 col-lg-2">
                <div class="card h-100">
                    <div class="p-2 d-flex justify-content-center align-items-center" style="height:120px;background:#f5f6f7">
                        <?php if(in_array($item->type, ['image/jpeg','image/png','image/webp','image/gif','image/svg+xml']) || str_contains($item->type,'image')): ?>
                            <img src="<?php echo e(\App\Services\FileUploadService::url($item->path)); ?>" class="img-fluid" style="max-height:110px;max-width:100%" alt="<?php echo e($item->alt_text); ?>">
                        <?php else: ?>
                            <span class="text-muted"><i class="bi bi-file-earmark fs-1"></i></span>
                        <?php endif; ?>
                    </div>
                    <div class="card-body p-2">
                        <small class="text-truncate d-block" title="<?php echo e($item->name); ?>"><?php echo e($item->name); ?></small>
                        <small class="text-muted d-block"><i class="bi bi-link-45deg"></i> <?php echo e(\App\Services\FileUploadService::url($item->path)); ?></small>
                        <form action="<?php echo e(route('admin.media.update', $item)); ?>" method="POST" class="mt-2">
                            <?php echo csrf_field(); ?> <?php echo method_field('PUT'); ?>
                            <input type="text" name="alt_text" class="form-control form-control-sm" placeholder="Alt text" value="<?php echo e($item->alt_text); ?>">
                            <div class="d-flex gap-1 mt-2">
                                <button class="btn btn-sm btn-outline-primary flex-grow-1">Save</button>
                                <a class="btn btn-sm btn-outline-secondary" href="<?php echo e(\App\Services\FileUploadService::url($item->path)); ?>" target="_blank"><i class="bi bi-eye"></i></a>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <div class="col-12 text-center text-muted py-4">No media uploaded yet.</div>
        <?php endif; ?>
    </div>
    <div class="mt-3"><?php echo e($media->links()); ?></div>
<?php $__env->stopSection(); ?>

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