<x-guru-layout>
    <x-slot name="header">
        <h2 class="font-bold text-2xl text-gray-900 leading-tight">
            {{ __('Dashboard Guru') }}
        </h2>
    </x-slot>

    <div class="py-10">
        <div class="max-w-4xl mx-auto px-6">
            <div class="bg-white shadow-xl rounded-lg overflow-hidden">
                <div class="p-8">
                    @php
                        $guru = \App\Models\Guru::where('user_id', auth()->id())->first();
                    @endphp

                    @if($guru)
                        <div class="flex flex-col items-center">
                            @if($guru->foto)
                                <img 
                                    src="{{ asset('storage/foto_guru/' . $guru->foto) }}" 
                                    alt="Foto Profil Guru" 
                                    class="w-32 h-32 rounded-full object-cover border-4 border-blue-400 shadow mb-6"
                                >
                            @endif

                            <table class="w-full md:w-auto text-sm text-gray-700">
                                <tbody>
                                    <tr>
                                        <th class="text-left font-semibold pr-4 py-2">Nama</th>
                                        <td class="py-2">{{ $guru->nama }}</td>
                                    </tr>
                                    <tr>
                                        <th class="text-left font-semibold pr-4 py-2">NIP</th>
                                        <td class="py-2">{{ $guru->code_guru }}</td>
                                    </tr>
                                    <tr>
                                        <th class="text-left font-semibold pr-4 py-2">Alamat</th>
                                        <td class="py-2">{{ $guru->alamat }}</td>
                                    </tr>
                                    <tr>
                                        <th class="text-left font-semibold pr-4 py-2">Tanggal Lahir</th>
                                        <td class="py-2">{{ \Carbon\Carbon::parse($guru->tanggal_lahir)->translatedFormat('d F Y') }}</td>
                                    </tr>
                                    <tr>
                                        <th class="text-left font-semibold pr-4 py-2">Jenis Kelamin</th>
                                        <td class="py-2">
                                            {{ $guru->jenis_kelamin == 'L' ? 'Laki-laki' : 'Perempuan' }}
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

                            {{-- Tombol Edit (aktifkan jika diperlukan) --}}
                            {{-- 
                            <a href="{{ route('guru.profile.edit') }}" 
                               class="mt-6 inline-block bg-yellow-500 hover:bg-yellow-600 text-white font-semibold py-2 px-4 rounded transition">
                               Edit Profil
                            </a> 
                            --}}
                        </div>
                    @else
                        <div class="text-center text-gray-600">
                            Data guru tidak ditemukan.
                        </div>
                    @endif
                </div>
            </div>
        </div>
    </div>
</x-guru-layout>
