<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Match Request Details</title>
    <style>
        body {
            font-family: 'DejaVu Sans', sans-serif;
            font-size: 10px;
            color: #333;
        }
        .header {
            text-align: center;
            margin-bottom: 20px;
            border-bottom: 2px solid #405189;
            padding-bottom: 10px;
        }
        .header h1 {
            color: #405189;
            margin: 0;
            font-size: 24px;
        }
        .section {
            margin-bottom: 20px;
        }
        .section-title {
            background-color: #405189;
            color: white;
            padding: 8px;
            font-size: 14px;
            font-weight: bold;
            margin-bottom: 10px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 15px;
            table-layout: fixed;
        }
        table td {
            padding: 6px 8px;
            border-bottom: 1px solid #ddd;
            word-wrap: break-word; /* Ensure long text wraps */
        }
        
        /* Column Widths */
        .two-col td:first-child { width: 30%; font-weight: bold; }
        .two-col td:last-child { width: 70%; }

        .three-col td:nth-child(1) { width: 25%; font-weight: bold; }
        .three-col td:nth-child(2) { width: 37.5%; }
        .three-col td:nth-child(3) { width: 37.5%; text-align: right; direction: rtl; }

        .user-section {
            page-break-inside: avoid;
        }
        .profile-pic {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            object-fit: cover;
            margin-bottom: 10px;
        }
        .badge {
            display: inline-block;
            padding: 3px 8px;
            background-color: #28a745;
            color: white;
            border-radius: 3px;
            font-size: 11px;
        }
        .footer {
            margin-top: 30px;
            text-align: center;
            font-size: 10px;
            color: #666;
            border-top: 1px solid #ddd;
            padding-top: 10px;
        }
        .page-break {
            page-break-after: always;
        }
    </style>
