File size: 57,955 Bytes
a41e33b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Tender RfP Extraction Tool</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .tab-content {
            display: none;
        }
        .tab-content.active {
            display: block;
            animation: fadeIn 0.3s ease-in-out;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .file-drop-area {
            border: 2px dashed #3b82f6;
            border-radius: 0.5rem;
            transition: all 0.2s ease;
        }
        .file-drop-area.active {
            border-color: #10b981;
            background-color: #f0fdf4;
        }
        .progress-bar {
            transition: width 0.3s ease;
        }
        .json-viewer {
            font-family: monospace;
            white-space: pre;
            overflow-x: auto;
        }
        .highlight {
            background-color: #fef08a;
            padding: 0.2rem;
            border-radius: 0.2rem;
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen">
    <div class="container mx-auto px-4 py-8">
        <header class="mb-8">
            <div class="flex items-center justify-between">
                <div>
                    <h1 class="text-3xl font-bold text-gray-800">Tender RfP Extraction Tool</h1>
                    <p class="text-gray-600">Extract structured information from Excel and PDF tender documents</p>
                </div>
                <div class="flex items-center space-x-4">
                    <div class="bg-blue-100 text-blue-800 px-4 py-2 rounded-full flex items-center">
                        <i class="fas fa-cloud mr-2"></i>
                        <span>Connected to Azure AI</span>
                    </div>
                    <button class="bg-gray-200 hover:bg-gray-300 px-4 py-2 rounded-full flex items-center">
                        <i class="fas fa-cog mr-2"></i>
                        <span>Settings</span>
                    </button>
                </div>
            </div>
        </header>

        <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
            <div class="border-b border-gray-200">
                <nav class="flex -mb-px">
                    <button class="tab-btn py-4 px-6 text-center border-b-2 font-medium text-sm border-blue-500 text-blue-600" data-tab="extraction">
                        <i class="fas fa-file-import mr-2"></i>Document Extraction
                    </button>
                    <button class="tab-btn py-4 px-6 text-center border-b-2 font-medium text-sm border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300" data-tab="results">
                        <i class="fas fa-database mr-2"></i>Extraction Results
                    </button>
                    <button class="tab-btn py-4 px-6 text-center border-b-2 font-medium text-sm border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300" data-tab="llm-config">
                        <i class="fas fa-brain mr-2"></i>LLM Configuration
                    </button>
                    <button class="tab-btn py-4 px-6 text-center border-b-2 font-medium text-sm border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300" data-tab="history">
                        <i class="fas fa-history mr-2"></i>Processing History
                    </button>
                </nav>
            </div>

            <!-- Document Extraction Tab -->
            <div id="extraction" class="tab-content active p-6">
                <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
                    <div>
                        <h2 class="text-xl font-semibold mb-4 text-gray-800">Upload Documents</h2>
                        <div class="file-drop-area p-8 text-center mb-6" id="dropArea">
                            <i class="fas fa-cloud-upload-alt text-4xl text-blue-500 mb-4"></i>
                            <p class="text-gray-600 mb-2">Drag & drop your Excel and PDF files here</p>
                            <p class="text-sm text-gray-500 mb-4">or</p>
                            <input type="file" id="fileInput" class="hidden" multiple accept=".xlsx,.xls,.pdf">
                            <label for="fileInput" class="bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-full cursor-pointer inline-block">
                                <i class="fas fa-folder-open mr-2"></i>Browse Files
                            </label>
                        </div>

                        <div class="mb-6">
                            <h3 class="font-medium text-gray-700 mb-2">Selected Files</h3>
                            <div class="border rounded-lg overflow-hidden">
                                <div class="divide-y divide-gray-200 max-h-60 overflow-y-auto" id="fileList">
                                    <div class="p-3 text-sm text-gray-500 italic">No files selected</div>
                                </div>
                            </div>
                        </div>

                        <div class="flex justify-end">
                            <button id="clearFiles" class="text-gray-500 hover:text-gray-700 mr-4">
                                <i class="fas fa-trash-alt mr-1"></i>Clear All
                            </button>
                            <button id="uploadBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-full disabled:opacity-50" disabled>
                                <i class="fas fa-upload mr-2"></i>Upload & Process
                            </button>
                        </div>
                    </div>

                    <div>
                        <h2 class="text-xl font-semibold mb-4 text-gray-800">Processing Options</h2>
                        <div class="bg-gray-50 p-6 rounded-lg mb-6">
                            <div class="mb-4">
                                <label class="block text-gray-700 font-medium mb-2">Target Format</label>
                                <select class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-blue-500 focus:border-blue-500">
                                    <option>Construction Tender v1.0</option>
                                    <option>Electrical Tender v2.1</option>
                                    <option>Mechanical Tender v1.5</option>
                                    <option selected>Custom Format</option>
                                </select>
                            </div>

                            <div class="mb-4">
                                <label class="block text-gray-700 font-medium mb-2">Mapping Template</label>
                                <div class="flex items-center">
                                    <select class="flex-1 border border-gray-300 rounded-lg px-4 py-2 focus:ring-blue-500 focus:border-blue-500 mr-2">
                                        <option>Default Mapping</option>
                                        <option>Advanced Technical Mapping</option>
                                        <option selected>Custom Mapping</option>
                                    </select>
                                    <button class="bg-gray-200 hover:bg-gray-300 px-4 py-2 rounded-lg">
                                        <i class="fas fa-edit"></i>
                                    </button>
                                </div>
                            </div>

                            <div class="mb-4">
                                <label class="flex items-center">
                                    <input type="checkbox" class="rounded text-blue-600 focus:ring-blue-500" checked>
                                    <span class="ml-2 text-gray-700">Extract technical drawings from PDF</span>
                                </label>
                            </div>

                            <div class="mb-4">
                                <label class="flex items-center">
                                    <input type="checkbox" class="rounded text-blue-600 focus:ring-blue-500" checked>
                                    <span class="ml-2 text-gray-700">Validate extracted data</span>
                                </label>
                            </div>

                            <div class="mb-4">
                                <label class="flex items-center">
                                    <input type="checkbox" class="rounded text-blue-600 focus:ring-blue-500">
                                    <span class="ml-2 text-gray-700">Cross-reference with previous tenders</span>
                                </label>
                            </div>
                        </div>

                        <div class="bg-yellow-50 border-l-4 border-yellow-400 p-4 mb-6">
                            <div class="flex">
                                <div class="flex-shrink-0">
                                    <i class="fas fa-exclamation-circle text-yellow-500"></i>
                                </div>
                                <div class="ml-3">
                                    <p class="text-sm text-yellow-700">
                                        <span class="font-medium">Note:</span> For best results, upload both Excel (containing position data) and PDF (containing technical drawings) files from the same tender.
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Extraction Results Tab -->
            <div id="results" class="tab-content p-6">
                <div class="flex justify-between items-center mb-6">
                    <h2 class="text-xl font-semibold text-gray-800">Extraction Results</h2>
                    <div class="flex space-x-2">
                        <button class="bg-gray-200 hover:bg-gray-300 px-4 py-2 rounded-lg">
                            <i class="fas fa-download mr-2"></i>Export JSON
                        </button>
                        <button class="bg-gray-200 hover:bg-gray-300 px-4 py-2 rounded-lg">
                            <i class="fas fa-file-excel mr-2"></i>Export Excel
                        </button>
                        <button class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg">
                            <i class="fas fa-sync-alt mr-2"></i>Refresh
                        </button>
                    </div>
                </div>

                <div class="bg-gray-50 p-4 rounded-lg mb-6">
                    <div class="flex items-center justify-between mb-2">
                        <div class="flex items-center">
                            <span class="bg-green-500 text-white text-xs px-2 py-1 rounded-full mr-2">Completed</span>
                            <span class="font-medium">Tender_2023_Construction_Renovation</span>
                        </div>
                        <span class="text-sm text-gray-500">Processed: 2 minutes ago</span>
                    </div>
                    <div class="grid grid-cols-3 gap-4 text-sm">
                        <div>
                            <span class="text-gray-600">Files:</span>
                            <span class="font-medium">3 (2 Excel, 1 PDF)</span>
                        </div>
                        <div>
                            <span class="text-gray-600">Entities extracted:</span>
                            <span class="font-medium">147</span>
                        </div>
                        <div>
                            <span class="text-gray-600">Confidence score:</span>
                            <span class="font-medium">92%</span>
                        </div>
                    </div>
                </div>

                <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
                    <div class="lg:col-span-2">
                        <div class="bg-white border border-gray-200 rounded-lg overflow-hidden">
                            <div class="border-b border-gray-200 bg-gray-50 px-4 py-3">
                                <h3 class="font-medium text-gray-800">Structured Data Output</h3>
                            </div>
                            <div class="p-4">
                                <div class="json-viewer bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto max-h-96">
{
  "tender": {
    "metadata": {
      "referenceNumber": "TND-2023-0456",
      "title": "Office Building Renovation Project",
      "publicationDate": "2023-06-15",
      "deadline": "2023-07-20",
      "estimatedValue": 1250000,
      "currency": "EUR"
    },
    "positions": [
      {
        "id": "POS-001",
        "description": "Demolition of existing interior walls",
        "quantity": 320,
        "unit": "sqm",
        "unitPrice": 45.00,
        "totalPrice": 14400.00,
        "specifications": {
          "material": "Existing drywall",
          "disposal": "Included",
          "drawingReference": "DRW-001-A"
        }
      },
      {
        "id": "POS-002",
        "description": "Installation of new electrical wiring",
        "quantity": 850,
        "unit": "lm",
        "unitPrice": 12.50,
        "totalPrice": 10625.00,
        "specifications": {
          "cableType": "NYM-J 3x1.5mm²",
          "protection": "PVC conduit",
          "drawingReference": "DRW-002-B"
        }
      }
    ],
    "drawings": [
      {
        "reference": "DRW-001-A",
        "description": "Demolition plan - Level 1",
        "sourcePage": 5,
        "confidenceScore": 0.94
      },
      {
        "reference": "DRW-002-B",
        "description": "Electrical installation diagram",
        "sourcePage": 8,
        "confidenceScore": 0.89
      }
    ]
  }
}
                                </div>
                            </div>
                        </div>
                    </div>

                    <div>
                        <div class="bg-white border border-gray-200 rounded-lg overflow-hidden mb-6">
                            <div class="border-b border-gray-200 bg-gray-50 px-4 py-3">
                                <h3 class="font-medium text-gray-800">Extraction Statistics</h3>
                            </div>
                            <div class="p-4">
                                <div class="space-y-4">
                                    <div>
                                        <div class="flex justify-between text-sm mb-1">
                                            <span class="text-gray-600">Excel data extraction</span>
                                            <span class="font-medium">96%</span>
                                        </div>
                                        <div class="w-full bg-gray-200 rounded-full h-2">
                                            <div class="bg-green-500 h-2 rounded-full" style="width: 96%"></div>
                                        </div>
                                    </div>
                                    <div>
                                        <div class="flex justify-between text-sm mb-1">
                                            <span class="text-gray-600">PDF drawing extraction</span>
                                            <span class="font-medium">89%</span>
                                        </div>
                                        <div class="w-full bg-gray-200 rounded-full h-2">
                                            <div class="bg-blue-500 h-2 rounded-full" style="width: 89%"></div>
                                        </div>
                                    </div>
                                    <div>
                                        <div class="flex justify-between text-sm mb-1">
                                            <span class="text-gray-600">Data validation</span>
                                            <span class="font-medium">92%</span>
                                        </div>
                                        <div class="w-full bg-gray-200 rounded-full h-2">
                                            <div class="bg-purple-500 h-2 rounded-full" style="width: 92%"></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="bg-white border border-gray-200 rounded-lg overflow-hidden">
                            <div class="border-b border-gray-200 bg-gray-50 px-4 py-3">
                                <h3 class="font-medium text-gray-800">Extraction Log</h3>
                            </div>
                            <div class="p-4">
                                <div class="space-y-3 text-sm max-h-60 overflow-y-auto">
                                    <div class="flex">
                                        <div class="text-green-500 mr-2"></div>
                                        <div>Successfully processed Excel file: Tender_Positions.xlsx</div>
                                    </div>
                                    <div class="flex">
                                        <div class="text-green-500 mr-2"></div>
                                        <div>Identified 24 position items in Excel</div>
                                    </div>
                                    <div class="flex">
                                        <div class="text-green-500 mr-2"></div>
                                        <div>Successfully processed PDF file: Technical_Drawings.pdf</div>
                                    </div>
                                    <div class="flex">
                                        <div class="text-green-500 mr-2"></div>
                                        <div>Extracted 5 technical drawings from PDF</div>
                                    </div>
                                    <div class="flex">
                                        <div class="text-yellow-500 mr-2">!</div>
                                        <div>Low confidence (72%) on drawing reference for position POS-012</div>
                                    </div>
                                    <div class="flex">
                                        <div class="text-green-500 mr-2"></div>
                                        <div>Cross-referenced all positions with drawings</div>
                                    </div>
                                    <div class="flex">
                                        <div class="text-green-500 mr-2"></div>
                                        <div>Validation completed with 92% confidence</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- LLM Configuration Tab -->
            <div id="llm-config" class="tab-content p-6">
                <div class="flex justify-between items-center mb-6">
                    <h2 class="text-xl font-semibold text-gray-800">LLM Configuration</h2>
                    <div class="flex space-x-2">
                        <button class="bg-gray-200 hover:bg-gray-300 px-4 py-2 rounded-lg">
                            <i class="fas fa-save mr-2"></i>Save Configuration
                        </button>
                        <button class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg">
                            <i class="fas fa-bolt mr-2"></i>Test Configuration
                        </button>
                    </div>
                </div>

                <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
                    <div class="lg:col-span-2">
                        <div class="bg-white border border-gray-200 rounded-lg overflow-hidden mb-6">
                            <div class="border-b border-gray-200 bg-gray-50 px-4 py-3">
                                <h3 class="font-medium text-gray-800">Azure AI Settings</h3>
                            </div>
                            <div class="p-4">
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
                                    <div>
                                        <label class="block text-gray-700 font-medium mb-1">Endpoint</label>
                                        <input type="text" class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-blue-500 focus:border-blue-500" value="https://your-azure-endpoint.cognitiveservices.azure.com/">
                                    </div>
                                    <div>
                                        <label class="block text-gray-700 font-medium mb-1">API Key</label>
                                        <div class="relative">
                                            <input type="password" class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-blue-500 focus:border-blue-500 pr-10" value="a1b2c3d4e5f6g7h8i9j0">
                                            <button class="absolute right-3 top-2.5 text-gray-500 hover:text-gray-700">
                                                <i class="far fa-eye"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>

                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
                                    <div>
                                        <label class="block text-gray-700 font-medium mb-1">Model</label>
                                        <select class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-blue-500 focus:border-blue-500">
                                            <option>gpt-4</option>
                                            <option selected>gpt-4-turbo</option>
                                            <option>gpt-3.5-turbo</option>
                                        </select>
                                    </div>
                                    <div>
                                        <label class="block text-gray-700 font-medium mb-1">Temperature</label>
                                        <input type="range" min="0" max="1" step="0.1" value="0.3" class="w-full">
                                        <div class="text-sm text-gray-600 text-right">0.3</div>
                                    </div>
                                </div>

                                <div class="mb-4">
                                    <label class="block text-gray-700 font-medium mb-1">Max Tokens</label>
                                    <input type="number" class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-blue-500 focus:border-blue-500" value="2000">
                                </div>

                                <div class="mb-4">
                                    <label class="block text-gray-700 font-medium mb-1">System Prompt</label>
                                    <textarea class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-blue-500 focus:border-blue-500 h-32">You are an expert tender document processor. Extract structured information from the provided documents following the specified format. Pay special attention to matching position descriptions with technical drawings from the PDF files. When in doubt, flag the item for manual review.</textarea>
                                </div>
                            </div>
                        </div>

                        <div class="bg-white border border-gray-200 rounded-lg overflow-hidden">
                            <div class="border-b border-gray-200 bg-gray-50 px-4 py-3">
                                <h3 class="font-medium text-gray-800">Target Format Mapping</h3>
                            </div>
                            <div class="p-4">
                                <div class="overflow-x-auto">
                                    <table class="min-w-full divide-y divide-gray-200">
                                        <thead class="bg-gray-50">
                                            <tr>
                                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Key</th>
                                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Term</th>
                                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Synonyms</th>
                                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Type</th>
                                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Description</th>
                                            </tr>
                                        </thead>
                                        <tbody class="bg-white divide-y divide-gray-200 text-sm">
                                            <tr>
                                                <td class="px-6 py-4 whitespace-nowrap font-medium">position.id</td>
                                                <td class="px-6 py-4 whitespace-nowrap">Position ID</td>
                                                <td class="px-6 py-4">Item No., Pos. No., Ref. No.</td>
                                                <td class="px-6 py-4 whitespace-nowrap">String</td>
                                                <td class="px-6 py-4">Unique identifier for the position</td>
                                            </tr>
                                            <tr class="bg-gray-50">
                                                <td class="px-6 py-4 whitespace-nowrap font-medium">position.description</td>
                                                <td class="px-6 py-4">Description</td>
                                                <td class="px-6 py-4">Item Description, Scope, Work Description</td>
                                                <td class="px-6 py-4 whitespace-nowrap">String</td>
                                                <td class="px-6 py-4">Detailed description of the work item</td>
                                            </tr>
                                            <tr>
                                                <td class="px-6 py-4 whitespace-nowrap font-medium">position.quantity</td>
                                                <td class="px-6 py-4">Quantity</td>
                                                <td class="px-6 py-4">Qty, Amount, Volume</td>
                                                <td class="px-6 py-4 whitespace-nowrap">Number</td>
                                                <td class="px-6 py-4">Numerical quantity of the item</td>
                                            </tr>
                                            <tr class="bg-gray-50">
                                                <td class="px-6 py-4 whitespace-nowrap font-medium">position.unit</td>
                                                <td class="px-6 py-4">Unit</td>
                                                <td class="px-6 py-4">Unit of Measure, UOM</td>
                                                <td class="px-6 py-4 whitespace-nowrap">String</td>
                                                <td class="px-6 py-4">Measurement unit (sqm, lm, kg, etc.)</td>
                                            </tr>
                                            <tr>
                                                <td class="px-6 py-4 whitespace-nowrap font-medium">drawing.reference</td>
                                                <td class="px-6 py-4">Drawing Ref.</td>
                                                <td class="px-6 py-4">Plan Ref., Diagram No., DRW No.</td>
                                                <td class="px-6 py-4 whitespace-nowrap">String</td>
                                                <td class="px-6 py-4">Reference to technical drawing</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div>
                        <div class="bg-white border border-gray-200 rounded-lg overflow-hidden mb-6">
                            <div class="border-b border-gray-200 bg-gray-50 px-4 py-3">
                                <h3 class="font-medium text-gray-800">Configuration Status</h3>
                            </div>
                            <div class="p-4">
                                <div class="space-y-4">
                                    <div>
                                        <div class="flex items-center mb-2">
                                            <div class="w-8 h-8 rounded-full bg-green-100 flex items-center justify-center mr-3">
                                                <i class="fas fa-check text-green-600"></i>
                                            </div>
                                            <div>
                                                <h4 class="font-medium">Azure Connection</h4>
                                                <p class="text-sm text-gray-600">Connected to endpoint</p>
                                            </div>
                                        </div>
                                    </div>
                                    <div>
                                        <div class="flex items-center mb-2">
                                            <div class="w-8 h-8 rounded-full bg-green-100 flex items-center justify-center mr-3">
                                                <i class="fas fa-check text-green-600"></i>
                                            </div>
                                            <div>
                                                <h4 class="font-medium">Model Availability</h4>
                                                <p class="text-sm text-gray-600">gpt-4-turbo available</p>
                                            </div>
                                        </div>
                                    </div>
                                    <div>
                                        <div class="flex items-center mb-2">
                                            <div class="w-8 h-8 rounded-full bg-yellow-100 flex items-center justify-center mr-3">
                                                <i class="fas fa-exclamation text-yellow-600"></i>
                                            </div>
                                            <div>
                                                <h4 class="font-medium">Mapping Validation</h4>
                                                <p class="text-sm text-gray-600">3 optional fields not mapped</p>
                                            </div>
                                        </div>
                                    </div>
                                    <div>
                                        <div class="flex items-center mb-2">
                                            <div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center mr-3">
                                                <i class="fas fa-info-circle text-blue-600"></i>
                                            </div>
                                            <div>
                                                <h4 class="font-medium">Last Test</h4>
                                                <p class="text-sm text-gray-600">2 days ago - 89% accuracy</p>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="mt-6">
                                    <h4 class="font-medium mb-2">Configuration Notes</h4>
                                    <textarea class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-blue-500 focus:border-blue-500 h-24" placeholder="Add notes about this configuration..."></textarea>
                                </div>
                            </div>
                        </div>

                        <div class="bg-white border border-gray-200 rounded-lg overflow-hidden">
                            <div class="border-b border-gray-200 bg-gray-50 px-4 py-3">
                                <h3 class="font-medium text-gray-800">Test Configuration</h3>
                            </div>
                            <div class="p-4">
                                <div class="mb-4">
                                    <label class="block text-gray-700 font-medium mb-1">Test Document</label>
                                    <select class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-blue-500 focus:border-blue-500">
                                        <option>Sample Construction Tender</option>
                                        <option>Sample Electrical Tender</option>
                                        <option>Custom Test File...</option>
                                    </select>
                                </div>
                                <button class="w-full bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg mb-4">
                                    <i class="fas fa-play mr-2"></i>Run Test
                                </button>
                                <div class="border-t pt-4">
                                    <h4 class="font-medium mb-2">Last Test Results</h4>
                                    <div class="text-sm space-y-2">
                                        <div class="flex items-center">
                                            <div class="w-4 h-4 rounded-full bg-green-500 mr-2"></div>
                                            <span>Position extraction: 94% accuracy</span>
                                        </div>
                                        <div class="flex items-center">
                                            <div class="w-4 h-4 rounded-full bg-green-500 mr-2"></div>
                                            <span>Drawing matching: 87% accuracy</span>
                                        </div>
                                        <div class="flex items-center">
                                            <div class="w-4 h-4 rounded-full bg-yellow-500 mr-2"></div>
                                            <span>Unit conversion: 3 issues</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Processing History Tab -->
            <div id="history" class="tab-content p-6">
                <div class="flex justify-between items-center mb-6">
                    <h2 class="text-xl font-semibold text-gray-800">Processing History</h2>
                    <div class="flex space-x-2">
                        <button class="bg-gray-200 hover:bg-gray-300 px-4 py-2 rounded-lg">
                            <i class="fas fa-filter mr-2"></i>Filter
                        </button>
                        <button class="bg-gray-200 hover:bg-gray-300 px-4 py-2 rounded-lg">
                            <i class="fas fa-download mr-2"></i>Export
                        </button>
                    </div>
                </div>

                <div class="bg-white border border-gray-200 rounded-lg overflow-hidden">
                    <div class="overflow-x-auto">
                        <table class="min-w-full divide-y divide-gray-200">
                            <thead class="bg-gray-50">
                                <tr>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Project</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Files</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Confidence</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
                                </tr>
                            </thead>
                            <tbody class="bg-white divide-y divide-gray-200">
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">2023-06-15 14:32</td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="font-medium">Office Renovation Project</div>
                                        <div class="text-sm text-gray-500">TND-2023-0456</div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="flex items-center">
                                            <i class="fas fa-file-excel text-green-600 mr-2"></i>
                                            <span class="text-sm">2</span>
                                            <i class="fas fa-file-pdf text-red-600 mx-2"></i>
                                            <span class="text-sm">1</span>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <span class="px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800">Completed</span>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="flex items-center">
                                            <div class="w-16 bg-gray-200 rounded-full h-2 mr-2">
                                                <div class="bg-green-500 h-2 rounded-full" style="width: 92%"></div>
                                            </div>
                                            <span class="text-sm">92%</span>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
                                        <button class="text-blue-600 hover:text-blue-900 mr-3">View</button>
                                        <button class="text-gray-600 hover:text-gray-900">Export</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">2023-06-10 09:15</td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="font-medium">Electrical Upgrade</div>
                                        <div class="text-sm text-gray-500">TND-2023-0382</div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="flex items-center">
                                            <i class="fas fa-file-excel text-green-600 mr-2"></i>
                                            <span class="text-sm">1</span>
                                            <i class="fas fa-file-pdf text-red-600 mx-2"></i>
                                            <span class="text-sm">3</span>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <span class="px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800">Completed</span>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="flex items-center">
                                            <div class="w-16 bg-gray-200 rounded-full h-2 mr-2">
                                                <div class="bg-green-500 h-2 rounded-full" style="width: 88%"></div>
                                            </div>
                                            <span class="text-sm">88%</span>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
                                        <button class="text-blue-600 hover:text-blue-900 mr-3">View</button>
                                        <button class="text-gray-600 hover:text-gray-900">Export</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">2023-06-05 16:42</td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="font-medium">HVAC Installation</div>
                                        <div class="text-sm text-gray-500">TND-2023-0321</div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="flex items-center">
                                            <i class="fas fa-file-excel text-green-600 mr-2"></i>
                                            <span class="text-sm">1</span>
                                            <i class="fas fa-file-pdf text-red-600 mx-2"></i>
                                            <span class="text-sm">2</span>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <span class="px-2 py-1 text-xs font-semibold rounded-full bg-yellow-100 text-yellow-800">Review Needed</span>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="flex items-center">
                                            <div class="w-16 bg-gray-200 rounded-full h-2 mr-2">
                                                <div class="bg-yellow-500 h-2 rounded-full" style="width: 72%"></div>
                                            </div>
                                            <span class="text-sm">72%</span>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
                                        <button class="text-blue-600 hover:text-blue-900 mr-3">Review</button>
                                        <button class="text-gray-600 hover:text-gray-900">Export</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">2023-05-28 11:07</td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="font-medium">Facade Renovation</div>
                                        <div class="text-sm text-gray-500">TND-2023-0289</div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="flex items-center">
                                            <i class="fas fa-file-excel text-green-600 mr-2"></i>
                                            <span class="text-sm">3</span>
                                            <i class="fas fa-file-pdf text-red-600 mx-2"></i>
                                            <span class="text-sm">5</span>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <span class="px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800">Completed</span>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="flex items-center">
                                            <div class="w-16 bg-gray-200 rounded-full h-2 mr-2">
                                                <div class="bg-green-500 h-2 rounded-full" style="width: 95%"></div>
                                            </div>
                                            <span class="text-sm">95%</span>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
                                        <button class="text-blue-600 hover:text-blue-900 mr-3">View</button>
                                        <button class="text-gray-600 hover:text-gray-900">Export</button>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="bg-gray-50 px-6 py-3 flex items-center justify-between border-t border-gray-200">
                        <div class="flex-1 flex justify-between sm:hidden">
                            <button class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
                                Previous
                            </button>
                            <button class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
                                Next
                            </button>
                        </div>
                        <div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between">
                            <div>
                                <p class="text-sm text-gray-700">
                                    Showing <span class="font-medium">1</span> to <span class="font-medium">4</span> of <span class="font-medium">12</span> results
                                </p>
                            </div>
                            <div>
                                <nav class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px" aria-label="Pagination">
                                    <button class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
                                        <span class="sr-only">Previous</span>
                                        <i class="fas fa-chevron-left"></i>
                                    </button>
                                    <button aria-current="page" class="z-10 bg-blue-50 border-blue-500 text-blue-600 relative inline-flex items-center px-4 py-2 border text-sm font-medium">
                                        1
                                    </button>
                                    <button class="bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border text-sm font-medium">
                                        2
                                    </button>
                                    <button class="bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border text-sm font-medium">
                                        3
                                    </button>
                                    <span class="relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-700">
                                        ...
                                    </span>
                                    <button class="bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border text-sm font-medium">
                                        8
                                    </button>
                                    <button class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
                                        <span class="sr-only">Next</span>
                                        <i class="fas fa-chevron-right"></i>
                                    </button>
                                </nav>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        // Tab switching functionality
        document.querySelectorAll('.tab-btn').forEach(btn => {
            btn.addEventListener('click', () => {
                // Remove active class from all tabs and buttons
                document.querySelectorAll('.tab-btn').forEach(b => {
                    b.classList.remove('border-blue-500', 'text-blue-600');
                    b.classList.add('border-transparent', 'text-gray-500');
                });
                
                document.querySelectorAll('.tab-content').forEach(tab => {
                    tab.classList.remove('active');
                });
                
                // Add active class to clicked tab and button
                btn.classList.remove('border-transparent', 'text-gray-500');
                btn.classList.add('border-blue-500', 'text-blue-600');
                
                const tabId = btn.getAttribute('data-tab');
                document.getElementById(tabId).classList.add('active');
            });
        });

        // File upload functionality
        const dropArea = document.getElementById('dropArea');
        const fileInput = document.getElementById('fileInput');
        const fileList = document.getElementById('fileList');
        const uploadBtn = document.getElementById('uploadBtn');
        const clearFiles = document.getElementById('clearFiles');
        
        let files = [];
        
        // Handle drag and drop events
        ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
            dropArea.addEventListener(eventName, preventDefaults, false);
        });
        
        function preventDefaults(e) {
            e.preventDefault();
            e.stopPropagation();
        }
        
        ['dragenter', 'dragover'].forEach(eventName => {
            dropArea.addEventListener(eventName, highlight, false);
        });
        
        ['dragleave', 'drop'].forEach(eventName => {
            dropArea.addEventListener(eventName, unhighlight, false);
        });
        
        function highlight() {
            dropArea.classList.add('active');
        }
        
        function unhighlight() {
            dropArea.classList.remove('active');
        }
        
        dropArea.addEventListener('drop', handleDrop, false);
        
        function handleDrop(e) {
            const dt = e.dataTransfer;
            const newFiles = dt.files;
            handleFiles(newFiles);
        }
        
        fileInput.addEventListener('change', function() {
            handleFiles(this.files);
        });
        
        function handleFiles(newFiles) {
            files = [...files, ...Array.from(newFiles)];
            updateFileList();
            uploadBtn.disabled = files.length === 0;
        }
        
        function updateFileList() {
            if (files.length === 0) {
                fileList.innerHTML = '<div class="p-3 text-sm text-gray-500 italic">No files selected</div>';
                return;
            }
            
            fileList.innerHTML = '';
            
            files.forEach((file, index) => {
                const fileElement = document.createElement('div');
                fileElement.className = 'flex items-center justify-between p-3';
                
                const fileInfo = document.createElement('div');
                fileInfo.className = 'flex items-center';
                
                const icon = document.createElement('i');
                icon.className = file.type.includes('sheet') ? 'fas fa-file-excel text-green-600 mr-3' : 
                                file.type.includes('pdf') ? 'fas fa-file-pdf text-red-600 mr-3' : 
                                'fas fa-file-alt text-gray-500 mr-3';
                
                const fileName = document.createElement('span');
                fileName.className = 'text-sm text-gray-700';
                fileName.textContent = file.name;
                
                const fileSize = document.createElement('span');
                fileSize.className = 'text-xs text-gray-500 ml-2';
                fileSize.textContent = `(${formatFileSize(file.size)})`;
                
                const removeBtn = document.createElement('button');
                removeBtn.className = 'text-red-500 hover:text-red-700';
                removeBtn.innerHTML = '<i class="fas fa-times"></i>';
                removeBtn.addEventListener('click', () => removeFile(index));
                
                fileInfo.appendChild(icon);
                fileInfo.appendChild(fileName);
                fileInfo.appendChild(fileSize);
                
                fileElement.appendChild(fileInfo);
                fileElement.appendChild(removeBtn);
                
                fileList.appendChild(fileElement);
            });
        }
        
        function formatFileSize(bytes) {
            if (bytes === 0) return '0 Bytes';
            const k = 1024;
            const sizes = ['Bytes', 'KB', 'MB', 'GB'];
            const i = Math.floor(Math.log(bytes) / Math.log(k));
            return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
        }
        
        function removeFile(index) {
            files.splice(index, 1);
            updateFileList();
            uploadBtn.disabled = files.length === 0;
        }
        
        clearFiles.addEventListener('click', () => {
            files = [];
            updateFileList();
            uploadBtn.disabled = true;
        });
        
        uploadBtn.addEventListener('click', () => {
            // Simulate upload process
            uploadBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i>Processing...';
            uploadBtn.disabled = true;
            
            setTimeout(() => {
                uploadBtn.innerHTML = '<i class="fas fa-check mr-2"></i>Processing Complete';
                
                // Switch to results tab after processing
                document.querySelector('[data-tab="results"]').click();
                
                // Reset upload button after delay
                setTimeout(() => {
                    uploadBtn.innerHTML = '<i class="fas fa-upload mr-2"></i>Upload & Process';
                    uploadBtn.disabled = false;
                }, 2000);
            }, 3000);
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - <a href="https://enzostvs-deepsite.hf.space?remix=luis-poe/tendextraction" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
</html>