<?php $__env->startSection('title', 
    (\App\Models\Setting::get('site_name') ?: 'My Website') 
    . ' - ' 
    . (\App\Models\Setting::get('seo_packages_title') ?: 'Browse Packages')
); ?>

<?php $__env->startSection('content'); ?>
<div class="min-h-screen bg-gray-50 dark:bg-gray-950">
    <!-- Hero Section -->
    <div class="relative bg-[#0c2340] dark:bg-gray-900 text-white overflow-hidden">
        <div class="absolute inset-0 opacity-20">
            <svg class="w-full h-full" viewBox="0 0 100 100" preserveAspectRatio="none">
                <path d="M0,0 L100,0 L100,100 L0,100 Z" fill="url(#grid)"></path>
            </svg>
            <defs>
                <pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse">
                    <path d="M 10 0 L 0 0 0 10" fill="none" stroke="#c9a84c" stroke-width="0.5"></path>
                </pattern>
            </defs>
        </div>
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-20 relative z-10">
            <div class="text-center">
                <h1 class="text-5xl font-bold mb-4 font-serif">🌟 Discover Amazing Destinations</h1>
                <p class="text-xl mb-8 text-white/70">Find your perfect adventure from our curated selection of tourism packages</p>
            </div>
        </div>
    </div>

    <!-- Filters Section -->
    <div class="bg-white dark:bg-gray-900 shadow-sm border-b border-gray-100 dark:border-gray-800">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
            <form method="GET" action="<?php echo e(route('packages.index')); ?>" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
                <!-- Search -->
                <div>
                    <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Search</label>
                    <input type="text" name="q" value="<?php echo e(request('q')); ?>" 
                           placeholder="Search packages..." 
                           class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 rounded-md focus:outline-none focus:ring-[#c9a84c] focus:border-[#c9a84c]">
                </div>

                <!-- Category Filter -->
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-2">Category</label>
                    <select name="category" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-[#c9a84c] focus:border-[#c9a84c]">
                        <option value="">All Categories</option>
                        <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($category); ?>" <?php echo e(request('category') == $category ? 'selected' : ''); ?>><?php echo e(ucfirst($category)); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>

                <!-- Destination Filter -->
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-2">Destination</label>
                    <select name="destination" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-[#c9a84c] focus:border-[#c9a84c]">
                        <option value="">All Destinations</option>
                        <?php $__currentLoopData = $destinations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $destination): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($destination); ?>" <?php echo e(request('destination') == $destination ? 'selected' : ''); ?>><?php echo e($destination); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>

                <!-- Price Range -->
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-2">Price Range</label>
                    <div class="flex space-x-2">
                        <input type="number" name="min_price" value="<?php echo e(request('min_price')); ?>" 
                               placeholder="Min" 
                               class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-[#c9a84c] focus:border-[#c9a84c]">
                        <input type="number" name="max_price" value="<?php echo e(request('max_price')); ?>" 
                               placeholder="Max" 
                               class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-[#c9a84c] focus:border-[#c9a84c]">
                    </div>
                </div>

                <!-- Duration Filter -->
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-2">Duration</label>
                    <select name="duration" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-[#c9a84c] focus:border-[#c9a84c]">
                        <option value="">All Durations</option>
                        <?php $__currentLoopData = $durations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $duration): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($duration); ?>" <?php echo e(request('duration') == $duration ? 'selected' : ''); ?>><?php echo e($duration); ?> days</option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>

                <!-- Difficulty Filter -->
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-2">Difficulty</label>
                    <select name="difficulty" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-[#c9a84c] focus:border-[#c9a84c]">
                        <option value="">All Levels</option>
                        <?php $__currentLoopData = $difficulties; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $difficulty): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($difficulty); ?>" <?php echo e(request('difficulty') == $difficulty ? 'selected' : ''); ?>><?php echo e(ucfirst($difficulty)); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>

                <!-- Sort Options -->
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-2">Sort By</label>
                    <select name="sort" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-[#c9a84c] focus:border-[#c9a84c]">
                        <option value="created_at" <?php echo e(request('sort') == 'created_at' ? 'selected' : ''); ?>>Newest First</option>
                        <option value="price" <?php echo e(request('sort') == 'price' ? 'selected' : ''); ?>>Price: Low to High</option>
                        <option value="price_desc" <?php echo e(request('sort') == 'price_desc' ? 'selected' : ''); ?>>Price: High to Low</option>
                        <option value="title" <?php echo e(request('sort') == 'title' ? 'selected' : ''); ?>>Name A-Z</option>
                    </select>
                </div>

                <!-- Submit Button -->
                <div class="flex items-end">
                    <button type="submit" class="w-full bg-[#0c2340] text-white px-4 py-2 rounded-md hover:bg-[#1a4a6e] transition-colors focus:outline-none focus:ring-2 focus:ring-[#0c2340] focus:ring-offset-2">
                        Apply Filters
                    </button>
                </div>
            </form>
        </div>
    </div>

    <!-- Packages Grid -->
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
        <?php if($packages->count() > 0): ?>
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                <?php $__currentLoopData = $packages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $package): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="group bg-[#f5f1ea] rounded-3xl overflow-hidden hover:-translate-y-1 transition-all duration-500 hover:shadow-2xl">
                        <!-- Package Image -->
                        <div class="relative h-64 overflow-hidden">
                            <img src="<?php echo e($package->main_image ?? asset('images/package-placeholder.jpg')); ?>" 
                                 alt="<?php echo e($package->title); ?>" 
                                 class="w-full h-full object-cover group-hover:scale-110 transition-transform duration-700">
                            
                            <?php if($package->is_featured): ?>
                                <div class="absolute top-4 left-4 bg-yellow-400 text-[#0c2340] px-3 py-1.5 rounded-full text-xs font-bold">
                                    Featured
                                </div>
                            <?php endif; ?>

                            <?php if($package->has_discount): ?>
                                <div class="absolute top-4 <?php echo e($package->is_featured ? 'left-24' : 'left-4'); ?> bg-[#c9a84c] text-[#0c2340] px-3 py-1.5 rounded-full text-xs font-bold">
                                    -<?php echo e($package->discount_percentage); ?>%
                                </div>
                            <?php endif; ?>

                            <div class="absolute top-4 right-4 bg-white/90 backdrop-blur text-[#0c2340] text-[10px] uppercase tracking-widest font-semibold px-3 py-1.5 rounded-full">
                                <?php echo e(ucfirst($package->category)); ?>

                            </div>
                        </div>

                        <!-- Package Content -->
                        <div class="p-6">
                            <h3 class="font-serif text-2xl text-[#0c2340] leading-snug"><?php echo e($package->title); ?></h3>
                            <p class="text-sm text-[#0c2340]/65 mt-2 leading-relaxed line-clamp-2"><?php echo e($package->description); ?></p>

                            <div class="flex items-center gap-2 mt-4 text-sm">
                                <div class="flex text-[#c9a84c]">
                                    <?php for($i = 0; $i < 5; $i++): ?>
                                        <i data-feather="star" class="w-3.5 h-3.5 fill-current"></i>
                                    <?php endfor; ?>
                                </div>
                                <span class="text-[#0c2340]/50 text-xs">(<?php echo e($package->booked_count); ?> bookings)</span>
                            </div>

                            <div class="flex items-center gap-4 mt-4 text-xs text-[#0c2340]/70">
                                <span class="flex items-center gap-1.5"><i data-feather="clock" class="w-3.5 h-3.5"></i><?php echo e($package->duration_days); ?> Days</span>
                                <span class="flex items-center gap-1.5"><i data-feather="map-pin" class="w-3.5 h-3.5"></i><?php echo e($package->destination); ?></span>
                                <span class="flex items-center gap-1.5"><i data-feather="users" class="w-3.5 h-3.5"></i><?php echo e($package->min_people); ?>-<?php echo e($package->max_people); ?> Pax</span>
                            </div>

                            <div class="flex items-end justify-between mt-6 pt-5 border-t border-[#0c2340]/10">
                                <div>
                                    <?php if($package->has_discount): ?>
                                        <div class="text-xs text-[#0c2340]/40 line-through"><?php echo e($package->formatted_price); ?></div>
                                        <div class="font-serif text-2xl text-[#0c2340]"><?php echo e($package->formatted_discount_price); ?></div>
                                    <?php else: ?>
                                        <div class="text-xs uppercase tracking-wider text-[#0c2340]/50">From</div>
                                        <div class="font-serif text-2xl text-[#0c2340]"><?php echo e($package->formatted_price); ?></div>
                                    <?php endif; ?>
                                </div>
                                
                                <?php if($package->is_available): ?>
                                    <a href="<?php echo e(route('packages.show', $package->slug)); ?>" class="bg-[#0c2340] text-white p-3 rounded-full hover:bg-[#c9a84c] hover:text-[#0c2340] transition">
                                        <i data-feather="arrow-right" class="w-4 h-4"></i>
                                    </a>
                                <?php else: ?>
                                    <button disabled class="bg-gray-400 text-white p-3 rounded-full cursor-not-allowed">
                                        <i data-feather="x" class="w-4 h-4"></i>
                                    </button>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>

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

            </div>
        <?php else: ?>
            <div class="text-center py-16 bg-white rounded-3xl shadow-sm border border-gray-100">
                <i data-feather="search" class="w-16 h-16 mx-auto text-[#0c2340]/30 mb-4"></i>
                <h3 class="text-2xl font-serif text-[#0c2340] mb-2">No packages found</h3>
                <p class="text-[#0c2340]/60 mb-8">Try adjusting your filters or search terms</p>
                <a href="<?php echo e(route('packages.index')); ?>" class="bg-[#0c2340] text-white px-8 py-3 rounded-full hover:bg-[#c9a84c] hover:text-[#0c2340] transition font-medium">
                    Clear Filters
                </a>
            </div>
        <?php endif; ?>
    </div>
</div>

<script>
    // Auto-submit form on filter change
    document.querySelectorAll('select, input[type="number"]').forEach(element => {
        element.addEventListener('change', function() {
            this.form.submit();
        });
    });
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH E:\project\tourism\resources\views/packages/index.blade.php ENDPATH**/ ?>