<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve(['title' => $category->name . ' for Sale','description' => $category->description
        ? \Illuminate\Support\Str::limit($category->description, 155)
        : 'Browse ' . $category->name . ' listings. ' . $items->total() . ' items available.'] + (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 justify-between items-center">
            <div class="flex items-center space-x-4">
                <?php if($category->icon): ?>
                    <span class="text-3xl"><?php echo e($category->icon); ?></span>
                <?php endif; ?>
                <div>
                    <h2 class="font-semibold text-xl text-gray-800 leading-tight">
                        <?php echo e($category->name); ?>

                    </h2>
                    <?php if($category->description): ?>
                        <p class="text-gray-600 text-sm"><?php echo e($category->description); ?></p>
                    <?php endif; ?>
                </div>
            </div>
            <a href="<?php echo e(route('categories.index')); ?>" class="inline-flex items-center px-3 py-2 bg-gray-300 border border-transparent rounded-md font-semibold text-xs text-gray-700 uppercase tracking-widest hover:bg-gray-400 transition ease-in-out duration-150">
                All Categories
            </a>
        </div>
     <?php $__env->endSlot(); ?>

    <div class="py-12">
        <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                <div class="p-6">
                    <?php if($items->count() > 0): ?>
                        <div class="mb-6 flex justify-between items-center">
                            <p class="text-gray-600"><?php echo e($items->total()); ?> items in <?php echo e($category->name); ?></p>
                            <a href="<?php echo e(route('items.index', ['category' => $category->id])); ?>" class="text-blue-600 hover:text-blue-700 text-sm">
                                View with filters →
                            </a>
                        </div>

                        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
                            <?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="group">
                                    <a href="<?php echo e(route('items.show', $item)); ?>" class="block">
                                        <div class="aspect-square bg-gray-200 rounded-lg overflow-hidden mb-3 relative">
                                            <?php if($item->primaryPhoto): ?>
                                                <img src="<?php echo e(asset($item->primaryPhoto->url)); ?>" alt="<?php echo e($item->title); ?>" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-200">
                                            <?php else: ?>
                                                <div class="w-full h-full flex items-center justify-center">
                                                    <span class="text-gray-400">No Image</span>
                                                </div>
                                            <?php endif; ?>
                                            
                                            <!-- Status Badge -->
                                            <?php if($item->status === 'sale_pending'): ?>
                                                <div class="absolute top-2 left-2 bg-orange-500 text-white text-xs px-2 py-1 rounded">
                                                    Sale Pending
                                                </div>
                                            <?php endif; ?>
                                            
                                            <!-- Listing Type Badge -->
                                            <?php if($item->listing_type === 'trade'): ?>
                                                <div class="absolute top-2 right-2 bg-green-500 text-white text-xs px-2 py-1 rounded">
                                                    Trade
                                                </div>
                                            <?php endif; ?>
                                        </div>
                                        
                                        <h3 class="font-semibold text-gray-900 group-hover:text-blue-600 line-clamp-2 mb-1"><?php echo e($item->title); ?></h3>
                                        
                                        <?php if($item->price && in_array($item->listing_type, ['sale', 'inventory_open'])): ?>
                                            <p class="font-bold text-lg text-gray-900">$<?php echo e(number_format($item->price, 2)); ?></p>
                                        <?php else: ?>
                                            <p class="font-bold text-lg text-green-600">Trade Only</p>
                                        <?php endif; ?>
                                        
                                        <div class="flex items-center justify-between text-xs text-gray-500 mt-2">
                                            <span><?php echo e($item->user->name); ?></span>
                                            <span><?php echo e($item->created_at->diffForHumans()); ?></span>
                                        </div>
                                        
                                        <?php if($item->location_city || $item->location_state): ?>
                                            <p class="text-xs text-gray-500 mt-1">
                                                <?php echo e(collect([$item->location_city, $item->location_state])->filter()->join(', ')); ?>

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

                        <!-- Pagination -->
                        <div class="mt-8">
                            <?php echo e($items->links()); ?>

                        </div>
                    <?php else: ?>
                        <div class="text-center py-12">
                            <?php if($category->icon): ?>
                                <div class="text-6xl mb-4"><?php echo e($category->icon); ?></div>
                            <?php else: ?>
                                <svg class="mx-auto h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"></path>
                                </svg>
                            <?php endif; ?>
                            <h3 class="text-lg font-semibold text-gray-900 mb-2 mt-4">No items in <?php echo e($category->name); ?></h3>
                            <p class="text-gray-600 mb-6">Be the first to list an item in this category!</p>
                            
                            <?php if(auth()->guard()->check()): ?>
                                <div class="space-x-4">
                                    <a href="<?php echo e(route('my-items.create')); ?>" class="inline-flex items-center px-4 py-2 bg-blue-600 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-blue-700 transition ease-in-out duration-150">
                                        List an Item
                                    </a>
                                    <a href="<?php echo e(route('items.index')); ?>" class="inline-flex items-center px-4 py-2 bg-gray-300 border border-transparent rounded-md font-semibold text-xs text-gray-700 uppercase tracking-widest hover:bg-gray-400 transition ease-in-out duration-150">
                                        Browse All Items
                                    </a>
                                </div>
                            <?php else: ?>
                                <div class="space-x-4">
                                    <a href="<?php echo e(route('register')); ?>" class="inline-flex items-center px-4 py-2 bg-blue-600 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-blue-700 transition ease-in-out duration-150">
                                        Join to List Items
                                    </a>
                                    <a href="<?php echo e(route('items.index')); ?>" class="inline-flex items-center px-4 py-2 bg-gray-300 border border-transparent rounded-md font-semibold text-xs text-gray-700 uppercase tracking-widest hover:bg-gray-400 transition ease-in-out duration-150">
                                        Browse All Items
                                    </a>
                                </div>
                            <?php endif; ?>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </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 /var/www/html/resources/views/categories/show.blade.php ENDPATH**/ ?>