<?php
    $totalNotes = \App\Models\Note::count();
    $totalCategories = \App\Models\Category::count();
    $totalViews = \App\Models\Note::sum('view_count');
    $premiumNotesCount = \App\Models\Note::where('is_paid', true)->count();

    // Check if we are on a filtered view
    $isFiltered = request()->filled('search') || request()->filled('category');

    if (!$isFiltered) {
        $trendingNotes = \App\Models\Note::orderBy('view_count', 'desc')->with('category')->limit(3)->get();
        $premiumNotes = \App\Models\Note::where('is_paid', true)->orderBy('created_at', 'desc')->with('category')->limit(3)->get();
    } else {
        $trendingNotes = collect();
        $premiumNotes = collect();
    }
?>

<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-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\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('header', null, []); ?> 
        <div class="flex flex-col lg:flex-row lg:items-center justify-between gap-8">
            <div class="flex flex-col gap-2">
                <h1 class="text-4xl sm:text-5xl font-black text-slate-900 tracking-tighter font-outfit leading-tight">
                    Academic <span class="text-indigo-600">Archive</span>
                </h1>
                <div class="flex items-center gap-3">
                    <div class="h-1 w-8 bg-indigo-600 rounded-full"></div>
                    <p class="font-caveat text-2xl sm:text-3xl text-slate-400 italic">
                        A curated vault of intellectual growth.
                    </p>
                </div>
            </div>

            <!-- Search and Filter Bar -->
            <div class="lg:max-w-md w-full">
                <form action="<?php echo e(route('notes.index')); ?>" method="GET" class="flex items-center gap-6">
                    <!-- Minimal Search -->
                    <div class="flex items-center gap-2 border-b border-slate-200 py-1 flex-grow focus-within:border-indigo-500 transition-colors duration-300">
                        <svg class="w-3.5 h-3.5 text-slate-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" /></svg>
                        <input type="text" name="search" value="<?php echo e(request('search')); ?>" 
                            class="bg-transparent border-none focus:ring-0 text-xs font-bold text-slate-600 placeholder:text-slate-400 p-0 w-full" 
                            placeholder="Find resources...">
                    </div>
                    
                    <!-- Minimal Topic -->
                    <div class="flex items-center gap-2 border-b border-slate-200 py-1 shrink-0 focus-within:border-indigo-500 transition-colors duration-300">
                        <select name="category" class="bg-transparent border-none focus:ring-0 text-[10px] font-black uppercase tracking-[0.15em] text-slate-400 cursor-pointer p-0 w-auto">
                            <option value="">Classification</option>
                            <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($category->id); ?>" <?php echo e(request('category') == $category->id ? 'selected' : ''); ?>>
                                    <?php echo e($category->name); ?>

                                </option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                        <button type="submit" class="text-slate-300 hover:text-indigo-600 transition-colors">
                            <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M14 5l7 7-7 7" /></svg>
                        </button>
                    </div>
                </form>
            </div>
        </div>
     <?php $__env->endSlot(); ?>

    <!-- 1. Academic Statistics Banner -->
    <div class="grid grid-cols-2 md:grid-cols-4 gap-4 sm:gap-6 mb-12 bg-slate-50/50 p-6 rounded-3xl border border-slate-100/80">
        <!-- Stat Item 1 -->
        <div class="flex flex-col items-center p-4 bg-white rounded-2xl border border-slate-100/60 shadow-sm hover:shadow transition-shadow duration-300">
            <span class="text-3xl font-extrabold text-slate-900 tracking-tight"><?php echo e($totalNotes); ?></span>
            <span class="text-[10px] font-black uppercase tracking-widest text-slate-400 mt-2">Total Notes</span>
        </div>
        <!-- Stat Item 2 -->
        <div class="flex flex-col items-center p-4 bg-white rounded-2xl border border-slate-100/60 shadow-sm hover:shadow transition-shadow duration-300">
            <span class="text-3xl font-extrabold text-indigo-600 tracking-tight"><?php echo e($totalCategories); ?></span>
            <span class="text-[10px] font-black uppercase tracking-widest text-slate-400 mt-2">Classifications</span>
        </div>
        <!-- Stat Item 3 -->
        <div class="flex flex-col items-center p-4 bg-white rounded-2xl border border-slate-100/60 shadow-sm hover:shadow transition-shadow duration-300">
            <span class="text-3xl font-extrabold text-emerald-600 tracking-tight">
                <?php echo e($totalViews > 1000 ? number_format($totalViews / 1000, 1) . 'k' : $totalViews); ?>

            </span>
            <span class="text-[10px] font-black uppercase tracking-widest text-slate-400 mt-2">Total Views</span>
        </div>
        <!-- Stat Item 4 -->
        <div class="flex flex-col items-center p-4 bg-white rounded-2xl border border-slate-100/60 shadow-sm hover:shadow transition-shadow duration-300">
            <span class="text-3xl font-extrabold text-amber-500 tracking-tight"><?php echo e($premiumNotesCount); ?></span>
            <span class="text-[10px] font-black uppercase tracking-widest text-slate-400 mt-2">Premium Guides</span>
        </div>
    </div>

    <!-- 2. Academic Toolkit Features Section (only on default landing page) -->
    <?php if(!$isFiltered): ?>
        <div class="mb-16">
            <div class="text-center max-w-2xl mx-auto mb-10">
                <span class="text-[10px] font-black uppercase tracking-[0.2em] text-indigo-600 bg-indigo-50 px-3 py-1 rounded-lg border border-indigo-100/50">Core Features</span>
                <h2 class="text-3xl sm:text-4xl font-black text-slate-900 tracking-tight mt-4 font-outfit">An Optimized Learning Environment</h2>
                <p class="text-slate-500 font-medium mt-2">StudyXnote bridges structured academic curriculum with interactive, community-driven note indexing.</p>
            </div>
            
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
                <!-- Feature 1 -->
                <div class="p-6 bg-white rounded-3xl border border-slate-100 shadow-sm hover:shadow-xl hover:-translate-y-1 transition-all duration-300">
                    <div class="w-12 h-12 bg-slate-900 text-white rounded-2xl flex items-center justify-center mb-6 shadow-sm">
                        <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" /></svg>
                    </div>
                    <h3 class="text-lg font-bold text-slate-800 mb-2">Structured Vault</h3>
                    <p class="text-slate-400 text-xs font-semibold leading-relaxed">Academic notes mapped precisely to grades and semester systems for organized browsing.</p>
                </div>
                <!-- Feature 2 -->
                <div class="p-6 bg-white rounded-3xl border border-slate-100 shadow-sm hover:shadow-xl hover:-translate-y-1 transition-all duration-300">
                    <div class="w-12 h-12 bg-indigo-600 text-white rounded-2xl flex items-center justify-center mb-6 shadow-sm">
                        <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>
                    </div>
                    <h3 class="text-lg font-bold text-slate-800 mb-2">Visual Richness</h3>
                    <p class="text-slate-400 text-xs font-semibold leading-relaxed">High-fidelity image notes allow mapping diagrams, mindmaps, and handwritten study guides.</p>
                </div>
                <!-- Feature 3 -->
                <div class="p-6 bg-white rounded-3xl border border-slate-100 shadow-sm hover:shadow-xl hover:-translate-y-1 transition-all duration-300">
                    <div class="w-12 h-12 bg-emerald-600 text-white rounded-2xl flex items-center justify-center mb-6 shadow-sm">
                        <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" /></svg>
                    </div>
                    <h3 class="text-lg font-bold text-slate-800 mb-2">Verified Content</h3>
                    <p class="text-slate-400 text-xs font-semibold leading-relaxed">Admin-curated educational archives ensuring information accuracy and relevancy.</p>
                </div>
                <!-- Feature 4 -->
                <div class="p-6 bg-white rounded-3xl border border-slate-100 shadow-sm hover:shadow-xl hover:-translate-y-1 transition-all duration-300">
                    <div class="w-12 h-12 bg-amber-500 text-white rounded-2xl flex items-center justify-center mb-6 shadow-sm">
                        <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" /></svg>
                    </div>
                    <h3 class="text-lg font-bold text-slate-800 mb-2">Premium Access</h3>
                    <p class="text-slate-400 text-xs font-semibold leading-relaxed">A specialized tier of advanced publications to unlock complex academic methodologies.</p>
                </div>
            </div>
        </div>
    <?php endif; ?>

    <!-- 3. Classification Explorer Hub -->
    <div class="mb-12">
        <h3 class="text-xs font-black uppercase tracking-[0.2em] text-slate-400 mb-4">Classifications Hub</h3>
        <div class="flex flex-wrap gap-3">
            <a href="<?php echo e(route('notes.index')); ?>" 
               class="inline-flex items-center gap-2 px-4 py-2 rounded-xl text-xs font-bold transition-all border duration-200 
               <?php echo e(!request('category') ? 'bg-slate-900 border-slate-900 text-white shadow-md shadow-slate-200' : 'bg-white border-slate-200 text-slate-600 hover:bg-slate-50'); ?>">
                <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z" /></svg>
                All Classifications
            </a>
            <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php
                    $isActive = request('category') == $cat->id;
                    $isGrade = $cat->type === 'grade';
                    $noteCount = $cat->notes_count ?? $cat->notes()->count();
                ?>
                <a href="<?php echo e(route('notes.index', ['category' => $cat->id] + request()->only(['search']))); ?>" 
                   class="inline-flex items-center gap-2 px-4 py-2 rounded-xl text-xs font-bold transition-all border duration-200 
                   <?php echo e($isActive ? 'bg-indigo-600 border-indigo-600 text-white shadow-md shadow-indigo-100' : 'bg-white border-slate-200 text-slate-600 hover:bg-slate-50'); ?>">
                    <?php if($isGrade): ?>
                        <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 14l9-5-9-5-9 5 9 5z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 14l6.16-3.422a12.083 12.083 0 01.665 6.479A11.952 11.952 0 0012 20.055a11.952 11.952 0 00-6.824-2.998 12.078 12.078 0 01.665-6.479L12 14z" /></svg>
                    <?php else: ?>
                        <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>
                    <?php endif; ?>
                    <?php echo e($cat->name); ?>

                    <span class="inline-flex items-center justify-center px-1.5 py-0.5 rounded-md text-[9px] font-black tracking-normal leading-none 
                    <?php echo e($isActive ? 'bg-indigo-700 text-white' : 'bg-slate-100 text-slate-500'); ?>">
                        <?php echo e($noteCount); ?>

                    </span>
                </a>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
    </div>

    <!-- 4. Trending & Premium Showcases -->
    <?php if(!$isFiltered): ?>
        <!-- Trending Publications Section -->
        <?php if($trendingNotes->isNotEmpty()): ?>
            <div class="mb-16">
                <div class="flex items-center justify-between mb-8 pb-3 border-b border-slate-100">
                    <div class="flex items-center gap-2">
                        <div class="w-1.5 h-6 bg-indigo-600 rounded-full"></div>
                        <h2 class="text-2xl font-black text-slate-800 font-outfit">Trending Publications</h2>
                    </div>
                    <span class="text-[10px] font-black uppercase tracking-widest text-slate-400">Most Viewed</span>
                </div>
                <div class="grid grid-cols-1 md:grid-cols-3 gap-8">
                    <?php $__currentLoopData = $trendingNotes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $note): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="relative group">
                            <!-- Trending Rank Badge -->
                            <div class="absolute -top-3 -left-3 w-8 h-8 rounded-full bg-slate-900 text-white flex items-center justify-center font-black text-xs shadow-md border-2 border-white z-30">
                                #<?php echo e($index + 1); ?>

                            </div>
                            <?php if (isset($component)) { $__componentOriginalc6db74179b29f2bc6b835779b6f27642 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc6db74179b29f2bc6b835779b6f27642 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.note-card','data' => ['note' => $note]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('note-card'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['note' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($note)]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc6db74179b29f2bc6b835779b6f27642)): ?>
<?php $attributes = $__attributesOriginalc6db74179b29f2bc6b835779b6f27642; ?>
<?php unset($__attributesOriginalc6db74179b29f2bc6b835779b6f27642); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc6db74179b29f2bc6b835779b6f27642)): ?>
<?php $component = $__componentOriginalc6db74179b29f2bc6b835779b6f27642; ?>
<?php unset($__componentOriginalc6db74179b29f2bc6b835779b6f27642); ?>
<?php endif; ?>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>
        <?php endif; ?>

        <!-- Premium Knowledge Vault Section -->
        <?php if($premiumNotes->isNotEmpty()): ?>
            <div class="mb-16 bg-amber-50/20 border border-amber-100/50 rounded-3xl p-8 sm:p-12 relative overflow-hidden">
                <!-- Background ambient glow -->
                <div class="absolute top-0 right-0 w-80 h-80 bg-amber-100/30 rounded-full -mr-40 -mt-40 blur-3xl"></div>
                
                <div class="flex flex-col sm:flex-row sm:items-center justify-between gap-6 mb-10 pb-4 border-b border-amber-100/40 relative z-10">
                    <div>
                        <span class="text-[9px] font-black uppercase tracking-[0.2em] text-amber-700 bg-amber-100/60 px-2.5 py-1 rounded-md">Exclusive Content</span>
                        <h2 class="text-2xl sm:text-3xl font-black text-slate-800 font-outfit mt-3">Premium Vault</h2>
                    </div>
                    <p class="text-slate-500 font-medium text-sm max-w-md">Unlock highly comprehensive study notes curated by educators to master complex syllabi.</p>
                </div>
                
                <div class="grid grid-cols-1 md:grid-cols-3 gap-8 relative z-10">
                    <?php $__currentLoopData = $premiumNotes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $note): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php if (isset($component)) { $__componentOriginalc6db74179b29f2bc6b835779b6f27642 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc6db74179b29f2bc6b835779b6f27642 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.note-card','data' => ['note' => $note]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('note-card'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['note' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($note)]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc6db74179b29f2bc6b835779b6f27642)): ?>
<?php $attributes = $__attributesOriginalc6db74179b29f2bc6b835779b6f27642; ?>
<?php unset($__attributesOriginalc6db74179b29f2bc6b835779b6f27642); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc6db74179b29f2bc6b835779b6f27642)): ?>
<?php $component = $__componentOriginalc6db74179b29f2bc6b835779b6f27642; ?>
<?php unset($__componentOriginalc6db74179b29f2bc6b835779b6f27642); ?>
<?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>
        <?php endif; ?>
    <?php endif; ?>

    <?php if (isset($component)) { $__componentOriginaled4987d3f6007db3445a6067a328a16c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginaled4987d3f6007db3445a6067a328a16c = $attributes; } ?>
