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

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


<div class="hero-section text-white text-center position-relative">
    <div class="container position-relative">
        <h1 class="display-3 fw-bold text-uppercase mb-3">FORUMS</h1>
        <h5 class="fw-light fs-3 opacity-90"><?php echo e($settings->website_name); ?> Community</h5>
    </div>
</div>

<div class="container my-5">

    
    <div class="d-flex flex-column flex-md-row justify-content-between align-items-start align-items-md-center mb-5 gap-4">
        <div>
            <h3 class="fw-bold text-white mb-1">Forum Topics</h3>
            <p class="text-light opacity-80 fs-5 mb-0">Total <?php echo e($topics->count()); ?> topics</p>
        </div>
        <div class="d-flex gap-3 flex-wrap">
            <a href="<?php echo e(route('topic.create')); ?>" class="btn btn-outline-light px-5 py-3 fw-bold">
                Add New Topic
            </a>
            <a href="<?php echo e(route('topicmanager.index')); ?>" class="btn btn-dark px-5 py-3 fw-bold">
                My Topics
            </a>
        </div>
    </div>

    <div class="row g-5">
        
        <div class="col-lg-10">
            
            <div class="content-card shadow-lg mb-5">
                <div class="card-header py-4 text-white text-center fw-bold" style="background: var(--primary); border-radius: 20px 20px 0 0;">
                    <h4 class="mb-0">Browse Topics</h4>
                </div>

                <div class="card-body p-0 bg-white">
                    
                    <ul class="nav nav-tabs border-0">
                        <li class="nav-item">
                            <button class="nav-link active fw-bold text-primary" data-bs-toggle="tab" data-bs-target="#popular">Popular</button>
                        </li>
                        <li class="nav-item">
                            <button class="nav-link fw-bold" data-bs-toggle="tab" data-bs-target="#latest">Newest</button>
                        </li>
                        <li class="nav-item">
                            <button class="nav-link fw-bold" data-bs-toggle="tab" data-bs-target="#all">All Posts</button>
                        </li>
                    </ul>

                    <div class="tab-content">
                        
                        <div class="tab-pane fade show active p-5" id="popular">
                            <h5 class="fw-bold text-primary mb-4">Top 10 Most Viewed Topics</h5>
                            <div class="table-responsive">
                                <table class="table table-hover align-middle mb-0">
                                    <tbody>
                                    <?php $__currentLoopData = $mostviews; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $topic): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr class="border-bottom">
                                            <td class="py-4">
                                                <div>
                                                    <a href="<?php echo e(route('topic.show', $topic->topic_id)); ?>"
                                                       class="text-decoration-none text-dark fw-bold fs-5">
                                                        <?php echo e($topic->topic_title); ?>

                                                        <?php if($key < 3): ?>
                                                            <span class="badge bg-danger text-white ms-2">#<?php echo e($key + 1); ?></span>
                                                        <?php endif; ?>
                                                    </a>
                                                    <div class="small text-muted mt-2">
                                                       By <?php echo e(optional($topic->author)->name ?? 'Unknown'); ?>


                                                        • <?php echo e($topic->topic_views); ?> views
                                                        • <?php echo e($topic->comments->count()); ?> replies
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        
                        <div class="tab-pane fade p-5" id="latest">
                            <h5 class="fw-bold text-primary mb-4">Latest Topics</h5>
                            <div class="table-responsive">
                                <table class="table table-hover align-middle mb-0">
                                    <tbody>
                                    <?php $__currentLoopData = $lastest; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $topic): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr class="border-bottom">
                                            <td class="py-4">
                                                <div>
                                                    <a href="<?php echo e(route('topic.show', $topic->topic_id)); ?>"
                                                       class="text-decoration-none text-dark fw-bold fs-5">
                                                        <?php echo e($topic->topic_title); ?>

                                                        <?php if($key == 0): ?>
                                                            <span class="badge bg-success text-white ms-2">NEW</span>
                                                        <?php endif; ?>
                                                    </a>
                                                    <div class="small text-muted mt-2">
                                                        By <?php echo e(optional($topic->author)->name ?? 'Unknown'); ?>

                                                        • <?php echo e($topic->topic_views); ?> views
                                                        • <?php echo e($topic->comments->count()); ?> replies
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        
                        <div class="tab-pane fade p-5" id="all">
                            <h5 class="fw-bold text-primary mb-4">All Topics</h5>
                            <div class="table-responsive">
                                <table class="table table-hover align-middle mb-0">
                                    <tbody>
                                    <?php $__currentLoopData = $topics; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $topic): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr class="border-bottom">
                                            <td class="py-4">
                                                <div>
                                                    <a href="<?php echo e(route('topic.show', $topic->topic_id)); ?>"
                                                       class="text-decoration-none text-dark fw-bold fs-5">
                                                        <?php echo e($topic->topic_title); ?>

                                                    </a>
                                                    <div class="small text-muted mt-2">
                                                        By <?php echo e(optional($topic->author)->name ?? 'Unknown'); ?>

                                                        • <?php echo e($topic->topic_views); ?> views
                                                        • <?php echo e($topic->comments->count()); ?> replies
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        
        <div class="col-lg-2">
            <div class="card shadow-lg border-0 sticky-top content-card" style="top:100px;">
                <div class="card-header text-white fw-bold text-center py-4" style="background: var(--primary); border-radius: 20px 20px 0 0;">
                    Categories
                </div>
                <div class="card-body p-4 bg-white">
                    <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <a href="<?php echo e(route('forumcategory.show', $category->forum_category_id)); ?>"
                           class="d-block text-decoration-none py-3 px-4 rounded mb-2 fw-bold
                                  <?php echo e(request()->route('id') == $category->forum_category_id ? 'bg-primary text-white' : 'text-dark bg-light'); ?>">
                            <?php echo e($category->forum_category_name); ?>

                        </a>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home2/reckons1/public_html/store1.reckonsoul.fun/resources/views/forum/index.blade.php ENDPATH**/ ?>