

<?php $__env->startSection('content'); ?>
<div style="padding: 60px 20px 40px 20px; width: 100%;">
    <h1 style="color: #0a3d91; text-align: center; margin-bottom: 20px; font-size: 2.5rem;">
        <?php if(isset($showAllCategories) && !$showAllCategories): ?>
            DOCUMENT STANDART SPMI
        <?php else: ?>
            DOWNLOAD DOKUMEN
        <?php endif; ?>
    </h1>
    <p style="text-align: center; color: #666; font-size: 1.2rem; margin-bottom: 60px;">
        <?php if(isset($showAllCategories) && !$showAllCategories): ?>
            Document standart SPMI yang telah disusun sesuai dengan persyaratan sistem penjaminan mutu.
        <?php else: ?>
            Unduh dokumen-dokumen penting terkait standar mutu dan regulasi.
        <?php endif; ?>
    </p>

    <div style="display: grid; gap: 20px; max-width: 1000px; margin: 0 auto;">
        <?php
            $filteredDocuments = isset($showAllCategories) && !$showAllCategories
                ? $documents->get('dokumen-mutu', collect())
                : $documents->flatten();
        ?>

        <?php if($filteredDocuments->isEmpty()): ?>
            <div style="background: white; padding: 60px; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); text-align: center;">
                <h3 style="color: #666; margin-bottom: 15px;">
                    <?php if(isset($showAllCategories) && !$showAllCategories): ?>
                        Belum ada dokumen mutu tersedia
                    <?php else: ?>
                        Belum ada dokumen tersedia
                    <?php endif; ?>
                </h3>
                <p style="color: #999;">
                    <?php if(isset($showAllCategories) && !$showAllCategories): ?>
                        Dokumen mutu akan segera ditambahkan oleh administrator.
                    <?php else: ?>
                        Dokumen-dokumen akan segera ditambahkan oleh administrator.
                    <?php endif; ?>
                </p>
            </div>
        <?php else: ?>
            <?php $__currentLoopData = $filteredDocuments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $document): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <!-- Simple Document Card -->
                <div style="background: white; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); overflow: hidden;">
                    <!-- Document Header -->
                    <div style="padding: 20px; border-bottom: 1px solid #eee;">
                        <h3 style="margin: 0; color: #0a3d91; font-size: 1.4rem; text-align: center;"><?php echo e($document->title); ?></h3>
                    </div>

                    <!-- Simple PDF Viewer -->
                    <div style="padding: 20px;">
                        <div style="width: 100%; height: 500px; border: 1px solid #ddd; border-radius: 8px; background: #f9f9fa;">
                            <iframe src="<?php echo e(route('documents.download', $document->id)); ?>?preview=1"
                                    style="width: 100%; height: 100%; border: none; border-radius: 8px;"
                                    title="Preview <?php echo e($document->title); ?>">
                            </iframe>
                        </div>
                    </div>

                    <!-- Document Info & Download -->
                    <div style="padding: 20px; background: #f8f9fa; border-top: 1px solid #eee;">
                        <div style="display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px;">
                            <div style="flex: 1;">
                                <div style="font-size: 0.9rem; color: #666;">
                                    <strong>Kategori:</strong> <?php echo e(ucfirst($document->category)); ?> |
                                    <strong>Ukuran:</strong> <?php echo e($document->formatted_file_size); ?> |
                                    <strong>Format:</strong> <?php echo e(strtoupper(pathinfo($document->file_name, PATHINFO_EXTENSION))); ?>

                                </div>
                                <?php if($document->description): ?>
                                    <div style="margin-top: 8px; font-size: 0.85rem; color: #888;">
                                        <?php echo e(Str::limit($document->description, 100)); ?>

                                    </div>
                                <?php endif; ?>
                            </div>

                            <div style="flex-shrink: 0;">
                                <a href="<?php echo e(route('documents.download', $document->id)); ?>"
                                   style="background: #0a3d91; color: white; padding: 12px 25px; border-radius: 25px; text-decoration: none; font-weight: bold; display: inline-block;">
                                    📥 Download
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        <?php endif; ?>
    </div>

    <div style="background: #f8f9fa; padding: 30px; border-radius: 10px; text-align: center; margin-top: 40px;">
        <h3 style="color: #0a3d91; margin-bottom: 15px;">Butuh Dokumen Lainnya?</h3>
        <p style="color: #666; margin-bottom: 20px;">
            Jika Anda membutuhkan dokumen tertentu yang tidak tersedia di sini, silakan hubungi kami.
        </p>
        <a href="<?php echo e(route('kontak')); ?>" style="background: #0a3d91; color: white; padding: 12px 25px; border-radius: 25px; text-decoration: none; font-weight: bold; display: inline-block;">
            Hubungi Kami
        </a>
    </div>
</div>

<style>
/* PDF Viewer responsive adjustments */
@media (max-width: 768px) {
    div[style*="height: 500px"] {
        height: 400px !important;
    }
}

@media (max-width: 480px) {
    div[style*="height: 500px"] {
        height: 350px !important;
    }
}
</style>

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