File size: 120,362 Bytes
32a841c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
01b1aa1
 
 
 
32a841c
01b1aa1
 
 
 
 
32a841c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>LocalTools - PDF Editor & Image Scraper</title>
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="/static/css/styles.css" />
</head>
<body>

<!-- Animated Background -->
<div class="animated-bg"></div>

<!-- Mobile Menu Button -->
<button class="mobile-menu-btn" id="mobileMenuBtn">
  <svg width="24" height="24" fill="none" stroke="currentColor" viewBox="0 0 24 24">
    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/>
  </svg>
</button>

<!-- Sidebar Overlay (Mobile) -->
<div class="sidebar-overlay" id="sidebarOverlay"></div>

<div class="app-container">

  <!-- Sidebar Navigation -->
  <aside class="sidebar" id="sidebar">
    <div class="sidebar-header">
      <div class="logo">
        <div class="logo-icon">LT</div>
        <div class="logo-text">
          <h1>LocalTools</h1>
          <span>v1.0</span>
        </div>
      </div>
    </div>

    <nav class="sidebar-nav">
      <div class="nav-section">
        <div class="nav-section-title">Tools</div>
        <button class="nav-item active" data-page="pdf">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
          </svg>
          <span>PDF Editor</span>
        </button>
        <button class="nav-item" data-page="watermark">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
          </svg>
          <span>Watermark Remover</span>
        </button>
        <button class="nav-item" data-page="img2pdf">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
          </svg>
          <span>Images to PDF</span>
        </button>
        <button class="nav-item" data-page="merge">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"/>
          </svg>
          <span>Merge PDFs</span>
        </button>
        <button class="nav-item" data-page="split">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7v8a2 2 0 002 2h6M8 7V5a2 2 0 012-2h4.586a1 1 0 01.707.293l4.414 4.414a1 1 0 01.293.707V15a2 2 0 01-2 2h-2M8 7H6a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2v-2"/>
          </svg>
          <span>Split PDF</span>
        </button>
        <button class="nav-item" data-page="pdf2img">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
          </svg>
          <span>PDF to Images</span>
        </button>
        <button class="nav-item" data-page="compress">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"/>
          </svg>
          <span>Compress PDF</span>
        </button>
        <button class="nav-item" data-page="rotate">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
          </svg>
          <span>Rotate Pages</span>
        </button>
        <button class="nav-item" data-page="pagenums">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 20l4-16m2 16l4-16M6 9h14M4 15h14"/>
          </svg>
          <span>Page Numbers</span>
        </button>
        <button class="nav-item" data-page="ocr">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
          </svg>
          <span>PDF to Text (OCR)</span>
        </button>
        <button class="nav-item" data-page="images">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
          </svg>
          <span>Image Scraper</span>
        </button>
      </div>

      <div class="nav-section">
        <div class="nav-section-title">Image Tools</div>
        <button class="nav-item" data-page="rembg">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.121 14.121L19 19m-7-7l7-7m-7 7l-2.879 2.879M12 12L9.121 9.121m0 5.758a3 3 0 10-4.243 4.243 3 3 0 004.243-4.243zm0-5.758a3 3 0 10-4.243-4.243 3 3 0 004.243 4.243z"/>
          </svg>
          <span>Remove Background</span>
        </button>
        <button class="nav-item" data-page="enhance">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"/>
          </svg>
          <span>Enhance Quality</span>
        </button>
        <button class="nav-item" data-page="imgwatermark">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"/>
          </svg>
          <span>Add Watermark</span>
        </button>
        <button class="nav-item" data-page="resize">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"/>
          </svg>
          <span>Resize Image</span>
        </button>
        <button class="nav-item" data-page="convert">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"/>
          </svg>
          <span>Convert Format</span>
        </button>
        <button class="nav-item" data-page="compressimg">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
          </svg>
          <span>Compress Image</span>
        </button>
      </div>

      <div class="nav-section">
        <div class="nav-section-title">Quick Actions</div>
        <button class="nav-item" id="navRecentFiles">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
          </svg>
          <span>Recent Files</span>
        </button>
        <button class="nav-item" id="navKeyboardShortcuts">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"/>
          </svg>
          <span>Keyboard Shortcuts</span>
        </button>
      </div>
    </nav>

    <div class="sidebar-footer">
      <!-- Setup Notice -->
      <div class="setup-notice" id="setupNotice">
        <div class="setup-notice-header">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
          </svg>
          <span>How to Run</span>
          <button class="setup-notice-close" id="closeSetupNotice">×</button>
        </div>
        <div class="setup-notice-body">
          
          <p><strong>Run server</strong> (choose one):</p>
          <div class="setup-notice-code">
            <code>python server.py</code>
            <button class="copy-btn" data-copy="python server.py">
              <svg width="14" height="14" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
            </button>
          </div>
          <p class="setup-notice-or">— or with auto-reload —</p>
          <div class="setup-notice-code">
            <code>python -m uvicorn server:app --reload --host 127.0.0.1 --port 8000</code>
            <button class="copy-btn" data-copy="python -m uvicorn server:app --reload --host 127.0.0.1 --port 8000">
              <svg width="14" height="14" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
            </button>
          </div>
          <p class="setup-notice-hint">Open <strong>http://127.0.0.1:8000</strong> in browser</p>
        </div>
      </div>

      <div class="theme-toggle" id="themeToggle">
        <div class="theme-toggle-label">
          <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"/>
          </svg>
          <span>Dark Mode</span>
        </div>
        <div class="theme-switch"></div>
      </div>
    </div>
  </aside>

  <!-- Main Content -->
  <main class="main-content">

    <!-- PDF Editor Page -->
    <div id="page-pdf" class="page active">
      <!-- Breadcrumbs -->
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">PDF Editor</span>
      </nav>

      <div class="page-header">
        <h2>PDF Editor</h2>
        <p>Crop margins, remove pages, and add watermarks to your PDF files. Upload directly or import from URL.</p>
      </div>

      <!-- Step Indicator -->
      <div class="step-indicator" id="pdfStepIndicator"></div>

      <!-- Import Card -->
      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"/></svg>
            Import PDF
          </h3>
          <p>Drag & drop a file or paste a URL (Google Drive supported)</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <label class="form-label">Upload PDF File</label>
            <div id="pdfDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"/>
              </svg>
              <div class="drop-zone-text">Drag & drop your PDF here, or click to browse</div>
              <div class="drop-zone-hint">Maximum file size: 100MB</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="pdf_file" accept="application/pdf" style="display: none;" />
          </div>

          <div class="form-group">
            <label class="form-label">Or paste PDF URL / Google Drive Link</label>
            <input type="text" id="pdf_url" class="form-input" placeholder="https://drive.google.com/file/d/... or direct PDF URL" />
          </div>

          <div class="form-group">
            <label class="form-label">Output Filename</label>
            <input type="text" id="output_name" class="form-input" value="cropped.pdf" />
          </div>
        </div>
      </div>

      <!-- Edit Options Card -->
      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"/></svg>
            Edit Options
          </h3>
          <p>Configure cropping, page removal, and watermark</p>
        </div>
        <div class="card-body">
          <div class="grid-2">
            <div class="form-group">
              <label class="form-label">
                Pages to Remove 
                <span class="optional">(optional)</span>
                <span class="help-tip tooltip" data-tooltip="Enter page numbers like 1,3,5 or ranges like 2-6">?</span>
              </label>
              <input type="text" id="remove_pages" class="form-input" placeholder="e.g., 1,3,5 or 2-6" />
            </div>
            <div class="form-group">
              <label class="form-label">Unit</label>
              <select id="unit" class="form-select">
                <option value="mm" selected>Millimeters (mm)</option>
                <option value="cm">Centimeters (cm)</option>
                <option value="in">Inches (in)</option>
                <option value="pt">Points (pt)</option>
              </select>
            </div>
          </div>

          <div class="form-group">
            <label class="form-label">
              Crop Margins
              <span class="help-tip tooltip" data-tooltip="Amount to cut from each edge of the page">?</span>
            </label>
            <div class="grid-4">
              <input type="number" id="top" class="form-input tooltip-bottom" data-tooltip="Top margin" step="0.1" placeholder="Top" />
              <input type="number" id="bottom" class="form-input tooltip-bottom" data-tooltip="Bottom margin" step="0.1" placeholder="Bottom" />
              <input type="number" id="left" class="form-input tooltip-bottom" data-tooltip="Left margin" step="0.1" placeholder="Left" />
              <input type="number" id="right" class="form-input tooltip-bottom" data-tooltip="Right margin" step="0.1" placeholder="Right" />
            </div>
          </div>

          <div class="form-group">
            <label class="form-label">
              Watermark 
              <span class="optional">(optional)</span>
              <span class="help-tip tooltip" data-tooltip="Add diagonal text watermark to all pages">?</span>
            </label>
            <div class="grid-3">
              <input type="text" id="watermark_text" class="form-input" data-tooltip="Watermark text" placeholder="Text" />
              <input type="number" id="watermark_size" class="form-input" data-tooltip="Font size in points" value="36" placeholder="Size" />
              <input type="number" id="watermark_rotate" class="form-input" data-tooltip="Rotation angle in degrees" value="45" placeholder="Angle" />
            </div>
          </div>

          <div class="btn-group">
            <button id="btnBefore" class="btn btn-secondary tooltip" data-tooltip="Load and preview the original PDF">
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
              Preview Original
            </button>
            <button id="btnAfter" class="btn btn-primary tooltip" data-tooltip="Apply changes and download the processed PDF">
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
              Process & Download
            </button>
            <button id="btnClearConfig" class="btn btn-secondary tooltip" data-tooltip="Reset all settings to defaults">
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/></svg>
              Reset
            </button>
          </div>

          <div id="pdfProgress" class="progress-container">
            <div class="progress-bar">
              <div class="progress-fill"></div>
            </div>
            <div class="progress-text">Processing...</div>
          </div>
        </div>
      </div>

      <!-- Preview Card -->
      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
            Preview
          </h3>
          <p>Compare original and processed PDF</p>
        </div>
        <div class="card-body">
          <div class="preview-container">
            <div class="preview-toolbar">
              <div class="preview-tabs">
                <button class="preview-tab active" data-preview="before">Original</button>
                <button class="preview-tab" data-preview="after">Processed</button>
              </div>
              <div class="preview-actions">
                <button class="preview-action-btn tooltip" id="btnSplitView" data-tooltip="Compare side by side">
                  <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"/></svg>
                </button>
                <button class="preview-action-btn tooltip" id="btnFullscreen" data-tooltip="View fullscreen">
                  <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"/></svg>
                </button>
              </div>
            </div>

            <!-- Single View Panels -->
            <div id="preview-before" class="preview-panel active">
              <div class="preview-frame">
                <iframe id="frameBefore"></iframe>
              </div>
            </div>
            <div id="preview-after" class="preview-panel">
              <div class="preview-frame">
                <iframe id="frameAfter"></iframe>
              </div>
            </div>

            <!-- Split View -->
            <div id="splitView" class="split-view">
              <div class="split-panel">
                <div class="split-panel-header">
                  <span class="dot before"></span>
                  Original
                </div>
                <iframe id="splitFrameBefore"></iframe>
              </div>
              <div class="split-panel">
                <div class="split-panel-header">
                  <span class="dot after"></span>
                  Processed
                </div>
                <iframe id="splitFrameAfter"></iframe>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- Watermark Remover Page -->
    <div id="page-watermark" class="page">
      <!-- Breadcrumbs -->
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">Watermark Remover</span>
      </nav>

      <div class="page-header">
        <h2>Watermark Remover</h2>
        <p>Remove text watermarks from scanned PDFs and photo notes using image processing.</p>
      </div>

      <!-- Import Card -->
      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"/></svg>
            Import PDF
          </h3>
          <p>Upload a PDF with watermarks to remove</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <label class="form-label">Upload PDF File</label>
            <div id="wmDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"/>
              </svg>
              <div class="drop-zone-text">Drag & drop your PDF here, or click to browse</div>
              <div class="drop-zone-hint">Maximum file size: 100MB</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="wm_file" accept="application/pdf" style="display: none;" />
          </div>

          <div class="form-group">
            <label class="form-label">Or paste PDF URL / Google Drive Link</label>
            <input type="text" id="wm_url" class="form-input" placeholder="https://drive.google.com/file/d/... or direct PDF URL" />
          </div>
        </div>
      </div>

      <!-- Settings Card -->
      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"/></svg>
            Removal Settings
          </h3>
          <p>Configure how the watermark should be removed</p>
        </div>
        <div class="card-body">
          <div class="grid-2">
            <div class="form-group">
              <label class="form-label">
                Watermark Text
                <span class="help-tip tooltip" data-tooltip="The text of the watermark (for reference)">?</span>
              </label>
              <input type="text" id="wm_text" class="form-input" value="Educated Nepal" placeholder="e.g., Educated Nepal" />
            </div>
            <div class="form-group">
              <label class="form-label">Removal Method</label>
              <select id="wm_method" class="form-select">
                <option value="inpaint" selected>Inpaint (Best for handwritten notes)</option>
                <option value="threshold">Threshold (Light watermarks on white)</option>
                <option value="color">Color-based (Gray watermarks)</option>
              </select>
            </div>
          </div>

          <div class="form-group">
            <label class="form-label">
              Removal Intensity
              <span class="help-tip tooltip" data-tooltip="Higher = more aggressive removal (may affect content)">?</span>
            </label>
            <input type="range" id="wm_intensity" min="0" max="100" value="50" style="width: 100%;" />
            <div style="display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 4px;">
              <span>Light (0)</span>
              <span id="wm_intensity_value">50</span>
              <span>Strong (100)</span>
            </div>
          </div>

          <div class="grid-2">
            <div class="form-group">
              <label class="form-label">
                Processing DPI
                <span class="help-tip tooltip" data-tooltip="Lower = smaller file, higher = better quality">?</span>
              </label>
              <select id="wm_dpi" class="form-select">
                <option value="72">72 DPI (Smallest file)</option>
                <option value="100">100 DPI (Small file)</option>
                <option value="120" selected>120 DPI (Balanced)</option>
                <option value="150">150 DPI (Good quality)</option>
                <option value="200">200 DPI (High quality)</option>
              </select>
            </div>
            <div class="form-group">
              <label class="form-label">
                Output Quality
                <span class="help-tip tooltip" data-tooltip="JPEG quality - lower = smaller file">?</span>
              </label>
              <select id="wm_quality" class="form-select">
                <option value="50">50% (Smallest file)</option>
                <option value="65">65% (Small file)</option>
                <option value="75" selected>75% (Balanced)</option>
                <option value="85">85% (Good quality)</option>
                <option value="92">92% (High quality)</option>
              </select>
            </div>
          </div>

          <div class="form-group">
            <label class="form-label">Output Filename</label>
            <input type="text" id="wm_output_name" class="form-input" value="cleaned.pdf" />
          </div>

          <div class="btn-group">
            <button id="btnWmPreview" class="btn btn-secondary">
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
              Preview Page 1
            </button>
            <button id="btnRemoveWatermark" class="btn btn-primary">
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
              Process All & Download
            </button>
          </div>

          <div id="wmProgress" class="progress-container">
            <div class="progress-bar">
              <div class="progress-fill"></div>
            </div>
            <div class="progress-text">Processing...</div>
          </div>
        </div>
      </div>

      <!-- Preview Card -->
      <div class="card" id="wmPreviewCard" style="display: none;">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
            Preview Comparison
          </h3>
          <p>Compare original and processed (Page 1)</p>
        </div>
        <div class="card-body">
          <div class="grid-2" style="gap: 20px;">
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary);">Original</div>
              <div style="border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="wmPreviewOriginal" style="width: 100%; display: block;" alt="Original" />
              </div>
            </div>
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--primary);">Processed</div>
              <div style="border: 1px solid var(--primary); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="wmPreviewProcessed" style="width: 100%; display: block;" alt="Processed" />
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- Tips Card -->
      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
            Tips for Best Results
          </h3>
        </div>
        <div class="card-body">
          <div style="display: grid; gap: 12px;">
            <div style="display: flex; gap: 12px; align-items: flex-start;">
              <div style="width: 24px; height: 24px; background: var(--primary-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0;">
                <span style="font-size: 12px; font-weight: 600; color: var(--primary);">1</span>
              </div>
              <div>
                <div style="font-size: 13px; font-weight: 600; color: var(--text);">Start with Inpaint method</div>
                <div style="font-size: 12px; color: var(--text-muted);">Best for handwritten notes with light gray watermarks</div>
              </div>
            </div>
            <div style="display: flex; gap: 12px; align-items: flex-start;">
              <div style="width: 24px; height: 24px; background: var(--primary-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0;">
                <span style="font-size: 12px; font-weight: 600; color: var(--primary);">2</span>
              </div>
              <div>
                <div style="font-size: 13px; font-weight: 600; color: var(--text);">Adjust intensity gradually</div>
                <div style="font-size: 12px; color: var(--text-muted);">If watermark persists, increase intensity. If content gets damaged, decrease it.</div>
              </div>
            </div>
            <div style="display: flex; gap: 12px; align-items: flex-start;">
              <div style="width: 24px; height: 24px; background: var(--primary-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0;">
                <span style="font-size: 12px; font-weight: 600; color: var(--primary);">3</span>
              </div>
              <div>
                <div style="font-size: 13px; font-weight: 600; color: var(--text);">Try different methods</div>
                <div style="font-size: 12px; color: var(--text-muted);">Threshold works well for very light watermarks, Color-based for consistent gray text.</div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- Images to PDF Page -->
    <div id="page-img2pdf" class="page">
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">Images to PDF</span>
      </nav>

      <div class="page-header">
        <h2>Images to PDF</h2>
        <p>Convert multiple images to a single PDF. Drag to reorder images before conversion.</p>
      </div>

      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>
            Upload Images
          </h3>
          <p>Select multiple images - drag to reorder</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <div id="img2pdfDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop images here, or click to browse</div>
              <div class="drop-zone-hint">Supports JPG, PNG, GIF, WebP</div>
            </div>
            <input type="file" id="img2pdf_files" accept="image/*" multiple style="display: none;" />
          </div>

          <div id="img2pdfPreview" class="image-grid" style="margin-top: 16px; min-height: 0;"></div>

          <div class="grid-2" style="margin-top: 20px;">
            <div class="form-group">
              <label class="form-label">Page Size</label>
              <select id="img2pdf_pagesize" class="form-select">
                <option value="a4" selected>A4</option>
                <option value="letter">Letter</option>
                <option value="a3">A3</option>
                <option value="fit">Fit to Image</option>
              </select>
            </div>
            <div class="form-group">
              <label class="form-label">Output Filename</label>
              <input type="text" id="img2pdf_output" class="form-input" value="images.pdf" />
            </div>
          </div>

          <div class="btn-group">
            <button id="btnImg2Pdf" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
              Create PDF
            </button>
            <button id="btnImg2PdfClear" class="btn btn-secondary" disabled>Clear All</button>
          </div>

          <div id="img2pdfProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Creating PDF...</div>
          </div>
        </div>
      </div>
    </div>

    <!-- Merge PDFs Page -->
    <div id="page-merge" class="page">
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">Merge PDFs</span>
      </nav>

      <div class="page-header">
        <h2>Merge PDFs</h2>
        <p>Combine multiple PDF files into one. Drag to reorder before merging.</p>
      </div>

      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"/></svg>
            Upload PDFs
          </h3>
          <p>Select multiple PDF files - drag to reorder</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <div id="mergeDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop PDF files here, or click to browse</div>
              <div class="drop-zone-hint">Select 2 or more PDFs to merge</div>
            </div>
            <input type="file" id="merge_files" accept="application/pdf" multiple style="display: none;" />
          </div>

          <div id="mergeFileList" style="margin-top: 16px;"></div>

          <div class="form-group" style="margin-top: 20px;">
            <label class="form-label">Output Filename</label>
            <input type="text" id="merge_output" class="form-input" value="merged.pdf" />
          </div>

          <div class="btn-group">
            <button id="btnMerge" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
              Merge PDFs
            </button>
            <button id="btnMergeClear" class="btn btn-secondary" disabled>Clear All</button>
          </div>

          <div id="mergeProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Merging PDFs...</div>
          </div>
        </div>
      </div>
    </div>

    <!-- Split PDF Page -->
    <div id="page-split" class="page">
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">Split PDF</span>
      </nav>

      <div class="page-header">
        <h2>Split PDF</h2>
        <p>Split a PDF into multiple files - by page, range, or chunks.</p>
      </div>

      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7v8a2 2 0 002 2h6M8 7V5a2 2 0 012-2h4.586a1 1 0 01.707.293l4.414 4.414a1 1 0 01.293.707V15a2 2 0 01-2 2h-2M8 7H6a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2v-2"/></svg>
            Upload PDF
          </h3>
          <p>Select a PDF file to split</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <div id="splitDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop a PDF here, or click to browse</div>
              <div class="drop-zone-hint">Maximum file size: 100MB</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="split_file" accept="application/pdf" style="display: none;" />
          </div>

          <div class="grid-2" style="margin-top: 20px;">
            <div class="form-group">
              <label class="form-label">Split Mode</label>
              <select id="split_mode" class="form-select">
                <option value="all" selected>Every Page (ZIP)</option>
                <option value="range">Extract Pages</option>
                <option value="chunks">Split into Chunks</option>
              </select>
            </div>
            <div class="form-group">
              <label class="form-label" id="split_pages_label">Pages / Chunk Size</label>
              <input type="text" id="split_pages" class="form-input" placeholder="e.g., 1,3,5-8 or chunk size" />
            </div>
          </div>

          <div class="form-group">
            <label class="form-label">Output Filename Prefix</label>
            <input type="text" id="split_output" class="form-input" value="split" />
          </div>

          <div class="btn-group">
            <button id="btnSplit" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
              Split PDF
            </button>
          </div>

          <div id="splitProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Splitting PDF...</div>
          </div>
        </div>
      </div>
    </div>

    <!-- Image Scraper Page -->
    <div id="page-images" class="page">
      <!-- Breadcrumbs -->
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">Image Scraper</span>
      </nav>

      <div class="page-header">
        <h2>Image Scraper</h2>
        <p>Extract high-quality images from any webpage. Automatically filters out small icons and duplicates.</p>
      </div>

      <!-- Step Indicator -->
      <div class="step-indicator" id="imageStepIndicator"></div>

      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
            Scrape Images
          </h3>
          <p>Enter a webpage URL to extract all images</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <label class="form-label">Webpage URL</label>
            <input type="text" id="page_url" class="form-input" placeholder="https://example.com/article" />
          </div>

          <div class="btn-group">
            <button id="btnScrape" class="btn btn-primary">
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
              Fetch Images
            </button>
            <button id="btnSelectAll" class="btn btn-secondary" disabled>Select All</button>
            <button id="btnSelectNone" class="btn btn-secondary" disabled>Clear Selection</button>
          </div>

          <div id="imgProgress" class="progress-container">
            <div class="progress-bar">
              <div class="progress-fill"></div>
            </div>
            <div class="progress-text">Scraping images...</div>
          </div>

          <!-- Skeleton Loader -->
          <div id="imageSkeleton" class="image-grid-skeleton" style="display: none; margin-top: 20px;">
            <div class="image-card-skeleton">
              <div class="skeleton skeleton-image"></div>
              <div class="skeleton-meta">
                <div class="skeleton skeleton-text"></div>
                <div class="skeleton skeleton-text"></div>
              </div>
            </div>
            <div class="image-card-skeleton">
              <div class="skeleton skeleton-image"></div>
              <div class="skeleton-meta">
                <div class="skeleton skeleton-text"></div>
                <div class="skeleton skeleton-text"></div>
              </div>
            </div>
            <div class="image-card-skeleton">
              <div class="skeleton skeleton-image"></div>
              <div class="skeleton-meta">
                <div class="skeleton skeleton-text"></div>
                <div class="skeleton skeleton-text"></div>
              </div>
            </div>
            <div class="image-card-skeleton">
              <div class="skeleton skeleton-image"></div>
              <div class="skeleton-meta">
                <div class="skeleton skeleton-text"></div>
                <div class="skeleton skeleton-text"></div>
              </div>
            </div>
          </div>

          <div class="image-toolbar" id="imageToolbar" style="display: none;">
            <div class="image-toolbar-left">
              <span class="counter-badge" id="img_counter">0 images • 0 selected</span>
            </div>
            <div class="image-toolbar-right">
              <div class="download-section">
                <input type="text" id="zip_name" class="form-input" value="images.zip" />
                <button id="btnZip" class="btn btn-success" disabled>
                  <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
                  ZIP
                </button>
              </div>
              <div class="download-section">
                <input type="text" id="pdf_name" class="form-input" value="images.pdf" />
                <button id="btnPdf" class="btn btn-success" disabled>
                  <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
                  PDF
                </button>
              </div>
            </div>
          </div>

          <div id="imgGrid" class="image-grid"></div>
        </div>
      </div>
    </div>

    <!-- PDF to Images Page -->
    <div id="page-pdf2img" class="page">
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">PDF to Images</span>
      </nav>

      <div class="page-header">
        <h2>PDF to Images</h2>
        <p>Convert PDF pages to PNG or JPG images. Download as a ZIP file.</p>
      </div>

      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>
            Convert PDF
          </h3>
          <p>Upload a PDF to extract pages as images</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <div id="pdf2imgDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop a PDF here, or click to browse</div>
              <div class="drop-zone-hint">Maximum file size: 100MB</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="pdf2img_file" accept="application/pdf" style="display: none;" />
          </div>

          <div class="grid-3" style="margin-top: 20px;">
            <div class="form-group">
              <label class="form-label">Image Format</label>
              <select id="pdf2img_format" class="form-select">
                <option value="png" selected>PNG (Lossless)</option>
                <option value="jpg">JPG (Smaller)</option>
              </select>
            </div>
            <div class="form-group">
              <label class="form-label">
                Quality (DPI)
                <span class="help-tip tooltip" data-tooltip="Higher DPI = sharper images but larger files">?</span>
              </label>
              <select id="pdf2img_dpi" class="form-select">
                <option value="150">150 DPI (Web preview)</option>
                <option value="200" selected>200 DPI (Good quality)</option>
                <option value="300">300 DPI (Print quality)</option>
                <option value="400">400 DPI (Ultra sharp)</option>
                <option value="600">600 DPI (Maximum - OCR/Archive)</option>
              </select>
            </div>
            <div class="form-group">
              <label class="form-label">Pages <span class="optional">(optional)</span></label>
              <input type="text" id="pdf2img_pages" class="form-input" placeholder="e.g., 1,3,5-8 or leave empty for all" />
            </div>
          </div>

          <div class="form-group">
            <label class="form-label">Output Filename</label>
            <input type="text" id="pdf2img_output" class="form-input" value="pages" />
          </div>

          <div class="btn-group">
            <button id="btnPdf2Img" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
              Convert & Download
            </button>
          </div>

          <div id="pdf2imgProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Converting...</div>
          </div>
        </div>
      </div>
    </div>

    <!-- Compress PDF Page -->
    <div id="page-compress" class="page">
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">Compress PDF</span>
      </nav>

      <div class="page-header">
        <h2>Compress PDF</h2>
        <p>Reduce PDF file size by compressing images and removing metadata.</p>
      </div>

      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"/></svg>
            Compress PDF
          </h3>
          <p>Upload a PDF to reduce its file size</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <div id="compressDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop a PDF here, or click to browse</div>
              <div class="drop-zone-hint">Maximum file size: 100MB</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="compress_file" accept="application/pdf" style="display: none;" />
          </div>

          <div class="grid-2" style="margin-top: 20px;">
            <div class="form-group">
              <label class="form-label">Quality: <span id="compress_quality_val">60</span>%</label>
              <input type="range" id="compress_quality" min="10" max="100" value="60" style="width: 100%;" />
            </div>
            <div class="form-group">
              <label class="form-label">Output Filename</label>
              <input type="text" id="compress_output" class="form-input" value="compressed.pdf" />
            </div>
          </div>

          <div class="btn-group">
            <button id="btnCompressPreview" class="btn btn-secondary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
              Preview Page 1
            </button>
            <button id="btnCompress" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
              Compress & Download
            </button>
          </div>

          <div id="compressProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Compressing...</div>
          </div>

          <div id="compressResult" style="display: none; margin-top: 16px; padding: 16px; background: var(--success-light); border-radius: var(--radius); border: 1px solid var(--success);">
            <div style="display: flex; align-items: center; gap: 12px;">
              <svg width="24" height="24" fill="none" stroke="var(--success)" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
              </svg>
              <div>
                <div style="font-weight: 600; color: var(--success);">Compression Complete!</div>
                <div id="compressStats" style="font-size: 13px; color: var(--text-secondary);"></div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- Preview Card -->
      <div class="card" id="compressPreviewCard" style="display: none;">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
            Preview Comparison
          </h3>
          <p>Compare original and compressed (Page 1)</p>
        </div>
        <div class="card-body">
          <div class="grid-2" style="gap: 20px;">
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary);">Original</div>
              <div style="border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="compressPreviewOriginal" style="width: 100%; display: block;" alt="Original" />
              </div>
            </div>
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--primary);">Compressed</div>
              <div style="border: 1px solid var(--primary); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="compressPreviewProcessed" style="width: 100%; display: block;" alt="Compressed" />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- Rotate Pages Page -->
    <div id="page-rotate" class="page">
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">Rotate Pages</span>
      </nav>

      <div class="page-header">
        <h2>Rotate PDF Pages</h2>
        <p>Rotate all pages or specific pages by 90°, 180°, or 270°.</p>
      </div>

      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/></svg>
            Rotate PDF
          </h3>
          <p>Upload a PDF to rotate its pages</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <div id="rotateDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop a PDF here, or click to browse</div>
              <div class="drop-zone-hint">Maximum file size: 100MB</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="rotate_file" accept="application/pdf" style="display: none;" />
          </div>

          <div class="grid-3" style="margin-top: 20px;">
            <div class="form-group">
              <label class="form-label">Rotation</label>
              <select id="rotate_angle" class="form-select">
                <option value="90" selected>90° Clockwise</option>
                <option value="180">180°</option>
                <option value="270">90° Counter-clockwise</option>
              </select>
            </div>
            <div class="form-group">
              <label class="form-label">Pages <span class="optional">(optional)</span></label>
              <input type="text" id="rotate_pages" class="form-input" placeholder="e.g., 1,3,5-8 or leave empty for all" />
            </div>
            <div class="form-group">
              <label class="form-label">Output Filename</label>
              <input type="text" id="rotate_output" class="form-input" value="rotated.pdf" />
            </div>
          </div>

          <div class="btn-group">
            <button id="btnRotatePreview" class="btn btn-secondary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
              Preview Page 1
            </button>
            <button id="btnRotate" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
              Rotate & Download
            </button>
          </div>

          <div id="rotateProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Rotating...</div>
          </div>
        </div>
      </div>

      <!-- Preview Card -->
      <div class="card" id="rotatePreviewCard" style="display: none;">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
            Preview Comparison
          </h3>
          <p>Compare original and rotated (Page 1)</p>
        </div>
        <div class="card-body">
          <div class="grid-2" style="gap: 20px;">
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary);">Original</div>
              <div style="border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="rotatePreviewOriginal" style="width: 100%; display: block;" alt="Original" />
              </div>
            </div>
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--primary);">Rotated</div>
              <div style="border: 1px solid var(--primary); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="rotatePreviewProcessed" style="width: 100%; display: block;" alt="Rotated" />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- Page Numbers Page -->
    <div id="page-pagenums" class="page">
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">Page Numbers</span>
      </nav>

      <div class="page-header">
        <h2>Add Page Numbers</h2>
        <p>Insert page numbers with customizable position and format.</p>
      </div>

      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 20l4-16m2 16l4-16M6 9h14M4 15h14"/></svg>
            Add Page Numbers
          </h3>
          <p>Upload a PDF to add page numbers</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <div id="pagenumsDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop a PDF here, or click to browse</div>
              <div class="drop-zone-hint">Maximum file size: 100MB</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="pagenums_file" accept="application/pdf" style="display: none;" />
          </div>

          <div class="grid-2" style="margin-top: 20px;">
            <div class="form-group">
              <label class="form-label">Position</label>
              <select id="pagenums_position" class="form-select">
                <option value="bottom-center" selected>Bottom Center</option>
                <option value="bottom-left">Bottom Left</option>
                <option value="bottom-right">Bottom Right</option>
                <option value="top-center">Top Center</option>
                <option value="top-left">Top Left</option>
                <option value="top-right">Top Right</option>
              </select>
            </div>
            <div class="form-group">
              <label class="form-label">Format</label>
              <select id="pagenums_format" class="form-select">
                <option value="Page {n} of {total}" selected>Page 1 of 10</option>
                <option value="{n} / {total}">1 / 10</option>
                <option value="{n}">1</option>
                <option value="- {n} -">- 1 -</option>
              </select>
            </div>
          </div>

          <div class="grid-3" style="margin-top: 12px;">
            <div class="form-group">
              <label class="form-label">Start Number</label>
              <input type="number" id="pagenums_start" class="form-input" value="1" min="1" />
            </div>
            <div class="form-group">
              <label class="form-label">Font Size</label>
              <input type="number" id="pagenums_fontsize" class="form-input" value="11" min="8" max="24" />
            </div>
            <div class="form-group">
              <label class="form-label">Output Filename</label>
              <input type="text" id="pagenums_output" class="form-input" value="numbered.pdf" />
            </div>
          </div>

          <div class="btn-group">
            <button id="btnPageNumsPreview" class="btn btn-secondary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
              Preview Page 1
            </button>
            <button id="btnPageNums" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
              Add Numbers & Download
            </button>
          </div>

          <div id="pagenumsProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Processing...</div>
          </div>
        </div>
      </div>

      <!-- Preview Card -->
      <div class="card" id="pagenumsPreviewCard" style="display: none;">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
            Preview Comparison
          </h3>
          <p>Compare original and numbered (Page 1)</p>
        </div>
        <div class="card-body">
          <div class="grid-2" style="gap: 20px;">
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary);">Original</div>
              <div style="border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="pagenumsPreviewOriginal" style="width: 100%; display: block;" alt="Original" />
              </div>
            </div>
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--primary);">With Page Numbers</div>
              <div style="border: 1px solid var(--primary); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="pagenumsPreviewProcessed" style="width: 100%; display: block;" alt="Numbered" />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- PDF to Text (OCR) Page -->
    <div id="page-ocr" class="page">
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">PDF to Text (OCR)</span>
      </nav>

      <div class="page-header">
        <h2>PDF to Text (OCR)</h2>
        <p>Extract text from PDFs. Uses OCR (Tesseract) for scanned documents.</p>
      </div>

      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
            Upload PDF
          </h3>
          <p>Select a PDF to extract text from</p>
        </div>
        <div class="card-body">
          <div id="ocrNotice" class="feature-hint" style="margin-bottom: 16px; display: none;">
            <div class="feature-hint-icon">ℹ️</div>
            <div class="feature-hint-content">
              <div class="feature-hint-title">Tesseract not installed</div>
              <div class="feature-hint-message">Basic text extraction will be used. Install Tesseract for OCR on scanned PDFs.</div>
            </div>
          </div>

          <div class="form-group">
            <div id="ocrDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop a PDF here, or click to browse</div>
              <div class="drop-zone-hint">Maximum file size: 100MB</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="ocr_file" accept="application/pdf" style="display: none;" />
          </div>

          <div class="grid-3" style="margin-top: 16px;">
            <div class="form-group">
              <label class="form-label">Language</label>
              <select id="ocr_language" class="form-select">
                <option value="eng" selected>English</option>
                <option value="fra">French</option>
                <option value="deu">German</option>
                <option value="spa">Spanish</option>
                <option value="ita">Italian</option>
                <option value="por">Portuguese</option>
                <option value="nld">Dutch</option>
                <option value="rus">Russian</option>
                <option value="chi_sim">Chinese (Simplified)</option>
                <option value="chi_tra">Chinese (Traditional)</option>
                <option value="jpn">Japanese</option>
                <option value="kor">Korean</option>
                <option value="ara">Arabic</option>
                <option value="hin">Hindi</option>
              </select>
            </div>
            <div class="form-group">
              <label class="form-label">Pages <span class="optional">(optional)</span></label>
              <input type="text" id="ocr_pages" class="form-input" placeholder="e.g., 1,3,5-8 or leave empty for all" />
            </div>
            <div class="form-group">
              <label class="form-label">OCR Quality (DPI)</label>
              <select id="ocr_dpi" class="form-select">
                <option value="150">150 DPI (Fast)</option>
                <option value="200" selected>200 DPI (Balanced)</option>
                <option value="300">300 DPI (Best)</option>
              </select>
            </div>
          </div>

          <div class="btn-group">
            <button id="btnOcr" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
              Extract Text
            </button>
            <button id="btnOcrCopy" class="btn btn-secondary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
              Copy to Clipboard
            </button>
          </div>

          <div id="ocrProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Extracting text...</div>
          </div>

          <div id="ocrResult" style="display: none; margin-top: 20px;">
            <div class="form-group">
              <label class="form-label">Extracted Text</label>
              <textarea id="ocrText" class="form-input" style="min-height: 300px; font-family: monospace; font-size: 13px;" readonly></textarea>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- Remove Background Page -->
    <div id="page-rembg" class="page">
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">Remove Background</span>
      </nav>

      <div class="page-header">
        <h2>Remove Background</h2>
        <p>AI-powered background removal. Works best with photos of people, products, and objects.</p>
      </div>

      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.121 14.121L19 19m-7-7l7-7m-7 7l-2.879 2.879M12 12L9.121 9.121m0 5.758a3 3 0 10-4.243 4.243 3 3 0 004.243-4.243zm0-5.758a3 3 0 10-4.243-4.243 3 3 0 004.243 4.243z"/></svg>
            Upload Image
          </h3>
          <p>Select an image to remove its background</p>
        </div>
        <div class="card-body">
          <div id="rembgNotice" class="feature-hint" style="margin-bottom: 16px; display: none;">
            <div class="feature-hint-icon">⚠️</div>
            <div class="feature-hint-content">
              <div class="feature-hint-title">rembg not installed</div>
              <div class="feature-hint-message">Run: pip install rembg[gpu] (or pip install rembg for CPU-only)</div>
            </div>
          </div>

          <div class="form-group">
            <div id="rembgDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop an image here, or click to browse</div>
              <div class="drop-zone-hint">Supports JPG, PNG, WebP</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="rembg_file" accept="image/*" style="display: none;" />
          </div>

          <div class="form-group" style="margin-top: 16px;">
            <label class="form-label">Output Filename</label>
            <input type="text" id="rembg_output" class="form-input" value="no-background.png" />
          </div>

          <div class="btn-group">
            <button id="btnRembgPreview" class="btn btn-secondary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
              Preview
            </button>
            <button id="btnRembg" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
              Remove Background
            </button>
          </div>

          <div id="rembgProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Processing (this may take a moment)...</div>
          </div>
        </div>
      </div>

      <!-- Preview Card -->
      <div class="card" id="rembgPreviewCard" style="display: none;">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
            Preview Comparison
          </h3>
          <p>Compare original and background removed</p>
        </div>
        <div class="card-body">
          <div class="grid-2" style="gap: 20px;">
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary);">Original</div>
              <div style="border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="rembgPreviewOriginal" style="width: 100%; display: block;" alt="Original" />
              </div>
            </div>
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--primary);">Background Removed</div>
              <div style="border: 1px solid var(--primary); border-radius: var(--radius); overflow: hidden; background: repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 50% / 20px 20px;">
                <img id="rembgPreviewProcessed" style="width: 100%; display: block;" alt="Processed" />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- Enhance Quality Page -->
    <div id="page-enhance" class="page">
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">Enhance Quality</span>
      </nav>

      <div class="page-header">
        <h2>Enhance Quality</h2>
        <p>Improve image and PDF quality with sharpening, contrast enhancement, and optional upscaling.</p>
      </div>

      <!-- Image Enhancement Card -->
      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>
            Enhance Image
          </h3>
          <p>Upload an image to enhance its quality</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <div id="enhanceImgDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop an image here, or click to browse</div>
              <div class="drop-zone-hint">Supports JPG, PNG, WebP</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="enhanceimg_file" accept="image/*" style="display: none;" />
          </div>

          <div class="grid-3" style="margin-top: 16px;">
            <div class="form-group">
              <label class="form-label">Enhancement Level</label>
              <select id="enhanceimg_level" class="form-select">
                <option value="light">Light (Subtle)</option>
                <option value="medium" selected>Medium (Balanced)</option>
                <option value="strong">Strong (Noticeable)</option>
              </select>
            </div>
            <div class="form-group">
              <label class="form-label">Upscale</label>
              <select id="enhanceimg_upscale" class="form-select">
                <option value="1.0" selected>No upscale</option>
                <option value="1.25">1.25x</option>
                <option value="1.5">1.5x</option>
                <option value="2.0">2x</option>
              </select>
            </div>
            <div class="form-group">
              <label class="form-label">Output Filename</label>
              <input type="text" id="enhanceimg_output" class="form-input" value="enhanced" />
            </div>
          </div>

          <div class="btn-group">
            <button id="btnEnhanceImgPreview" class="btn btn-secondary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
              Preview
            </button>
            <button id="btnEnhanceImg" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"/></svg>
              Enhance Image
            </button>
          </div>

          <div id="enhanceimgProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Enhancing...</div>
          </div>
        </div>
      </div>

      <!-- Preview Card for Image Enhancement -->
      <div class="card" id="enhanceimgPreviewCard" style="display: none;">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
            Preview Comparison
          </h3>
          <p>Compare original and enhanced image</p>
        </div>
        <div class="card-body">
          <div class="grid-2" style="gap: 20px;">
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary);">Original</div>
              <div style="border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="enhanceimgPreviewOriginal" style="width: 100%; display: block;" alt="Original" />
              </div>
            </div>
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--primary);">Enhanced</div>
              <div style="border: 1px solid var(--primary); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="enhanceimgPreviewProcessed" style="width: 100%; display: block;" alt="Enhanced" />
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- PDF Enhancement Card -->
      <div class="card" style="margin-top: 24px;">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
            Enhance PDF
          </h3>
          <p>Improve quality of images within a PDF document</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <div id="enhancePdfDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop a PDF here, or click to browse</div>
              <div class="drop-zone-hint">Maximum file size: 100MB</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="enhancepdf_file" accept="application/pdf" style="display: none;" />
          </div>

          <div class="grid-2" style="margin-top: 16px;">
            <div class="form-group">
              <label class="form-label">Enhancement Level</label>
              <select id="enhancepdf_level" class="form-select">
                <option value="light">Light (Subtle)</option>
                <option value="medium" selected>Medium (Balanced)</option>
                <option value="strong">Strong (Noticeable)</option>
              </select>
            </div>
            <div class="form-group">
              <label class="form-label">Output Filename</label>
              <input type="text" id="enhancepdf_output" class="form-input" value="enhanced.pdf" />
            </div>
          </div>

          <div class="btn-group">
            <button id="btnEnhancePdf" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"/></svg>
              Enhance PDF
            </button>
          </div>

          <div id="enhancepdfProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Enhancing...</div>
          </div>

          <div id="enhancepdfResult" style="display: none; margin-top: 16px; padding: 16px; background: var(--success-light); border-radius: var(--radius); border: 1px solid var(--success);">
            <div style="display: flex; align-items: center; gap: 12px;">
              <svg width="24" height="24" fill="none" stroke="var(--success)" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
              </svg>
              <div>
                <div style="font-weight: 600; color: var(--success);">Enhancement Complete!</div>
                <div id="enhancepdfStats" style="font-size: 13px; color: var(--text-secondary);"></div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- Tips -->
      <div class="card" style="margin-top: 24px;">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
            Tips
          </h3>
        </div>
        <div class="card-body">
          <div style="display: grid; gap: 12px; font-size: 13px; color: var(--text-secondary);">
            <div><strong>Light:</strong> Subtle improvements, minimal file size increase</div>
            <div><strong>Medium:</strong> Balanced enhancement, recommended for most cases</div>
            <div><strong>Strong:</strong> More noticeable sharpening and contrast boost</div>
            <div><strong>Upscaling:</strong> Increases resolution but also file size</div>
            <div>• File size is kept reasonable (typically 1.5-2x original for enhanced files)</div>
          </div>
        </div>
      </div>
    </div>

    <!-- Add Watermark Page -->
    <div id="page-imgwatermark" class="page">
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">Add Watermark</span>
      </nav>

      <div class="page-header">
        <h2>Add Watermark</h2>
        <p>Add text watermark to your images with customizable position, opacity, and style.</p>
      </div>

      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"/></svg>
            Upload Image
          </h3>
          <p>Select an image to add watermark</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <div id="imgwatermarkDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop an image here, or click to browse</div>
              <div class="drop-zone-hint">Supports JPG, PNG, WebP, GIF</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="imgwatermark_file" accept="image/*" style="display: none;" />
          </div>

          <div class="form-group" style="margin-top: 16px;">
            <label class="form-label">Watermark Text</label>
            <input type="text" id="imgwatermark_text" class="form-input" placeholder="© Your Name" />
          </div>

          <div class="grid-3" style="margin-top: 12px;">
            <div class="form-group">
              <label class="form-label">Position</label>
              <select id="imgwatermark_position" class="form-select">
                <option value="center" selected>Center</option>
                <option value="top-left">Top Left</option>
                <option value="top-center">Top Center</option>
                <option value="top-right">Top Right</option>
                <option value="bottom-left">Bottom Left</option>
                <option value="bottom-center">Bottom Center</option>
                <option value="bottom-right">Bottom Right</option>
                <option value="tile">Tile (Repeat)</option>
              </select>
            </div>
            <div class="form-group">
              <label class="form-label">Opacity (%)</label>
              <input type="number" id="imgwatermark_opacity" class="form-input" value="50" min="10" max="100" />
            </div>
            <div class="form-group">
              <label class="form-label">Font Size</label>
              <input type="number" id="imgwatermark_fontsize" class="form-input" value="36" min="12" max="200" />
            </div>
          </div>

          <div class="grid-2" style="margin-top: 12px;">
            <div class="form-group">
              <label class="form-label">Color</label>
              <input type="color" id="imgwatermark_color" class="form-input" value="#000000" style="height: 40px; padding: 4px;" />
            </div>
            <div class="form-group">
              <label class="form-label">Output Filename</label>
              <input type="text" id="imgwatermark_output" class="form-input" value="watermarked" />
            </div>
          </div>

          <div class="btn-group">
            <button id="btnImgWatermarkPreview" class="btn btn-secondary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
              Preview
            </button>
            <button id="btnImgWatermark" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
              Add Watermark & Download
            </button>
          </div>

          <div id="imgwatermarkProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Processing...</div>
          </div>
        </div>
      </div>

      <!-- Preview Card -->
      <div class="card" id="imgwatermarkPreviewCard" style="display: none;">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
            Preview Comparison
          </h3>
          <p>Compare original and watermarked image</p>
        </div>
        <div class="card-body">
          <div class="grid-2" style="gap: 20px;">
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary);">Original</div>
              <div style="border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="imgwatermarkPreviewOriginal" style="width: 100%; display: block;" alt="Original" />
              </div>
            </div>
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--primary);">With Watermark</div>
              <div style="border: 1px solid var(--primary); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="imgwatermarkPreviewProcessed" style="width: 100%; display: block;" alt="Watermarked" />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- Resize Image Page -->
    <div id="page-resize" class="page">
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">Resize Image</span>
      </nav>

      <div class="page-header">
        <h2>Resize Image</h2>
        <p>Resize images with presets or custom dimensions. Maintains aspect ratio by default.</p>
      </div>

      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"/></svg>
            Upload Image
          </h3>
          <p>Select an image to resize</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <div id="resizeDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop an image here, or click to browse</div>
              <div class="drop-zone-hint">Supports JPG, PNG, WebP, GIF</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="resize_file" accept="image/*" style="display: none;" />
          </div>

          <div class="form-group" style="margin-top: 16px;">
            <label class="form-label">Preset</label>
            <select id="resize_preset" class="form-select">
              <option value="custom">Custom Size</option>
              <option value="thumbnail">Thumbnail (150×150)</option>
              <option value="small">Small (320×240)</option>
              <option value="medium">Medium (640×480)</option>
              <option value="hd">HD (1280×720)</option>
              <option value="fullhd">Full HD (1920×1080)</option>
              <option value="4k">4K (3840×2160)</option>
              <option value="square-sm">Square Small (500×500)</option>
              <option value="square-lg">Square Large (1000×1000)</option>
            </select>
          </div>

          <div class="grid-3" style="margin-top: 12px;">
            <div class="form-group">
              <label class="form-label">Width (px)</label>
              <input type="number" id="resize_width" class="form-input" placeholder="Auto" min="1" />
            </div>
            <div class="form-group">
              <label class="form-label">Height (px)</label>
              <input type="number" id="resize_height" class="form-input" placeholder="Auto" min="1" />
            </div>
            <div class="form-group">
              <label class="form-label">Output Filename</label>
              <input type="text" id="resize_output" class="form-input" value="resized" />
            </div>
          </div>

          <div class="form-group" style="margin-top: 12px;">
            <label style="display: flex; align-items: center; gap: 8px; cursor: pointer;">
              <input type="checkbox" id="resize_aspect" checked style="width: 18px; height: 18px;" />
              <span class="form-label" style="margin: 0;">Maintain aspect ratio</span>
            </label>
          </div>

          <div class="btn-group">
            <button id="btnResizePreview" class="btn btn-secondary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
              Preview
            </button>
            <button id="btnResize" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
              Resize & Download
            </button>
          </div>

          <div id="resizeProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Resizing...</div>
          </div>
        </div>
      </div>

      <!-- Preview Card -->
      <div class="card" id="resizePreviewCard" style="display: none;">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
            Preview Comparison
          </h3>
          <p>Compare original and resized image</p>
        </div>
        <div class="card-body">
          <div class="grid-2" style="gap: 20px;">
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary);">Original <span id="resizeOriginalSize"></span></div>
              <div style="border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="resizePreviewOriginal" style="width: 100%; display: block;" alt="Original" />
              </div>
            </div>
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--primary);">Resized <span id="resizeNewSize"></span></div>
              <div style="border: 1px solid var(--primary); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="resizePreviewProcessed" style="width: 100%; display: block;" alt="Resized" />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- Convert Format Page -->
    <div id="page-convert" class="page">
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">Convert Format</span>
      </nav>

      <div class="page-header">
        <h2>Convert Image Format</h2>
        <p>Convert images between JPG, PNG, WebP, and GIF formats.</p>
      </div>

      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"/></svg>
            Upload Image
          </h3>
          <p>Select an image to convert</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <div id="convertDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop an image here, or click to browse</div>
              <div class="drop-zone-hint">Supports JPG, PNG, WebP, GIF</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="convert_file" accept="image/*" style="display: none;" />
          </div>

          <div class="grid-3" style="margin-top: 16px;">
            <div class="form-group">
              <label class="form-label">Target Format</label>
              <select id="convert_format" class="form-select">
                <option value="png">PNG (Lossless)</option>
                <option value="jpg" selected>JPG (Smaller)</option>
                <option value="webp">WebP (Modern)</option>
                <option value="gif">GIF</option>
              </select>
            </div>
            <div class="form-group">
              <label class="form-label">Quality (JPG/WebP)</label>
              <input type="number" id="convert_quality" class="form-input" value="90" min="10" max="100" />
            </div>
            <div class="form-group">
              <label class="form-label">Output Filename</label>
              <input type="text" id="convert_output" class="form-input" value="converted" />
            </div>
          </div>

          <div class="btn-group">
            <button id="btnConvert" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
              Convert & Download
            </button>
          </div>

          <div id="convertProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Converting...</div>
          </div>
        </div>
      </div>
    </div>

    <!-- Compress Image Page -->
    <div id="page-compressimg" class="page">
      <nav class="breadcrumbs">
        <span class="breadcrumb-item"><a href="#">Home</a></span>
        <span class="breadcrumb-separator">/</span>
        <span class="breadcrumb-item active">Compress Image</span>
      </nav>

      <div class="page-header">
        <h2>Compress Image</h2>
        <p>Reduce image file size while maintaining quality. Great for web optimization.</p>
      </div>

      <div class="card">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>
            Upload Image
          </h3>
          <p>Select an image to compress</p>
        </div>
        <div class="card-body">
          <div class="form-group">
            <div id="compressimgDropZone" class="drop-zone">
              <svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
              </svg>
              <div class="drop-zone-text">Drag & drop an image here, or click to browse</div>
              <div class="drop-zone-hint">Supports JPG, PNG, WebP</div>
              <div class="drop-zone-file">
                <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
                </svg>
                <span class="drop-zone-file-name"></span>
                <span class="drop-zone-file-size"></span>
                <button type="button" class="drop-zone-file-remove">Remove</button>
              </div>
            </div>
            <input type="file" id="compressimg_file" accept="image/*" style="display: none;" />
          </div>

          <div class="grid-2" style="margin-top: 16px;">
            <div class="form-group">
              <label class="form-label">Quality: <span id="compressimg_quality_val">70</span>%</label>
              <input type="range" id="compressimg_quality" min="10" max="100" value="70" style="width: 100%;" />
            </div>
            <div class="form-group">
              <label class="form-label">Output Filename</label>
              <input type="text" id="compressimg_output" class="form-input" value="compressed" />
            </div>
          </div>

          <div class="btn-group">
            <button id="btnCompressImgPreview" class="btn btn-secondary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
              Preview
            </button>
            <button id="btnCompressImg" class="btn btn-primary" disabled>
              <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
              Compress & Download
            </button>
          </div>

          <div id="compressimgProgress" class="progress-container">
            <div class="progress-bar"><div class="progress-fill"></div></div>
            <div class="progress-text">Compressing...</div>
          </div>

          <div id="compressimgResult" style="display: none; margin-top: 16px; padding: 16px; background: var(--success-light); border-radius: var(--radius); border: 1px solid var(--success);">
            <div style="display: flex; align-items: center; gap: 12px;">
              <svg width="24" height="24" fill="none" stroke="var(--success)" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
              </svg>
              <div>
                <div style="font-weight: 600; color: var(--success);">Compression Complete!</div>
                <div id="compressimgStats" style="font-size: 13px; color: var(--text-secondary);"></div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- Preview Card -->
      <div class="card" id="compressimgPreviewCard" style="display: none;">
        <div class="card-header">
          <h3>
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
            Preview Comparison
          </h3>
          <p>Compare original and compressed image</p>
        </div>
        <div class="card-body">
          <div class="grid-2" style="gap: 20px;">
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary);">Original</div>
              <div style="border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="compressimgPreviewOriginal" style="width: 100%; display: block;" alt="Original" />
              </div>
            </div>
            <div>
              <div style="font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--primary);">Compressed</div>
              <div style="border: 1px solid var(--primary); border-radius: var(--radius); overflow: hidden; background: var(--border-light);">
                <img id="compressimgPreviewProcessed" style="width: 100%; display: block;" alt="Compressed" />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

  </main>
</div>

<!-- Fullscreen Preview Overlay -->
<div class="fullscreen-overlay" id="fullscreenOverlay">
  <div class="fullscreen-header">
    <span class="fullscreen-title">PDF Preview</span>
    <button class="fullscreen-close" id="fullscreenClose">
      <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
      </svg>
    </button>
  </div>
  <div class="fullscreen-content">
    <iframe id="fullscreenFrame"></iframe>
  </div>
</div>

<!-- Scripts -->
<script src="/static/js/utils.js"></script>
<script src="/static/js/pdf-editor.js"></script>
<script src="/static/js/pdf-tools.js"></script>
<script src="/static/js/image-tools.js"></script>
<script src="/static/js/image-scraper.js"></script>
<script src="/static/js/app.js"></script>

</body>
</html>