@extends('layouts.app')

@section('title', 'Pencarian - FIN ANALYSIS PRO')

@section('content')
<div class="min-h-screen py-8">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        <!-- Header Pencarian -->
        <div class="mb-8">
            <h1 class="text-3xl font-bold text-gray-900 dark:text-white mb-2">Pencarian</h1>
            <p class="text-gray-600 dark:text-gray-400">Temukan perusahaan, analisis, dan informasi keuangan lainnya</p>
        </div>
        
        <!-- Form Pencarian -->
        <div class="bg-white dark:bg-gray-800 rounded-2xl shadow-lg p-6 mb-8">
            <form action="{{ route('search') }}" method="GET" class="relative">
                <div class="flex items-center border-2 border-gray-200 dark:border-gray-700 rounded-xl overflow-hidden focus-within:border-blue-500 dark:focus-within:border-blue-400 transition-colors">
                    <div class="px-4 text-gray-400">
                        <i class="fas fa-search"></i>
                    </div>
                    <input type="text" 
                           name="q" 
                           value="{{ request('q') }}"
                           placeholder="Cari perusahaan, analisis, atau laporan..." 
                           class="flex-1 py-4 px-2 bg-transparent border-0 focus:ring-0 text-gray-900 dark:text-white placeholder-gray-400"
                           autofocus>
                    <button type="submit" class="px-6 py-4 bg-blue-600 text-white font-medium hover:bg-blue-700 transition-colors">
                        Cari
                    </button>
                </div>
            </form>
        </div>
        
        <!-- Hasil Pencarian -->
        @if(request('q'))
            <div class="mb-6">
                <h2 class="text-xl font-semibold text-gray-900 dark:text-white">
                    Hasil pencarian untuk "{{ request('q') }}"
                </h2>
            </div>
            
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                <!-- Contoh Hasil Pencarian (Sementara) -->
                @php
                    $hasResults = false; // Ganti dengan logika pencarian nanti
                @endphp
                
                @if(!$hasResults)
                    <!-- Empty State -->
                    <div class="col-span-full py-12 text-center">
                        <div class="inline-flex items-center justify-center w-24 h-24 bg-gray-100 dark:bg-gray-800 rounded-full mb-4">
                            <i class="fas fa-search text-4xl text-gray-400"></i>
                        </div>
                        <h3 class="text-lg font-medium text-gray-900 dark:text-white mb-2">Tidak ada hasil ditemukan</h3>
                        <p class="text-gray-500 dark:text-gray-400 mb-6">
                            Maaf, tidak menemukan hasil untuk "{{ request('q') }}"
                        </p>
                        <div class="text-sm text-gray-500 dark:text-gray-400">
                            <p>Coba:</p>
                            <ul class="mt-2 space-y-1">
                                <li>• Memeriksa ejaan kata kunci</li>
                                <li>• Menggunakan kata kunci yang lebih umum</li>
                                <li>• Mencari dengan kata kunci lain</li>
                            </ul>
                        </div>
                    </div>
                @else
                    <!-- Card Hasil Pencarian (Contoh) -->
                    <div class="bg-white dark:bg-gray-800 rounded-xl shadow-md overflow-hidden hover:shadow-lg transition-shadow">
                        <div class="p-6">
                            <div class="flex items-start justify-between mb-4">
                                <div class="w-12 h-12 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-lg flex items-center justify-center">
                                    <i class="fas fa-building text-white text-xl"></i>
                                </div>
                                <span class="px-3 py-1 bg-green-100 dark:bg-green-900/20 text-green-600 dark:text-green-400 text-xs font-medium rounded-full">
                                    Perusahaan
                                </span>
                            </div>
                            <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">PT Maju Jaya</h3>
                            <p class="text-sm text-gray-600 dark:text-gray-400 mb-4">Manufaktur · 2024</p>
                            <div class="flex items-center justify-between">
                                <span class="text-sm text-gray-500 dark:text-gray-400">Z-Score: 2.85</span>
                                <a href="#" class="text-blue-600 dark:text-blue-400 text-sm font-medium hover:underline">
                                    Lihat Detail →
                                </a>
                            </div>
                        </div>
                    </div>
                    
                    <div class="bg-white dark:bg-gray-800 rounded-xl shadow-md overflow-hidden hover:shadow-lg transition-shadow">
                        <div class="p-6">
                            <div class="flex items-start justify-between mb-4">
                                <div class="w-12 h-12 bg-gradient-to-br from-purple-500 to-pink-600 rounded-lg flex items-center justify-center">
                                    <i class="fas fa-chart-line text-white text-xl"></i>
                                </div>
                                <span class="px-3 py-1 bg-blue-100 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 text-xs font-medium rounded-full">
                                    Analisis
                                </span>
                            </div>
                            <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">Analisis PT Sejahtera</h3>
                            <p class="text-sm text-gray-600 dark:text-gray-400 mb-4">Diproses: 15 Mar 2026</p>
                            <div class="flex items-center justify-between">
                                <span class="text-sm text-gray-500 dark:text-gray-400">Z-Score: 4.25</span>
                                <a href="#" class="text-blue-600 dark:text-blue-400 text-sm font-medium hover:underline">
                                    Lihat Detail →
                                </a>
                            </div>
                        </div>
                    </div>
                @endif
            </div>
        @else
            <!-- Initial State (belum mencari) -->
            <div class="text-center py-12">
                <div class="inline-flex items-center justify-center w-32 h-32 bg-gradient-to-br from-blue-50 to-indigo-50 dark:from-gray-800 dark:to-gray-700 rounded-full mb-6">
                    <i class="fas fa-search text-5xl text-blue-600 dark:text-blue-400"></i>
                </div>
                <h3 class="text-xl font-medium text-gray-900 dark:text-white mb-3">
                    Mulai Pencarian
                </h3>
                <p class="text-gray-600 dark:text-gray-400 max-w-md mx-auto mb-8">
                    Cari perusahaan, analisis, atau laporan keuangan yang ingin Anda pelajari
                </p>
                <div class="grid grid-cols-1 md:grid-cols-3 gap-4 max-w-3xl mx-auto">
                    <div class="bg-white dark:bg-gray-800 p-4 rounded-xl shadow-sm">
                        <i class="fas fa-building text-2xl text-blue-600 dark:text-blue-400 mb-2"></i>
                        <h4 class="font-medium text-gray-900 dark:text-white">Perusahaan</h4>
                        <p class="text-sm text-gray-500 dark:text-gray-400">Cari data perusahaan</p>
                    </div>
                    <div class="bg-white dark:bg-gray-800 p-4 rounded-xl shadow-sm">
                        <i class="fas fa-chart-pie text-2xl text-blue-600 dark:text-blue-400 mb-2"></i>
                        <h4 class="font-medium text-gray-900 dark:text-white">Analisis</h4>
                        <p class="text-sm text-gray-500 dark:text-gray-400">Lihat hasil analisis</p>
                    </div>
                    <div class="bg-white dark:bg-gray-800 p-4 rounded-xl shadow-sm">
                        <i class="fas fa-file-alt text-2xl text-blue-600 dark:text-blue-400 mb-2"></i>
                        <h4 class="font-medium text-gray-900 dark:text-white">Laporan</h4>
                        <p class="text-sm text-gray-500 dark:text-gray-400">Temukan laporan</p>
                    </div>
                </div>
            </div>
        @endif
    </div>
</div>
@endsection