</head>
<body>
    <div class="header">
        <h1>Match Request Details</h1>
        <p>Generated on {{ now()->format('d/m/Y h:i A') }}</p>
    </div>

    <!-- Chat Summary -->
    <div class="section">
        <div class="section-title">Chat Summary</div>
        <table class="two-col">
            <tr>
                <td>Questions Exchanged</td>
                <td>{{ $chat->questions_exchanged }}</td>
            </tr>
            <tr>
                <td>Match Agreement Date</td>
                <td>{{ $chat->updated_at->format('d/m/Y h:i A') }}</td>
            </tr>
            <tr>
                <td>Chat Status</td>
                <td><span class="badge">Completed</span></td>
            </tr>
        </table>
    </div>

    <!-- Male User Basic Information -->
    <div class="section user-section">
        <div class="section-title">Male User - Basic Information</div>
        @if($maleUser->profile_image_url)
        <img src="{{ $maleUser->profile_image_url }}" class="profile-pic" alt="Male User">
        @endif
        <table class="two-col">
            <tr>
                <td>Full Name</td>
                <td>{{ $maleUser->name }}</td>
            </tr>
            <tr>
                <td>User ID</td>
                <td>{{ $maleUser->nick_name }}</td>
            </tr>
            <tr>
                <td>Email</td>
                <td>{{ $maleUser->email }}</td>
            </tr>
            <tr>
                <td>Phone</td>
                <td>{{ $maleUser->dial_code }} {{ $maleUser->phone }}</td>
            </tr>
            <tr>
                <td>Date of Birth</td>
                <td>{{ $maleUser->dob ?? 'N/A' }}</td>
            </tr>
            <tr>
                <td>Nationality</td>
                <td>{{ $maleUser->nationality->name ?? 'N/A' }}</td>
            </tr>
            <tr>
                <td>Emirate</td>
                <td>{{ $maleUser->emirate->name ?? 'N/A' }}</td>
            </tr>
            <tr>
                <td>Registered On</td>
                <td>{{ $maleUser->created_at->format('d/m/y H:i A') }}</td>
            </tr>
            <tr>
                <td>Is Mother Uae Nationality</td>
                <td>{{ $maleUser->is_mother_uae_national == 1 ? 'YES' : 'NO' }}</td>
            </tr>
            <tr>
                <td>Is User Uae Resident</td>
                <td>{{ $maleUser->is_user_uae_nationality == 1 ? 'YES' : 'NO' }}</td>
        </table>
    </div>

    <!-- Female User Basic Information -->
    <div class="section user-section">
        <div class="section-title">Female User - Basic Information</div>
        @if($femaleUser->profile_image_url)
        <img src="{{ $femaleUser->profile_image_url }}" class="profile-pic" alt="Female User">
        @endif
        <table class="two-col">
            <tr>
                <td>Full Name</td>
                <td>{{ $femaleUser->name }}</td>
            </tr>
            <tr>
                <td>User ID</td>
                <td>{{ $femaleUser->nick_name }}</td>
            </tr>
            <tr>
                <td>Email</td>
                <td>{{ $femaleUser->email }}</td>
            </tr>
            <tr>
                <td>Phone</td>
                <td>{{ $femaleUser->dial_code }} {{ $femaleUser->phone }}</td>
            </tr>
            <tr>
                <td>Date of Birth</td>
                <td>{{ $femaleUser->dob ?? 'N/A' }}</td>
            </tr>
            <tr>
                <td>Nationality</td>
                <td>{{ $femaleUser->nationality->name ?? 'N/A' }}</td>
            </tr>
            <tr>
                <td>Emirate</td>
                <td>{{ $femaleUser->emirate->name ?? 'N/A' }}</td>
            </tr>
            <tr>
                <td>Registered On</td>
                <td>{{ $femaleUser->created_at->format('d/m/y H:i A') }}</td>
            </tr>
            <tr>
                <td>Is Mother Uae Nationality</td>
                <td>{{ $femaleUser->is_mother_uae_national == 1 ? 'YES' : 'NO' }}</td>
            </tr>
            <tr>
                <td>Is User Uae Resident</td>
                <td>{{ $femaleUser->is_user_uae_nationality == 1 ? 'YES' : 'NO' }}</td>
            @if($femaleUser->gardien_relation || $femaleUser->gardien_phone_number || $femaleUser->parent_name)
            <tr>
                <td colspan="2" style="background-color: #f0f0f0; font-weight: bold;">Guardian Information</td>
            </tr>
            @if($femaleUser->parent_name)
            <tr>
                <td>Parent Name</td>
                <td>{{ $femaleUser->parent_name }}</td>
            </tr>
            @endif
            @if($femaleUser->gardien_relation)
            <tr>
                <td>Guardian Relation</td>
                <td>{{ $femaleUser->gardien_relation }}</td>
            </tr>
            @endif
            @if($femaleUser->gardien_phone_number)
            <tr>
                <td>Guardian Phone</td>
                <td>{{ $femaleUser->gardien_phone_dial_code }} {{ $femaleUser->gardien_phone_number }}</td>
            </tr>
            @endif
            @endif
        </table>
    </div>

    <div class="page-break"></div>

    <!-- Male User Details (3 Columns) -->
    <div class="section user-section">
        <div class="section-title">Male User - Details</div>
        <table class="three-col">
            @if($maleUser->details)
            <tr>
                <td>Sect</td>
                <td>{{ $maleUser->details->sect->name??'N/A' }}</td>
                <td>{{ $maleUser->details->sect->name_ar??'N/A' }}</td>
            </tr>
            <tr>
                <td>Education</td>
                <td>{{ $maleUser->details->education->name??'N/A' }}</td>
                <td>{{ $maleUser->details->education->name_ar??'N/A' }}</td>
            </tr>
            <tr>
                <td>Profession</td>
                <td>{{ $maleUser->details->profession->name??'N/A' }}</td>
                <td>{{ $maleUser->details->profession->name_ar??'N/A' }}</td>
            </tr>
            <tr>
                <td>Marital Status</td>
                <td>{{ $maleUser->details->maritalStatus->name??'N/A' }}</td>
                <td>{{ $maleUser->details->maritalStatus->name_ar??'N/A' }}</td>
            </tr>
            @foreach($maleUser->children as $ch)
            <tr>
                <td>Children Age {{$ch->age}}</td>
                <td>{{$ch->kid_count}}</td>
                <td></td>
            </tr>
            @endforeach
            <tr style="display:none;">
                <td>Dress Code</td>
                <td>{{ $maleUser->details->dressCode->name??'N/A' }}</td>
                <td>{{ $maleUser->details->dressCode->name_ar??'N/A' }}</td>
            </tr>
            @if(isset($maleUser->details->genetic_disease) && $maleUser->details->genetic_disease == 1)
            <tr>
                <td>Genetic Disease</td>
                <td>Yes ({{ $maleUser->geneticDiseases->map(fn($d) => $d->geneticDisease->name ?? '')->join(', ') }})</td>
                 <td>نعم ({{ $maleUser->geneticDiseases->map(fn($d) => $d->geneticDisease->name_ar ?? '')->join(', ') }})</td>
            </tr>
            @else
            <tr>
                <td>Genetic Disease</td>
                <td>No</td>
                <td>لا</td>
            </tr>
            @endif
            <tr>
                <td>Height</td>
                <td>{{isset($maleUser->details->height_cm)?$maleUser->details->height_cm.' cm':'N/A'}}</td>
                <td>{{isset($maleUser->details->height_ft)?$maleUser->details->height_ft.' ft':'N/A'}}</td>
            </tr>
            <tr>
                <td>Weight</td>
                <td>{{isset($maleUser->details->weight_kg)?$maleUser->details->weight_kg.' kg':'N/A'}}</td>
                <td>{{isset($maleUser->details->weight_lbs)?$maleUser->details->weight_lbs.' lbs':'N/A'}}</td>
            </tr>
            <tr>
                <td>Smoking</td>
                <td>{{ isset($maleUser->details->smoking) && $maleUser->details->smoking == 1 ? 'Yes' : 'No' }}</td>
                <td>{{ isset($maleUser->details->smoking) && $maleUser->details->smoking == 1 ? 'نعم' : 'لا' }}</td>
            </tr>
            <tr style="display:none;">
                <td>Religious Practice</td>
                 <td>{{ isset($maleUser->details->religious_practice) ? getRelegiousCount($maleUser->details->religious_practice, 'en') : 'N/A' }}</td>
                 <td>{{ isset($maleUser->details->religious_practice) ? getRelegiousCount($maleUser->details->religious_practice, 'ar') : 'N/A' }}</td>
            </tr>
            <tr>
                <td>Activities</td>
                <td>@foreach($maleUser->activities as $activity){{ $activity->activity->name }}@if(!$loop->last), @endif @endforeach</td>
                <td>@foreach($maleUser->activities as $activity){{ $activity->activity->name_ar }}@if(!$loop->last), @endif @endforeach</td>
            </tr>
            <tr>
                <td>Sports</td>
                <td>@foreach($maleUser->sports as $sport){{ $sport->sport->name }}@if(!$loop->last), @endif @endforeach</td>
                <td>@foreach($maleUser->sports as $sport){{ $sport->sport->name_ar }}@if(!$loop->last), @endif @endforeach</td>
            </tr>
             <tr>
                <td>Known Languages</td>
                <td>@foreach($maleUser->known_languages??[] as $lang){{ $lang->language->name }}@if(!$loop->last), @endif @endforeach</td>
                <td></td>
            </tr>
            @if(isset($maleUser->details->maritalStatus) && $maleUser->details->maritalStatus->show_wife_children_option == true)
            <tr style="display:none;">
                <td>Wives</td>
                <td>{{$maleUser->details->wives??0}}</td>
                <td></td>
            </tr>
            @endif
            @if(isset($maleUser->details->children) && $maleUser->details->children > 0)
            <tr>
                <td>Children</td>
                <td>{{$maleUser->details->children}}</td>
                <td></td>
            </tr>
            @endif
            <tr style="display:none;">
                <td>About</td>
                <td colspan="2">{{$maleUser->details->about??'N/A'}}</td>
            </tr>
            @else
            <tr>
                <td colspan="3">No details available</td>
            </tr>
            @endif
        </table>
    </div>

    <!-- Female User Details (3 Columns) -->
    <div class="section user-section">
        <div class="section-title">Female User - Details</div>
        <table class="three-col">
            @if($femaleUser->details)
            <tr>
                <td>Sect</td>
                <td>{{ $femaleUser->details->sect->name??'N/A' }}</td>
                <td>{{ $femaleUser->details->sect->name_ar??'N/A' }}</td>
            </tr>
            <tr>
                <td>Education</td>
                <td>{{ $femaleUser->details->education->name??'N/A' }}</td>
                <td>{{ $femaleUser->details->education->name_ar??'N/A' }}</td>
            </tr>
            <tr>
                <td>Profession</td>
                <td>{{ $femaleUser->details->profession->name??'N/A' }}</td>
                <td>{{ $femaleUser->details->profession->name_ar??'N/A' }}</td>
            </tr>
             <tr>
                <td>Marital Status</td>
                <td>{{ $femaleUser->details->maritalStatus->name??'N/A' }}</td>
                <td>{{ $femaleUser->details->maritalStatus->name_ar??'N/A' }}</td>
            </tr>
            @foreach($femaleUser->children as $ch)
            <tr>
                <td>Children Age {{$ch->age}}</td>
                <td>{{$ch->kid_count}}</td>
                <td></td>
            </tr>
            @endforeach
            <tr>
                <td>Dress Code</td>
                <td>{{ $femaleUser->details->dressCode->name??'N/A' }}</td>
                <td>{{ $femaleUser->details->dressCode->name_ar??'N/A' }}</td>
            </tr>
             @if(isset($femaleUser->details->genetic_disease) && $femaleUser->details->genetic_disease == 1)
            <tr>
                <td>Genetic Disease</td>
                <td>Yes ({{ $femaleUser->geneticDiseases->map(fn($d) => $d->geneticDisease->name ?? '')->join(', ') }})</td>
                 <td>نعم ({{ $femaleUser->geneticDiseases->map(fn($d) => $d->geneticDisease->name_ar ?? '')->join(', ') }})</td>
            </tr>
            @else
            <tr>
                <td>Genetic Disease</td>
                <td>No</td>
                <td>لا</td>
            </tr>
            @endif
            <tr>
                <td>Height</td>
                <td>{{isset($femaleUser->details->height_cm)?$femaleUser->details->height_cm.' cm':'N/A'}}</td>
                <td>{{isset($femaleUser->details->height_ft)?$femaleUser->details->height_ft.' ft':'N/A'}}</td>
            </tr>
            <tr>
                <td>Weight</td>
                <td>{{isset($femaleUser->details->weight_kg)?$femaleUser->details->weight_kg.' kg':'N/A'}}</td>
                <td>{{isset($femaleUser->details->weight_lbs)?$femaleUser->details->weight_lbs.' lbs':'N/A'}}</td>
            </tr>
            <tr>
                <td>Smoking</td>
                <td>{{ isset($femaleUser->details->smoking) && $femaleUser->details->smoking == 1 ? 'Yes' : 'No' }}</td>
                <td>{{ isset($femaleUser->details->smoking) && $femaleUser->details->smoking == 1 ? 'نعم' : 'لا' }}</td>
            </tr>
             <tr style="display:none;">
                <td>Religious Practice</td>
                 <td>{{ isset($femaleUser->details->religious_practice) ? getRelegiousCount($femaleUser->details->religious_practice, 'en') : 'N/A' }}</td>
                 <td>{{ isset($femaleUser->details->religious_practice) ? getRelegiousCount($femaleUser->details->religious_practice, 'ar') : 'N/A' }}</td>
            </tr>
            <tr>
                <td>Activities</td>
                <td>@foreach($femaleUser->activities as $activity){{ $activity->activity->name }}@if(!$loop->last), @endif @endforeach</td>
                <td>@foreach($femaleUser->activities as $activity){{ $activity->activity->name_ar }}@if(!$loop->last), @endif @endforeach</td>
            </tr>
            <tr>
                <td>Sports</td>
                <td>@foreach($femaleUser->sports as $sport){{ $sport->sport->name }}@if(!$loop->last), @endif @endforeach</td>
                <td>@foreach($femaleUser->sports as $sport){{ $sport->sport->name_ar }}@if(!$loop->last), @endif @endforeach</td>
            </tr>
             <tr>
                <td>Known Languages</td>
                <td>@foreach($femaleUser->known_languages??[] as $lang){{ $lang->language->name }}@if(!$loop->last), @endif @endforeach</td>
                <td></td>
            </tr>
            @if(isset($femaleUser->details->children) && $femaleUser->details->children > 0)
            <tr>
                <td>Children</td>
                <td>{{$femaleUser->details->children}}</td>
                <td></td>
            </tr>
            @endif
             <tr style="display:none;">
                <td>About</td>
                <td colspan="2">{{$femaleUser->details->about??'N/A'}}</td>
            </tr>
            @else
            <tr>
                <td colspan="3">No details available</td>
            </tr>
            @endif
        </table>
    </div>

    <!-- Male User Preferences (3 Columns) -->
    <div class="section user-section">
        <div class="section-title">Male User - Preference</div>
        <table class="three-col">
            @if($maleUser->preference)
            <tr>
                <td>Sect</td>
                <td>
                    @if($maleUser->sects->count() > 0)
                        @foreach($maleUser->sects as $sect)
                            {{$sect->sect?->name??''}}@if(!$loop->last), @endif
                        @endforeach
                    @else
                        Any
                    @endif
                </td>
                <td>
                    @if($maleUser->sects->count() > 0)
                        @foreach($maleUser->sects as $sect)
                            {{$sect->sect?->name_ar??''}}@if(!$loop->last), @endif
                        @endforeach
                    @else
                        لجميع
                    @endif
                </td>
            </tr>
            <tr>
                <td>Education</td>
                <td>
                    @if($maleUser->educations->count() > 0)
                        @foreach($maleUser->educations as $ed)
                            {{$ed->education?->name??''}}@if(!$loop->last), @endif
                        @endforeach
                    @else
                        Any
                    @endif
                </td>
                <td>
                    @if($maleUser->educations->count() > 0)
                        @foreach($maleUser->educations as $ed)
                            {{$ed->education?->name_ar??''}}@if(!$loop->last), @endif
                        @endforeach
                    @else
                        لجميع
                    @endif
                </td>
            </tr>
            <tr>
                <td>Profession</td>
                <td>
                    @if($maleUser->professions->count() > 0)
                        @foreach($maleUser->professions as $ed)
                            {{$ed->profession?->name??''}}@if(!$loop->last), @endif
                        @endforeach
                    @else
                        Any
                    @endif
                </td>
                <td>
                    @if($maleUser->professions->count() > 0)
                        @foreach($maleUser->professions as $ed)
                            {{$ed->profession?->name_ar??''}}@if(!$loop->last), @endif
                        @endforeach
                    @else
                        لجميع
                    @endif
                </td>
            </tr>
            <tr>
                <td>Marital Status</td>
                <td>
                    @if($maleUser->maritalStatuses->count() == 0)
                    Any
                    @else
                    @foreach($maleUser->maritalStatuses??[] as $maritalStatus)
                    {{ $maritalStatus->maritalStatus->name??'' }}@if(!$loop->last), @endif
                    @endforeach
                    @endif
                </td>
                <td>
                    @if($maleUser->maritalStatuses->count() == 0)
                    الجميع
                    @else
                    @foreach($maleUser->maritalStatuses??[] as $maritalStatus)
                    {{ $maritalStatus->maritalStatus->name_ar??'' }}@if(!$loop->last), @endif
                    @endforeach
                    @endif
                </td>
            </tr>
            <tr style="display:none;">
                <td>Dress Code</td>
                <td>
                    @if($maleUser->dressCodes->count() == 0)
                    Any
                    @else
                    @foreach($maleUser->dressCodes??[] as $dressCode)
                    {{ $dressCode->dressCode->name??'' }}@if(!$loop->last), @endif
                    @endforeach
                    @endif
                </td>
                <td>
                    @if($maleUser->dressCodes->count() == 0)
                    الجميع
                    @else
                    @foreach($maleUser->dressCodes??[] as $dressCode)
                    {{ $dressCode->dressCode->name_ar??'' }}@if(!$loop->last), @endif
                    @endforeach
                    @endif
                </td>
            </tr>
            <tr>
                <td>Height</td>
                <td>
                    @if(isset($maleUser->preference->height_all) && $maleUser->preference->height_all) All 
                    @elseif(empty($maleUser->preference->from_height_cm) && empty($maleUser->preference->to_height_cm)) Any
                    @else {{ number_format($maleUser->preference->from_height_cm??0, 2) }}-{{ number_format($maleUser->preference->to_height_cm??0, 2) }} cm
                    @endif
                </td>
                <td>
                    @if(isset($maleUser->preference->height_all) && $maleUser->preference->height_all) الجميع
                    @elseif(empty($maleUser->preference->from_height_cm) && empty($maleUser->preference->to_height_cm)) الجميع
                    @else {{ number_format($maleUser->preference->from_height_ft??0, 2) }}-{{ number_format($maleUser->preference->to_height_ft??0, 2) }} ft
                    @endif
                </td>
            </tr>
            <tr>
                <td>Weight</td>
                <td>
                    @if(isset($maleUser->preference->weight_all) && $maleUser->preference->weight_all) Any
                    @elseif(empty($maleUser->preference->from_weight_kg) && empty($maleUser->preference->to_weight_kg)) Any
                    @else {{ number_format($maleUser->preference->from_weight_kg??0, 2) }}-{{ number_format($maleUser->preference->to_weight_kg??0, 2) }} kg
                    @endif
                </td>
                 <td>
                    @if(isset($maleUser->preference->weight_all) && $maleUser->preference->weight_all) الجميع
                    @elseif(empty($maleUser->preference->from_weight_kg) && empty($maleUser->preference->to_weight_kg)) الجميع
                    @else {{ number_format($maleUser->preference->from_weight_lbs??0, 2) }}-{{ number_format($maleUser->preference->to_weight_lbs??0, 2) }} lbs
                    @endif
                </td>
            </tr>
            <tr style="display:none;">
                <td>Religious</td>
                <td>{{getRelegiousCount($maleUser->details->religious_practice??null) }}</td>
                <td>{{getRelegiousCount($maleUser->details->religious_practice??null, 'ar') }}</td>
            </tr>
            <tr>
                <td>Smoke</td>
                <td>
                    @if($maleUser->preference->smoking=="")
                        Any
                    @else
                        {{ $maleUser->preference->smoking == 1?'Yes':'No' }}
                    @endif
                </td>
                <td>
                    @if($maleUser->preference->smoking=="")
                        الجميع
                    @else
                        {{ $maleUser->preference->smoking == 1?'نعم':'لا' }}
                    @endif
                </td>
            </tr>
            <tr>
                <td>City Of Residence</td>
                <td>{{ $maleUser->preference->city_emirate?($maleUser->preference->city_emirate->name??""):"" }}</td>
                <td>{{ $maleUser->preference->city_emirate?($maleUser->preference->city_emirate->name_ar??""):"" }}</td>
            </tr>
            
            @else
            <tr>
                <td colspan="3">No preferences set</td>
            </tr>
            @endif
        </table>
    </div>

    <!-- Female User Preferences (3 Columns) -->
    <div class="section user-section">
        <div class="section-title">Female User - Preference</div>
        <table class="three-col">
            @if($femaleUser->preference)
            <tr>
                <td>Sect</td>
                <td>
                    @if($femaleUser->sects->count() > 0)
                        @foreach($femaleUser->sects as $sect)
                            {{$sect->sect?->name??''}}@if(!$loop->last), @endif
                        @endforeach
                    @else
                        Any
                    @endif
                </td>
                <td>
                    @if($femaleUser->sects->count() > 0)
                        @foreach($femaleUser->sects as $sect)
                            {{$sect->sect?->name_ar??''}}@if(!$loop->last), @endif
                        @endforeach
                    @else
                        لجميع
                    @endif
                </td>
            </tr>
            <tr>
                <td>Education</td>
                <td>
                    @if($femaleUser->educations->count() > 0)
                        @foreach($femaleUser->educations as $ed)
                            {{$ed->education?->name??''}}@if(!$loop->last), @endif
                        @endforeach
                    @else
                        Any
                    @endif
                </td>
                <td>
                    @if($femaleUser->educations->count() > 0)
                        @foreach($femaleUser->educations as $ed)
                            {{$ed->education?->name_ar??''}}@if(!$loop->last), @endif
                        @endforeach
                    @else
                        لجميع
                    @endif
                </td>
            </tr>
            <tr>
                <td>Profession</td>
                <td>
                    @if($femaleUser->professions->count() > 0)
                        @foreach($femaleUser->professions as $ed)
                            {{$ed->profession?->name??''}}@if(!$loop->last), @endif
                        @endforeach
                    @else
                        Any
                    @endif
                </td>
                <td>
                    @if($femaleUser->professions->count() > 0)
                        @foreach($femaleUser->professions as $ed)
                            {{$ed->profession?->name_ar??''}}@if(!$loop->last), @endif
                        @endforeach
                    @else
                        لجميع
                    @endif
                </td>
            </tr>
            <tr>
                <td>Marital Status</td>
                <td>
                    @if($femaleUser->maritalStatuses->count() == 0)
                    Any
                    @else
                    @foreach($femaleUser->maritalStatuses??[] as $maritalStatus)
                    {{ $maritalStatus->maritalStatus->name??'' }}@if(!$loop->last), @endif
                    @endforeach
                    @endif
                </td>
                <td>
                    @if($femaleUser->maritalStatuses->count() == 0)
                    الجميع
                    @else
                    @foreach($femaleUser->maritalStatuses??[] as $maritalStatus)
                    {{ $maritalStatus->maritalStatus->name_ar??'' }}@if(!$loop->last), @endif
                    @endforeach
                    @endif
                </td>
            </tr>
            <tr>
                <td>Dress Code</td>
                <td>
                    @if($femaleUser->dressCodes->count() == 0)
                    Any
                    @else
                    @foreach($femaleUser->dressCodes??[] as $dressCode)
                    {{ $dressCode->dressCode->name??'' }}@if(!$loop->last), @endif
                    @endforeach
                    @endif
                </td>
                <td>
                    @if($femaleUser->dressCodes->count() == 0)
                    الجميع
                    @else
                    @foreach($femaleUser->dressCodes??[] as $dressCode)
                    {{ $dressCode->dressCode->name_ar??'' }}@if(!$loop->last), @endif
                    @endforeach
                    @endif
                </td>
            </tr>
             <tr>
                <td>Height</td>
                <td>
                    @if(isset($femaleUser->preference->height_all) && $femaleUser->preference->height_all) All 
                    @elseif(empty($femaleUser->preference->from_height_cm) && empty($femaleUser->preference->to_height_cm)) Any
                    @else {{ number_format($femaleUser->preference->from_height_cm??0, 2) }}-{{ number_format($femaleUser->preference->to_height_cm??0, 2) }} cm
                    @endif
                </td>
                <td>
                    @if(isset($femaleUser->preference->height_all) && $femaleUser->preference->height_all) الجميع
                    @elseif(empty($femaleUser->preference->from_height_cm) && empty($femaleUser->preference->to_height_cm)) الجميع
                    @else {{ number_format($femaleUser->preference->from_height_ft??0, 2) }}-{{ number_format($femaleUser->preference->to_height_ft??0, 2) }} ft
                    @endif
                </td>
            </tr>
            <tr>
                <td>Weight</td>
                <td>
                    @if(isset($femaleUser->preference->weight_all) && $femaleUser->preference->weight_all) Any
                    @elseif(empty($femaleUser->preference->from_weight_kg) && empty($femaleUser->preference->to_weight_kg)) Any
                    @else {{ number_format($femaleUser->preference->from_weight_kg??0, 2) }}-{{ number_format($femaleUser->preference->to_weight_kg??0, 2) }} kg
                    @endif
                </td>
                 <td>
                    @if(isset($femaleUser->preference->weight_all) && $femaleUser->preference->weight_all) الجميع
                    @elseif(empty($femaleUser->preference->from_weight_kg) && empty($femaleUser->preference->to_weight_kg)) الجميع
                    @else {{ number_format($femaleUser->preference->from_weight_lbs??0, 2) }}-{{ number_format($femaleUser->preference->to_weight_lbs??0, 2) }} lbs
                    @endif
                </td>
            </tr>
            <tr style="display:none;">
                <td>Religious</td>
                <td>{{getRelegiousCount($femaleUser->details->religious_practice??null) }}</td>
                <td>{{getRelegiousCount($femaleUser->details->religious_practice??null, 'ar') }}</td>
            </tr>
            <tr>
                <td>Smoke</td>
                <td>
                    @if($femaleUser->preference->smoking=="")
                        Any
                    @else
                        {{ $femaleUser->preference->smoking == 1?'Yes':'No' }}
                    @endif
                </td>
                <td>
                    @if($femaleUser->preference->smoking=="")
                        الجميع
                    @else
                        {{ $femaleUser->preference->smoking == 1?'نعم':'لا' }}
                    @endif
                </td>
            </tr>
            <tr>
                <td>City Of Residence</td>
                <td>{{ $femaleUser->preference->city_emirate?($femaleUser->preference->city_emirate->name??""):"" }}</td>
                <td>{{ $femaleUser->preference->city_emirate?($femaleUser->preference->city_emirate->name_ar??""):"" }}</td>
            </tr>
            @else
            <tr>
                <td colspan="3">No preferences set</td>
            </tr>
            @endif
        </table>
    </div>

    <div class="page-break"></div>

    <!-- Male User Subscription -->
    <div class="section user-section">
        <div class="section-title">Male User - Subscription Details</div>
        <table class="two-col">
            <tr>
                <td>Plan Name</td>
                <td>{{ $maleUser->plan->name ?? 'N/A' }}</td>
            </tr>
            <tr>
                <td>Plan Type</td>
                <td>{{ ucfirst($maleUser->plan->type ?? 'N/A') }}</td>
            </tr>
            <tr>
                <td>Start Date</td>
                <td>{{ isset($maleUser->plan->created_at) ? $maleUser->plan->created_at->format('d/m/Y') : 'N/A' }}</td>
            </tr>
            <tr>
                <td>End Date</td>
                <td>{{ isset($maleUser->plan->end_date) ? \Carbon\Carbon::parse($maleUser->plan->end_date)->format('d/m/Y') : 'N/A' }}</td>
            </tr>
            <tr>
                <td>Status</td>
                <td>{{ isset($maleUser->plan) && $maleUser->plan->status == 1 ? 'Active' : 'Inactive' }}</td>
            </tr>
        </table>
    </div>

    <!-- Female User Subscription -->
    <div class="section user-section">
        <div class="section-title">Female User - Subscription Details</div>
        <table class="two-col">
            <tr>
                <td>Plan Name</td>
                <td>{{ $femaleUser->plan->name ?? 'N/A' }}</td>
            </tr>
            <tr>
                <td>Plan Type</td>
                <td>{{ ucfirst($femaleUser->plan->type ?? 'N/A') }}</td>
            </tr>
            <tr>
                <td>Start Date</td>
                <td>{{ isset($femaleUser->plan->created_at) ? $femaleUser->plan->created_at->format('d/m/Y') : 'N/A' }}</td>
            </tr>
            <tr>
                <td>End Date</td>
                <td>{{ isset($femaleUser->plan->end_date) ? \Carbon\Carbon::parse($femaleUser->plan->end_date)->format('d/m/Y') : 'N/A' }}</td>
            </tr>
            <tr>
                <td>Status</td>
                <td>{{ isset($femaleUser->plan) && $femaleUser->plan->status == 1 ? 'Active' : 'Inactive' }}</td>
            </tr>
        </table>
    </div>

    <div class="footer">
        <p>This is a system-generated document. Match Request ID: {{ $chat->id }}</p>
        <p>&copy; {{ date('Y') }} Luqia - All Rights Reserved</p>
    </div>
</body>
</html>