<?php $component = App\View\Components\AdBanner::resolve(['placement' => 'library_top'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('ad-banner'); ?>
<?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\AdBanner::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginaled4987d3f6007db3445a6067a328a16c)): ?>
<?php $attributes = $__attributesOriginaled4987d3f6007db3445a6067a328a16c; ?>
<?php unset($__attributesOriginaled4987d3f6007db3445a6067a328a16c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginaled4987d3f6007db3445a6067a328a16c)): ?>
<?php $component = $__componentOriginaled4987d3f6007db3445a6067a328a16c; ?>
<?php unset($__componentOriginaled4987d3f6007db3445a6067a328a16c); ?>
<?php endif; ?>

    <!-- 5. Main Catalog Section Header -->
    <div class="flex items-center justify-between mb-8 pb-3 border-b border-slate-100 mt-12">
        <div class="flex items-center gap-2">
            <div class="w-1.5 h-6 bg-slate-900 rounded-full"></div>
            <h2 class="text-2xl font-black text-slate-800 font-outfit">
                <?php if(request()->filled('search')): ?>
                    Search Results for <span class="text-indigo-600">"<?php echo e(request('search')); ?>"</span>
                <?php elseif(request()->filled('category')): ?>
                    <?php
                        $activeCat = $categories->firstWhere('id', request('category'));
                    ?>
                    Resources under <span class="text-indigo-600"><?php echo e($activeCat ? $activeCat->name : 'Classification'); ?></span>
                <?php else: ?>
                    All Publications
                <?php endif; ?>
            </h2>
        </div>
        <span class="text-[10px] font-black uppercase tracking-widest text-slate-400">
            Page <?php echo e($notes->currentPage()); ?> of <?php echo e($notes->lastPage()); ?>

        </span>
    </div>

    <!-- 6. Main Catalog Content -->
    <?php if($notes->isEmpty()): ?>
        <div class="bg-slate-50 border-2 border-dashed border-slate-200 rounded-[2rem] sm:rounded-[3rem] p-12 sm:p-24 text-center">
            <div class="w-20 h-20 sm:w-24 sm:h-24 bg-white rounded-3xl flex items-center justify-center mx-auto mb-8 shadow-sm border border-slate-100">
                <svg class="w-10 h-10 sm:w-12 sm:h-12 text-slate-300" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" /></svg>
            </div>
            <h2 class="text-2xl sm:text-3xl font-bold text-slate-800 font-outfit mb-2">No Results Found</h2>
            <p class="text-slate-500 font-medium text-base sm:text-lg">We couldn't find any entries matching your search criteria.</p>
            <?php if(request()->anyFilled(['search', 'category'])): ?>
                <a href="<?php echo e(route('notes.index')); ?>" class="inline-block mt-8 text-indigo-600 font-black uppercase tracking-widest text-xs hover:underline">Clear all filters</a>
            <?php endif; ?>
        </div>
    <?php else: ?>
        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 sm:gap-12">
            <?php $__currentLoopData = $notes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $note): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php if (isset($component)) { $__componentOriginalc6db74179b29f2bc6b835779b6f27642 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc6db74179b29f2bc6b835779b6f27642 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.note-card','data' => ['note' => $note]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('note-card'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['note' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($note)]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc6db74179b29f2bc6b835779b6f27642)): ?>
<?php $attributes = $__attributesOriginalc6db74179b29f2bc6b835779b6f27642; ?>
<?php unset($__attributesOriginalc6db74179b29f2bc6b835779b6f27642); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc6db74179b29f2bc6b835779b6f27642)): ?>
<?php $component = $__componentOriginalc6db74179b29f2bc6b835779b6f27642; ?>
<?php unset($__componentOriginalc6db74179b29f2bc6b835779b6f27642); ?>
<?php endif; ?>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>

        <div class="mt-16 sm:mt-24">
            <?php echo e($notes->links()); ?>

        </div>

        <?php if (isset($component)) { $__componentOriginaled4987d3f6007db3445a6067a328a16c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginaled4987d3f6007db3445a6067a328a16c = $attributes; } ?>
