<div class="bg-white/40 dark:bg-white/5 backdrop-blur-2xl p-4 lg:p-6 rounded-2xl lg:rounded-[2.5rem] border border-white/20 dark:border-white/10 shadow-2xl relative overflow-hidden group transition-all duration-500 hover:shadow-primary-500/5 hover:border-primary-500/20" 
     x-data="{
        filters: { priority: [], tags: [], due_date: '' },
        togglePriority(p) { this.filters.priority.includes(p) ? this.filters.priority = this.filters.priority.filter(i => i !== p) : this.filters.priority.push(p); this.applyFilters(); },
        applyFilters() { 
            const p = new URLSearchParams(window.location.search);
            this.filters.priority.length > 0 ? p.set('priorities[]', this.filters.priority) : p.delete('priorities[]');
            this.filters.due_date ? p.set('due_start', this.filters.due_date) : p.delete('due_start');
            window.location.search = p.toString();
        }
     }">
    
    <!-- Background Accents -->
    <div class="absolute -top-24 -right-24 w-64 h-64 bg-primary-500/10 rounded-full blur-[80px] pointer-events-none transition-opacity duration-1000 group-hover:opacity-100 opacity-50"></div>
    <div class="absolute -bottom-24 -left-24 w-64 h-64 bg-indigo-500/10 rounded-full blur-[80px] pointer-events-none transition-opacity duration-1000 group-hover:opacity-100 opacity-50"></div>

    <div class="flex flex-col lg:flex-row gap-8 items-start lg:items-center justify-between relative z-10">
        
        <div class="flex flex-col sm:flex-row gap-10 items-start sm:items-center flex-1">
            <!-- Priority Selector -->
            <div class="space-y-3">
                <div class="flex items-center gap-2">
                    <span class="w-1.5 h-1.5 rounded-full bg-primary-500 animate-pulse"></span>
                    <span class="text-[10px] font-black text-muted uppercase tracking-[0.2em] opacity-60">Strategic Priority</span>
                </div>
                <div class="flex flex-wrap gap-2">
                    @foreach(['low', 'medium', 'high', 'urgent'] as $p)
                        <button 
                            @click="togglePriority('{{ $p }}')"
                            :class="filters.priority.includes('{{ $p }}') ? 'bg-primary-600 text-white shadow-xl shadow-primary-600/30 ring-2 ring-primary-500/20' : 'bg-white/50 dark:bg-white/10 text-muted border-main/50 hover:bg-white dark:hover:bg-white/20 hover:text-main'"
                            class="px-5 py-2 rounded-2xl text-[11px] font-black border transition-all duration-500 uppercase tracking-widest active:scale-90"
                        >
                            {{ $p }}
                        </button>
                    @endforeach
                </div>
            </div>

            <!-- Separator -->
            <div class="hidden lg:block h-12 w-px bg-gradient-to-b from-transparent via-main/50 to-transparent"></div>

            <!-- Date Analysis -->
            <div class="space-y-3">
                <div class="flex items-center gap-2">
                    <span class="w-1.5 h-1.5 rounded-full bg-indigo-500 animate-pulse"></span>
                    <span class="text-[10px] font-black text-muted uppercase tracking-[0.2em] opacity-60">Timeline Range</span>
                </div>
                <div class="relative group/input">
                    <input 
                        type="date" 
                        x-model="filters.due_date" 
                        @change="applyFilters()" 
                        class="pl-4 pr-4 py-2.5 rounded-2xl border-main/50 bg-white/50 dark:bg-white/10 text-main focus:ring-4 focus:ring-primary-500/10 focus:border-primary-500 text-xs font-black uppercase tracking-widest transition-all w-full sm:w-48 appearance-none"
                    >
                    <div class="absolute right-4 top-1/2 -translate-y-1/2 pointer-events-none text-muted group-hover/input:text-primary-500 transition-colors">
                        <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="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- Action Control -->
        <div class="flex items-center gap-4 w-full lg:w-auto pt-4 lg:pt-0 border-t lg:border-t-0 border-main/30">
             <button 
                @click="window.location.href = '/dashboard'"
                class="flex-1 lg:flex-none h-12 px-6 rounded-2xl bg-red-500/5 hover:bg-red-500 text-red-500 hover:text-white border border-red-500/20 transition-all duration-500 flex items-center justify-center gap-3 text-[10px] font-black uppercase tracking-[0.15em] active:scale-95 group/clear"
            >
                <svg class="w-4 h-4 group-hover/clear:rotate-90 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M6 18L18 6M6 6l12 12"></path></svg>
                Reset System
            </button>
        </div>
    </div>
</div>
