@extends('layouts.admin')
@section('content')
    <style>
        .table tbody tr:last-child td,
        .table tbody tr:last-child th{
            border-bottom: none;
        }
        .card-body .table{
            margin-bottom: 0;
        }
    </style>

   <!-- start page title -->
   <div class="row">
    <div class="col-12">
        <div class="page-title-box d-sm-flex align-items-center justify-content-between bg-galaxy-transparent">
            <h4 class="mb-sm-0">Match Request Details</h4>

            <div class="page-title-right">
                <ol class="breadcrumb m-0">
                    <li class="breadcrumb-item"><a href="javascript: void(0);">Home</a></li>
                    <li class="breadcrumb-item"><a href="{{ route('admin.match.requests') }}">Match Requests</a></li>
                    <li class="breadcrumb-item active">Details</li>
                </ol>
            </div>
        </div>
    </div>
</div>
<!-- end page title -->

<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-header border-0">
                <div class="row align-items-center gy-3">
                    <div class="col-sm">
                        <h5 class="card-title mb-0">Chat Summary</h5>
                    </div>
                </div>
            </div>
            <div class="card-body">
                <table class="table table-sm">
                    <tr>
                        <td style="width: 30%;">Questions Exchanged</td>
                        <td style="width: 70%;">{{ $chat->questions_exchanged }}</td>
                    </tr>
                    <tr>
                        <td style="width: 30%;">Match Agreement Date</td>
                        <td style="width: 70%;">{{ $chat->updated_at->format('d/m/Y h:i A') }}</td>
                    </tr>
                    <tr>
                        <td style="width: 30%;">Chat Status</td>
                        <td style="width: 70%;"><span class="badge bg-success">Completed</span></td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <!-- Male User Basic Information -->
                    <div class="col-lg-6">
                        <div class="card mb-3">
                            <div class="card-header py-2" style="background-color: var(--vz-primary);">
                                <div class="d-flex align-items-center">
                                    <img src="{{ $maleUser->profile_image_url ?? asset('assets/images/default-avatar.png') }}" 
                                         alt="Male User" 
                                         class="rounded-circle me-3" 
                                         style="width: 60px; height: 60px; object-fit: cover; border: 3px solid white;">
                                    <h4 class="mb-0 text-white">Male User - Basic Information</h4>
                                </div>
                            </div>
                            <div class="card-body">
                                <table class="table table-sm">
                                    <tr>
                                        <td style="width: 30%;">Full Name</td>
                                        <td style="width: 70%;">{{ $maleUser->name }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">User ID</td>
                                        <td style="width: 70%;">{{ $maleUser->nick_name }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Email</td>
                                        <td style="width: 70%;">{{ $maleUser->email }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Phone</td>
                                        <td style="width: 70%;">{{ $maleUser->dial_code }} {{ $maleUser->phone }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Date of Birth</td>
                                        <td style="width: 70%;">{{ $maleUser->dob ?? 'N/A' }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Status</td>
                                        <td style="width: 70%;">{{ $maleUser->status == 1? 'Active':'Inactive' }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Nationality</td>
                                        <td style="width: 70%;">{{ $maleUser->nationality->name ?? 'N/A' }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Is Mother Uae Nationality</td>
                                        <td style="width: 70%;">{{ $maleUser->is_mother_uae_national?"YES":"NO" }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Is User Uae Resident</td>
                                        <td style="width: 70%;">{{ $maleUser->is_user_uae_nationality?"YES":"NO" }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Emirate</td>
                                        <td style="width: 70%;">{{ $maleUser->emirate->name ?? 'N/A' }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Registered On</td>
                                        <td style="width: 70%;">{{ $maleUser->created_at->format('d/m/y H:i A') }}</td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>

                    <!-- Female User Basic Information -->
                    <div class="col-lg-6">
                        <div class="card mb-3">
                            <div class="card-header py-2" style="background-color: var(--vz-primary);">
                                <div class="d-flex align-items-center">
                                    <img src="{{ $femaleUser->profile_image_url ?? asset('assets/images/default-avatar.png') }}" 
                                         alt="Female User" 
                                         class="rounded-circle me-3" 
                                         style="width: 60px; height: 60px; object-fit: cover; border: 3px solid white;">
                                    <h4 class="mb-0 text-white">Female User - Basic Information</h4>
                                </div>
                            </div>
                            <div class="card-body">
                                <table class="table table-sm">
                                    <tr>
                                        <td style="width: 30%;">Full Name</td>
                                        <td style="width: 70%;">{{ $femaleUser->name }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">User ID</td>
                                        <td style="width: 70%;">{{ $femaleUser->nick_name }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Email</td>
                                        <td style="width: 70%;">{{ $femaleUser->email }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Phone</td>
                                        <td style="width: 70%;">{{ $femaleUser->dial_code }} {{ $femaleUser->phone }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Date of Birth</td>
                                        <td style="width: 70%;">{{ $femaleUser->dob ?? 'N/A' }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Status</td>
                                        <td style="width: 70%;">{{ $femaleUser->status == 1? 'Active':'Inactive' }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Nationality</td>
                                        <td style="width: 70%;">{{ $femaleUser->nationality->name ?? 'N/A' }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Is Mother Uae Nationality</td>
                                        <td style="width: 70%;">{{ $femaleUser->is_mother_uae_national?"YES":"NO" }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Is User Uae Resident</td>
                                        <td style="width: 70%;">{{ $femaleUser->is_user_uae_nationality?"YES":"NO" }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Emirate</td>
                                        <td style="width: 70%;">{{ $femaleUser->emirate->name ?? 'N/A' }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%;">Registered On</td>
                                        <td style="width: 70%;">{{ $femaleUser->created_at->format('d/m/y H:i A') }}</td>
                                    </tr>
                                    @if($femaleUser->gardien_relation || $femaleUser->gardien_phone_number || $femaleUser->parent_name)
                                    <tr>
                                        <td colspan="2" class="bg-light"><strong>Guardian Information</strong></td>
                                    </tr>
                                    @if($femaleUser->parent_name)
                                    <tr>
                                        <td style="width: 30%;">Parent Name</td>
                                        <td style="width: 70%;">{{ $femaleUser->parent_name }}</td>
                                    </tr>
                                    @endif
                                    @if($femaleUser->gardien_relation)
                                    <tr>
                                        <td style="width: 30%;">Guardian Relation</td>
                                        <td style="width: 70%;">{{ $femaleUser->gardien_relation }}</td>
                                    </tr>
                                    @endif
                                    @if($femaleUser->gardien_phone_number)
                                    <tr>
                                        <td style="width: 30%;">Guardian Phone</td>
                                        <td style="width: 70%;">{{ $femaleUser->gardien_phone_dial_code }} {{ $femaleUser->gardien_phone_number }}</td>
                                    </tr>
                                    @endif
                                    @endif
                                </table>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <!-- Male User Details -->
                    <div class="col-lg-6">
                        <div class="card mb-3">
                            <div class="card-header py-2" style="background-color: var(--vz-primary);">
                                <h4 class="mb-0 text-white">Male User - Details</h4>
                            </div>
                            <div class="card-body">
                                <table class="table table-sm">
                                    @if($maleUser->details)
                                    <tr>
                                        <td style="width: 20%;">Sect</td>
                                        <td style="width: 40%;">{{ $maleUser->details->sect->name??'N/A' }}</td>
                                        <td style="width: 40%;">{{ $maleUser->details->sect->name_ar??'N/A' }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Education</td>
                                        <td style="width: 40%;">{{ $maleUser->details->education->name??'N/A' }}</td>
                                        <td style="width: 40%;">{{ $maleUser->details->education->name_ar??'N/A' }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Profession</td>
                                        <td style="width: 40%;">{{ $maleUser->details->profession->name??'N/A' }}</td>
                                        <td style="width: 40%;">{{ $maleUser->details->profession->name_ar??'N/A' }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Marital Status</td>
                                        <td style="width: 40%;">{{ $maleUser->details->maritalStatus->name??'N/A' }}</td>
                                        <td style="width: 40%;">{{ $maleUser->details->maritalStatus->name_ar??'N/A' }}</td>
                                    </tr>
                                    @foreach($maleUser->children as $ch)
                                    <tr>
                                        <td style="width: 20%;">Children Age {{$ch->age}}</td>
                                        <td style="width: 40%;">{{$ch->kid_count}}</td>
                                        <td style="width: 40%;"></td>
                                    </tr>
                                    @endforeach
                                    <tr style="display:none;">
                                        <td style="width: 20%;">Dress Code</td>
                                        <td style="width: 40%;">{{ $maleUser->details->dressCode->name??'N/A' }}</td>
                                        <td style="width: 40%;">{{ $maleUser->details->dressCode->name_ar??'N/A' }}</td>
                                    </tr>
                                    @if(isset($maleUser->details->genetic_disease) && $maleUser->details->genetic_disease == 1)
                                    <tr>
                                        <td style="width: 20%;">Genetic Disease</td>
                                        <td style="width: 40%;">Yes</td>
                                        <td style="width: 40%;">
                                            @foreach($maleUser->geneticDiseases??[] as $disease)
                                            - {{$disease->geneticDisease->name??''}} - {{$disease->geneticDisease->name_ar??''}} <br>
                                            @endforeach
                                        </td>
                                    </tr>
                                    @else
                                    <tr>
                                        <td style="width: 20%;">Genetic Disease</td>
                                        <td style="width: 40%;">No</td>
                                        <td style="width: 40%;"></td>
                                    </tr>
                                    @endif
                                    <tr>
                                        <td style="width: 20%;">Height</td>
                                        <td style="width: 40%;">{{isset($maleUser->details->height_cm)?$maleUser->details->height_cm.' cm':'N/A'}}</td>
                                        <td style="width: 40%;">{{isset($maleUser->details->height_cm)?$maleUser->details->height_ft.' ft':'N/A'}}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Weight</td>
                                        <td style="width: 40%;">{{isset($maleUser->details->weight_kg)?$maleUser->details->weight_kg.' kg':'N/A'}}</td>
                                        <td style="width: 40%;">{{isset($maleUser->details->weight_lbs)?$maleUser->details->weight_lbs.' lbs':'N/A'}}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Smoking</td>
                                        <td style="width: 40%;">{{ isset($maleUser->details->smoking) && $maleUser->details->smoking == 1 ? 'Yes' : 'No' }}</td>
                                        <td style="width: 40%;"></td>
                                    </tr>
                                    <tr style="display:none;">
                                        <td style="width: 20%;">Religious Practice</td>
                                        <td style="width: 40%;">
                                            @if(isset($maleUser->details->religious_practice))
                                                {{getRelegiousCount($maleUser->details->religious_practice??null) }}
                                            @else
                                                N/A
                                            @endif
                                        </td>
                                        <td style="width: 40%;">
                                            @if(isset($maleUser->details->religious_practice))
                                                {{getRelegiousCount($maleUser->details->religious_practice??null , 'ar') }}
                                            @else
                                                N/A
                                            @endif
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Activities</td>
                                        <td style="width: 40%;">@foreach($maleUser->activities as $activity)- {{$activity->activity->name}} @endforeach</td>
                                        <td style="width: 40%;">@foreach($maleUser->activities as $activity)- {{$activity->activity->name_ar}} @endforeach</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Sports</td>
                                        <td style="width: 40%;">@foreach($maleUser->sports as $sport)- {{$sport->sport->name}} @endforeach</td>
                                        <td style="width: 40%;">@foreach($maleUser->sports as $sport)- {{$sport->sport->name_ar}} @endforeach</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Known Language</td>
                                        <td style="width: 40%;">@foreach($maleUser->known_languages??[] as $lang) - {{$lang->language->name}} @endforeach</td>
                                        <td style="width: 40%;"></td>
                                    </tr>
                                    @if(isset($maleUser->details->maritalStatus) && $maleUser->details->maritalStatus->show_wife_children_option == true)
                                    <tr style="display:none;">
                                        <td style="width: 20%;">Wives</td>
                                        <td style="width: 40%;">{{$maleUser->details->wives??0}}</td>
                                        <td style="width: 40%;"></td>
                                    </tr>
                                    @endif
                                    @if(isset($maleUser->details->children) && $maleUser->details->children > 0)
                                    <tr>
                                        <td style="width: 20%;">Children</td>
                                        <td style="width: 40%;">{{$maleUser->details->children}}</td>
                                        <td style="width: 40%;">@foreach($maleUser->children??[] as $child) Child # {{$child->kid_count}} > {{$child->age}} year <br> @endforeach</td>
                                    </tr>
                                    @endif
                                    <tr style="display:none;">
                                        <td style="width: 20%;">About</td>
                                        <td colspan="2">{{$maleUser->details->about??'N/A'}}</td>
                                    </tr>
                                    @else
                                    <tr>
                                        <td colspan="3" class="text-center">No details available</td>
                                    </tr>
                                    @endif
                                </table>
                            </div>
                        </div>
                    </div>

                    <!-- Female User Details -->
                    <div class="col-lg-6">
                        <div class="card mb-3">
                            <div class="card-header py-2" style="background-color: var(--vz-primary);">
                                <h4 class="mb-0 text-white">Female User - Details</h4>
                            </div>
                            <div class="card-body">
                                <table class="table table-sm">
                                    @if($femaleUser->details)
                                    <tr>
                                        <td style="width: 20%;">Sect</td>
                                        <td style="width: 40%;">{{ $femaleUser->details->sect->name??'N/A' }}</td>
                                        <td style="width: 40%;">{{ $femaleUser->details->sect->name_ar??'N/A' }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Education</td>
                                        <td style="width: 40%;">{{ $femaleUser->details->education->name??'N/A' }}</td>
                                        <td style="width: 40%;">{{ $femaleUser->details->education->name_ar??'N/A' }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Profession</td>
                                        <td style="width: 40%;">{{ $femaleUser->details->profession->name??'N/A' }}</td>
                                        <td style="width: 40%;">{{ $femaleUser->details->profession->name_ar??'N/A' }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Marital Status</td>
                                        <td style="width: 40%;">{{ $femaleUser->details->maritalStatus->name??'N/A' }}</td>
                                        <td style="width: 40%;">{{ $femaleUser->details->maritalStatus->name_ar??'N/A' }}</td>
                                    </tr>
                                    @foreach($femaleUser->children as $ch)
                                    <tr>
                                        <td style="width: 20%;">Children Age {{$ch->age}}</td>
                                        <td style="width: 40%;">{{$ch->kid_count}}</td>
                                        <td style="width: 40%;"></td>
                                    </tr>
                                    @endforeach
                                    <tr>
                                        <td style="width: 20%;">Dress Code</td>
                                        <td style="width: 40%;">{{ $femaleUser->details->dressCode->name??'N/A' }}</td>
                                        <td style="width: 40%;">{{ $femaleUser->details->dressCode->name_ar??'N/A' }}</td>
                                    </tr>
                                    @if(isset($femaleUser->details->genetic_disease) && $femaleUser->details->genetic_disease == 1)
                                    <tr>
                                        <td style="width: 20%;">Genetic Disease</td>
                                        <td style="width: 40%;">Yes</td>
                                        <td style="width: 40%;">
                                            @foreach($femaleUser->geneticDiseases??[] as $disease)
                                            - {{$disease->geneticDisease->name??''}} - {{$disease->geneticDisease->name_ar??''}} <br>
                                            @endforeach
                                        </td>
                                    </tr>
                                    @else
                                    <tr>
                                        <td style="width: 20%;">Genetic Disease</td>
                                        <td style="width: 40%;">No</td>
                                        <td style="width: 40%;"></td>
                                    </tr>
                                    @endif
                                    <tr>
                                        <td style="width: 20%;">Height</td>
                                        <td style="width: 40%;">{{isset($femaleUser->details->height_cm)?$femaleUser->details->height_cm.' cm':'N/A'}}</td>
                                        <td style="width: 40%;">{{isset($femaleUser->details->height_cm)?$femaleUser->details->height_ft.' ft':'N/A'}}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Weight</td>
                                        <td style="width: 40%;">{{isset($femaleUser->details->weight_kg)?$femaleUser->details->weight_kg.' kg':'N/A'}}</td>
                                        <td style="width: 40%;">{{isset($femaleUser->details->weight_lbs)?$femaleUser->details->weight_lbs.' lbs':'N/A'}}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Smoking</td>
                                        <td style="width: 40%;">{{ isset($femaleUser->details->smoking) && $femaleUser->details->smoking == 1 ? 'Yes' : 'No' }}</td>
                                        <td style="width: 40%;"></td>
                                    </tr>
                                    <tr style="display:none;">
                                        <td style="width: 20%;">Religious Practice</td>
                                        <td style="width: 40%;">
                                            @if(isset($femaleUser->details->religious_practice))
                                                {{getRelegiousCount($femaleUser->details->religious_practice??null) }}
                                            @else
                                                N/A
                                            @endif
                                        </td>
                                        <td style="width: 40%;">
                                            @if(isset($femaleUser->details->religious_practice))
                                                {{getRelegiousCount($femaleUser->details->religious_practice??null , 'ar') }}
                                            @else
                                                N/A
                                            @endif
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Activities</td>
                                        <td style="width: 40%;">@foreach($femaleUser->activities as $activity)- {{$activity->activity->name}} @endforeach</td>
                                        <td style="width: 40%;">@foreach($femaleUser->activities as $activity)- {{$activity->activity->name_ar}} @endforeach</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Sports</td>
                                        <td style="width: 40%;">@foreach($femaleUser->sports as $sport)- {{$sport->sport->name}} @endforeach</td>
                                        <td style="width: 40%;">@foreach($femaleUser->sports as $sport)- {{$sport->sport->name_ar}} @endforeach</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Known Language</td>
                                        <td style="width: 40%;">@foreach($femaleUser->known_languages??[] as $lang) - {{$lang->language->name}} @endforeach</td>
                                        <td style="width: 40%;"></td>
                                    </tr>
                                    @if(isset($femaleUser->details->children) && $femaleUser->details->children > 0)
                                    <tr>
                                        <td style="width: 20%;">Children</td>
                                        <td style="width: 40%;">{{$femaleUser->details->children}}</td>
                                        <td style="width: 40%;">@foreach($femaleUser->children??[] as $child) Child # {{$child->kid_count}} > {{$child->age}} year <br> @endforeach</td>
                                    </tr>
                                    @endif
                                    <tr style="display:none;">
                                        <td style="width: 20%;">About</td>
                                        <td colspan="2">{{$femaleUser->details->about??'N/A'}}</td>
                                    </tr>
                                    @else
                                    <tr>
                                        <td colspan="3" class="text-center">No details available</td>
                                    </tr>
                                    @endif
                                </table>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Preferences Row -->
                <div class="row">
                    <!-- Male User Preference -->
                    <div class="col-lg-6">
                        <div class="card mb-3">
                            <div class="card-header py-2" style="background-color: var(--vz-primary);">
                                <h4 class="mb-0 text-white">Male User - Preference</h4>
                            </div>
                            <div class="card-body">
                                <table class="table table-sm">
                                    <tr>
                                        <td style="width: 20%;">Sect </td>
                                        <td style="width: 40%;">
                                            @if($maleUser->sects->count() > 0)
                                                @foreach($maleUser->sects as $sect)
                                                    {{$sect->sect?->name??''}}@if(!$loop->last), @endif 
                                                @endforeach
                                            @else
                                                Any
                                            @endif
                                        <td style="width: 40%;">
                                            @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 style="width: 20%;">Education</td>
                                        <td style="width: 40%;">
                                            @if($maleUser->educations->count() > 0)
                                                @foreach($maleUser->educations as $ed)
                                                    {{$ed->education?->name??''}}@if(!$loop->last), @endif 
                                                @endforeach
                                            @else
                                                Any
                                            @endif
                                        <td style="width: 40%;">
                                            @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 style="width: 20%;">Profession</td>
                                        <td style="width: 40%;">
                                            @if($maleUser->professions->count() > 0)
                                                @foreach($maleUser->professions as $ed)
                                                    {{$ed->profession?->name??''}}@if(!$loop->last), @endif  
                                                @endforeach
                                            @else
                                                Any
                                            @endif
                                        <td style="width: 40%;">
                                            @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 style="width: 20%;">Marital Status</td>
                                        <td style="width: 40%;">
                                            @if($maleUser->maritalStatuses->count() == 0)
                                            Any
                                            @else
                                            @foreach($maleUser->maritalStatuses??[] as $maritalStatus)
                                            {{ $maritalStatus->maritalStatus->name??'' }}@if(!$loop->last), @endif
                                            @endforeach
                                            @endif
                                         </td>
                                        <td style="width: 40%;">
                                            @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 style="width: 20%;">Dress Code</td>
                                        <td style="width: 40%;">
                                            @if($maleUser->dressCodes->count() == 0)
                                            Any
                                            @else
                                            @foreach($maleUser->dressCodes??[] as $dressCode)
                                            {{ $dressCode->dressCode->name??'' }}@if(!$loop->last), @endif
                                            @endforeach
                                            @endif
                                         </td>
                                        <td style="width: 40%;">
                                            @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 style="width: 20%;">Height</td>
                                        @if(isset($maleUser->preference->height_all) && $maleUser->preference->height_all)
                                        <td style="width: 40%;">All</td>
                                        <td style="width: 40%;">الجميع</td>
                                        @else
                                        @if(empty($maleUser->preference->from_height_cm) && empty($maleUser->preference->to_height_cm))
                                        <td style="width: 40%;">Any</td>
                                        @else
                                            <td style="width: 40%;">{{ number_format($maleUser->preference->from_height_cm??0, 2) }}-{{ number_format($maleUser->preference->to_height_cm??0, 2) }} cm</td>
                                        @endif
                                        @if(empty($maleUser->preference->from_height_ft) && empty($maleUser->preference->to_height_ft))
                                        <td style="width: 40%;">الجميع</td>
                                        @else
                                            <td style="width: 40%;">{{ number_format($maleUser->preference->from_height_ft??0, 2) }}-{{ number_format($maleUser->preference->to_height_ft??0, 2) }} ft</td>
                                        @endif
                                        @endif
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Weight</td>
                                        @if(isset($maleUser->preference->weight_all) && $maleUser->preference->weight_all)
                                        <td style="width: 40%;">Any</td>
                                        <td style="width: 40%;">الجميع</td>
                                        @else
                                        @if(empty($maleUser->preference->from_weight_kg) && empty($maleUser->preference->to_weight_kg))
                                        <td style="width: 40%;">Any</td>
                                        @else
                                            <td style="width: 40%;">{{ number_format($maleUser->preference->from_weight_kg??0, 2) }}-{{ number_format($maleUser->preference->to_weight_kg??0, 2) }} kg</td>
                                        @endif
                                        @if(empty($maleUser->preference->from_weight_lbs) && empty($maleUser->preference->to_weight_lbs))
                                        <td style="width: 40%;">الجميع</td>
                                        @else
                                            <td style="width: 40%;">{{ number_format($maleUser->preference->from_weight_lbs??0, 2) }}-{{ number_format($maleUser->preference->to_weight_lbs??0, 2) }} lbs</td>
                                        @endif
                                        @endif
                                    </tr>
                                    <tr style="display:none;">
                                        <td style="width: 20%;">Religious</td>
                                        <td style="width: 40%;">{{getRelegiousCount($maleUser->details->religious_practice??null) }}</td>
                                        <td style="width: 40%;">{{getRelegiousCount($maleUser->details->religious_practice??null, 'ar') }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Smoke</td>
                                        @if($maleUser->preference->smoking=="")
                                        <td style="width: 40%;">Any</td>
                                        <td style="width: 40%;">الجميع</td>
                                        @else
                                        <td style="width: 40%;">{{ $maleUser->preference->smoking == 1?'Yes':'No' }}</td>
                                        <td style="width: 40%;">{{ $maleUser->preference->smoking == 1?'نعم':'لا' }}</td>
                                        @endif
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">City Of Residence</td>
                                        <td style="width: 40%;">{{ $maleUser->preference->city_emirate?($maleUser->preference->city_emirate->name??""):"" }}</td>
                                        <td style="width: 40%;">{{ $maleUser->preference->city_emirate?($maleUser->preference->city_emirate->name_ar??""):"" }}</td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>

                    <!-- Female User Preference -->
                    <div class="col-lg-6">
                        <div class="card mb-3">
                            <div class="card-header py-2" style="background-color: var(--vz-primary);">
                                <h4 class="mb-0 text-white">Female User - Preference</h4>
                            </div>
                            <div class="card-body">
                                <table class="table table-sm">
                                    <tr>
                                        <td style="width: 20%;">Sect </td>
                                        <td style="width: 40%;">
                                            @if($femaleUser->sects->count() > 0)
                                                @foreach($femaleUser->sects as $sect)
                                                    {{$sect->sect?->name??''}}@if(!$loop->last), @endif 
                                                @endforeach
                                            @else
                                                Any
                                            @endif
                                        <td style="width: 40%;">
                                            @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 style="width: 20%;">Education</td>
                                        <td style="width: 40%;">
                                            @if($femaleUser->educations->count() > 0)
                                                @foreach($femaleUser->educations as $ed)
                                                    {{$ed->education?->name??''}}@if(!$loop->last), @endif 
                                                @endforeach
                                            @else
                                                Any
                                            @endif
                                        <td style="width: 40%;">
                                            @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 style="width: 20%;">Profession</td>
                                        <td style="width: 40%;">
                                            @if($femaleUser->professions->count() > 0)
                                                @foreach($femaleUser->professions as $ed)
                                                    {{$ed->profession?->name??''}}@if(!$loop->last), @endif  
                                                @endforeach
                                            @else
                                                Any
                                            @endif
                                        <td style="width: 40%;">
                                            @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 style="width: 20%;">Marital Status</td>
                                        <td style="width: 40%;">
                                            @if($femaleUser->maritalStatuses->count() == 0)
                                            Any
                                            @else
                                            @foreach($femaleUser->maritalStatuses??[] as $maritalStatus)
                                            {{ $maritalStatus->maritalStatus->name??'' }}@if(!$loop->last), @endif
                                            @endforeach
                                            @endif
                                         </td>
                                        <td style="width: 40%;">
                                            @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 style="width: 20%;">Dress Code</td>
                                        <td style="width: 40%;">
                                            @if($femaleUser->dressCodes->count() == 0)
                                            Any
                                            @else
                                            @foreach($femaleUser->dressCodes??[] as $dressCode)
                                            {{ $dressCode->dressCode->name??'' }}@if(!$loop->last), @endif
                                            @endforeach
                                            @endif
                                         </td>
                                        <td style="width: 40%;">
                                            @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 style="width: 20%;">Height</td>
                                        @if(isset($femaleUser->preference->height_all) && $femaleUser->preference->height_all)
                                        <td style="width: 40%;">All</td>
                                        <td style="width: 40%;">الجميع</td>
                                        @else
                                        @if(empty($femaleUser->preference->from_height_cm) && empty($femaleUser->preference->to_height_cm))
                                        <td style="width: 40%;">Any</td>
                                        @else
                                            <td style="width: 40%;">{{ number_format($femaleUser->preference->from_height_cm??0, 2) }}-{{ number_format($femaleUser->preference->to_height_cm??0, 2) }} cm</td>
                                        @endif
                                        @if(empty($femaleUser->preference->from_height_ft) && empty($femaleUser->preference->to_height_ft))
                                        <td style="width: 40%;">الجميع</td>
                                        @else
                                            <td style="width: 40%;">{{ number_format($femaleUser->preference->from_height_ft??0, 2) }}-{{ number_format($femaleUser->preference->to_height_ft??0, 2) }} ft</td>
                                        @endif
                                        @endif
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Weight</td>
                                        @if(isset($femaleUser->preference->weight_all) && $femaleUser->preference->weight_all)
                                        <td style="width: 40%;">Any</td>
                                        <td style="width: 40%;">الجميع</td>
                                        @else
                                        @if(empty($femaleUser->preference->from_weight_kg) && empty($femaleUser->preference->to_weight_kg))
                                        <td style="width: 40%;">Any</td>
                                        @else
                                            <td style="width: 40%;">{{ number_format($femaleUser->preference->from_weight_kg??0, 2) }}-{{ number_format($femaleUser->preference->to_weight_kg??0, 2) }} kg</td>
                                        @endif
                                        @if(empty($femaleUser->preference->from_weight_lbs) && empty($femaleUser->preference->to_weight_lbs))
                                        <td style="width: 40%;">الجميع</td>
                                        @else
                                            <td style="width: 40%;">{{ number_format($femaleUser->preference->from_weight_lbs??0, 2) }}-{{ number_format($femaleUser->preference->from_weight_lbs??0, 2) }} lbs</td>
                                        @endif
                                        @endif
                                    </tr>
                                    <tr style="display:none;">
                                        <td style="width: 20%;">Religious</td>
                                        <td style="width: 40%;">{{getRelegiousCount($femaleUser->details->religious_practice??null) }}</td>
                                        <td style="width: 40%;">{{getRelegiousCount($femaleUser->details->religious_practice??null, 'ar') }}</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">Smoke</td>
                                        @if($femaleUser->preference->smoking=="")
                                        <td style="width: 40%;">Any</td>
                                        <td style="width: 40%;">الجميع</td>
                                        @else
                                        <td style="width: 40%;">{{ $femaleUser->preference->smoking == 1?'Yes':'No' }}</td>
                                        <td style="width: 40%;">{{ $femaleUser->preference->smoking == 1?'نعم':'لا' }}</td>
                                        @endif
                                    </tr>
                                    <tr>
                                        <td style="width: 20%;">City Of Residence</td>
                                        <td style="width: 40%;">{{ $femaleUser->preference->city_emirate?($femaleUser->preference->city_emirate->name??""):"" }}</td>
                                        <td style="width: 40%;">{{ $femaleUser->preference->city_emirate?($femaleUser->preference->city_emirate->name_ar??""):"" }}</td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Subscription Details Row -->
                <div class="row">
                    <!-- Male User Subscription -->
                    <div class="col-lg-6">
                        <div class="card mb-3">
                            <div class="card-header py-2" style="background-color: var(--vz-primary);">
                                <h4 class="mb-0 text-white">Male User - Subscription Details</h4>
                            </div>
                            <div class="card-body">
                                <table class="table table-sm">
                                    <tr>
                                        <td style="width: 30%;">Plan Name</td>
                                        <td style="width: 70%;">{{ $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>
                        </div>
                    </div>

                    <!-- Female User Subscription -->
                    <div class="col-lg-6">
                        <div class="card mb-3">
                            <div class="card-header py-2" style="background-color: var(--vz-primary);">
                                <h4 class="mb-0 text-white">Female User - Subscription Details</h4>
                            </div>
                            <div class="card-body">
                                <table class="table table-sm">
                                    <tr>
                                        <td style="width: 30%;">Plan Name</td>
                                        <td style="width: 70%;">{{ $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>
                    </div>
                </div>

                <!-- Back Button -->
                <div class="hstack gap-2 justify-content-between mt-3">
                    <a href="{{ route('admin.match.requests') }}" class="btn btn-success">Back to Match Requests</a>
                    <a href="{{ route('admin.match.requests.download_pdf', $chat->id) }}" class="btn btn-primary">
                        <i class="ri-download-2-line me-1"></i> Download PDF
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>

@endsection
