@php
    $contact = \App\Models\Contact::current();
    $profile = \App\Models\VillageProfile::current();
@endphp

<footer class="bg-primary text-white">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <div class="grid grid-cols-1 md:grid-cols-3 gap-10">
            <div>
                <div class="flex items-center gap-3.5 mb-4">
                    @if(file_exists(public_path('images/logo_cropped.png')))
                        <img src="{{ asset('images/logo_cropped.png') }}" alt="Logo {{ $profile->nama_desa }}" class="h-14 sm:h-16 w-auto object-contain drop-shadow">
                    @elseif(file_exists(public_path('images/logo.png')))
                        <img src="{{ asset('images/logo.png') }}" alt="Logo {{ $profile->nama_desa }}" class="h-14 sm:h-16 w-auto object-contain drop-shadow">
                    @elseif(file_exists(public_path('images/logo.jpg')))
                        <img src="{{ asset('images/logo.jpg') }}" alt="Logo {{ $profile->nama_desa }}" class="h-14 sm:h-16 w-auto object-contain drop-shadow">
                    @elseif(file_exists(public_path('images/logo.jpeg')))
                        <img src="{{ asset('images/logo.jpeg') }}" alt="Logo {{ $profile->nama_desa }}" class="h-14 sm:h-16 w-auto object-contain drop-shadow">
                    @elseif(file_exists(public_path('images/logo.svg')))
                        <img src="{{ asset('images/logo.svg') }}" alt="Logo {{ $profile->nama_desa }}" class="h-14 sm:h-16 w-auto object-contain drop-shadow">
                    @else
                        <div class="w-10 h-10 bg-white/15 rounded-xl flex items-center justify-center text-white border border-white/20">
                            <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"/></svg>
                        </div>
                    @endif
                    <div>
                        <div class="font-bold text-lg text-white">{{ $profile->nama_desa }}</div>
                        <div class="text-blue-200 text-xs font-medium">{{ $profile->kecamatan }}, {{ $profile->kabupaten }}</div>
                    </div>
                </div>
                @if($profile->slogan)
                    <p class="text-blue-200 text-sm italic">"{{ $profile->slogan }}"</p>
                @endif
            </div>

            <div>
                <h3 class="font-semibold text-sm uppercase tracking-wider text-blue-200 mb-4">Navigasi</h3>
                <ul class="space-y-2">
                    <li><a href="{{ route('home') }}" class="text-sm text-blue-100 hover:text-white transition-colors">Beranda</a></li>
                    <li><a href="{{ route('profil.tentang') }}" class="text-sm text-blue-100 hover:text-white transition-colors">Tentang Desa</a></li>
                    <li><a href="{{ route('data-desa') }}" class="text-sm text-blue-100 hover:text-white transition-colors">Data Desa</a></li>
                    <li><a href="{{ route('potensi') }}" class="text-sm text-blue-100 hover:text-white transition-colors">Potensi Desa</a></li>
                    <li><a href="{{ route('peta') }}" class="text-sm text-blue-100 hover:text-white transition-colors">Peta Desa</a></li>
                    <li><a href="{{ route('berita.index') }}" class="text-sm text-blue-100 hover:text-white transition-colors">Berita</a></li>
                    <li><a href="{{ route('kontak') }}" class="text-sm text-blue-100 hover:text-white transition-colors">Kontak</a></li>
                    <li>
                        @auth
                            <a href="{{ route('admin.dashboard') }}" class="text-sm text-blue-200 hover:text-white font-semibold transition-colors inline-flex items-center gap-1.5 mt-1">
                                <svg class="w-4 h-4 text-blue-300" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"/></svg>
                                Panel Admin
                            </a>
                        @else
                            <a href="{{ route('login') }}" class="text-sm text-blue-200 hover:text-white font-semibold transition-colors inline-flex items-center gap-1.5 mt-1">
                                <svg class="w-4 h-4 text-blue-300" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/></svg>
                                Login Admin
                            </a>
                        @endauth
                    </li>
                </ul>
            </div>

            <div>
                <h3 class="font-semibold text-sm uppercase tracking-wider text-blue-200 mb-4">Kontak</h3>
                <ul class="space-y-2.5 text-sm text-blue-100">
                    @if($contact->alamat)
                    <li class="flex items-start gap-2">
                        <svg class="w-4 h-4 mt-0.5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a2 2 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"/></svg>
                        {{ $contact->alamat }}
                    </li>
                    @endif
                    @if($contact->jam_pelayanan)
                    <li class="flex items-center gap-2">
                        <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
                        {{ $contact->jam_pelayanan }}
                    </li>
                    @endif
                    @if($contact->whatsapp && !str_contains($contact->whatsapp, 'Belum'))
                    <li class="flex items-center gap-2">
                        <svg class="w-4 h-4 flex-shrink-0" fill="currentColor" viewBox="0 0 24 24"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51a9.87 9.87 0 00-.57-.01c-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347z"/></svg>
                        <a href="{{ $contact->whatsapp_url }}" target="_blank" class="hover:text-white">{{ $contact->whatsapp }}</a>
                    </li>
                    @endif
                </ul>
            </div>
        </div>
    </div>
    <div class="border-t border-blue-800 py-4">
        <div class="max-w-7xl mx-auto px-4 flex flex-col md:flex-row items-center justify-between gap-2">
            <p class="text-blue-200 text-xs">&copy; {{ date('Y') }} {{ $profile->nama_desa }}. Hak cipta dilindungi.</p>
            <p class="text-blue-300 text-xs">Powered by Laravel & Tailwind CSS</p>
        </div>
    </div>
</footer>
