File size: 65,312 Bytes
38fa174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d1ee381
38fa174
 
d1ee381
 
 
38fa174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
<!-- Loader Overlay -->
<div class="loader-overlay" *ngIf="loading">
  <div class="loader-container">
    <img src="assets/Loader.gif" alt="Loading..." style="width:50%;height:50%;display:block;margin:0 auto 25px;" />
  </div>
</div>

<!-- Main Content -->
<div *ngIf="!loading" class="main-container">
  <!-- ENHANCED HEADER BAR -->
  <div class="header-bar">
    <div class="header-left">

      <!-- Enhanced Mode Toggle -->
      <div class="mode-toggle">
        <button class="mode-btn"

                [class.active]="mode === 'character'"

                (click)="sortCharacterwise()">
          Character
          <span class="mode-badge" *ngIf="mode === 'character'">βœ“</span>
        </button>
        <button class="mode-btn"

                [class.active]="mode === 'expectation-only'"

                (click)="sortByExpectationOnly()">
          Expectation
          <span class="mode-badge" *ngIf="mode === 'expectation-only'">βœ“</span>
          <!--<span *ngIf="mode === 'expectation-only'">

            <span class="badge-info">Exact Matches: {{compatibilityAnalysis?.totalExactMatches || 0}}</span>

            <span class="badge-info">Differences: {{compatibilityAnalysis?.totalDifferences || 0}}</span>

          </span>-->
        </button>
        <button class="mode-btn"

                [class.active]="mode === 'expectation'"

                (click)="sortByExpectation()">
          Expectation with Character
          <span class="mode-badge" *ngIf="mode === 'expectation'">βœ“</span>
          <!--<span *ngIf="mode === 'expectation'">

            <span class="badge-info">Exact Matches: {{compatibilityAnalysis?.totalExactMatches || 0}}</span>

            <span class="badge-info">Differences: {{compatibilityAnalysis?.totalDifferences || 0}}</span>

          </span>-->
        </button>
      </div>


      <!-- App Brand -->
      <div class="app-brand">
        <!-- Enhanced Results Info -->
        <!--<div class="results-info">

          <span class="results-count">🎯 {{ displayedMatches.length }} Matches Found</span>

          <span class="mode-indicator">

            <span class="mode-dot"

                  [class.expectation-only]="mode === 'expectation-only'"

                  [class.expectation]="mode === 'expectation'"

                  [class.character]="mode === 'character'"></span>

            <span *ngIf="mode === 'expectation-only'">Pure Expectation Matching</span>

            <span *ngIf="mode === 'character'">Pure Character Matching</span>

            <span *ngIf="mode === 'expectation'">Combined Matching</span>

          </span>

        </div>-->
      </div>

    </div>

    <div class="header-right">
      <!-- Enhanced Search Section -->
      <div class="search-section">
        <div class="search-box">
          <input type="text" placeholder="Search profiles..."

                 [(ngModel)]="searchTerm" (input)="onSearchChange()">
          <span class="search-icon">πŸ”</span>
        </div>
      </div>

      <!-- Enhanced Like Section -->
      <div class="like-section" (click)="toggleLikedDropdown($event)">
        <div class="heart-container">
          ❀️
          <span class="like-count">{{ likedProfiles.length }}</span>
        </div>
        <div class="liked-dropdown" [class.show]="showLikedDropdown">
          <div class="dropdown-header">
            <h4>Liked Profiles</h4>
          </div>
          <ul>
            <li *ngFor="let profile of likedProfiles" class="liked-profile-item">
              <img [src]="profile.photo_url" [alt]="profile.name" class="liked-profile-img">
              <span>{{ profile.name }}</span>
            </li>
            <li *ngIf="likedProfiles.length === 0" class="no-likes">No liked profiles yet</li>
          </ul>
        </div>
      </div>
    </div>
  </div>

  <!-- MAIN LAYOUT -->
  <div class="main-layout">
    <!-- ENHANCED USER PANEL -->
    <div class="user-panel">
      <div class="user-header">
        <div class="user-photo-container">
          <img [src]="userPhoto" class="user-photo" alt="User Photo">
          <div class="online-status"></div>
        </div>
        <div class="user-info">
          <h3 class="user-name">{{ userName }}</h3>
          <p class="user-city">πŸ“ {{ userCity }}</p>
        </div>
      </div>

      <!-- Enhanced User Stats -->
      <div class="user-stats">
        <div class="stat-item">
          <div class="stat-value">{{ totalMatches }}</div>
          <div class="stat-label">Total Matches</div>
        </div>
        <div class="stat-item">
          <div class="stat-value">{{ likedProfiles.length }}</div>
          <div class="stat-label">Liked Profiles</div>
        </div>
        <!--<div class="stat-item">

          <div class="stat-value">{{ userProfileCompletion }}</div>

          <div class="stat-label">Profile Score</div>

        </div>-->
      </div>

      <!-- Enhanced Profile Completion -->
      <!--<div class="profile-completion">-->
      <!--<div class="completion-header">

        <span>Profile Completion</span>

        <span class="completion-percent">{{ userProfileCompletion }}%</span>

      </div>-->
      <!--<div class="progress-bar-user">

          <div class="progress-fill" [style.width]="userProfileCompletion + '%'"></div>

        </div>

      </div>-->
      <!-- Enhanced Edit Button -->
    <button class="edit-btn" (click)="openEditModal()">
      <span class="btn-icon">βš™οΈ</span>
      View Your Profile
    </button>    </div>

    <!-- ENHANCED MATCHING CONTAINER -->
    <div class="matching-container">
      <div class="matching-header">
        <!-- ENHANCED HEADER TOP ROW -->
        <div class="header-top-row">
          <div class="range-filter">
            <!-- Range Selector -->
            <select [(ngModel)]="selectedRange" class="range-select" (change)="onRangeChange()">
              <option *ngFor="let range of availableRanges" [value]="range">
                {{ range === 'all' ? 'All Scores' : range === 'below_60' ? 'Below 60%' : range + '%' }}
              </option>
            </select>

            <!-- Enhanced Filter Group - Only show in Character mode -->
            <div class="filter-group" *ngIf="mode === 'character' && displayedMatches.length > 0">
              <!-- Location Filter -->
              <select [(ngModel)]="selectedLocation" class="filter-select">
                <option value="">πŸ“ All Locations</option>
                <option *ngFor="let location of availableLocations" [value]="location">
                  {{ location }}
                </option>
              </select>
              <!-- Profession Filter -->
              <select [(ngModel)]="selectedProfession" class="filter-select">
                <option value="">πŸ’Ό All Professions</option>
                <option *ngFor="let profession of availableProfessions" [value]="profession">
                  {{ profession }}
                </option>
              </select>
              <!-- Education Filter -->
              <select [(ngModel)]="selectedEducation" class="filter-select">
                <option value="">πŸŽ“ All Education</option>
                <option *ngFor="let education of availableEducationLevels" [value]="education">
                  {{ education }}
                </option>
              </select>
              <!-- Age Range Filter -->
              <select [(ngModel)]="selectedAgeRange" class="filter-select">
                <option value="">πŸ‘€ All Ages</option>
                <option *ngFor="let ageRange of availableAgeRanges" [value]="ageRange">
                  {{ ageRange }}
                </option>
              </select>
              <!-- Religion Filter -->
              <select [(ngModel)]="selectedReligion" class="filter-select" *ngIf="availableReligions.length > 0">
                <option value="">πŸ™ All Religions</option>
                <option *ngFor="let religion of availableReligions" [value]="religion">
                  {{ religion }}
                </option>
              </select>
            </div>

            <!-- Enhanced Filter Actions - Only show in Character mode -->
            <div class="filter-actions" *ngIf="mode === 'character' && displayedMatches.length > 0">
              <button class="filter-btn primary" (click)="applyFilters()">
                <span class="btn-text">Apply Filters</span>
                <span class="btn-icon">⚑</span>
              </button>
              <button class="filter-btn secondary" (click)="clearFilters()"

                      *ngIf="selectedLocation || selectedProfession || selectedEducation || selectedReligion || selectedAgeRange">
                <span class="btn-text">Clear All</span>
                <span class="btn-icon">❌</span>
              </button>
            </div>
          </div>
        </div>
      </div>

      <!-- GRID VIEW -->
      <div class="grid-view" id="profilesContainer">
        <!-- Minimalist Spinner -->
        <div *ngIf="displayedMatches.length === 0 && !loading" class="loading-animation">
          <div class="elegant-spinner">
            <div class="spinner-dots">
              <div class="dot"></div>
              <div class="dot"></div>
              <div class="dot"></div>
              <div class="dot"></div>
            </div>
            <div class="spinner-text" style="color: #f3a54c; font-weight:600;">Finding your perfect matches...</div>
          </div>
        </div>

  <!-- Profile Cards -->
        <!--<div *ngFor="let profile of displayedMatches"

             class="profile-card"

             [class.high-match]="((profile.match_score ?? profile.score ?? 0) >= 80)"

             (click)="openProfileModal(profile)">-->
        <div *ngFor="let profile of displayedMatches"

             class="profile-card">
          <div class="card-header">
            <div class="image-wrapper">
              <div class="online-dot" *ngIf="profile.isOnline"></div>
              <img [src]="profile.photo_url" [alt]="profile.name"

                   (error)="handleImageError($event, profile)">
              <span class="badge">{{ profile.match_score ?? profile.score ?? 0 }}%</span>
            </div>

            <div class="profile-basic-info">
              <h3 class="profile-name">{{ profile.name }}</h3>
              <p class="profile-details">{{ profile.age }} β€’ {{ profile.city }}</p>
              <p class="profession">{{ profile.job }}</p>
            </div>
          </div>

          <div class="compatibility-bar">
            <div class="progress-bar">
              <div class="progress-bar-inner" [style.width]="(profile.match_score ?? profile.score ?? 0) + '%'">
              </div>
            </div>
            <span class="score-text">{{ profile.match_score ?? profile.score ?? 0 }}% Match</span>
          </div>

          <div class="actions">
            <button class="action-btn like"

                    [class.liked]="isLiked(profile)"

                    (click)="$event.stopPropagation(); toggleLike(profile)">
              ❀️
            </button>
            <button class="action-btn chat"

                    (click)="$event.stopPropagation(); openChat(profile)">
              πŸ’¬
            </button>
            <button class="action-btn view"

                    (click)="$event.stopPropagation(); openProfileModal(profile)">
              πŸ‘οΈ
            </button>
          </div>
        </div>
      </div>
    </div>
  </div>

  <!-- PROFILE MODAL -->
  <div class="modal" [class.show]="showProfileModal">
    <div class="modal-content profile-modal" *ngIf="selectedProfile">
      <span class="close" (click)="closeModal()">&times;</span>

      <!-- User Info Section -->
      <div class="user-info-section" *ngIf="showUserInfo && userProfileData">
        <div class="user-info-header">
          <h3>Your Complete Profile Information</h3>
          <button class="close-user-info" (click)="toggleUserInfo()">βœ–</button>
        </div>

        <div class="user-info-content scrollable-content">
          <!-- Basic User Info -->
          <div class="user-basic-info">
            <img [src]="userPhoto" [alt]="userName" class="user-info-img">
            <div class="user-info-details">
              <h4>{{ userName }}</h4>
              <p>πŸ“ {{ userCity }}</p>
              <!--<p class="profile-completion">Profile Completion: {{ userProfileCompletion }}%</p>-->
            </div>
          </div>

          <!-- Current Matching Mode -->
          <div class="matching-mode-info">
            <h5>Current Matching Mode:</h5>
            <div class="mode-indicator">
              <span class="mode-dot"

                    [class.expectation-only]="mode === 'expectation-only'"

                    [class.expectation]="mode === 'expectation'"

                    [class.character]="mode === 'character'"></span>
              <span *ngIf="mode === 'expectation-only'">Pure Expectation Matching</span>
              <span *ngIf="mode === 'character'">Pure Character Matching</span>
              <span *ngIf="mode === 'expectation'">Expectation + Character Refinement</span>
            </div>
          </div>

          <!-- Full Profile Details -->
          <div class="profile-details-container">
            <!-- Basic Information Section -->
            <div class="section" *ngIf="userProfileData.gender || userProfileData.marital_status || userProfileData.date_of_birth || userProfileData.height || userProfileData.skin_tone || userProfileData.blood_group">
              <h4>Basic Information</h4>
              <div class="details-grid">
                <div *ngIf="userProfileData.gender" class="detail-item">
                  <span class="detail-label">Gender</span>
                  <span class="detail-value">{{ userProfileData.gender }}</span>
                </div>
                <div *ngIf="userProfileData.marital_status" class="detail-item">
                  <span class="detail-label">Marital Status</span>
                  <span class="detail-value">{{ userProfileData.marital_status }}</span>
                </div>
                <div *ngIf="userProfileData.date_of_birth" class="detail-item">
                  <span class="detail-label">Date of Birth</span>
                  <span class="detail-value">{{ userProfileData.date_of_birth }}</span>
                </div>
                <div *ngIf="userProfileData.height" class="detail-item">
                  <span class="detail-label">Height</span>
                  <span class="detail-value">{{ userProfileData.height }}</span>
                </div>
                <div *ngIf="userProfileData.skin_tone" class="detail-item">
                  <span class="detail-label">Skin Tone</span>
                  <span class="detail-value">{{ userProfileData.skin_tone }}</span>
                </div>
                <div *ngIf="userProfileData.blood_group" class="detail-item">
                  <span class="detail-label">Blood Group</span>
                  <span class="detail-value">{{ userProfileData.blood_group }}</span>
                </div>
              </div>
            </div>

            <!-- Location & Background Section -->
            <div class="section" *ngIf="userProfileData.current_city || userProfileData.country || userProfileData.religion || userProfileData.languages_spoken || userProfileData.dual_citizenship">
              <h4>Location & Background</h4>
              <div class="details-grid">
                <div *ngIf="userProfileData.current_city" class="detail-item">
                  <span class="detail-label">Current City</span>
                  <span class="detail-value">{{ userProfileData.current_city }}</span>
                </div>
                <div *ngIf="userProfileData.country" class="detail-item">
                  <span class="detail-label">Country</span>
                  <span class="detail-value">{{ userProfileData.country }}</span>
                </div>
                <div *ngIf="userProfileData.religion" class="detail-item">
                  <span class="detail-label">Religion</span>
                  <span class="detail-value">{{ userProfileData.religion }}</span>
                </div>
                <div *ngIf="userProfileData.languages_spoken" class="detail-item">
                  <span class="detail-label">Languages Spoken</span>
                  <span class="detail-value">{{ userProfileData.languages_spoken }}</span>
                </div>
                <div *ngIf="userProfileData.dual_citizenship" class="detail-item">
                  <span class="detail-label">Dual Citizenship</span>
                  <span class="detail-value">{{ userProfileData.dual_citizenship }}</span>
                </div>
              </div>
            </div>

            <!-- Education & Career Section -->
            <div class="section" *ngIf="userProfileData.education_level || userProfileData.field_of_study || userProfileData.employment_status || userProfileData.job_role || userProfileData.work_experience_years || userProfileData.career_aspirations || userProfileData.income_range">
              <h4>Education & Career</h4>
              <div class="details-grid">
                <div *ngIf="userProfileData.education_level" class="detail-item">
                  <span class="detail-label">Education Level</span>
                  <span class="detail-value">{{ userProfileData.education_level }}</span>
                </div>
                <div *ngIf="userProfileData.field_of_study" class="detail-item">
                  <span class="detail-label">Field of Study</span>
                  <span class="detail-value">{{ userProfileData.field_of_study }}</span>
                </div>
                <div *ngIf="userProfileData.employment_status" class="detail-item">
                  <span class="detail-label">Employment Status</span>
                  <span class="detail-value">{{ userProfileData.employment_status }}</span>
                </div>
                <div *ngIf="userProfileData.job_role" class="detail-item">
                  <span class="detail-label">Profession</span>
                  <span class="detail-value">{{ userProfileData.job_role }}</span>
                </div>
                <div *ngIf="userProfileData.work_experience_years" class="detail-item">
                  <span class="detail-label">Work Experience</span>
                  <span class="detail-value">{{ userProfileData.work_experience_years }}</span>
                </div>
                <div *ngIf="userProfileData.career_aspirations" class="detail-item">
                  <span class="detail-label">Career Aspirations</span>
                  <span class="detail-value">{{ userProfileData.career_aspirations }}</span>
                </div>
                <div *ngIf="userProfileData.income_range" class="detail-item">
                  <span class="detail-label">Income Range</span>
                  <span class="detail-value">{{ userProfileData.income_range }}</span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="modal-header">
        <img [src]="selectedProfile.photo_url" [alt]="selectedProfile.name"

             (error)="handleImageError($event, selectedProfile)" class="modal-profile-img">
        <div class="modal-profile-info">
          <h2>{{ selectedProfile.name }}</h2>
          <p class="modal-subtitle">{{ selectedProfile.age }} β€’ {{ selectedProfile.city }}</p>
          <div class="match-score-large">
            {{ selectedProfile.match_score ?? selectedProfile.score ?? 0 }}% Match
          </div>
        </div>
      </div>

      <!-- TAB NAVIGATION -->
      <div class="modal-tabs">
        <button class="tab-btn"

                [class.active]="activeTab === 'details'"

                (click)="setActiveTab('details')">
          πŸ“‹ Details
        </button>
        <button class="tab-btn"

                [class.active]="activeTab === 'compatibility'"

                (click)="setActiveTab('compatibility')">
          πŸ” Compatibility Analysis
        </button>
      </div>

      <div class="modal-body">
        <!-- DETAILS TAB CONTENT -->
        <div class="tab-content" [class.active]="activeTab === 'details'">

          <!-- Basic Information Section -->
          <div class="section">
            <h4>Basic Information</h4>
            <div class="details-grid">
              <div *ngIf="selectedProfile.gender" class="detail-item">
                <span class="detail-label">Gender</span>
                <span class="detail-value">{{ selectedProfile.gender }}</span>
              </div>
              <div *ngIf="selectedProfile.marital_status" class="detail-item">
                <span class="detail-label">Marital Status</span>
                <span class="detail-value">{{ selectedProfile.marital_status }}</span>
              </div>
              <div *ngIf="selectedProfile.date_of_birth" class="detail-item">
                <span class="detail-label">Date of Birth</span>
                <span class="detail-value">{{ selectedProfile.date_of_birth }}</span>
              </div>
              <div *ngIf="selectedProfile.height" class="detail-item">
                <span class="detail-label">Height</span>
                <span class="detail-value">{{ selectedProfile.height }}</span>
              </div>
              <div *ngIf="selectedProfile.skin_tone" class="detail-item">
                <span class="detail-label">Skin Tone</span>
                <span class="detail-value">{{ selectedProfile.skin_tone }}</span>
              </div>
              <div *ngIf="selectedProfile.blood_group" class="detail-item">
                <span class="detail-label">Blood Group</span>
                <span class="detail-value">{{ selectedProfile.blood_group }}</span>
              </div>
            </div>
          </div>

          <!-- Location & Background Section -->
          <div class="section">
            <h4>Location & Background</h4>
            <div class="details-grid">
              <div *ngIf="selectedProfile.current_city" class="detail-item">
                <span class="detail-label">Current City</span>
                <span class="detail-value">{{ selectedProfile.current_city }}</span>
              </div>
              <div *ngIf="selectedProfile.country" class="detail-item">
                <span class="detail-label">Country</span>
                <span class="detail-value">{{ selectedProfile.country }}</span>
              </div>
              <div *ngIf="selectedProfile.religion" class="detail-item">
                <span class="detail-label">Religion</span>
                <span class="detail-value">{{ selectedProfile.religion }}</span>
              </div>
              <div *ngIf="selectedProfile.languages_spoken" class="detail-item">
                <span class="detail-label">Languages Spoken</span>
                <span class="detail-value">{{ selectedProfile.languages_spoken }}</span>
              </div>
              <div *ngIf="selectedProfile.dual_citizenship" class="detail-item">
                <span class="detail-label">Dual Citizenship</span>
                <span class="detail-value">{{ selectedProfile.dual_citizenship }}</span>
              </div>
            </div>
          </div>

          <!-- Education & Career Section -->
          <div class="section">
            <h4>Education & Career</h4>
            <div class="details-grid">
              <div *ngIf="selectedProfile.education_level" class="detail-item">
                <span class="detail-label">Education Level</span>
                <span class="detail-value">{{ selectedProfile.education_level }}</span>
              </div>
              <div *ngIf="selectedProfile.field_of_study" class="detail-item">
                <span class="detail-label">Field of Study</span>
                <span class="detail-value">{{ selectedProfile.field_of_study }}</span>
              </div>
              <div *ngIf="selectedProfile.employment_status" class="detail-item">
                <span class="detail-label">Employment Status</span>
                <span class="detail-value">{{ selectedProfile.employment_status }}</span>
              </div>
              <div *ngIf="selectedProfile.job_role" class="detail-item">
                <span class="detail-label">Profession</span>
                <span class="detail-value">{{ selectedProfile.job_role }}</span>
              </div>
              <div *ngIf="selectedProfile.work_experience_years" class="detail-item">
                <span class="detail-label">Work Experience</span>
                <span class="detail-value">{{ selectedProfile.work_experience_years }}</span>
              </div>
              <div *ngIf="selectedProfile.career_aspirations" class="detail-item">
                <span class="detail-label">Career Aspirations</span>
                <span class="detail-value">{{ selectedProfile.career_aspirations }}</span>
              </div>
              <div *ngIf="selectedProfile.income_range" class="detail-item">
                <span class="detail-label">Income Range</span>
                <span class="detail-value">{{ selectedProfile.income_range }}</span>
              </div>
            </div>
          </div>
        </div>

        <!-- COMPATIBILITY ANALYSIS TAB CONTENT -->
        <div class="tab-content" [class.active]="activeTab === 'compatibility'">

          <!-- ENHANCED COMPATIBILITY ANALYSIS SECTION -->
          <div class="compatibility-section" *ngIf="activeTab === 'compatibility'">

            <!-- Mode-specific header -->
            <!--<div class="mode-specific-header">

              <div class="mode-info-banner">

                <span class="mode-icon"

                      [class.character]="mode === 'character'"

                      [class.combined]="mode === 'expectation'"

                      [class.expectation-only]="mode === 'expectation-only'">

                  {{ mode === 'character' ? '🧠' : mode === 'expectation' ? '⚑' : '🎯' }}

                </span>

                <div class="mode-info-content">-->
                  <!-- Combined mode tab buttons only -->
                  <!--<div class="combined-mode-tabs" *ngIf="mode === 'expectation'">

                    <nav class="combined-tabs-nav">

                      <button class="combined-tab"

                              [class.active]="subTab === 'expectation'"

                              (click)="subTab = 'expectation'">

                        <span class="tab-icon">πŸ“Š</span>

                        <span class="tab-text">Expectation Analysis</span>

                      </button>

                      <div class="tab-separator">

                        <span class="separator-line"></span>

                        <span class="separator-plus">+</span>

                        <span class="separator-line"></span>

                      </div>

                      <button class="combined-tab"

                              [class.active]="subTab === 'character'"

                              (click)="subTab = 'character'">

                        <span class="tab-icon">🧬</span>

                        <span class="tab-text">Character Analysis</span>

                      </button>

                    </nav>

                  </div>-->

                  <!-- Other modes -->
                  <!--<div *ngIf="mode !== 'expectation'">

                    <h5>{{ getModeDisplayName() }} Analysis</h5>

                    <p *ngIf="mode === 'expectation-only'">

                      Pure expectation matching based on profile criteria

                    </p>

                    <p *ngIf="mode === 'character'">

                      Personality-based compatibility analysis

                    </p>

                  </div>

                </div>

              </div>

            </div>-->

            <!-- Mode-specific content -->
            <ng-container [ngSwitch]="mode">

              <!-- EXPECTATION-ONLY MODE -->
              <div *ngSwitchCase="'expectation-only'" class="analysis-container">
                <!-- Toggle for expectation-only mode -->
                <div class="analysis-toggle">
                  <button class="toggle-btn"

                          [class.active]="showDifferences"

                          (click)="toggleDifferences()">
                    <span class="toggle-icon">❌</span>
                    <span class="toggle-text">Difference Areas</span>
                    <span class="toggle-count">({{compatibilityAnalysis?.totalDifferences || 0}})</span>
                  </button>

                  <button class="toggle-btn"

                          [class.active]="showExactMatches"

                          (click)="toggleExactMatches()">
                    <span class="toggle-icon">βœ…</span>
                    <span class="toggle-text">Common Expectations</span>
                    <span class="toggle-count">({{compatibilityAnalysis?.totalExactMatches || 0}})</span>
                  </button>
                </div>

                <!-- Exact Matches View -->
                <div *ngIf="showExactMatches && compatibilityAnalysis" class="analysis-view">
                  <div *ngIf="compatibilityAnalysis.exactMatches && compatibilityAnalysis.exactMatches.length > 0; else noExactMatches">

                    <!-- Table Header for Exact Matches -->
                    <div class="comparison-table exact-matches-table">
                      <div class="table-header">
                        <div class="table-column field-column">
                          <h6>πŸ“‹ Expectation Field</h6>
                        </div>
                        <div class="table-column value-column">
                          <h6>🀝 Mutual Expectation</h6>
                        </div>
                      </div>

                      <!-- Table Content for Exact Matches -->
                      <div class="table-body">
                        <div *ngFor="let match of compatibilityAnalysis.exactMatches; let i = index"

                             class="table-row">
                          <div class="table-column field-column">
                            <div class="field-name">{{getFieldNameFromMatch(match)}}</div>
                          </div>
                          <div class="table-column value-column">
                            <div class="common-value">
                              <div class="mutual-expectation">
                                <span class="mutual-label">Both are expecting:</span>
                                <span class="value-text">{{getExpectationValueFromMatch(match)}}</span>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>

                  </div>
                </div>

                <!-- Differences View -->
                <div *ngIf="showDifferences && compatibilityAnalysis" class="analysis-view">
                  <div *ngIf="compatibilityAnalysis.differences && compatibilityAnalysis.differences.length > 0; else noDifferences">

                    <!-- Table Header for Differences -->
                    <div class="comparison-table differences-table">
                      <div class="table-header">
                        <div class="table-column">
                          <h6>🎯 Your Expectation</h6>
                        </div>
                        <div class="table-column">
                          <h6>πŸ‘€ Partner's Profile</h6>
                        </div>
                      </div>

                      <!-- Table Content for Differences -->
                      <div class="table-body">
                        <div *ngFor="let difference of compatibilityAnalysis.differences; let i = index"

                             class="table-row"

                             [class.critical-row]="difference.isCritical">

                          <div class="table-column your-expectation-column">
                            <div class="field-name">{{difference.fieldName}}</div>
                            <div class="expectation-value">{{difference.yourExpectation}}</div>
                            <div *ngIf="difference.isCritical" class="critical-badge">Critical difference</div>
                          </div>

                          <div class="table-column their-profile-column">
                            <div class="field-name">{{difference.fieldName}}</div>
                            <div class="profile-value">{{difference.theirProfile}}</div>
                            <div *ngIf="difference.isCritical" class="critical-badge">Critical difference</div>
                          </div>

                        </div>
                      </div>
                    </div>

                  </div>
                </div>
              </div>

              <!-- CHARACTER MODE - Now uses the same professional UI -->
              <div *ngSwitchCase="'character'" class="character-analysis-container">

                <!-- Character Analysis Header -->
                <div class="character-analysis-header">
                  <div class="character-header-icon">
                    <span class="icon">🧠</span>
                  </div>
                  <div class="character-header-content">
                    <h3>Character Compatibility Analysis</h3>
                    <p class="character-subtitle">Based on personality color traits and psychological patterns</p>
                  </div>
                </div>

                <!-- Character Insights Grid -->
                <div class="character-insights-grid" *ngIf="strengths?.length || risks?.length || sacrifices?.length">

                  <!-- STRENGTHS CARD -->
                  <div class="character-insight-card strength-card" *ngIf="strengths?.length">
                    <div class="character-card-header">
                      <div class="character-card-icon strength-icon">
                        <span>πŸ’ͺ</span>
                      </div>
                      <div class="character-card-title">
                        <h4>Character Strengths</h4>
                        <p class="card-subtitle">Positive synergies and complementary traits</p>
                      </div>
                      <div class="character-card-badge">
                        <span class="badge-count">{{ strengths.length }}</span>
                      </div>
                    </div>
                    <div class="character-card-body">
                      <ul class="character-insight-list">
                        <li *ngFor="let point of strengths; let i = index" class="character-insight-item">
                          <div class="insight-number">{{ i + 1 }}</div>
                          <div class="insight-content">
                            <p>{{ point }}</p>
                          </div>
                        </li>
                      </ul>
                    </div>
                    <div class="character-card-footer">
                      <span class="footer-tag">Strong Foundation</span>
                    </div>
                  </div>

                  <!-- RISKS CARD -->
                  <div class="character-insight-card risk-card" *ngIf="risks?.length">
                    <div class="character-card-header">
                      <div class="character-card-icon risk-icon">
                        <span>⚠️</span>
                      </div>
                      <div class="character-card-title">
                        <h4>Character Risks</h4>
                        <p class="card-subtitle">Potential challenges and areas of friction</p>
                      </div>
                      <div class="character-card-badge">
                        <span class="badge-count">{{ risks.length }}</span>
                      </div>
                    </div>
                    <div class="character-card-body">
                      <ul class="character-insight-list">
                        <li *ngFor="let point of risks; let i = index" class="character-insight-item">
                          <div class="insight-number">{{ i + 1 }}</div>
                          <div class="insight-content">
                            <p>{{ point }}</p>
                          </div>
                        </li>
                      </ul>
                    </div>
                    <div class="character-card-footer">
                      <span class="footer-tag">Manageable Challenges</span>
                    </div>
                  </div>

                  <!-- SACRIFICES CARD -->
                  <div class="character-insight-card sacrifice-card" *ngIf="sacrifices?.length">
                    <div class="character-card-header">
                      <div class="character-card-icon sacrifice-icon">
                        <span>🀝</span>
                      </div>
                      <div class="character-card-title">
                        <h4>Sacrifices Needed</h4>
                        <p class="card-subtitle">Compromises for harmonious partnership</p>
                      </div>
                      <div class="character-card-badge">
                        <span class="badge-count">{{ sacrifices.length }}</span>
                      </div>
                    </div>
                    <div class="character-card-body">
                      <ul class="character-insight-list">
                        <li *ngFor="let point of sacrifices; let i = index" class="character-insight-item">
                          <div class="insight-number">{{ i + 1 }}</div>
                          <div class="insight-content">
                            <p>{{ point }}</p>
                          </div>
                        </li>
                      </ul>
                    </div>
                    <div class="character-card-footer">
                      <span class="footer-tag">Growth Opportunities</span>
                    </div>
                  </div>

                </div>

                <!-- No Character Data -->
                <div *ngIf="!strengths?.length && !risks?.length && !sacrifices?.length" class="no-character-data">
                  <div class="no-data-icon">πŸ”</div>
                  <h4>Character Analysis Unavailable</h4>
                  <p>Character compatibility data is not available for this match. Try refreshing or selecting another profile.</p>
                </div>

              </div>

              <!-- EXPECTATION WITH CHARACTER MODE -->
              <div *ngSwitchCase="'expectation'" class="combined-analysis-container">

                <!-- Combined Mode Tabs -->
                <div class="combined-mode-tabs">
                  <nav class="combined-tabs-nav">
                    <button class="combined-tab"

                            [class.active]="subTab === 'expectation'"

                            (click)="subTab = 'expectation'">
                      <span class="tab-icon">πŸ“Š</span>
                      <span class="tab-text">Expectation Analysis</span>
                    </button>
                    <div class="tab-separator">
                      <span class="separator-line"></span>
                      <span class="separator-plus">+</span>
                      <span class="separator-line"></span>
                    </div>
                    <button class="combined-tab"

                            [class.active]="subTab === 'character'"

                            (click)="subTab = 'character'">
                      <span class="tab-icon">🧬</span>
                      <span class="tab-text">Character Analysis</span>
                    </button>
                  </nav>
                </div>

                <!-- Expectation Analysis Tab Content -->
                <div *ngIf="subTab === 'expectation'" class="expectation-tab-content">

                  <!-- Toggle buttons for expectation analysis -->
                  <div class="toggle-group">
                    <button class="toggle-group-btn"

                            [class.active]="showDifferences"

                            (click)="toggleDifferences()">
                      <span class="toggle-icon">❌</span>
                      <span class="toggle-text">Difference Areas</span>
                      <span class="toggle-count">({{compatibilityAnalysis?.totalDifferences || 0}})</span>
                    </button>

                    <button class="toggle-group-btn"

                            [class.active]="showExactMatches"

                            (click)="toggleExactMatches()">
                      <span class="toggle-icon">βœ…</span>
                      <span class="toggle-text">Common Expectations</span>
                      <span class="toggle-count">({{compatibilityAnalysis?.totalExactMatches || 0}})</span>
                    </button>
                  </div>

                  <!-- Exact Matches View -->
                  <div *ngIf="showExactMatches && compatibilityAnalysis" class="analysis-view">
                    <div *ngIf="compatibilityAnalysis.exactMatches && compatibilityAnalysis.exactMatches.length > 0; else noExactMatches">
                      <!-- Table Header for Exact Matches -->
                      <div class="comparison-table exact-matches-table">
                        <div class="table-header">
                          <div class="table-column field-column">
                            <h6>πŸ“‹ Expectation Field</h6>
                          </div>
                          <div class="table-column value-column">
                            <h6>🀝 Mutual Expectation</h6>
                          </div>
                        </div>

                        <!-- Table Content for Exact Matches -->
                        <div class="table-body">
                          <div *ngFor="let match of compatibilityAnalysis.exactMatches; let i = index"

                               class="table-row">
                            <div class="table-column field-column">
                              <div class="field-name">{{getFieldNameFromMatch(match)}}</div>
                            </div>
                            <div class="table-column value-column">
                              <div class="common-value">
                                <div class="mutual-expectation">
                                  <span class="mutual-label">Both are expecting:</span>
                                  <span class="value-text">{{getExpectationValueFromMatch(match)}}</span>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>

                  <!-- Differences View -->
                  <div *ngIf="showDifferences && compatibilityAnalysis" class="analysis-view">
                    <div *ngIf="compatibilityAnalysis.differences && compatibilityAnalysis.differences.length > 0; else noDifferences">
                      <!-- Table Header for Differences -->
                      <div class="comparison-table differences-table">
                        <div class="table-header">
                          <div class="table-column">
                            <h6>🎯 Your Expectation</h6>
                          </div>
                          <div class="table-column">
                            <h6>πŸ‘€ Partner's Profile</h6>
                          </div>
                        </div>

                        <!-- Table Content for Differences -->
                        <div class="table-body">
                          <div *ngFor="let difference of compatibilityAnalysis.differences; let i = index"

                               class="table-row"

                               [class.critical-row]="difference.isCritical">

                            <div class="table-column your-expectation-column">
                              <div class="field-name">{{difference.fieldName}}</div>
                              <div class="expectation-value">{{difference.yourExpectation}}</div>
                              <div *ngIf="difference.isCritical" class="critical-badge">Critical difference</div>
                            </div>

                            <div class="table-column their-profile-column">
                              <div class="field-name">{{difference.fieldName}}</div>
                              <div class="profile-value">{{difference.theirProfile}}</div>
                              <div *ngIf="difference.isCritical" class="critical-badge">Critical difference</div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>

                <!-- Character Analysis Tab Content -->
                <div *ngIf="subTab === 'character'" class="character-tab-content">

                  <!-- Character Analysis Header -->
                  <div class="character-analysis-header">
                    <div class="character-header-icon">
                      <span class="icon">🧬</span>
                    </div>
                    <div class="character-header-content">
                      <h3>Character Compatibility Analysis</h3>
                      <p class="character-subtitle">Based on personality color traits and psychological patterns</p>
                    </div>
                  </div>

                  <!-- Character Insights Grid -->
                  <div class="character-insights-grid" *ngIf="strengths?.length || risks?.length || sacrifices?.length">

                    <!-- STRENGTHS CARD -->
                    <div class="character-insight-card strength-card" *ngIf="strengths?.length">
                      <div class="character-card-header">
                        <div class="character-card-icon strength-icon">
                          <span>πŸ’ͺ</span>
                        </div>
                        <div class="character-card-title">
                          <h4>Character Strengths</h4>
                          <p class="card-subtitle">Positive synergies and complementary traits</p>
                        </div>
                        <div class="character-card-badge">
                          <span class="badge-count">{{ strengths.length }}</span>
                        </div>
                      </div>
                      <div class="character-card-body">
                        <ul class="character-insight-list">
                          <li *ngFor="let point of strengths; let i = index" class="character-insight-item">
                            <div class="insight-number">{{ i + 1 }}</div>
                            <div class="insight-content">
                              <p>{{ point }}</p>
                            </div>
                          </li>
                        </ul>
                      </div>
                      <div class="character-card-footer">
                        <span class="footer-tag">Strong Foundation</span>
                      </div>
                    </div>

                    <!-- RISKS CARD -->
                    <div class="character-insight-card risk-card" *ngIf="risks?.length">
                      <div class="character-card-header">
                        <div class="character-card-icon risk-icon">
                          <span>⚠️</span>
                        </div>
                        <div class="character-card-title">
                          <h4>Character Risks</h4>
                          <p class="card-subtitle">Potential challenges and areas of friction</p>
                        </div>
                        <div class="character-card-badge">
                          <span class="badge-count">{{ risks.length }}</span>
                        </div>
                      </div>
                      <div class="character-card-body">
                        <ul class="character-insight-list">
                          <li *ngFor="let point of risks; let i = index" class="character-insight-item">
                            <div class="insight-number">{{ i + 1 }}</div>
                            <div class="insight-content">
                              <p>{{ point }}</p>
                            </div>
                          </li>
                        </ul>
                      </div>
                      <div class="character-card-footer">
                        <span class="footer-tag">Manageable Challenges</span>
                      </div>
                    </div>

                    <!-- SACRIFICES CARD -->
                    <div class="character-insight-card sacrifice-card" *ngIf="sacrifices?.length">
                      <div class="character-card-header">
                        <div class="character-card-icon sacrifice-icon">
                          <span>🀝</span>
                        </div>
                        <div class="character-card-title">
                          <h4>Sacrifices Needed</h4>
                          <p class="card-subtitle">Compromises for harmonious partnership</p>
                        </div>
                        <div class="character-card-badge">
                          <span class="badge-count">{{ sacrifices.length }}</span>
                        </div>
                      </div>
                      <div class="character-card-body">
                        <ul class="character-insight-list">
                          <li *ngFor="let point of sacrifices; let i = index" class="character-insight-item">
                            <div class="insight-number">{{ i + 1 }}</div>
                            <div class="insight-content">
                              <p>{{ point }}</p>
                            </div>
                          </li>
                        </ul>
                      </div>
                      <div class="character-card-footer">
                        <span class="footer-tag">Growth Opportunities</span>
                      </div>
                    </div>

                  </div>

                  <!-- No Character Data -->
                  <div *ngIf="!strengths?.length && !risks?.length && !sacrifices?.length" class="no-character-data">
                    <div class="no-data-icon">πŸ”</div>
                    <h4>Character Analysis Unavailable</h4>
                    <p>Character compatibility data is not available for this match. Try refreshing or selecting another profile.</p>
                  </div>

                </div>
              </div>
            </ng-container>

            <!-- Common No Data Templates -->
            <ng-template #noExactMatches>
              <div class="no-data-section">
                <div class="no-data-icon">πŸ”</div>
                <p class="no-data">No common expectations found between both profiles</p>
              </div>
            </ng-template>

            <ng-template #noDifferences>
              <div class="no-data-section">
                <div class="no-data-icon">πŸŽ‰</div>
                <p class="no-data">No differences found - perfect match across all expectations!</p>
              </div>
            </ng-template>

          </div>
        </div>
      </div>

      <div class="modal-actions">
        <button class="modal-btn primary"

                [class.liked]="isLiked(selectedProfile)"

                (click)="toggleLike(selectedProfile)">
          {{ isLiked(selectedProfile) ? '❀️ Liked' : '❀️ Like' }}
        </button>
        <button class="modal-btn primary" (click)="openChat(selectedProfile); closeModal()">
          πŸ’¬ Start Chat
        </button>
        <!--<button class="modal-btn secondary" (click)="toggleUserInfo()">

          πŸ‘€ View My Profile

        </button>-->
      </div>
    </div>
  </div>

  <!-- EDIT PROFILE MODAL -->
  <div class="modal" [class.show]="showEditModal" *ngIf="showEditModal">
    <div class="modal-content edit-modal">
      <span class="close" (click)="closeEditModal()">&times;</span>
      <h3 class="modal-title">Edit Profile</h3>

      <div class="form-group">
        <label for="editName">Name</label>
        <input id="editName" [(ngModel)]="editName" placeholder="Enter your name" class="form-input">
      </div>

      <div class="form-group">
        <label for="editCity">City</label>
        <input id="editCity" [(ngModel)]="editCity" placeholder="Enter your city" class="form-input">
      </div>

      <div class="form-actions">
        <button class="modal-btn secondary" (click)="closeEditModal()">Cancel</button>
        <button class="modal-btn primary" (click)="saveProfile()">Save Changes</button>
      </div>
    </div>
  </div>

  <!-- CHAT WINDOW -->
  <div class="chat-window" [class.show]="showChatWindow">
    <div class="chat-header">
      <div class="chat-user-info">
        <img [src]="currentChatUser?.photo_url" [alt]="currentChatUser?.name" class="chat-user-img">
        <div>
          <div class="chat-user-name">{{ currentChatUser?.name }}</div>
          <div class="chat-user-status">Online</div>
        </div>
      </div>
      <button class="chat-close" (click)="closeChat()">βœ–</button>
    </div>

    <div class="chat-body" #chatBody>
      <div *ngFor="let message of chatMessages"

           class="chat-msg"

           [class.user-msg]="message.sender === 'me'"

           [class.other-msg]="message.sender === 'them'">
        <div class="msg-content">{{ message.text }}</div>
        <div class="timestamp">{{ message.time }}</div>
      </div>
      <div *ngIf="showTyping" class="typing-indicator">
        <div class="typing-dots">
          <span></span>
          <span></span>
          <span></span>
        </div>
        <span class="typing-text">Typing...</span>
      </div>
    </div>

    <div class="chat-input">
      <input type="text"

             [(ngModel)]="newMessage"

             placeholder="Type a message..."

             (keyup.enter)="sendMessage()"

             (keypress)="typingIndicator()"

             class="chat-input-field">
      <button class="send-btn" (click)="sendMessage()">
        <span class="send-icon">➀</span>
      </button>
    </div>
  </div>

  <!-- USER PROFILE MODAL -->
  <div class="modal" [class.show]="showUserProfileModal">
    <div class="modal-content profile-modal">
      <span class="close" (click)="closeUserProfileModal()">&times;</span>

      <!-- User Info Header -->
      <div class="modal-header">
        <div class="user-photo-container">
          <img [src]="userPhoto" class="modal-profile-img" alt="User Photo">
        </div>
        <div class="modal-profile-info">
          <h2>{{ userName }}</h2>
          <p class="modal-subtitle">πŸ“ {{ userCity }}</p>
          <!--<div class="profile-score">

            Profile Completion: {{ userProfileCompletion }}%

          </div>-->
        </div>
      </div>

      <!-- Profile Tabs -->
      <div class="modal-tabs">
        <button class="tab-btn active">πŸ“‹ Profile Details</button>
      </div>

      <div class="modal-body">
        <!-- Basic Information Section -->
        <div class="section" *ngIf="userProfileData">
          <h4>Basic Information</h4>
          <div class="details-grid">
            <div *ngIf="userProfileData.gender" class="detail-item">
              <span class="detail-label">Gender</span>
              <span class="detail-value">{{ userProfileData.gender }}</span>
            </div>
            <div *ngIf="userProfileData.marital_status" class="detail-item">
              <span class="detail-label">Marital Status</span>
              <span class="detail-value">{{ userProfileData.marital_status }}</span>
            </div>
            <div *ngIf="userProfileData.date_of_birth" class="detail-item">
              <span class="detail-label">Date of Birth</span>
              <span class="detail-value">{{ userProfileData.date_of_birth }}</span>
            </div>
            <div *ngIf="userProfileData.height" class="detail-item">
              <span class="detail-label">Height</span>
              <span class="detail-value">{{ userProfileData.height }}</span>
            </div>
            <div *ngIf="userProfileData.skin_tone" class="detail-item">
              <span class="detail-label">Skin Tone</span>
              <span class="detail-value">{{ userProfileData.skin_tone }}</span>
            </div>
            <div *ngIf="userProfileData.blood_group" class="detail-item">
              <span class="detail-label">Blood Group</span>
              <span class="detail-value">{{ userProfileData.blood_group }}</span>
            </div>
          </div>
        </div>

        <!-- Location & Background Section -->
        <div class="section" *ngIf="userProfileData">
          <h4>Location & Background</h4>
          <div class="details-grid">
            <div *ngIf="userProfileData.current_city" class="detail-item">
              <span class="detail-label">Current City</span>
              <span class="detail-value">{{ userProfileData.current_city }}</span>
            </div>
            <div *ngIf="userProfileData.country" class="detail-item">
              <span class="detail-label">Country</span>
              <span class="detail-value">{{ userProfileData.country }}</span>
            </div>
            <div *ngIf="userProfileData.religion" class="detail-item">
              <span class="detail-label">Religion</span>
              <span class="detail-value">{{ userProfileData.religion }}</span>
            </div>
            <div *ngIf="userProfileData.languages_spoken" class="detail-item">
              <span class="detail-label">Languages Spoken</span>
              <span class="detail-value">{{ userProfileData.languages_spoken }}</span>
            </div>
            <div *ngIf="userProfileData.dual_citizenship" class="detail-item">
              <span class="detail-label">Dual Citizenship</span>
              <span class="detail-value">{{ userProfileData.dual_citizenship }}</span>
            </div>
          </div>
        </div>

        <!-- Education & Career Section -->
        <div class="section" *ngIf="userProfileData">
          <h4>Education & Career</h4>
          <div class="details-grid">
            <div *ngIf="userProfileData.education_level" class="detail-item">
              <span class="detail-label">Education Level</span>
              <span class="detail-value">{{ userProfileData.education_level }}</span>
            </div>
            <div *ngIf="userProfileData.field_of_study" class="detail-item">
              <span class="detail-label">Field of Study</span>
              <span class="detail-value">{{ userProfileData.field_of_study }}</span>
            </div>
            <div *ngIf="userProfileData.employment_status" class="detail-item">
              <span class="detail-label">Employment Status</span>
              <span class="detail-value">{{ userProfileData.employment_status }}</span>
            </div>
            <div *ngIf="userProfileData.job_role" class="detail-item">
              <span class="detail-label">Profession</span>
              <span class="detail-value">{{ userProfileData.job_role }}</span>
            </div>
            <div *ngIf="userProfileData.work_experience_years" class="detail-item">
              <span class="detail-label">Work Experience</span>
              <span class="detail-value">{{ userProfileData.work_experience_years }}</span>
            </div>
            <div *ngIf="userProfileData.career_aspirations" class="detail-item">
              <span class="detail-label">Career Aspirations</span>
              <span class="detail-value">{{ userProfileData.career_aspirations }}</span>
            </div>
            <div *ngIf="userProfileData.income_range" class="detail-item">
              <span class="detail-label">Income Range</span>
              <span class="detail-value">{{ userProfileData.income_range }}</span>
            </div>
          </div>
        </div>

        <!-- Lifestyle & Preferences Section -->
        <div class="section" *ngIf="userProfileData">
          <h4>Lifestyle & Preferences</h4>
          <div class="details-grid">
            <div *ngIf="userProfileData.food_preference" class="detail-item">
              <span class="detail-label">Food Preference</span>
              <span class="detail-value">{{ userProfileData.food_preference }}</span>
            </div>
            <div *ngIf="userProfileData.smoking_habit" class="detail-item">
              <span class="detail-label">Smoking Habit</span>
              <span class="detail-value">{{ userProfileData.smoking_habit }}</span>
            </div>
            <div *ngIf="userProfileData.alcohol_habit" class="detail-item">
              <span class="detail-label">Alcohol Habit</span>
              <span class="detail-value">{{ userProfileData.alcohol_habit }}</span>
            </div>
            <div *ngIf="userProfileData.fitness_level" class="detail-item">
              <span class="detail-label">Fitness Level</span>
              <span class="detail-value">{{ userProfileData.fitness_level }}</span>
            </div>
            <div *ngIf="userProfileData.hobbies_interests" class="detail-item">
              <span class="detail-label">Hobbies & Interests</span>
              <span class="detail-value">{{ userProfileData.hobbies_interests }}</span>
            </div>
            <div *ngIf="userProfileData.travel_preference" class="detail-item">
              <span class="detail-label">Travel Preference</span>
              <span class="detail-value">{{ userProfileData.travel_preference }}</span>
            </div>
          </div>
        </div>

        <!-- Relationship Preferences Section -->
        <div class="section" *ngIf="userProfileData">
          <h4>Relationship Preferences</h4>
          <div class="details-grid">
            <div *ngIf="userProfileData.family_type" class="detail-item">
              <span class="detail-label">Family Type</span>
              <span class="detail-value">{{ userProfileData.family_type }}</span>
            </div>
            <div *ngIf="userProfileData.children_timeline" class="detail-item">
              <span class="detail-label">Children Timeline</span>
              <span class="detail-value">{{ userProfileData.children_timeline }}</span>
            </div>
            <div *ngIf="userProfileData.open_to_adoption" class="detail-item">
              <span class="detail-label">Open to Adoption</span>
              <span class="detail-value">{{ userProfileData.open_to_adoption }}</span>
            </div>
            <div *ngIf="userProfileData.relocation_willingness" class="detail-item">
              <span class="detail-label">Relocation Willingness</span>
              <span class="detail-value">{{ userProfileData.relocation_willingness }}</span>
            </div>
            <div *ngIf="userProfileData.live_with_inlaws" class="detail-item">
              <span class="detail-label">Live with In-Laws</span>
              <span class="detail-value">{{ userProfileData.live_with_inlaws }}</span>
            </div>
          </div>
        </div>
      </div>

      <div class="modal-actions">
        <button class="modal-btn primary" (click)="editProfile()">
          ✏️ Edit Profile
        </button>
        <!--<button class="modal-btn secondary" (click)="closeUserProfileModal()">

          Close

        </button>-->
      </div>
    </div>
  </div>

</div>