File size: 54,720 Bytes
f907c0a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>FocusTime - Gestion du temps et productivité</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .pomodoro-progress {
            background: conic-gradient(#4ade80 var(--progress), #e2e8f0 0deg);
        }
        .task-checkbox:checked + .task-label {
            text-decoration: line-through;
            color: #94a3b8;
        }
        .fade-in {
            animation: fadeIn 0.3s ease-in-out;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .slide-in {
            animation: slideIn 0.3s ease-out;
        }
        @keyframes slideIn {
            from { transform: translateX(100%); }
            to { transform: translateX(0); }
        }
    </style>
</head>
<body class="bg-gray-50 text-gray-800 font-sans min-h-screen">
    <div class="max-w-md mx-auto bg-white min-h-screen shadow-lg flex flex-col">
        <!-- Header -->
        <header class="bg-indigo-700 text-white p-4 shadow-md">
            <div class="flex items-center justify-between">
                <div class="flex items-center space-x-2">
                    <i class="fas fa-clock text-2xl"></i>
                    <h1 class="text-xl font-bold">FocusTime</h1>
                </div>
                <button id="theme-toggle" class="p-2 rounded-full hover:bg-indigo-600">
                    <i class="fas fa-moon"></i>
                </button>
            </div>
        </header>

        <!-- Main Content -->
        <main class="flex-1 overflow-y-auto pb-16" id="main-content">
            <!-- Home Screen (default) -->
            <section id="home-screen" class="p-4 fade-in">
                <div class="text-center mb-6">
                    <h2 class="text-xl font-semibold mb-2">Prêt à rester concentré ?</h2>
                    <p class="text-gray-600" id="motivational-quote">"La discipline est la clé de la liberté."</p>
                </div>

                <!-- Quick Actions -->
                <div class="grid grid-cols-2 gap-4 mb-6">
                    <button onclick="showScreen('pomodoro-screen')" class="bg-green-100 hover:bg-green-200 text-green-800 p-4 rounded-lg flex flex-col items-center transition">
                        <i class="fas fa-hourglass-start text-2xl mb-2"></i>
                        <span>Démarrer Pomodoro</span>
                    </button>
                    <button onclick="showScreen('tasks-screen')" class="bg-blue-100 hover:bg-blue-200 text-blue-800 p-4 rounded-lg flex flex-col items-center transition">
                        <i class="fas fa-tasks text-2xl mb-2"></i>
                        <span>Mes tâches</span>
                    </button>
                    <button onclick="showScreen('focus-mode-screen')" class="bg-purple-100 hover:bg-purple-200 text-purple-800 p-4 rounded-lg flex flex-col items-center transition">
                        <i class="fas fa-brain text-2xl mb-2"></i>
                        <span>Mode Focus</span>
                    </button>
                    <button onclick="showScreen('stats-screen')" class="bg-yellow-100 hover:bg-yellow-200 text-yellow-800 p-4 rounded-lg flex flex-col items-center transition">
                        <i class="fas fa-chart-line text-2xl mb-2"></i>
                        <span>Statistiques</span>
                    </button>
                </div>

                <!-- Today's Summary -->
                <div class="bg-gray-100 p-4 rounded-lg mb-6">
                    <h3 class="font-medium mb-2">Résumé du jour</h3>
                    <div class="flex justify-between text-sm">
                        <div class="text-center">
                            <div class="text-2xl font-bold" id="today-sessions">0</div>
                            <div class="text-gray-600">Sessions</div>
                        </div>
                        <div class="text-center">
                            <div class="text-2xl font-bold" id="today-minutes">0</div>
                            <div class="text-gray-600">Minutes</div>
                        </div>
                        <div class="text-center">
                            <div class="text-2xl font-bold" id="today-tasks">0</div>
                            <div class="text-gray-600">Tâches</div>
                        </div>
                    </div>
                </div>

                <!-- Recent Tasks -->
                <div>
                    <h3 class="font-medium mb-2">Tâches récentes</h3>
                    <div id="recent-tasks" class="space-y-2">
                        <!-- Tasks will be added here dynamically -->
                    </div>
                </div>
            </section>

            <!-- Pomodoro Screen -->
            <section id="pomodoro-screen" class="p-4 hidden">
                <div class="flex justify-between items-center mb-6">
                    <button onclick="showScreen('home-screen')" class="p-2 rounded-full hover:bg-gray-100">
                        <i class="fas fa-arrow-left"></i>
                    </button>
                    <h2 class="text-xl font-semibold">Pomodoro</h2>
                    <div class="w-8"></div> <!-- Spacer for alignment -->
                </div>

                <div class="text-center mb-8">
                    <div class="relative w-48 h-48 mx-auto mb-6">
                        <div class="absolute inset-0 rounded-full pomodoro-progress flex items-center justify-center"
                             style="--progress: 0%">
                            <div class="absolute inset-4 bg-white rounded-full flex items-center justify-center">
                                <div class="text-center">
                                    <div id="timer-display" class="text-3xl font-bold">25:00</div>
                                    <div id="timer-state" class="text-gray-600">Prêt</div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="flex justify-center space-x-4 mb-6">
                        <button id="start-pomodoro" class="bg-green-500 hover:bg-green-600 text-white px-6 py-2 rounded-full font-medium">
                            Démarrer
                        </button>
                        <button id="reset-pomodoro" class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-6 py-2 rounded-full font-medium">
                            Réinitialiser
                        </button>
                    </div>
                </div>

                <div class="bg-gray-100 p-4 rounded-lg">
                    <h3 class="font-medium mb-2">Paramètres Pomodoro</h3>
                    <div class="space-y-4">
                        <div>
                            <label class="block text-sm text-gray-600 mb-1">Temps de travail (minutes)</label>
                            <input type="number" id="work-time" value="25" min="1" max="60" class="w-full p-2 border rounded">
                        </div>
                        <div>
                            <label class="block text-sm text-gray-600 mb-1">Pause courte (minutes)</label>
                            <input type="number" id="short-break" value="5" min="1" max="15" class="w-full p-2 border rounded">
                        </div>
                        <div>
                            <label class="block text-sm text-gray-600 mb-1">Pause longue (minutes)</label>
                            <input type="number" id="long-break" value="15" min="5" max="30" class="w-full p-2 border rounded">
                        </div>
                        <div>
                            <label class="flex items-center space-x-2">
                                <input type="checkbox" id="auto-start" class="rounded text-indigo-600">
                                <span class="text-sm text-gray-600">Démarrer automatiquement les pauses</span>
                            </label>
                        </div>
                    </div>
                </div>
            </section>

            <!-- Tasks Screen -->
            <section id="tasks-screen" class="p-4 hidden">
                <div class="flex justify-between items-center mb-6">
                    <button onclick="showScreen('home-screen')" class="p-2 rounded-full hover:bg-gray-100">
                        <i class="fas fa-arrow-left"></i>
                    </button>
                    <h2 class="text-xl font-semibold">Mes tâches</h2>
                    <button onclick="showAddTaskModal()" class="p-2 rounded-full hover:bg-gray-100">
                        <i class="fas fa-plus"></i>
                    </button>
                </div>

                <div class="flex mb-4 overflow-x-auto pb-2">
                    <button data-filter="all" class="filter-btn active px-4 py-1 bg-indigo-600 text-white rounded-full mr-2 text-sm">
                        Toutes
                    </button>
                    <button data-filter="today" class="filter-btn px-4 py-1 bg-gray-200 hover:bg-gray-300 rounded-full mr-2 text-sm">
                        Aujourd'hui
                    </button>
                    <button data-filter="week" class="filter-btn px-4 py-1 bg-gray-200 hover:bg-gray-300 rounded-full mr-2 text-sm">
                        Cette semaine
                    </button>
                    <button data-filter="high" class="filter-btn px-4 py-1 bg-gray-200 hover:bg-gray-300 rounded-full text-sm">
                        Priorité haute
                    </button>
                </div>

                <div id="tasks-list" class="space-y-2">
                    <!-- Tasks will be added here dynamically -->
                </div>
            </section>

            <!-- Add Task Modal -->
            <div id="add-task-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 hidden z-50">
                <div class="bg-white rounded-lg w-full max-w-md p-6 slide-in">
                    <div class="flex justify-between items-center mb-4">
                        <h3 class="text-lg font-semibold">Ajouter une tâche</h3>
                        <button onclick="hideAddTaskModal()" class="p-2 rounded-full hover:bg-gray-100">
                            <i class="fas fa-times"></i>
                        </button>
                    </div>
                    
                    <form id="task-form" class="space-y-4">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Titre</label>
                            <input type="text" id="task-title" required class="w-full p-2 border rounded focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Description (optionnel)</label>
                            <textarea id="task-description" rows="2" class="w-full p-2 border rounded focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"></textarea>
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Date d'échéance</label>
                            <input type="date" id="task-due" class="w-full p-2 border rounded focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Priorité</label>
                            <select id="task-priority" class="w-full p-2 border rounded focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
                                <option value="low">Basse</option>
                                <option value="medium" selected>Moyenne</option>
                                <option value="high">Haute</option>
                            </select>
                        </div>
                        
                        <div class="flex justify-end space-x-3 pt-2">
                            <button type="button" onclick="hideAddTaskModal()" class="px-4 py-2 bg-gray-200 hover:bg-gray-300 rounded-md font-medium">
                                Annuler
                            </button>
                            <button type="submit" class="px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-md font-medium">
                                Ajouter
                            </button>
                        </div>
                    </form>
                </div>
            </div>

            <!-- Focus Mode Screen -->
            <section id="focus-mode-screen" class="p-4 hidden">
                <div class="flex justify-between items-center mb-6">
                    <button onclick="showScreen('home-screen')" class="p-2 rounded-full hover:bg-gray-100">
                        <i class="fas fa-arrow-left"></i>
                    </button>
                    <h2 class="text-xl font-semibold">Mode Focus</h2>
                    <div class="w-8"></div> <!-- Spacer for alignment -->
                </div>

                <div class="bg-gray-100 p-4 rounded-lg mb-6">
                    <h3 class="font-medium mb-4">Choisissez votre mode de concentration</h3>
                    
                    <div class="space-y-4">
                        <div class="flex items-start">
                            <input type="radio" id="custom-mode" name="focus-mode" value="custom" class="mt-1" checked>
                            <label for="custom-mode" class="ml-2">
                                <div class="font-medium">Mode personnalisé</div>
                                <div class="text-sm text-gray-600">Sélectionnez les applications à bloquer pendant votre session</div>
                            </label>
                        </div>
                        
                        <div class="flex items-start">
                            <input type="radio" id="total-mode" name="focus-mode" value="total" class="mt-1">
                            <label for="total-mode" class="ml-2">
                                <div class="font-medium">Mode total</div>
                                <div class="text-sm text-gray-600">Bloque toutes les applications sauf FocusTime</div>
                            </label>
                        </div>
                    </div>
                </div>

                <div id="custom-apps-section" class="bg-gray-100 p-4 rounded-lg mb-6">
                    <h3 class="font-medium mb-3">Applications à bloquer</h3>
                    
                    <div class="space-y-3">
                        <div class="flex items-center justify-between p-2 bg-white rounded">
                            <div class="flex items-center">
                                <i class="fas fa-comment text-blue-500 mr-3"></i>
                                <span>WhatsApp</span>
                            </div>
                            <label class="relative inline-flex items-center cursor-pointer">
                                <input type="checkbox" class="sr-only peer" checked>
                                <div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
                            </label>
                        </div>
                        
                        <div class="flex items-center justify-between p-2 bg-white rounded">
                            <div class="flex items-center">
                                <i class="fab fa-facebook text-blue-600 mr-3"></i>
                                <span>Facebook</span>
                            </div>
                            <label class="relative inline-flex items-center cursor-pointer">
                                <input type="checkbox" class="sr-only peer" checked>
                                <div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
                            </label>
                        </div>
                        
                        <div class="flex items-center justify-between p-2 bg-white rounded">
                            <div class="flex items-center">
                                <i class="fab fa-instagram text-pink-500 mr-3"></i>
                                <span>Instagram</span>
                            </div>
                            <label class="relative inline-flex items-center cursor-pointer">
                                <input type="checkbox" class="sr-only peer" checked>
                                <div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
                            </label>
                        </div>
                        
                        <div class="flex items-center justify-between p-2 bg-white rounded">
                            <div class="flex items-center">
                                <i class="fab fa-twitter text-blue-400 mr-3"></i>
                                <span>Twitter</span>
                            </div>
                            <label class="relative inline-flex items-center cursor-pointer">
                                <input type="checkbox" class="sr-only peer">
                                <div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
                            </label>
                        </div>
                        
                        <div class="flex items-center justify-between p-2 bg-white rounded">
                            <div class="flex items-center">
                                <i class="fab fa-tiktok text-black mr-3"></i>
                                <span>TikTok</span>
                            </div>
                            <label class="relative inline-flex items-center cursor-pointer">
                                <input type="checkbox" class="sr-only peer" checked>
                                <div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
                            </label>
                        </div>
                    </div>
                    
                    <button class="mt-4 w-full py-2 bg-indigo-100 hover:bg-indigo-200 text-indigo-700 rounded-lg font-medium">
                        <i class="fas fa-plus mr-2"></i> Ajouter une application
                    </button>
                </div>

                <div class="bg-gray-100 p-4 rounded-lg mb-6">
                    <h3 class="font-medium mb-3">Paramètres du mode Focus</h3>
                    
                    <div class="space-y-4">
                        <div class="flex items-center justify-between">
                            <div>
                                <div class="font-medium">Activer le mode Ne pas déranger</div>
                                <div class="text-sm text-gray-600">Silencie toutes les notifications</div>
                            </div>
                            <label class="relative inline-flex items-center cursor-pointer">
                                <input type="checkbox" class="sr-only peer" checked>
                                <div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
                            </label>
                        </div>
                        
                        <div class="flex items-center justify-between">
                            <div>
                                <div class="font-medium">Bloquer les appels entrants</div>
                                <div class="text-sm text-gray-600">Autorise uniquement les appels favoris</div>
                            </div>
                            <label class="relative inline-flex items-center cursor-pointer">
                                <input type="checkbox" class="sr-only peer">
                                <div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
                            </label>
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-1">Durée de la session (minutes)</label>
                            <input type="number" value="60" min="5" max="240" class="w-full p-2 border rounded">
                        </div>
                    </div>
                </div>

                <button id="start-focus" class="w-full py-3 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg font-medium text-lg">
                    <i class="fas fa-play mr-2"></i> Démarrer la session
                </button>
            </section>

            <!-- Stats Screen -->
            <section id="stats-screen" class="p-4 hidden">
                <div class="flex justify-between items-center mb-6">
                    <button onclick="showScreen('home-screen')" class="p-2 rounded-full hover:bg-gray-100">
                        <i class="fas fa-arrow-left"></i>
                    </button>
                    <h2 class="text-xl font-semibold">Statistiques</h2>
                    <div class="w-8"></div> <!-- Spacer for alignment -->
                </div>

                <div class="bg-gray-100 p-4 rounded-lg mb-6">
                    <h3 class="font-medium mb-4">Votre productivité</h3>
                    
                    <div class="flex justify-between mb-6">
                        <div class="text-center">
                            <div class="text-3xl font-bold" id="total-sessions">24</div>
                            <div class="text-gray-600">Sessions</div>
                        </div>
                        <div class="text-center">
                            <div class="text-3xl font-bold" id="total-hours">12.5</div>
                            <div class="text-gray-600">Heures</div>
                        </div>
                        <div class="text-center">
                            <div class="text-3xl font-bold" id="completed-tasks">36</div>
                            <div class="text-gray-600">Tâches</div>
                        </div>
                    </div>
                    
                    <div class="text-center mb-2">
                        <p class="text-gray-600 italic">"Ce qui se mesure s'améliore."</p>
                    </div>
                </div>

                <div class="bg-white p-4 rounded-lg shadow mb-6">
                    <h3 class="font-medium mb-4">Temps de focus</h3>
                    
                    <div class="h-40 mb-4">
                        <!-- Chart placeholder -->
                        <div class="w-full h-full bg-gray-100 rounded flex items-center justify-center text-gray-400">
                            Graphique des sessions
                        </div>
                    </div>
                    
                    <div class="flex justify-between text-sm">
                        <button class="px-3 py-1 bg-indigo-600 text-white rounded-full">Jour</button>
                        <button class="px-3 py-1 bg-gray-200 hover:bg-gray-300 rounded-full">Semaine</button>
                        <button class="px-3 py-1 bg-gray-200 hover:bg-gray-300 rounded-full">Mois</button>
                        <button class="px-3 py-1 bg-gray-200 hover:bg-gray-300 rounded-full">Année</button>
                    </div>
                </div>

                <div class="bg-white p-4 rounded-lg shadow">
                    <h3 class="font-medium mb-4">Tâches accomplies</h3>
                    
                    <div class="h-40 mb-4">
                        <!-- Chart placeholder -->
                        <div class="w-full h-full bg-gray-100 rounded flex items-center justify-center text-gray-400">
                            Graphique des tâches
                        </div>
                    </div>
                    
                    <div class="flex justify-between text-sm">
                        <div class="text-center">
                            <div class="text-xl font-bold" id="high-priority-tasks">8</div>
                            <div class="text-gray-600">Haute priorité</div>
                        </div>
                        <div class="text-center">
                            <div class="text-xl font-bold" id="medium-priority-tasks">18</div>
                            <div class="text-gray-600">Moyenne</div>
                        </div>
                        <div class="text-center">
                            <div class="text-xl font-bold" id="low-priority-tasks">10</div>
                            <div class="text-gray-600">Basse</div>
                        </div>
                    </div>
                </div>
            </section>

            <!-- Active Focus Session Screen -->
            <section id="active-focus-screen" class="p-4 hidden">
                <div class="flex flex-col items-center justify-center h-full text-center">
                    <div class="mb-8">
                        <div class="relative w-48 h-48 mx-auto mb-6">
                            <div class="absolute inset-0 rounded-full bg-indigo-100 flex items-center justify-center">
                                <div class="text-center">
                                    <div id="focus-timer" class="text-4xl font-bold">59:45</div>
                                    <div class="text-gray-600">Temps restant</div>
                                </div>
                            </div>
                        </div>
                        
                        <h2 class="text-xl font-semibold mb-2">Mode Focus activé</h2>
                        <p class="text-gray-600 mb-6">Restez concentré, vous y arrivez !</p>
                    </div>
                    
                    <button id="end-focus" class="w-full py-3 bg-red-500 hover:bg-red-600 text-white rounded-lg font-medium text-lg">
                        <i class="fas fa-stop mr-2"></i> Terminer la session
                    </button>
                </div>
            </section>
        </main>

        <!-- Bottom Navigation -->
        <nav class="bg-white border-t border-gray-200 fixed bottom-0 w-full max-w-md flex justify-around py-2">
            <button onclick="showScreen('home-screen')" class="p-3 text-indigo-600 flex flex-col items-center">
                <i class="fas fa-home text-xl"></i>
                <span class="text-xs mt-1">Accueil</span>
            </button>
            <button onclick="showScreen('tasks-screen')" class="p-3 text-gray-500 hover:text-indigo-600 flex flex-col items-center">
                <i class="fas fa-tasks text-xl"></i>
                <span class="text-xs mt-1">Tâches</span>
            </button>
            <button onclick="showScreen('pomodoro-screen')" class="p-3 text-gray-500 hover:text-indigo-600 flex flex-col items-center">
                <i class="fas fa-hourglass-half text-xl"></i>
                <span class="text-xs mt-1">Pomodoro</span>
            </button>
            <button onclick="showScreen('stats-screen')" class="p-3 text-gray-500 hover:text-indigo-600 flex flex-col items-center">
                <i class="fas fa-chart-line text-xl"></i>
                <span class="text-xs mt-1">Stats</span>
            </button>
        </nav>
    </div>

    <script>
        // Sample data
        let tasks = [
            { id: 1, title: "Finir le rapport", description: "Rapport trimestriel pour le client", due: "2023-06-15", priority: "high", completed: false, createdAt: new Date() },
            { id: 2, title: "Réunion d'équipe", description: "Préparer l'ordre du jour", due: "2023-06-14", priority: "medium", completed: true, createdAt: new Date() },
            { id: 3, title: "Faire les courses", description: "Acheter des fruits et légumes", due: "2023-06-16", priority: "low", completed: false, createdAt: new Date() },
            { id: 4, title: "Réviser pour l'examen", description: "Chapitres 5 à 8", due: "2023-06-20", priority: "high", completed: false, createdAt: new Date() },
            { id: 5, title: "Appeler le médecin", description: "Prendre rendez-vous", due: "2023-06-12", priority: "medium", completed: true, createdAt: new Date() }
        ];

        let pomodoroSessions = [
            { date: "2023-06-10", duration: 25, type: "work" },
            { date: "2023-06-10", duration: 5, type: "break" },
            { date: "2023-06-10", duration: 25, type: "work" },
            { date: "2023-06-11", duration: 25, type: "work" },
            { date: "2023-06-11", duration: 15, type: "break" },
            { date: "2023-06-12", duration: 25, type: "work" }
        ];

        // Motivational quotes
        const quotes = [
            "La discipline est la clé de la liberté.",
            "Le succès est la somme de petits efforts répétés jour après jour.",
            "Ne reporte pas à demain ce que tu peux faire aujourd'hui.",
            "La concentration est la racine de toute force.",
            "La productivité n'est jamais un accident.",
            "Faites chaque jour quelque chose qui vous rapproche de votre but."
        ];

        // DOM elements
        const mainContent = document.getElementById('main-content');
        const themeToggle = document.getElementById('theme-toggle');
        const taskForm = document.getElementById('task-form');
        const filterButtons = document.querySelectorAll('.filter-btn');

        // Initialize the app
        document.addEventListener('DOMContentLoaded', function() {
            // Set random motivational quote
            document.getElementById('motivational-quote').textContent = quotes[Math.floor(Math.random() * quotes.length)];
            
            // Load tasks
            renderTasks();
            renderRecentTasks();
            updateTodaySummary();
            
            // Initialize Pomodoro timer
            initPomodoro();
            
            // Initialize theme toggle
            initThemeToggle();
            
            // Event listeners
            taskForm.addEventListener('submit', handleTaskSubmit);
            
            filterButtons.forEach(button => {
                button.addEventListener('click', function() {
                    filterButtons.forEach(btn => btn.classList.remove('active', 'bg-indigo-600', 'text-white'));
                    this.classList.add('active', 'bg-indigo-600', 'text-white');
                    renderTasks(this.dataset.filter);
                });
            });
            
            // Focus mode toggle
            document.querySelectorAll('input[name="focus-mode"]').forEach(radio => {
                radio.addEventListener('change', function() {
                    const customAppsSection = document.getElementById('custom-apps-section');
                    if (this.value === 'custom') {
                        customAppsSection.classList.remove('hidden');
                    } else {
                        customAppsSection.classList.add('hidden');
                    }
                });
            });
            
            // Start focus session
            document.getElementById('start-focus').addEventListener('click', function() {
                showScreen('active-focus-screen');
                startFocusTimer();
            });
            
            // End focus session
            document.getElementById('end-focus').addEventListener('click', function() {
                showScreen('home-screen');
                stopFocusTimer();
                // Add session to stats
                const today = new Date().toISOString().split('T')[0];
                pomodoroSessions.push({ date: today, duration: 60, type: "work" });
                updateTodaySummary();
            });
        });

        // Functions
        function showScreen(screenId) {
            document.querySelectorAll('section').forEach(section => {
                section.classList.add('hidden');
                section.classList.remove('fade-in');
            });
            
            const screen = document.getElementById(screenId);
            screen.classList.remove('hidden');
            screen.classList.add('fade-in');
            
            // Update active tab in bottom nav
            if (screenId === 'home-screen') {
                document.querySelector('nav button:nth-child(1)').classList.add('text-indigo-600');
                document.querySelector('nav button:nth-child(1)').classList.remove('text-gray-500');
            } else if (screenId === 'tasks-screen') {
                document.querySelector('nav button:nth-child(2)').classList.add('text-indigo-600');
                document.querySelector('nav button:nth-child(2)').classList.remove('text-gray-500');
            } else if (screenId === 'pomodoro-screen') {
                document.querySelector('nav button:nth-child(3)').classList.add('text-indigo-600');
                document.querySelector('nav button:nth-child(3)').classList.remove('text-gray-500');
            } else if (screenId === 'stats-screen') {
                document.querySelector('nav button:nth-child(4)').classList.add('text-indigo-600');
                document.querySelector('nav button:nth-child(4)').classList.remove('text-gray-500');
            }
        }

        function showAddTaskModal() {
            document.getElementById('add-task-modal').classList.remove('hidden');
            document.getElementById('task-title').focus();
        }

        function hideAddTaskModal() {
            document.getElementById('add-task-modal').classList.add('hidden');
            document.getElementById('task-form').reset();
        }

        function renderTasks(filter = 'all') {
            const tasksList = document.getElementById('tasks-list');
            tasksList.innerHTML = '';
            
            let filteredTasks = [...tasks];
            
            // Apply filters
            if (filter === 'today') {
                const today = new Date().toISOString().split('T')[0];
                filteredTasks = filteredTasks.filter(task => task.due === today);
            } else if (filter === 'week') {
                // This week filter logic would be more complex in a real app
                filteredTasks = filteredTasks.filter(task => {
                    const taskDate = new Date(task.due);
                    const today = new Date();
                    const nextWeek = new Date(today);
                    nextWeek.setDate(today.getDate() + 7);
                    return taskDate >= today && taskDate <= nextWeek;
                });
            } else if (filter === 'high') {
                filteredTasks = filteredTasks.filter(task => task.priority === 'high');
            }
            
            // Sort by priority (high > medium > low) and then by due date
            filteredTasks.sort((a, b) => {
                const priorityOrder = { high: 1, medium: 2, low: 3 };
                if (priorityOrder[a.priority] !== priorityOrder[b.priority]) {
                    return priorityOrder[a.priority] - priorityOrder[b.priority];
                }
                return new Date(a.due) - new Date(b.due);
            });
            
            if (filteredTasks.length === 0) {
                tasksList.innerHTML = '<p class="text-center text-gray-500 py-4">Aucune tâche à afficher</p>';
                return;
            }
            
            filteredTasks.forEach(task => {
                const taskElement = document.createElement('div');
                taskElement.className = `p-3 bg-white rounded-lg shadow-sm flex items-start ${task.completed ? 'opacity-70' : ''}`;
                
                const priorityColors = {
                    high: 'bg-red-500',
                    medium: 'bg-yellow-500',
                    low: 'bg-green-500'
                };
                
                taskElement.innerHTML = `
                    <div class="flex items-start w-full">
                        <div class="mr-3 mt-1">
                            <input type="checkbox" id="task-${task.id}" ${task.completed ? 'checked' : ''} 
                                   class="task-checkbox h-5 w-5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
                                   onclick="toggleTaskCompletion(${task.id})">
                        </div>
                        <div class="flex-1">
                            <label for="task-${task.id}" class="task-label block font-medium ${task.completed ? 'line-through text-gray-400' : 'text-gray-800'}">
                                ${task.title}
                            </label>
                            ${task.description ? `<p class="text-sm text-gray-600 mt-1">${task.description}</p>` : ''}
                            ${task.due ? `<p class="text-xs text-gray-500 mt-2"><i class="far fa-calendar-alt mr-1"></i> ${formatDate(task.due)}</p>` : ''}
                        </div>
                        <div class="flex items-center ml-2">
                            <div class="h-3 w-3 rounded-full ${priorityColors[task.priority]} mr-2"></div>
                            <button onclick="deleteTask(${task.id})" class="text-gray-400 hover:text-red-500">
                                <i class="far fa-trash-alt"></i>
                            </button>
                        </div>
                    </div>
                `;
                
                tasksList.appendChild(taskElement);
            });
        }

        function renderRecentTasks() {
            const recentTasksContainer = document.getElementById('recent-tasks');
            recentTasksContainer.innerHTML = '';
            
            // Sort tasks by creation date (newest first)
            const sortedTasks = [...tasks].sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));
            
            // Show only the 3 most recent tasks
            const recentTasks = sortedTasks.slice(0, 3);
            
            if (recentTasks.length === 0) {
                recentTasksContainer.innerHTML = '<p class="text-center text-gray-500 py-2">Aucune tâche récente</p>';
                return;
            }
            
            recentTasks.forEach(task => {
                const taskElement = document.createElement('div');
                taskElement.className = `p-3 bg-white rounded-lg shadow-sm flex items-start ${task.completed ? 'opacity-70' : ''}`;
                
                taskElement.innerHTML = `
                    <div class="flex items-center w-full">
                        <input type="checkbox" id="recent-task-${task.id}" ${task.completed ? 'checked' : ''} 
                               class="task-checkbox h-5 w-5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500 mr-3"
                               onclick="toggleTaskCompletion(${task.id})">
                        <label for="recent-task-${task.id}" class="task-label flex-1 text-sm ${task.completed ? 'line-through text-gray-400' : 'text-gray-800'}">
                            ${task.title}
                        </label>
                    </div>
                `;
                
                recentTasksContainer.appendChild(taskElement);
            });
        }

        function handleTaskSubmit(e) {
            e.preventDefault();
            
            const title = document.getElementById('task-title').value;
            const description = document.getElementById('task-description').value;
            const due = document.getElementById('task-due').value;
            const priority = document.getElementById('task-priority').value;
            
            const newTask = {
                id: tasks.length > 0 ? Math.max(...tasks.map(t => t.id)) + 1 : 1,
                title,
                description,
                due,
                priority,
                completed: false,
                createdAt: new Date()
            };
            
            tasks.push(newTask);
            renderTasks();
            renderRecentTasks();
            updateTodaySummary();
            hideAddTaskModal();
        }

        function toggleTaskCompletion(taskId) {
            const taskIndex = tasks.findIndex(task => task.id === taskId);
            if (taskIndex !== -1) {
                tasks[taskIndex].completed = !tasks[taskIndex].completed;
                renderTasks();
                renderRecentTasks();
                updateTodaySummary();
            }
        }

        function deleteTask(taskId) {
            if (confirm("Supprimer cette tâche ?")) {
                tasks = tasks.filter(task => task.id !== taskId);
                renderTasks();
                renderRecentTasks();
                updateTodaySummary();
            }
        }

        function updateTodaySummary() {
            const today = new Date().toISOString().split('T')[0];
            
            // Today's completed tasks
            const todayTasks = tasks.filter(task => {
                return task.due === today && task.completed;
            }).length;
            
            // Today's pomodoro sessions
            const todaySessions = pomodoroSessions.filter(session => session.date === today).length;
            
            // Today's focus minutes
            const todayMinutes = pomodoroSessions.filter(session => session.date === today)
                .reduce((total, session) => total + session.duration, 0);
            
            document.getElementById('today-tasks').textContent = todayTasks;
            document.getElementById('today-sessions').textContent = todaySessions;
            document.getElementById('today-minutes').textContent = todayMinutes;
            
            // Update stats screen
            document.getElementById('total-sessions').textContent = pomodoroSessions.length;
            document.getElementById('total-hours').textContent = (pomodoroSessions.reduce((total, session) => total + session.duration, 0) / 60).toFixed(1);
            document.getElementById('completed-tasks').textContent = tasks.filter(task => task.completed).length;
            
            // Priority tasks
            document.getElementById('high-priority-tasks').textContent = tasks.filter(task => task.priority === 'high' && task.completed).length;
            document.getElementById('medium-priority-tasks').textContent = tasks.filter(task => task.priority === 'medium' && task.completed).length;
            document.getElementById('low-priority-tasks').textContent = tasks.filter(task => task.priority === 'low' && task.completed).length;
        }

        function formatDate(dateString) {
            const options = { weekday: 'short', day: 'numeric', month: 'short' };
            return new Date(dateString).toLocaleDateString('fr-FR', options);
        }

        function initThemeToggle() {
            const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
            if (prefersDark) {
                document.documentElement.classList.add('dark');
                themeToggle.innerHTML = '<i class="fas fa-sun"></i>';
            } else {
                document.documentElement.classList.remove('dark');
                themeToggle.innerHTML = '<i class="fas fa-moon"></i>';
            }
            
            themeToggle.addEventListener('click', function() {
                document.documentElement.classList.toggle('dark');
                if (document.documentElement.classList.contains('dark')) {
                    themeToggle.innerHTML = '<i class="fas fa-sun"></i>';
                } else {
                    themeToggle.innerHTML = '<i class="fas fa-moon"></i>';
                }
            });
        }

        function initPomodoro() {
            const timerDisplay = document.getElementById('timer-display');
            const timerState = document.getElementById('timer-state');
            const startButton = document.getElementById('start-pomodoro');
            const resetButton = document.getElementById('reset-pomodoro');
            const progressCircle = document.querySelector('.pomodoro-progress');
            
            let workTime = 25 * 60; // 25 minutes in seconds
            let shortBreak = 5 * 60;
            let longBreak = 15 * 60;
            let timeLeft = workTime;
            let timerInterval;
            let isRunning = false;
            let isWorkTime = true;
            let sessionCount = 0;
            
            // Update timer display
            function updateDisplay() {
                const minutes = Math.floor(timeLeft / 60);
                const seconds = timeLeft % 60;
                timerDisplay.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
                
                // Update progress circle
                const totalTime = isWorkTime ? workTime : (sessionCount % 4 === 0 ? longBreak : shortBreak);
                const progress = ((totalTime - timeLeft) / totalTime) * 100;
                progressCircle.style.setProperty('--progress', `${progress}%`);
            }
            
            // Start timer
            function startTimer() {
                if (timerInterval) clearInterval(timerInterval);
                
                isRunning = true;
                startButton.textContent = 'Pause';
                timerState.textContent = isWorkTime ? 'Travail en cours' : 'Pause';
                
                timerInterval = setInterval(() => {
                    timeLeft--;
                    updateDisplay();
                    
                    if (timeLeft <= 0) {
                        clearInterval(timerInterval);
                        timerFinished();
                    }
                }, 1000);
            }
            
            // Pause timer
            function pauseTimer() {
                clearInterval(timerInterval);
                isRunning = false;
                startButton.textContent = 'Reprendre';
                timerState.textContent = 'En pause';
            }
            
            // Timer finished
            function timerFinished() {
                // Play sound
                const audio = new Audio('https://assets.mixkit.co/sfx/preview/mixkit-alarm-digital-clock-beep-989.mp3');
                audio.play();
                
                if (isWorkTime) {
                    sessionCount++;
                    // Add to stats
                    const today = new Date().toISOString().split('T')[0];
                    pomodoroSessions.push({ date: today, duration: workTime / 60, type: "work" });
                    updateTodaySummary();
                    
                    // Check if it's time for a long break
                    if (sessionCount % 4 === 0) {
                        timeLeft = longBreak;
                        alert('Bonne session ! Prenez une longue pause de 15 minutes.');
                    } else {
                        timeLeft = shortBreak;
                        alert('Bonne session ! Prenez une courte pause de 5 minutes.');
                    }
                } else {
                    timeLeft = workTime;
                    alert('La pause est terminée ! Retour au travail.');
                }
                
                isWorkTime = !isWorkTime;
                updateDisplay();
                
                // Auto-start next session if enabled
                if (document.getElementById('auto-start').checked) {
                    startTimer();
                } else {
                    isRunning = false;
                    startButton.textContent = 'Démarrer';
                    timerState.textContent = isWorkTime ? 'Prêt à travailler' : 'Prêt pour une pause';
                }
            }
            
            // Reset timer
            function resetTimer() {
                clearInterval(timerInterval);
                isRunning = false;
                isWorkTime = true;
                timeLeft = workTime;
                updateDisplay();
                startButton.textContent = 'Démarrer';
                timerState.textContent = 'Prêt';
            }
            
            // Update timer settings
            function updateSettings() {
                workTime = parseInt(document.getElementById('work-time').value) * 60;
                shortBreak = parseInt(document.getElementById('short-break').value) * 60;
                longBreak = parseInt(document.getElementById('long-break').value) * 60;
                
                if (!isRunning && isWorkTime) {
                    timeLeft = workTime;
                    updateDisplay();
                }
            }
            
            // Event listeners
            startButton.addEventListener('click', function() {
                if (isRunning) {
                    pauseTimer();
                } else {
                    startTimer();
                }
            });
            
            resetButton.addEventListener('click', resetTimer);
            
            // Update settings when inputs change
            document.getElementById('work-time').addEventListener('change', updateSettings);
            document.getElementById('short-break').addEventListener('change', updateSettings);
            document.getElementById('long-break').addEventListener('change', updateSettings);
            
            // Initialize display
            updateDisplay();
        }

        function startFocusTimer() {
            const focusTimer = document.getElementById('focus-timer');
            let minutes = 59;
            let seconds = 59;
            
            focusTimer.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
            
            const timerInterval = setInterval(() => {
                seconds--;
                
                if (seconds < 0) {
                    minutes--;
                    seconds = 59;
                }
                
                focusTimer.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
                
                if (minutes === 0 && seconds === 0) {
                    clearInterval(timerInterval);
                    // Play sound
                    const audio = new Audio('https://assets.mixkit.co/sfx/preview/mixkit-alarm-digital-clock-beep-989.mp3');
                    audio.play();
                    alert('Session de focus terminée !');
                    showScreen('home-screen');
                }
            }, 1000);
            
            // Store interval ID to clear it later
            document.getElementById('active-focus-screen').dataset.timerInterval = timerInterval;
        }

        function stopFocusTimer() {
            const timerInterval = document.getElementById('active-focus-screen').dataset.timerInterval;
            if (timerInterval) {
                clearInterval(timerInterval);
            }
        }
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Jeanic/focustime" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>