<?php $__env->startSection('title', $publication->title . ' - Research & Innovation Centre'); ?>
<?php $__env->startSection('meta-description', Str::limit($publication->abstract, 160)); ?>

<?php $__env->startSection('content'); ?>

<div class="bg-gradient-to-r from-emerald-600 to-teal-700 shadow-lg">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
        <div class="flex flex-col md:flex-row gap-8">
            
            <div class="flex-1">
                <div class="flex items-center gap-2 mb-4">
                    <span class="px-3 py-1 bg-emerald-800 text-white text-sm font-semibold rounded-full uppercase">
                        <?php echo e($publication->category_label); ?>

                    </span>
                    <?php if($publication->is_featured): ?>
                    <span class="px-3 py-1 bg-yellow-500 text-yellow-900 text-sm font-semibold rounded-full">
                        <i class="fas fa-star mr-1"></i>Featured
                    </span>
                    <?php endif; ?>
                </div>
                
                <h1 class="text-3xl md:text-4xl font-bold text-white font-serif mb-4">
                    <?php echo e($publication->title); ?>

                </h1>
                
                <div class="flex flex-wrap items-center gap-4 text-emerald-100">
                    <div class="flex items-center">
                        <div class="w-10 h-10 rounded-full bg-emerald-800 flex items-center justify-center mr-3">
                            <i class="fas fa-user text-white"></i>
                        </div>
                        <div>
                            <p class="text-white font-medium"><?php echo e($publication->user->name ?? 'Unknown Author'); ?></p>
                            <p class="text-sm"><?php echo e($publication->author_badge); ?></p>
                        </div>
                    </div>
                    <span class="text-emerald-300">|</span>
                    <span class="flex items-center">
                        <i class="fas fa-calendar mr-2"></i>
                        Published <?php echo e($publication->approved_at?->format('F d, Y') ?? 'N/A'); ?>

                    </span>
                </div>
            </div>
            
            
            <?php if($publication->cover_image): ?>
            <div class="w-full md:w-72 flex-shrink-0">
                <img src="<?php echo e(Storage::url($publication->cover_image)); ?>" 
                     alt="<?php echo e($publication->title); ?>"
                     class="w-full h-48 md:h-64 object-cover rounded-xl shadow-lg">
            </div>
            <?php endif; ?>
        </div>
    </div>
</div>


<div class="bg-gray-50 border-b border-gray-200">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-3">
        <nav class="flex items-center space-x-2 text-sm text-gray-600" aria-label="Breadcrumb">
            <a href="<?php echo e(url('/')); ?>" class="hover:text-emerald-600 transition flex items-center">
                <i class="fas fa-home mr-1"></i>Home
            </a>
            <i class="fas fa-chevron-right text-gray-400 text-xs"></i>
            <a href="<?php echo e(route('research.public.index')); ?>" class="hover:text-emerald-600 transition">Research</a>
            <i class="fas fa-chevron-right text-gray-400 text-xs"></i>
            <span class="text-gray-500"><?php echo e($publication->category_label); ?></span>
            <i class="fas fa-chevron-right text-gray-400 text-xs"></i>
            <span class="text-gray-900 font-medium"><?php echo e(Str::limit($publication->title, 50)); ?></span>
        </nav>
    </div>
</div>


