@php
    $association = filament()->getTenant();
@endphp

<div class="fi-page">
    <div style="width:100%;background:#fff;padding:24px;">
        <div class="header" style="display:flex;align-items:center;border-bottom:2px solid #e2e8f0;padding-bottom:16px;margin-bottom:32px;">
            @if($association && $association->logo_path)
                <img src="{{ asset('storage/' . $association->logo_path) }}" class="logo" alt="Logo" style="width:80px;height:80px;object-fit:contain;margin-right:24px;">
            @endif
            <div class="association-info" style="flex:1;">
                <div class="association-name" style="font-size:2rem;font-weight:bold;color:#1e293b;">{{ $association->name ?? 'Association' }}</div>
                <div class="association-desc" style="color:#64748b;font-size:1rem;">{{ $association->description ?? '' }}</div>
            </div>
        </div>
        <div class="profile-title" style="font-size:1.5rem;font-weight:600;color:#334155;margin-bottom:24px;">Member Profile: {{ $user->firstname ?? '' }} {{ $user->surname ?? '' }}</div>
        <div class="profile-section" style="margin-bottom:32px;">
            <table class="profile-table" style="width:100%;border-collapse:collapse;">
                <tbody>
                    <tr>
                        <th style="background:#f1f5f9;color:#475569;font-weight:600;padding:10px 8px;border-bottom:1px solid #e2e8f0;text-align:left;">Email</th>
                        <td style="padding:10px 8px;border-bottom:1px solid #e2e8f0;text-align:left;">{{ $user->email ?? '' }}</td>
                    </tr>
                    <tr>
                        <th style="background:#f1f5f9;color:#475569;font-weight:600;padding:10px 8px;border-bottom:1px solid #e2e8f0;text-align:left;">Phone</th>
                        <td style="padding:10px 8px;border-bottom:1px solid #e2e8f0;text-align:left;">{{ $user->phone ?? '' }}</td>
                    </tr>
                    <tr>
                        <th style="background:#f1f5f9;color:#475569;font-weight:600;padding:10px 8px;border-bottom:1px solid #e2e8f0;text-align:left;">Status</th>
                        <td style="padding:10px 8px;border-bottom:1px solid #e2e8f0;text-align:left;">{{ isset($user->status) ? ucfirst($user->status) : '' }}</td>
                    </tr>
                    @if(isset($profileData))
                        @foreach($profileData as $item)
                            <tr>
                                <th style="background:#f1f5f9;color:#475569;font-weight:600;padding:10px 8px;border-bottom:1px solid #e2e8f0;text-align:left;">{{ $item['label'] }}</th>
                                <td style="padding:10px 8px;border-bottom:1px solid #e2e8f0;text-align:left;">{{ is_array($item['value']) ? implode(', ', $item['value']) : $item['value'] }}</td>
                            </tr>
                        @endforeach
                    @endif
                </tbody>
            </table>
        </div>
        <div class="footer" style="margin-top:48px;text-align:center;color:#94a3b8;font-size:0.95rem;">
            Generated by {{ config('app.name') }} &mdash; {{ now()->format('F j, Y, g:i a') }}
        </div>
    </div>
</div>