<?php $component = App\View\Components\AdBanner::resolve(['placement' => 'library_bottom'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('ad-banner'); ?>
<?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\AdBanner::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginaled4987d3f6007db3445a6067a328a16c)): ?>
<?php $attributes = $__attributesOriginaled4987d3f6007db3445a6067a328a16c; ?>
<?php unset($__attributesOriginaled4987d3f6007db3445a6067a328a16c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginaled4987d3f6007db3445a6067a328a16c)): ?>
<?php $component = $__componentOriginaled4987d3f6007db3445a6067a328a16c; ?>
<?php unset($__componentOriginaled4987d3f6007db3445a6067a328a16c); ?>
<?php endif; ?>
    <?php endif; ?>

    <!-- 7. FAQ Accordion Section -->
    <?php if(!$isFiltered): ?>
        <div class="mb-16 mt-20">
            <div class="text-center max-w-2xl mx-auto mb-12">
                <span class="text-[10px] font-black uppercase tracking-[0.2em] text-indigo-600 bg-indigo-50 px-3 py-1 rounded-lg border border-indigo-100/50">FAQ</span>
                <h2 class="text-3xl sm:text-4xl font-black text-slate-900 tracking-tight mt-4 font-outfit">Frequently Asked Questions</h2>
                <p class="text-slate-500 font-medium mt-2">Find answers to quick questions regarding note formats, premium access, and general operations.</p>
            </div>
            
            <div class="max-w-3xl mx-auto flex flex-col gap-4">
                <!-- FAQ 1 -->
                <details class="group bg-white rounded-2xl border border-slate-200/80 p-5 shadow-sm transition-all duration-300 [&_summary::-webkit-details-marker]:hidden">
                    <summary class="flex items-center justify-between cursor-pointer focus:outline-none">
                        <span class="text-base font-bold text-slate-800 group-hover:text-indigo-600 transition-colors duration-200">How do I access Premium notes?</span>
                        <span class="w-8 h-8 rounded-xl bg-slate-50 flex items-center justify-center text-slate-400 group-open:rotate-180 transition-transform duration-300">
                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M19 9l-7 7-7-7" /></svg>
                        </span>
                    </summary>
                    <p class="mt-4 text-slate-500 text-sm font-medium leading-relaxed pl-1 border-l-2 border-indigo-500">
                        Premium notes are high-fidelity educational resources. They can be unlocked by requesting access through your student account page or by reaching out to the administrator for custom grants.
                    </p>
                </details>

                <!-- FAQ 2 -->
                <details class="group bg-white rounded-2xl border border-slate-200/80 p-5 shadow-sm transition-all duration-300 [&_summary::-webkit-details-marker]:hidden">
                    <summary class="flex items-center justify-between cursor-pointer focus:outline-none">
                        <span class="text-base font-bold text-slate-800 group-hover:text-indigo-600 transition-colors duration-200">What note formats are supported on StudyXnote?</span>
                        <span class="w-8 h-8 rounded-xl bg-slate-50 flex items-center justify-center text-slate-400 group-open:rotate-180 transition-transform duration-300">
                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M19 9l-7 7-7-7" /></svg>
                        </span>
                    </summary>
                    <p class="mt-4 text-slate-500 text-sm font-medium leading-relaxed pl-1 border-l-2 border-indigo-500">
                        We support both structural text notes (for code syntax, textbook explanations, and historical listings) and graphical image uploads (for mindmaps, written sheets, and structural diagrams).
                    </p>
                </details>

                <!-- FAQ 3 -->
                <details class="group bg-white rounded-2xl border border-slate-200/80 p-5 shadow-sm transition-all duration-300 [&_summary::-webkit-details-marker]:hidden">
                    <summary class="flex items-center justify-between cursor-pointer focus:outline-none">
                        <span class="text-base font-bold text-slate-800 group-hover:text-indigo-600 transition-colors duration-200">Can I request a custom classification or class category?</span>
                        <span class="w-8 h-8 rounded-xl bg-slate-50 flex items-center justify-center text-slate-400 group-open:rotate-180 transition-transform duration-300">
                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M19 9l-7 7-7-7" /></svg>
                        </span>
                    </summary>
                    <p class="mt-4 text-slate-500 text-sm font-medium leading-relaxed pl-1 border-l-2 border-indigo-500">
                        Yes! If you are a registered student, you can request custom categories or syllabus mappings from the admin team. We continually update the archive based on syllabus structures.
                    </p>
                </details>
            </div>
        </div>
    <?php endif; ?>

    <!-- 8. Join the Archive / Signup CTA Section -->
    <div class="mt-20 mb-10 bg-slate-900 rounded-[2rem] p-8 sm:p-12 text-center text-white relative overflow-hidden shadow-xl shadow-slate-200">
        <!-- Abstract gradient overlays -->
        <div class="absolute inset-0 opacity-10 bg-[radial-gradient(#ffffff_1px,transparent_1px)] [background-size:16px_16px]"></div>
        <div class="absolute top-0 left-1/4 w-96 h-96 bg-indigo-500/20 rounded-full -mt-48 -ml-48 blur-3xl"></div>
        <div class="absolute bottom-0 right-1/4 w-96 h-96 bg-emerald-500/20 rounded-full -mb-48 -mr-48 blur-3xl"></div>

        <div class="relative z-10 max-w-2xl mx-auto flex flex-col items-center">
            <span class="text-[10px] font-black uppercase tracking-[0.2em] text-indigo-300 bg-indigo-950/60 px-3 py-1.5 rounded-lg border border-indigo-800/30">Join the Circle</span>
            <h2 class="text-3xl sm:text-4xl font-black font-outfit mt-6 leading-tight">Elevate Your Learning Capacity</h2>
            <p class="text-slate-300 font-medium text-base sm:text-lg mt-4 mb-8 max-w-lg">Create a student profile to save entries, organize your cart, and track your recent study sessions.</p>
            
            <?php if(auth()->guard()->check()): ?>
                <div class="flex flex-col sm:flex-row items-center gap-4">
                    <a href="<?php echo e(url('/dashboard')); ?>" class="btn btn-indigo text-sm font-black uppercase tracking-widest px-8 py-3">Go to Dashboard</a>
                    <a href="<?php echo e(route('profile.show')); ?>" class="btn bg-slate-800 text-slate-300 border border-slate-700/80 hover:bg-slate-700/80 text-sm font-black uppercase tracking-widest px-8 py-3">View Profile</a>
                </div>
            <?php else: ?>
                <div class="flex flex-col sm:flex-row items-center gap-4">
                    <a href="<?php echo e(route('register')); ?>" class="btn bg-white text-slate-900 hover:bg-slate-50 text-sm font-black uppercase tracking-widest px-8 py-3 shadow-lg shadow-slate-900/10">Register Account</a>
                    <a href="<?php echo e(route('login')); ?>" class="btn bg-slate-800 text-slate-300 border border-slate-700/80 hover:bg-slate-700/80 text-sm font-black uppercase tracking-widest px-8 py-3">Log In</a>
                </div>
            <?php endif; ?>
        </div>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php /**PATH /Users/sajnush/Herd/StudyXnote/resources/views/notes/index.blade.php ENDPATH**/ ?>