

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

<?php $__env->startSection('buyer-content'); ?>
    <!-- Page Header -->
    <div class="page-header">
        <div>
            <h3 class="page-title">Saved Searches</h3>
            <p class="text-muted mb-0">Quickly access your previous search queries</p>
        </div>
        <span class="badge bg-primary-subtle text-primary rounded-pill px-3 py-2">
            <i class="bi bi-search me-1"></i> <?php echo e($savedSearches->total()); ?> Searches
        </span>
    </div>

    <div class="card border-0 shadow-sm rounded-4 overflow-hidden">
        <div class="card-header bg-transparent py-3">
            <h6 class="fw-bold mb-0">
                <i class="bi bi-bookmark-fill me-2 text-primary"></i>Your Saved Searches
            </h6>
        </div>
        
        <div class="card-body p-0">
            <?php $__empty_1 = true; $__currentLoopData = $savedSearches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $search): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <div class="p-4 border-bottom hover-bg-light transition-all">
                    <div class="d-flex justify-content-between align-items-center">
                        <div class="d-flex align-items-center flex-grow-1">
                            <div class="rounded-3 bg-primary bg-opacity-10 text-primary p-3 me-3 flex-shrink-0">
                                <i class="bi bi-search fs-4"></i>
                            </div>
                            <div class="flex-grow-1">
                                <h6 class="fw-bold mb-1 text-dark">"<?php echo e($search->query); ?>"</h6>
                                <div class="d-flex flex-wrap gap-2 mb-1">
                                    <?php if($search->filters): ?>
                                        <?php $__currentLoopData = (array)$search->filters; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php if($value): ?>
                                                <span class="badge bg-light text-secondary border fw-normal shadow-sm px-2">
                                                    <?php echo e(ucfirst(str_replace('_', ' ', $key))); ?>: <?php echo e(is_array($value) ? implode(', ', $value) : $value); ?>

                                                </span>
                                            <?php endif; ?>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    <?php endif; ?>
                                </div>
                                <small class="text-muted d-flex align-items-center">
                                    <i class="bi bi-clock me-1"></i> Saved <?php echo e($search->created_at->diffForHumans()); ?>

                                </small>
                            </div>
                        </div>
                        <div class="d-flex gap-2 ms-3">
                            <a href="<?php echo e(route('public.search', ['q' => $search->query] + (array)$search->filters)); ?>" 
                               class="btn btn-primary btn-sm shadow-sm rounded-pill px-3 fw-medium">
                                <i class="bi bi-search me-1"></i> Search
                            </a>
                            <form action="<?php echo e(route('buyer.saved-searches.destroy', $search->id)); ?>" method="POST" class="d-inline">
                                <?php echo csrf_field(); ?>
                                <?php echo method_field('DELETE'); ?>
                                <button type="submit" class="btn btn-outline-danger btn-sm rounded-circle d-flex align-items-center justify-content-center" 
                                        style="width: 32px; height: 32px;"
                                        onclick="return confirm('Delete this saved search?')">
                                    <i class="bi bi-trash"></i>
                                </button>
                            </form>
                        </div>
                    </div>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <div class="text-center py-5">
                    <div class="rounded-circle bg-light d-inline-flex align-items-center justify-content-center mb-4" style="width: 80px; height: 80px;">
                        <i class="bi bi-search fs-1 text-muted opacity-50"></i>
                    </div>
                    <h5 class="fw-bold mb-2">No Saved Searches</h5>
                    <p class="text-muted mb-4 opacity-75">Save your search queries for quick access in the future.</p>
                    <a href="<?php echo e(route('public.products.index')); ?>" class="btn btn-primary rounded-pill px-4 shadow-sm hover-lift">
                        <i class="bi bi-search me-2"></i> Start Searching
                    </a>
                </div>
            <?php endif; ?>

            <?php if($savedSearches->hasPages()): ?>
                <div class="p-3 bg-light border-top">
                    <?php echo e($savedSearches->links()); ?>

                </div>
            <?php endif; ?>
        </div>
    </div>

    <!-- Tips Card -->
    <div class="card mt-4 border-0 shadow-sm rounded-4" style="background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);">
        <div class="card-body p-4">
            <div class="d-flex align-items-start">
                <div class="rounded-circle bg-white text-primary p-2 me-3 flex-shrink-0 shadow-sm d-flex align-items-center justify-content-center" style="width: 40px; height: 40px;">
                    <i class="bi bi-lightbulb-fill fs-5"></i>
                </div>
                <div>
                    <h6 class="fw-bold mb-1 text-primary-emphasis">Pro Tip</h6>
                    <p class="mb-0 text-primary-emphasis opacity-75 small fw-medium">
                        Save your frequently used searches to quickly find products. 
                        When searching for products, click the "Save Search" button to add it here.
                    </p>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.buyer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/u281583269/domains/theminiport.com/public_html/resources/views/buyer/saved-searches.blade.php ENDPATH**/ ?>