
<?php if (isset($component)) { $__componentOriginalf2a1b2b34b0a376d40858ac9c2a946a5 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalf2a1b2b34b0a376d40858ac9c2a946a5 = $attributes; } ?>
<?php $component = App\View\Components\SiteLayout::resolve(['title' => ''.e($seoMetadata['title'] ?? $topic->name . ' - Discussions').'','metaDescription' => ''.e($seoMetadata['description'] ?? $topic->description).''] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('site-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\SiteLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
    
    <?php if(isset($breadcrumbSchema)): ?>
        <?php echo $breadcrumbSchema; ?>

    <?php endif; ?>
    
    
    <div class="bg-gradient-to-r from-green-600 to-green-700 shadow-lg">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
            
            
            <div class="flex items-start">
                <div class="flex-shrink-0 w-16 h-16 rounded-xl <?php echo e($topic->color ? "bg-{$topic->color}-500" : 'bg-white'); ?> bg-opacity-20 flex items-center justify-center mr-4">
                    <i class="fas <?php echo e($topic->icon ?? 'fa-folder'); ?> text-white text-2xl"></i>
                </div>
                <div>
                    <h1 class="text-3xl font-bold text-white"><?php echo e($topic->name); ?></h1>
                    <?php if($topic->description): ?>
                        <p class="text-green-100 mt-2 max-w-5xl"><?php echo e($topic->description); ?></p>
                    <?php endif; ?>
                </div>
            </div>
            
            
            <div class="mt-6 flex flex-wrap gap-4">
                <div class="bg-white bg-opacity-20 backdrop-blur-sm rounded-lg px-4 py-2">
                    <span class="text-green-100 text-sm">Discussions</span>
                    <p class="text-white text-xl font-bold"><?php echo e(number_format($topic->active_discussions_count ?? $discussions->total())); ?></p>
                </div>
            </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-green-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('public.discussions.index')); ?>" class="hover:text-green-600 transition">Discussions</a>
                <i class="fas fa-chevron-right text-gray-400 text-xs"></i>
                <span class="text-gray-900 font-medium"><?php echo e($topic->name); ?></span>
            </nav>
        </div>
    </div>

    
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
        <div class="grid grid-cols-1 lg:grid-cols-4 gap-8">
            
            
            <div class="lg:col-span-3">
                
                
                <div class="bg-theme-card rounded-lg shadow-sm p-4 mb-6">
                    <form method="GET" class="flex flex-col md:flex-row gap-4">
                        <div class="flex-1 relative">
                            <input type="text" 
                                   name="q" 
                                   value="<?php echo e(request('q')); ?>"
                                   placeholder="Search in <?php echo e($topic->name); ?>..."
                                   class="w-full pl-10 pr-4 py-2 border theme-divider rounded-lg bg-theme-body text-theme-body focus:ring-2 focus:ring-green-500 focus:border-transparent">
                            <i class="fas fa-search absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"></i>
                        </div>
                        
                        <select name="sort" class="px-4 py-2 border theme-divider rounded-lg bg-theme-body text-theme-body focus:ring-2 focus:ring-green-500">
                            <option value="latest" <?php echo e(request('sort') === 'latest' ? 'selected' : ''); ?>>Latest</option>
                            <option value="popular" <?php echo e(request('sort') === 'popular' ? 'selected' : ''); ?>>Most Popular</option>
                            <option value="active" <?php echo e(request('sort') === 'active' ? 'selected' : ''); ?>>Most Active</option>
                        </select>
                        
                        <button type="submit" class="px-6 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition">
                            <i class="fas fa-filter mr-2"></i>
                            Filter
                        </button>
                    </form>
                </div>
                
                
                <div class="space-y-4">
                    <?php $__empty_1 = true; $__currentLoopData = $discussions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $discussion): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <?php echo $__env->make('public.discussions.partials.discussion-card', ['discussion' => $discussion], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <div class="bg-theme-card rounded-lg shadow-sm p-8 text-center">
                            <i class="fas fa-comments text-4xl text-gray-300 mb-4"></i>
                            <h3 class="text-lg font-medium text-theme-heading mb-2">No discussions in this topic</h3>
                            <p class="text-theme-body mb-4">
                                <?php if(request('q')): ?>
                                    No discussions match your search in this topic.
                                <?php else: ?>
                                    Be the first to start a discussion in <?php echo e($topic->name); ?>!
                                <?php endif; ?>
                            </p>
                            <?php if(auth()->guard()->check()): ?>
                                <a href="<?php echo e(route('knowledge-sharing.discussions.create', ['topic_id' => $topic->id])); ?>" 
                                   class="inline-flex items-center px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition">
                                    <i class="fas fa-plus mr-2"></i>
                                    Start a Discussion
                                </a>
                            <?php endif; ?>
                        </div>
                    <?php endif; ?>
                </div>
                
                
                <?php if($discussions->hasPages()): ?>
                    <div class="mt-6">
                        <?php echo e($discussions->links()); ?>

                    </div>
                <?php endif; ?>
            </div>
            
            
            <div class="lg:col-span-1 space-y-6">
                
                
                <div class="bg-theme-card rounded-lg shadow-sm p-4">
                    <h3 class="text-lg font-semibold text-theme-heading mb-4 flex items-center">
                        <i class="fas fa-folder text-green-600 mr-2"></i>
                        Other Topics
                    </h3>
                    <ul class="space-y-2">
                        <?php $__currentLoopData = $topics->where('id', '!=', $topic->id); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $otherTopic): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <li>
                                <a href="<?php echo e(route('public.discussions.topic', $otherTopic->slug)); ?>" 
                                   class="flex items-center justify-between p-2 rounded-lg hover:bg-theme-body transition">
                                    <span class="flex items-center">
                                        <i class="fas <?php echo e($otherTopic->icon ?? 'fa-folder'); ?> <?php echo e($otherTopic->color ? "text-{$otherTopic->color}-500" : 'text-gray-400'); ?> mr-2"></i>
                                        <?php echo e($otherTopic->name); ?>

                                    </span>
                                    <span class="text-xs bg-theme-body px-2 py-1 rounded-full text-theme-body">
                                        <?php echo e($otherTopic->active_discussions_count); ?>

                                    </span>
                                </a>
                            </li>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </ul>
                </div>
                
                
                <?php if(auth()->guard()->check()): ?>
                    <div class="bg-gradient-to-r from-green-600 to-green-700 rounded-lg shadow-sm p-4 text-white">
                        <h3 class="font-semibold mb-2">Have something to share?</h3>
                        <p class="text-sm text-green-100 mb-4">Start a discussion in this topic.</p>
                        <a href="<?php echo e(route('knowledge-sharing.discussions.create', ['topic_id' => $topic->id])); ?>" 
                           class="inline-flex items-center px-4 py-2 bg-white text-green-700 rounded-lg hover:bg-green-50 transition font-medium">
                            <i class="fas fa-plus mr-2"></i>
                            Start Discussion
                        </a>
                    </div>
                <?php else: ?>
                    <div class="bg-theme-card rounded-lg shadow-sm p-4">
                        <h3 class="font-semibold text-theme-heading mb-2">Join the Community</h3>
                        <p class="text-sm text-theme-body mb-4">Sign in to start discussions and reply.</p>
                        <a href="<?php echo e(route('register')); ?>" 
                           class="inline-flex items-center px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition">
                            <i class="fas fa-user-plus mr-2"></i>
                            Sign Up
                        </a>
                    </div>
                <?php endif; ?>
            </div>
        </div>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalf2a1b2b34b0a376d40858ac9c2a946a5)): ?>
<?php $attributes = $__attributesOriginalf2a1b2b34b0a376d40858ac9c2a946a5; ?>
<?php unset($__attributesOriginalf2a1b2b34b0a376d40858ac9c2a946a5); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalf2a1b2b34b0a376d40858ac9c2a946a5)): ?>
<?php $component = $__componentOriginalf2a1b2b34b0a376d40858ac9c2a946a5; ?>
<?php unset($__componentOriginalf2a1b2b34b0a376d40858ac9c2a946a5); ?>
<?php endif; ?>
<?php /**PATH /home/www/sshia.org/sshia/resources/views/public/discussions/topic.blade.php ENDPATH**/ ?>