<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
    <div class="flex flex-col lg:flex-row gap-8">
        
        <div class="flex-1">
            
            <section class="bg-white rounded-xl shadow-sm border border-gray-100 p-8 mb-8">
                <h2 class="text-xl font-bold text-gray-900 font-serif mb-4 flex items-center">
                    <i class="fas fa-align-left text-emerald-600 mr-3"></i>
                    Abstract
                </h2>
                <div class="prose prose-lg max-w-none text-gray-700">
                    <?php echo e($publication->abstract); ?>

                </div>
            </section>

            
            <?php if($publication->methodology): ?>
            <section class="bg-white rounded-xl shadow-sm border border-gray-100 p-8 mb-8">
                <h2 class="text-xl font-bold text-gray-900 font-serif mb-4 flex items-center">
                    <i class="fas fa-cogs text-emerald-600 mr-3"></i>
                    Methodology
                </h2>
                <div class="prose prose-lg max-w-none text-gray-700 whitespace-pre-line">
                    <?php echo e($publication->methodology); ?>

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

            
            <?php if($publication->findings): ?>
            <section class="bg-white rounded-xl shadow-sm border border-gray-100 p-8 mb-8">
                <h2 class="text-xl font-bold text-gray-900 font-serif mb-4 flex items-center">
                    <i class="fas fa-lightbulb text-emerald-600 mr-3"></i>
                    Key Findings
                </h2>
                <div class="prose prose-lg max-w-none text-gray-700 whitespace-pre-line">
                    <?php echo e($publication->findings); ?>

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

            
            <?php if($publication->references): ?>
            <section class="bg-white rounded-xl shadow-sm border border-gray-100 p-8 mb-8">
                <h2 class="text-xl font-bold text-gray-900 font-serif mb-4 flex items-center">
                    <i class="fas fa-book text-emerald-600 mr-3"></i>
                    References
                </h2>
                <div class="prose prose-lg max-w-none text-gray-700 whitespace-pre-line text-sm">
                    <?php echo e($publication->references); ?>

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

            
            <?php if($publication->files->count() > 0): ?>
            <section class="bg-white rounded-xl shadow-sm border border-gray-100 p-8 mb-8">
                <h2 class="text-xl font-bold text-gray-900 font-serif mb-4 flex items-center">
                    <i class="fas fa-paperclip text-emerald-600 mr-3"></i>
                    Attached Files
                </h2>
                <div class="space-y-3">
                    <?php $__currentLoopData = $publication->files; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $file): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php if($file->is_public): ?>
                    <div class="flex items-center justify-between p-4 bg-gray-50 rounded-lg hover:bg-gray-100 transition">
                        <div class="flex items-center">
                            <div class="w-10 h-10 rounded-lg bg-emerald-100 flex items-center justify-center mr-4">
                                <i class="fas <?php echo e($file->icon); ?> text-emerald-600"></i>
                            </div>
                            <div>
                                <p class="font-medium text-gray-900"><?php echo e($file->original_name); ?></p>
                                <p class="text-sm text-gray-500"><?php echo e($file->formatted_size); ?></p>
                            </div>
                        </div>
                        <a href="<?php echo e($file->url); ?>" 
                           target="_blank"
                           class="px-4 py-2 bg-emerald-600 text-white rounded-lg hover:bg-emerald-700 transition text-sm font-medium">
                            <i class="fas fa-download mr-2"></i>
                            Download
                        </a>
                    </div>
                    <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </section>
            <?php endif; ?>
        </div>

        
        <div class="w-full lg:w-80 flex-shrink-0">
            
            <div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6 mb-6">
                <h3 class="text-lg font-bold text-gray-900 font-serif mb-4">About the Author</h3>
                <div class="flex items-center mb-4">
                    <div class="w-16 h-16 rounded-full bg-emerald-100 flex items-center justify-center mr-4">
                        <i class="fas fa-user text-emerald-600 text-2xl"></i>
                    </div>
                    <div>
                        <p class="font-semibold text-gray-900"><?php echo e($publication->user->name ?? 'Unknown Author'); ?></p>
                        <span class="px-2 py-1 bg-emerald-100 text-emerald-700 text-xs font-semibold rounded-full">
                            <?php echo e($publication->author_badge); ?>

                        </span>
                    </div>
                </div>
                <?php if($publication->user?->email && $publication->user->email !== auth()->user()?->email): ?>
                <a href="mailto:<?php echo e($publication->user->email); ?>" 
                   class="block w-full text-center px-4 py-2 border border-emerald-600 text-emerald-600 rounded-lg hover:bg-emerald-50 transition text-sm font-medium">
                    <i class="fas fa-envelope mr-2"></i>
                    Contact Author
                </a>
                <?php endif; ?>
            </div>

            
            <div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6 mb-6">
                <h3 class="text-lg font-bold text-gray-900 font-serif mb-4">Publication Details</h3>
                <dl class="space-y-3 text-sm">
                    <div class="flex justify-between">
                        <dt class="text-gray-500">Category</dt>
                        <dd class="text-gray-900 font-medium"><?php echo e($publication->category_label); ?></dd>
                    </div>
                    <div class="flex justify-between">
                        <dt class="text-gray-500">Published</dt>
                        <dd class="text-gray-900 font-medium"><?php echo e($publication->approved_at?->format('M d, Y') ?? 'N/A'); ?></dd>
                    </div>
                    <div class="flex justify-between">
                        <dt class="text-gray-500">Attachments</dt>
                        <dd class="text-gray-900 font-medium"><?php echo e($publication->files->count()); ?> file(s)</dd>
                    </div>
                </dl>
            </div>

            
            <div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6 mb-6">
                <h3 class="text-lg font-bold text-gray-900 font-serif mb-4">Share This Research</h3>
                <div class="flex gap-2">
                    <button onclick="shareOnTwitter()" 
                            class="flex-1 px-3 py-2 bg-blue-400 text-white rounded-lg hover:bg-blue-500 transition">
                        <i class="fab fa-twitter"></i>
                    </button>
                    <button onclick="shareOnLinkedIn()" 
                            class="flex-1 px-3 py-2 bg-blue-700 text-white rounded-lg hover:bg-blue-800 transition">
                        <i class="fab fa-linkedin"></i>
                    </button>
                    <button onclick="copyLink()" 
                            class="flex-1 px-3 py-2 bg-gray-600 text-white rounded-lg hover:bg-gray-700 transition">
                        <i class="fas fa-link"></i>
                    </button>
                </div>
            </div>

            
            <?php if(auth()->guard()->check()): ?>
            <?php if($publication->isAuthor(auth()->id())): ?>
            <div class="bg-yellow-50 rounded-xl border border-yellow-200 p-6">
                <h3 class="text-lg font-bold text-yellow-800 font-serif mb-4">
                    <i class="fas fa-edit mr-2"></i>
                    Author Actions
                </h3>
                <div class="space-y-2">
                    <a href="<?php echo e(route('research.edit', $publication)); ?>" 
                       class="block w-full text-center px-4 py-2 bg-yellow-600 text-white rounded-lg hover:bg-yellow-700 transition text-sm font-medium">
                        <i class="fas fa-edit mr-2"></i>
                        Edit Publication
                    </a>
                </div>
            </div>
            <?php endif; ?>
            <?php endif; ?>
        </div>
    </div>

    
    <?php if($related->count() > 0): ?>
    <section class="mt-12">
        <h2 class="text-2xl font-bold text-gray-900 font-serif mb-6 flex items-center">
            <i class="fas fa-bookmark text-emerald-600 mr-3"></i>
            Related Publications
        </h2>
        <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
            <?php $__currentLoopData = $related; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $relatedPub): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <article class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden hover:shadow-md transition-shadow duration-300">
                <?php if($relatedPub->cover_image): ?>
                <div class="h-32 overflow-hidden">
                    <img src="<?php echo e(Storage::url($relatedPub->cover_image)); ?>" 
                         alt="<?php echo e($relatedPub->title); ?>"
                         class="w-full h-full object-cover">
                </div>
                <?php else: ?>
                <div class="h-32 bg-gradient-to-br from-gray-100 to-gray-200 flex items-center justify-center">
                    <i class="fas fa-file-alt text-gray-400 text-3xl"></i>
                </div>
                <?php endif; ?>
                
                <div class="p-4">
                    <span class="text-xs font-semibold text-emerald-600 uppercase">
                        <?php echo e($relatedPub->category_label); ?>

                    </span>
                    <h3 class="text-sm font-bold text-gray-900 mt-1 line-clamp-2">
                        <a href="<?php echo e(route('research.public.show', $relatedPub)); ?>" 
                           class="hover:text-emerald-600 transition">
                            <?php echo e($relatedPub->title); ?>

                        </a>
                    </h3>
                    <p class="text-xs text-gray-500 mt-2">
                        <?php echo e($relatedPub->approved_at?->format('M d, Y') ?? 'N/A'); ?>

                    </p>
                </div>
            </article>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
    </section>
    <?php endif; ?>
</div>

<?php $__env->startPush('scripts'); ?>
<script>
function shareOnTwitter() {
    const url = encodeURIComponent(window.location.href);
    const text = encodeURIComponent('<?php echo e($publication->title); ?>');
    window.open(`https://twitter.com/intent/tweet?url=${url}&text=${text}`, '_blank', 'width=550,height=420');
}

function shareOnLinkedIn() {
    const url = encodeURIComponent(window.location.href);
    window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${url}`, '_blank', 'width=550,height=420');
}

function copyLink() {
    navigator.clipboard.writeText(window.location.href).then(() => {
        alert('Link copied to clipboard!');
    });
}
</script>
<?php $__env->stopPush(); ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.site', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/www/sshia.org/sshia/resources/views/research/public/show.blade.php ENDPATH**/ ?>