-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1629 lines (1426 loc) · 80.5 KB
/
index.html
File metadata and controls
1629 lines (1426 loc) · 80.5 KB
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
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Study OS Pro - JEE 2026</title>
<!-- Fonts -->
<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&family=JetBrains+Mono:wght@400;500;700&family=Outfit:wght@400;500;700;800&display=swap" rel="stylesheet">
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Icons -->
<script src="https://unpkg.com/lucide@latest"></script>
<!-- Config -->
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
fontFamily: {
sans: ['Inter', 'sans-serif'],
display: ['Outfit', 'sans-serif'],
mono: ['JetBrains Mono', 'monospace'],
},
colors: {
bg: '#030304',
surface: '#0A0A0B',
surfaceHighlight: '#18181B',
border: '#27272A',
accent: {
400: '#818cf8',
500: '#6366f1',
600: '#4f46e5',
glow: 'rgba(99, 102, 241, 0.15)'
}
},
animation: {
'pulse-slow': 'pulse 4s cubic-bezier(0.4, 0, 0.6, 1) infinite',
'slide-up': 'slideUp 0.3s ease-out forwards',
'scale-in': 'scaleIn 0.2s ease-out forwards',
},
keyframes: {
slideUp: {
'0%': { transform: 'translateY(10px)', opacity: '0' },
'100%': { transform: 'translateY(0)', opacity: '1' },
},
scaleIn: {
'0%': { transform: 'scale(0.95)', opacity: '0' },
'100%': { transform: 'scale(1)', opacity: '1' },
}
}
}
}
}
</script>
<style>
/* Core Aesthetics */
body {
background-color: #030304;
color: #e4e4e7;
overflow: hidden;
background-image: radial-gradient(circle at 50% 0%, #18181b 0%, transparent 40%);
}
/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar { width: 5px; height: 5px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #3f3f46; border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #52525b; }
/* --- SPEED SLIDER STYLING --- */
input[type=range] {
-webkit-appearance: none;
width: 100%;
height: 4px;
background: #27272a;
border-radius: 2px;
cursor: pointer;
outline: none;
margin: 0;
vertical-align: middle;
}
/* Track - Webkit */
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 4px;
cursor: pointer;
background: transparent;
border-radius: 2px;
border: none;
}
/* Thumb - Webkit */
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
height: 14px;
width: 14px;
border-radius: 50%;
background: #ffffff;
cursor: pointer;
margin-top: -5px; /* (4px track - 14px thumb) / 2 */
box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
transition: transform 0.1s ease, box-shadow 0.1s ease;
position: relative;
z-index: 2;
}
input[type=range]:hover::-webkit-slider-thumb {
transform: scale(1.2);
box-shadow: 0 0 15px rgba(99, 102, 241, 0.8);
}
/* Firefox Support */
input[type=range]::-moz-range-track {
width: 100%;
height: 4px;
cursor: pointer;
background: transparent;
border-radius: 2px;
}
input[type=range]::-moz-range-thumb {
height: 14px;
width: 14px;
border: none;
border-radius: 50%;
background: #ffffff;
cursor: pointer;
box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}
/* Glassmorphism */
.glass {
background: rgba(10, 10, 11, 0.7);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
transition: all 0.3s ease;
}
/* --- FOCUS MODE (MAXIMIZE) --- */
body.focus-mode header {
height: 0;
padding: 0;
opacity: 0;
overflow: hidden;
border: 0;
}
body.focus-mode #sidebar {
width: 0 !important;
opacity: 0;
overflow: hidden;
border: 0;
}
body.focus-mode #right-panel {
width: 0 !important;
opacity: 0;
overflow: hidden;
border: 0;
}
/* --- AMBIENT GLOW --- */
.ambient-glow {
position: absolute;
top: 50%; left: 50%;
transform: translate(-50%, -50%);
width: 140%; height: 140%; /* Oversize to fill corners */
/* Stronger, more visible gradient */
background: radial-gradient(circle, rgba(99,102,241,0.3) 0%, rgba(79,70,229,0.15) 40%, transparent 70%);
filter: blur(50px);
z-index: 0;
pointer-events: none;
opacity: 0;
transition: opacity 0.8s ease;
}
/* The glow effect on the video wrapper itself */
#video-wrapper {
transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
z-index: 10;
position: relative;
width: 100%;
height: 100%;
}
.glow-active .ambient-glow {
opacity: 1;
animation: pulse-glow 5s ease-in-out infinite alternate;
}
/* When active, shrink video slightly to show the glow and cast a shadow */
.glow-active #video-wrapper {
width: 92%;
height: 92%;
box-shadow: 0 0 100px 30px rgba(99, 102, 241, 0.25);
border-radius: 12px;
overflow: hidden;
}
@keyframes pulse-glow {
0% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
100% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}
/* Keyboard Shortcut Hint */
.kbd {
font-family: 'JetBrains Mono', monospace;
background: #27272a;
border: 1px solid #3f3f46;
border-radius: 4px;
padding: 2px 4px;
font-size: 10px;
color: #a1a1aa;
display: inline-block;
min-width: 1.2em;
text-align: center;
}
</style>
</head>
<body class="h-screen flex flex-col font-sans selection:bg-accent-500/30 selection:text-white">
<!-- API Placeholder -->
<div id="yt-api-placeholder"></div>
<!-- Command Palette (Global Search) -->
<div id="cmd-palette-overlay" class="fixed inset-0 bg-black/60 backdrop-blur-sm z-[100] hidden flex items-start justify-center pt-[15vh] opacity-0 transition-opacity duration-200" onclick="toggleCmdPalette()">
<div class="w-full max-w-xl bg-[#0F0F10] border border-border rounded-xl shadow-2xl overflow-hidden transform scale-95 transition-transform duration-200" id="cmd-palette-modal" onclick="event.stopPropagation()">
<div class="flex items-center px-4 border-b border-border">
<i data-lucide="search" class="w-5 h-5 text-zinc-500"></i>
<input type="text" id="cmd-input" class="w-full h-14 bg-transparent border-none text-white px-4 focus:ring-0 placeholder-zinc-600 font-medium" placeholder="Search lectures, folders, or type 'help'..." autocomplete="off">
<span class="text-xs text-zinc-600 font-mono border border-border px-1.5 py-0.5 rounded">ESC</span>
</div>
<div id="cmd-results" class="max-h-[60vh] overflow-y-auto p-2 custom-scrollbar">
<!-- Results injected here -->
</div>
<div class="px-4 py-2 bg-surfaceHighlight border-t border-border flex justify-between items-center text-[10px] text-zinc-500">
<div class="flex gap-3">
<span><span class="font-bold text-zinc-400">↑↓</span> to navigate</span>
<span><span class="font-bold text-zinc-400">↵</span> to select</span>
</div>
<span>Study OS Pro v2.1</span>
</div>
</div>
</div>
<!-- Shortcuts Modal -->
<div id="shortcuts-overlay" class="fixed inset-0 bg-black/80 backdrop-blur-sm z-[100] hidden flex items-center justify-center p-4 opacity-0 transition-opacity duration-200" onclick="toggleShortcuts()">
<div class="w-full max-w-2xl bg-[#0F0F10] border border-border rounded-2xl shadow-2xl overflow-hidden transform scale-95 transition-transform duration-200" onclick="event.stopPropagation()">
<div class="p-6 border-b border-border flex justify-between items-center">
<h2 class="text-lg font-bold text-white flex items-center gap-2">
<i data-lucide="keyboard" class="w-5 h-5 text-accent-400"></i> Keyboard Shortcuts
</h2>
<button onclick="toggleShortcuts()" class="text-zinc-500 hover:text-white transition-colors">
<i data-lucide="x" class="w-5 h-5"></i>
</button>
</div>
<div class="p-6 grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-4 max-h-[70vh] overflow-y-auto custom-scrollbar">
<!-- Section: Global -->
<div class="col-span-1 md:col-span-2 text-xs font-bold text-zinc-500 uppercase tracking-widest mb-1 mt-1">Global</div>
<div class="flex justify-between items-center group">
<span class="text-sm text-zinc-300">Command Palette</span>
<span class="kbd">⌘K</span>
</div>
<div class="flex justify-between items-center group">
<span class="text-sm text-zinc-300">Show Shortcuts</span>
<span class="kbd">?</span>
</div>
<div class="flex justify-between items-center group">
<span class="text-sm text-zinc-300">Close Modals</span>
<span class="kbd">Esc</span>
</div>
<!-- Section: Player -->
<div class="col-span-1 md:col-span-2 text-xs font-bold text-zinc-500 uppercase tracking-widest mb-1 mt-4">Video Player</div>
<div class="flex justify-between items-center group">
<span class="text-sm text-zinc-300">Play / Pause</span>
<span class="kbd">Space</span>
</div>
<div class="flex justify-between items-center group">
<span class="text-sm text-zinc-300">Seek Backward</span>
<span class="kbd">←</span>
</div>
<div class="flex justify-between items-center group">
<span class="text-sm text-zinc-300">Seek Forward</span>
<span class="kbd">→</span>
</div>
<div class="flex justify-between items-center group">
<span class="text-sm text-zinc-300">Fullscreen (Native)</span>
<span class="kbd">F</span>
</div>
<div class="flex justify-between items-center group">
<span class="text-sm text-zinc-300">Mute / Unmute</span>
<span class="kbd">M</span>
</div>
<div class="flex justify-between items-center group">
<span class="text-sm text-zinc-300">Maximize Mode</span>
<span class="kbd">Z</span>
</div>
<div class="flex justify-between items-center group">
<span class="text-sm text-zinc-300">Theater Mode</span>
<span class="kbd">T</span>
</div>
<!-- Section: Tools -->
<div class="col-span-1 md:col-span-2 text-xs font-bold text-zinc-500 uppercase tracking-widest mb-1 mt-4">Tools</div>
<div class="flex justify-between items-center group">
<span class="text-sm text-zinc-300">Toggle Loop</span>
<span class="kbd">L</span>
</div>
<div class="flex justify-between items-center group">
<span class="text-sm text-zinc-300">Set Loop Start (A)</span>
<span class="kbd">[</span>
</div>
<div class="flex justify-between items-center group">
<span class="text-sm text-zinc-300">Set Loop End (B)</span>
<span class="kbd">]</span>
</div>
</div>
<div class="p-4 bg-surfaceHighlight border-t border-border text-center">
<p class="text-[10px] text-zinc-500">Study OS Pro - Efficiency Tools</p>
</div>
</div>
</div>
<!-- Header -->
<header class="h-14 glass flex items-center justify-between px-5 z-40 flex-shrink-0 relative overflow-hidden">
<div class="flex items-center gap-5">
<button onclick="toggleMobileSidebar()" class="lg:hidden text-zinc-400 hover:text-white transition-colors">
<i data-lucide="menu" class="w-5 h-5"></i>
</button>
<div class="flex items-center gap-3 cursor-pointer group" onclick="renderDashboard()">
<div class="relative">
<div class="w-8 h-8 rounded-lg bg-gradient-to-br from-accent-600 to-accent-400 flex items-center justify-center shadow-lg shadow-accent-500/20 group-hover:shadow-accent-500/40 transition-shadow">
<i data-lucide="zap" class="w-4 h-4 text-white fill-white"></i>
</div>
<div class="absolute -bottom-1 -right-1 w-3 h-3 bg-black rounded-full flex items-center justify-center">
<div class="w-1.5 h-1.5 bg-green-500 rounded-full animate-pulse"></div>
</div>
</div>
<div>
<h1 class="text-sm font-display font-bold text-white tracking-tight leading-none">STUDY<span class="text-accent-400">OS</span></h1>
<p class="text-[10px] text-zinc-500 font-mono leading-none mt-1">PRO EDITION</p>
</div>
</div>
</div>
<!-- Center: Clock & Streak -->
<div class="hidden md:flex items-center gap-6">
<div class="flex items-center gap-2 px-3 py-1.5 rounded-full bg-surface border border-border">
<i data-lucide="flame" class="w-3.5 h-3.5 text-orange-500 fill-orange-500"></i>
<span class="text-xs font-bold text-zinc-300">Streak: <span id="streak-count" class="text-white">1</span></span>
</div>
<div class="text-xs font-mono text-zinc-500" id="clock-display">00:00</div>
</div>
<div class="flex items-center gap-3">
<button onclick="toggleShortcuts()" class="p-2 text-zinc-400 hover:text-white hover:bg-surfaceHighlight rounded-lg transition-colors" title="Keyboard Shortcuts (?)">
<i data-lucide="keyboard" class="w-4 h-4"></i>
</button>
<button onclick="toggleCmdPalette()" class="hidden md:flex items-center gap-2 px-3 py-1.5 text-xs bg-surface border border-border rounded-lg text-zinc-400 hover:text-white hover:border-zinc-600 transition-all group">
<i data-lucide="search" class="w-3.5 h-3.5 group-hover:scale-110 transition-transform"></i>
<span>Search</span>
<span class="kbd ml-1">⌘K</span>
</button>
<div class="h-4 w-[1px] bg-border mx-1"></div>
<button onclick="document.getElementById('import-input').click()" class="p-2 text-zinc-400 hover:text-white hover:bg-surfaceHighlight rounded-lg transition-colors" title="Import Data">
<i data-lucide="upload" class="w-4 h-4"></i>
</button>
<input type="file" id="import-input" accept=".json" class="hidden" onchange="processImport(this)">
<button onclick="exportData()" class="p-2 text-zinc-400 hover:text-white hover:bg-surfaceHighlight rounded-lg transition-colors" title="Backup Data">
<i data-lucide="download" class="w-4 h-4"></i>
</button>
</div>
</header>
<div class="flex flex-1 overflow-hidden relative">
<!-- Sidebar -->
<aside id="sidebar" class="w-64 bg-surface/50 backdrop-blur-md border-r border-border flex flex-col flex-shrink-0 z-30 transition-all duration-300 absolute lg:static h-full -translate-x-full lg:translate-x-0">
<div class="p-4">
<button onclick="renderDashboard()" class="w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-xs font-bold transition-all text-white bg-gradient-to-r from-zinc-800 to-zinc-900 border border-zinc-700/50 hover:border-zinc-600 shadow-sm group">
<i data-lucide="layout-grid" class="w-4 h-4 text-zinc-400 group-hover:text-white transition-colors"></i>
DASHBOARD
</button>
</div>
<div class="px-5 pt-2 pb-2 flex items-center justify-between">
<span class="text-[10px] font-bold text-zinc-500 uppercase tracking-widest">Library</span>
<button onclick="openModal('folder')" class="text-zinc-500 hover:text-white transition-colors p-1 hover:bg-surfaceHighlight rounded" title="New Folder">
<i data-lucide="plus" class="w-3.5 h-3.5"></i>
</button>
</div>
<div id="sidebar-list" class="flex-1 overflow-y-auto px-3 pb-4 space-y-0.5 custom-scrollbar">
<!-- Folders injected here -->
</div>
<!-- Sidebar Footer -->
<div class="p-4 border-t border-border mt-auto">
<div class="flex items-center justify-between text-[10px] text-zinc-500">
<span>Storage</span>
<span id="storage-usage">...</span>
</div>
<div class="w-full h-1 bg-zinc-800 rounded-full mt-2 overflow-hidden">
<div id="storage-bar" class="h-full bg-zinc-600 rounded-full" style="width: 0%"></div>
</div>
</div>
</aside>
<!-- Main Content -->
<div class="flex-1 flex flex-col relative min-w-0 bg-bg z-0">
<!-- VIEW: DASHBOARD -->
<main id="view-dashboard" class="flex-1 overflow-y-auto p-6 lg:p-10 relative z-10 custom-scrollbar">
<div class="max-w-7xl mx-auto space-y-8 animate-slide-up">
<!-- Welcome / Hero -->
<div id="hero-section" class="hidden relative group rounded-2xl overflow-hidden border border-border bg-[#0E0E10] shadow-2xl">
<!-- Decorative BG -->
<div class="absolute top-0 right-0 w-64 h-64 bg-accent-600/10 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2"></div>
<div class="relative p-8 md:p-10 flex flex-col md:flex-row items-start md:items-center justify-between gap-6">
<div class="space-y-2">
<div class="flex items-center gap-2">
<span class="w-2 h-2 rounded-full bg-accent-500 animate-pulse"></span>
<span class="text-[10px] font-bold uppercase tracking-wider text-accent-400">Resume Learning</span>
</div>
<h2 id="hero-title" class="text-3xl font-display font-bold text-white tracking-tight">Folder Name</h2>
<p id="hero-sub" class="text-zinc-400 text-sm font-mono flex items-center gap-2">
<i data-lucide="play-circle" class="w-4 h-4"></i> Lecture Title
</p>
</div>
<button onclick="resumeLast()" class="px-8 py-3.5 bg-white text-black hover:bg-zinc-200 rounded-xl text-sm font-bold shadow-xl shadow-white/5 transition-all hover:scale-105 hover:shadow-white/10 flex items-center gap-2.5">
<i data-lucide="play" class="w-4 h-4 fill-current"></i> Resume
</button>
</div>
</div>
<!-- Stats Row -->
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<div class="bg-surface/50 border border-border rounded-xl p-4">
<div class="text-zinc-500 text-[10px] font-bold uppercase mb-1">Total Folders</div>
<div class="text-2xl font-display font-bold text-white" id="stat-folders">0</div>
</div>
<div class="bg-surface/50 border border-border rounded-xl p-4">
<div class="text-zinc-500 text-[10px] font-bold uppercase mb-1">Lectures</div>
<div class="text-2xl font-display font-bold text-white" id="stat-videos">0</div>
</div>
<div class="bg-surface/50 border border-border rounded-xl p-4">
<div class="text-zinc-500 text-[10px] font-bold uppercase mb-1">Completed</div>
<div class="text-2xl font-display font-bold text-emerald-400" id="stat-completed">0</div>
</div>
<div class="bg-surface/50 border border-border rounded-xl p-4">
<div class="text-zinc-500 text-[10px] font-bold uppercase mb-1">Completion</div>
<div class="text-2xl font-display font-bold text-accent-400" id="stat-percent">0%</div>
</div>
</div>
<!-- Grid -->
<h3 class="text-sm font-bold text-zinc-400 uppercase tracking-widest pl-1">Your Courses</h3>
<div id="dash-grid" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5"></div>
<!-- Empty State -->
<div id="dash-empty" class="hidden flex-col items-center justify-center py-24 border border-dashed border-zinc-800 rounded-2xl bg-surface/20">
<div class="w-16 h-16 bg-surfaceHighlight rounded-2xl flex items-center justify-center mb-4 text-zinc-600 shadow-inner">
<i data-lucide="folder-plus" class="w-8 h-8"></i>
</div>
<h3 class="text-lg font-bold text-white mb-1">No courses found</h3>
<p class="text-zinc-500 text-sm mb-6">Create a folder to start organizing your lectures.</p>
<button onclick="openModal('folder')" class="px-5 py-2.5 bg-accent-600 hover:bg-accent-500 text-white rounded-lg text-sm font-medium transition-colors">
Create First Folder
</button>
</div>
</div>
</main>
<!-- VIEW: PLAYER -->
<main id="view-player" class="hidden flex-1 flex flex-col h-full absolute inset-0 bg-black z-20">
<div class="flex-1 flex flex-row min-h-0">
<!-- Video Stage -->
<div class="flex-1 flex flex-col relative bg-[#050505] min-w-0">
<!-- Video Wrapper -->
<!-- Removed overflow-hidden to allow Ambient glow to bleed -->
<div id="video-container" class="flex-1 relative flex items-center justify-center group">
<!-- Ambient Glow Element -->
<div class="ambient-glow"></div>
<div id="video-wrapper" class="w-full h-full relative z-10 transition-all duration-500">
<div id="yt-player-mount" class="w-full h-full"></div>
</div>
<!-- Drag Drop Overlay -->
<div id="drag-overlay" class="absolute inset-0 z-[60] bg-accent-500/10 hidden backdrop-blur-sm border-4 border-dashed border-accent-500/50 m-8 rounded-2xl flex flex-col items-center justify-center text-accent-200 animate-pulse">
<i data-lucide="download-cloud" class="w-12 h-12 mb-4"></i>
<span class="font-bold text-2xl">Drop Video Here</span>
</div>
</div>
<!-- Controls Deck -->
<div id="player-controls" class="bg-surface border-t border-border flex flex-col z-20 flex-shrink-0 relative">
<!-- Progress Bar for Loop (Visual only for now) -->
<div id="loop-bar-container" class="w-full h-1 bg-black hidden">
<div id="loop-bar" class="h-full bg-accent-500 w-0"></div>
</div>
<div class="flex items-center justify-between px-5 py-3">
<!-- Left: Title & Nav -->
<div class="flex items-center gap-4 min-w-0 flex-1 mr-8">
<button onclick="renderDashboard()" class="p-2 hover:bg-surfaceHighlight rounded-lg text-zinc-400 hover:text-white transition-colors" title="Back (Esc)">
<i data-lucide="arrow-left" class="w-5 h-5"></i>
</button>
<div class="min-w-0">
<h2 id="player-title" class="text-sm font-bold text-white truncate leading-tight">Select Video</h2>
<div class="flex items-center gap-2 mt-0.5">
<span id="player-tag" class="text-[10px] font-bold px-1.5 py-0.5 rounded bg-surfaceHighlight text-zinc-400 border border-zinc-800">TAG</span>
<p id="player-folder" class="text-[11px] text-zinc-500 truncate font-mono hover:text-zinc-300 cursor-pointer">Folder</p>
</div>
</div>
</div>
<!-- Center: Transport -->
<div class="hidden md:flex items-center gap-4">
<button id="btn-loop-toggle" onclick="toggleLoop()" class="p-2 text-zinc-500 hover:text-white transition-colors" title="Toggle Loop (L)">
<i data-lucide="repeat" class="w-4 h-4"></i>
</button>
<!-- A-B Repeater -->
<div class="flex items-center bg-black/50 border border-border rounded-lg overflow-hidden">
<button onclick="setLoopPoint('A')" id="btn-loop-a" class="px-3 py-1.5 text-[10px] font-mono hover:bg-accent-500/20 hover:text-accent-400 transition-colors border-r border-border text-zinc-400 font-bold" title="Set Start ( [ )">A</button>
<button onclick="setLoopPoint('B')" id="btn-loop-b" class="px-3 py-1.5 text-[10px] font-mono hover:bg-accent-500/20 hover:text-accent-400 transition-colors text-zinc-400 font-bold" title="Set End ( ] )">B</button>
</div>
</div>
<!-- Right: Toggles -->
<div class="flex items-center gap-2 ml-8">
<div class="flex items-center gap-2 mr-4 border-r border-border pr-4">
<i data-lucide="gauge" class="w-3.5 h-3.5 text-zinc-600"></i>
<span id="speed-val" class="text-xs font-mono text-zinc-300 w-8 text-right">1.0x</span>
<!-- Improved Speed Slider -->
<input type="range" id="speed-slider" min="0.5" max="4.0" step="0.1" value="1.0"
oninput="setSpeed(this.value)"
class="w-24">
</div>
<button onclick="toggleGlow()" id="btn-glow" class="p-2 rounded-lg text-zinc-400 hover:text-accent-400 hover:bg-surfaceHighlight transition-colors" title="Ambient Glow">
<i data-lucide="lightbulb" class="w-4 h-4"></i>
</button>
<button onclick="toggleFocus()" id="btn-focus" class="p-2 rounded-lg text-zinc-400 hover:text-white hover:bg-surfaceHighlight transition-colors" title="Focus Mode (Maximize)">
<i data-lucide="maximize-2" class="w-4 h-4"></i>
</button>
<button onclick="toggleTheater()" id="btn-theater" class="p-2 rounded-lg text-zinc-400 hover:text-white hover:bg-surfaceHighlight transition-colors hidden sm:block" title="Theater Mode (T)">
<i data-lucide="panel-left-close" class="w-4 h-4"></i>
</button>
</div>
</div>
</div>
</div>
<!-- Right Panel (Playlist) -->
<div id="right-panel" class="w-80 bg-surface border-l border-border flex flex-col flex-shrink-0 transition-all duration-300 z-30">
<div class="p-4 border-b border-border flex flex-col gap-3">
<div class="flex justify-between items-center">
<h3 class="text-xs font-bold uppercase tracking-wider text-zinc-500">Playlist</h3>
<button onclick="openModal('edit-folder')" class="text-zinc-600 hover:text-white transition-colors" title="Folder Settings">
<i data-lucide="settings-2" class="w-4 h-4"></i>
</button>
</div>
<div class="relative w-full group">
<i data-lucide="search" class="absolute left-3 top-2.5 w-3.5 h-3.5 text-zinc-500 group-focus-within:text-accent-500 transition-colors"></i>
<input type="text" id="playlist-search" oninput="debouncedRenderPlaylist()" placeholder="Filter lectures..." class="w-full bg-[#121214] border border-border rounded-lg pl-9 py-2 text-xs text-white focus:outline-none focus:border-accent-500 focus:ring-1 focus:ring-accent-500/20 transition-all">
</div>
</div>
<div id="playlist-container" class="flex-1 overflow-y-auto p-2 space-y-1 custom-scrollbar"></div>
<div class="p-4 border-t border-border bg-surface">
<button onclick="openModal('video')" class="w-full py-2.5 bg-accent-600 hover:bg-accent-500 text-white rounded-lg shadow-lg shadow-accent-500/20 text-xs font-bold flex items-center justify-center gap-2 transition-transform active:scale-95">
<i data-lucide="plus-circle" class="w-4 h-4"></i> Add Lecture
</button>
</div>
</div>
</div>
</main>
</div>
</div>
<!-- MODALS -->
<div id="modal-overlay" class="fixed inset-0 bg-black/80 backdrop-blur-sm z-[90] hidden opacity-0 transition-opacity flex items-center justify-center p-4">
<!-- Add Folder -->
<div id="modal-folder" class="bg-[#0F0F10] border border-border w-full max-w-sm rounded-2xl p-6 shadow-2xl scale-95 opacity-0 transition-all transform hidden">
<h3 class="text-lg font-bold text-white mb-1">New Collection</h3>
<p class="text-xs text-zinc-500 mb-6">Create a folder to organize your subjects.</p>
<div class="space-y-4">
<div>
<label class="text-[10px] font-bold text-zinc-500 mb-1.5 block uppercase">Name</label>
<input type="text" id="inp-folder-name" class="w-full bg-black border border-border rounded-lg p-3 text-sm text-white focus:border-accent-500 focus:outline-none focus:ring-1 focus:ring-accent-500/20 placeholder-zinc-700 transition-all" placeholder="e.g. Electrostatics">
</div>
<div class="flex justify-end gap-3 pt-2">
<button onclick="closeModals()" class="px-4 py-2 text-xs font-medium text-zinc-400 hover:text-white transition-colors">Cancel</button>
<button onclick="createFolder()" class="px-5 py-2 bg-white text-black hover:bg-zinc-200 rounded-lg text-xs font-bold transition-colors">Create Folder</button>
</div>
</div>
</div>
<!-- Add Video -->
<div id="modal-video" class="bg-[#0F0F10] border border-border w-full max-w-md rounded-2xl p-6 shadow-2xl scale-95 opacity-0 transition-all transform hidden">
<h3 class="text-lg font-bold text-white mb-1">Add Lecture</h3>
<p class="text-xs text-zinc-500 mb-6">Import content from YouTube.</p>
<div class="space-y-4">
<div>
<label class="text-[10px] font-bold text-zinc-500 mb-1.5 block uppercase">YouTube URL</label>
<div class="relative">
<i data-lucide="link" class="absolute left-3 top-3 w-4 h-4 text-zinc-600"></i>
<input type="text" id="inp-video-url" class="w-full bg-black border border-border rounded-lg pl-9 p-2.5 text-sm text-white focus:border-accent-500 focus:outline-none transition-all font-mono" placeholder="https://youtu.be/...">
</div>
</div>
<div>
<label class="text-[10px] font-bold text-zinc-500 mb-1.5 block uppercase">Title (Optional)</label>
<input type="text" id="inp-video-title" class="w-full bg-black border border-border rounded-lg p-2.5 text-sm text-white focus:border-accent-500 focus:outline-none" placeholder="e.g. Coulomb's Law">
</div>
<div>
<label class="text-[10px] font-bold text-zinc-500 mb-2 block uppercase">Category</label>
<div class="grid grid-cols-4 gap-2">
<button onclick="setTag('Lecture')" class="tag-btn text-xs border rounded-lg py-2 text-zinc-500 border-border hover:bg-surfaceHighlight" data-tag="Lecture">Lecture</button>
<button onclick="setTag('Concept')" class="tag-btn text-xs border rounded-lg py-2 text-zinc-500 border-border hover:bg-surfaceHighlight" data-tag="Concept">Concept</button>
<button onclick="setTag('PYQ')" class="tag-btn text-xs border rounded-lg py-2 text-zinc-500 border-border hover:bg-surfaceHighlight" data-tag="PYQ">PYQ</button>
<button onclick="setTag('Notes')" class="tag-btn text-xs border rounded-lg py-2 text-zinc-500 border-border hover:bg-surfaceHighlight" data-tag="Notes">Notes</button>
</div>
<input type="hidden" id="inp-video-tag" value="Lecture">
</div>
<div class="flex justify-end gap-3 pt-4">
<button onclick="closeModals()" class="px-4 py-2 text-xs font-medium text-zinc-400 hover:text-white">Cancel</button>
<button onclick="addVideo()" class="px-5 py-2 bg-accent-600 hover:bg-accent-500 text-white rounded-lg text-xs font-bold shadow-lg shadow-accent-500/20">Add Lecture</button>
</div>
</div>
</div>
<!-- Edit Folder -->
<div id="modal-edit-folder" class="bg-[#0F0F10] border border-border w-full max-w-sm rounded-2xl p-6 shadow-2xl scale-95 opacity-0 transition-all transform hidden">
<h3 class="text-lg font-bold text-white mb-4">Folder Settings</h3>
<input type="text" id="inp-edit-name" class="w-full bg-black border border-border rounded-lg p-3 text-sm text-white focus:border-accent-500 focus:outline-none mb-6">
<button onclick="deleteCurrentFolder()" class="w-full py-3 text-xs font-bold text-red-400 hover:bg-red-500/10 rounded-lg border border-red-500/20 flex items-center justify-center gap-2 mb-2 transition-colors">
<i data-lucide="trash-2" class="w-4 h-4"></i> Delete Folder
</button>
<div class="flex justify-end gap-3 pt-4 border-t border-border mt-2">
<button onclick="closeModals()" class="px-4 py-2 text-xs font-medium text-zinc-400 hover:text-white">Cancel</button>
<button onclick="saveEditFolder()" class="px-5 py-2 bg-white text-black hover:bg-zinc-200 rounded-lg text-xs font-bold">Save Changes</button>
</div>
</div>
</div>
<!-- Toast -->
<div id="toast" class="fixed bottom-8 right-8 z-[110] transition-all duration-300 transform translate-y-20 opacity-0 pointer-events-none">
<div class="bg-[#0F0F10] border border-border/50 text-white pl-4 pr-6 py-3.5 rounded-xl shadow-2xl flex items-center gap-4 relative overflow-hidden group">
<div class="absolute inset-0 bg-accent-500/5 group-hover:bg-accent-500/10 transition-colors"></div>
<div class="w-8 h-8 rounded-full bg-surfaceHighlight flex items-center justify-center relative z-10 border border-border">
<i id="toast-icon" data-lucide="check" class="w-4 h-4 text-emerald-400"></i>
</div>
<div class="flex flex-col relative z-10">
<span id="toast-msg" class="text-xs font-bold text-zinc-100">Notification</span>
</div>
</div>
</div>
<!-- Javascript -->
<script>
// --- DATA & STATE ---
const DB_KEY = 'jee_os_v4';
let db = { folders: [], lastPlayed: null, stats: { streak: 0, lastLogin: null } };
// Runtime State
let activeFolderId = null;
let activeVideoId = null;
let player = null;
let ytApiReady = false;
// Command Palette State
let cmdMatches = [];
let cmdSelectedIndex = 0;
// Loop State
let loopStart = null;
let loopEnd = null;
let isLooping = false;
let loopInterval = null;
// UI State
let glowEnabled = false;
// --- UTILS: PERFORMANCE ---
// Debounce utility to stop heavy functions running on every keystroke
function debounce(func, wait) {
let timeout;
return function(...args) {
clearTimeout(timeout);
timeout = setTimeout(() => func.apply(this, args), wait);
};
}
// --- INIT ---
function init() {
loadDB();
updateStreak();
renderSidebar();
renderDashboard();
updateClock();
setInterval(updateClock, 10000);
// Initial scan only. Subsequent updates use scoped scanning.
lucide.createIcons();
setupDragDrop();
setupKeyboardShortcuts();
// Add Enter key listeners
document.getElementById('inp-folder-name').addEventListener('keydown', (e) => { if(e.key === 'Enter') createFolder(); });
document.getElementById('inp-video-url').addEventListener('keydown', (e) => { if(e.key === 'Enter') addVideo(); });
// Command Palette Input Listeners
const searchInput = document.getElementById('cmd-input');
// 1. Debounced Search
searchInput.oninput = debounce((e) => {
cmdSelectedIndex = 0; // Reset selection on new query
renderCmdResults(e.target.value);
}, 300);
// 2. Navigation Handler (Arrows + Enter)
searchInput.addEventListener('keydown', (e) => {
if (cmdMatches.length === 0) return;
if (e.key === 'ArrowDown') {
e.preventDefault(); // Stop cursor moving
cmdSelectedIndex = (cmdSelectedIndex + 1) % cmdMatches.length;
updateCmdVisuals();
} else if (e.key === 'ArrowUp') {
e.preventDefault(); // Stop cursor moving
cmdSelectedIndex = (cmdSelectedIndex - 1 + cmdMatches.length) % cmdMatches.length;
updateCmdVisuals();
} else if (e.key === 'Enter') {
e.preventDefault();
executeCmdAction(cmdMatches[cmdSelectedIndex]);
}
});
// Load Youtube API
if (!window.YT) {
const tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
const firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
}
}
window.onYouTubeIframeAPIReady = function() {
ytApiReady = true;
}
function loadDB() {
const saved = localStorage.getItem(DB_KEY);
if(saved) {
try {
const parsed = JSON.parse(saved);
db = { ...db, ...parsed };
if (!Array.isArray(db.folders)) db.folders = [];
if(!db.stats) db.stats = { streak: 0, lastLogin: null };
} catch(e) {
console.error("Corrupt DB", e);
toast('Database corrupted, using safe mode', 'error');
}
} else {
const fid = uid();
db.folders = [{id: fid, name: 'Physics - Mechanics', videos: []}];
save();
}
updateStorageBar();
}
function save() {
try {
localStorage.setItem(DB_KEY, JSON.stringify(db));
updateStorageBar();
} catch(e) {
toast('Save Failed: Storage Full', 'error');
console.error(e);
}
}
function uid() { return Date.now().toString(36) + Math.random().toString(36).substr(2); }
function getFolder(id) { return db.folders.find(f => f.id === id); }
function updateClock() {
const now = new Date();
document.getElementById('clock-display').innerText = now.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
}
function updateStreak() {
const today = new Date().toDateString();
if(db.stats.lastLogin !== today) {
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
if(db.stats.lastLogin === yesterday.toDateString()) {
db.stats.streak++;
} else if(db.stats.lastLogin !== today) {
db.stats.streak = 1;
}
db.stats.lastLogin = today;
save();
}
document.getElementById('streak-count').innerText = db.stats.streak;
}
// --- DASHBOARD RENDER ---
function renderDashboard() {
const sidebar = document.getElementById('sidebar');
const theaterBtn = document.getElementById('btn-theater');
document.body.classList.remove('focus-mode');
if(sidebar.classList.contains('w-0')) {
sidebar.classList.remove('w-0', 'overflow-hidden', 'opacity-0', 'border-0');
sidebar.classList.add('w-64', 'border-r');
if(theaterBtn) theaterBtn.classList.remove('text-accent-400', 'bg-accent-500/10');
}
document.getElementById('view-dashboard').classList.remove('hidden');
document.getElementById('view-player').classList.add('hidden');
document.getElementById('cmd-palette-overlay').classList.add('hidden');
activeFolderId = null;
const grid = document.getElementById('dash-grid');
grid.innerHTML = '';
if(db.folders.length === 0) document.getElementById('dash-empty').classList.remove('hidden');
else document.getElementById('dash-empty').classList.add('hidden');
let totalVids = 0, doneVids = 0;
const hero = document.getElementById('hero-section');
let hasResume = false;
if(db.lastPlayed) {
const f = getFolder(db.lastPlayed.folderId);
const v = f ? f.videos.find(x => x.id === db.lastPlayed.videoId) : null;
if(f && v) {
hero.classList.remove('hidden');
document.getElementById('hero-title').innerText = f.name;
document.getElementById('hero-sub').innerHTML = `<i data-lucide="play-circle" class="w-4 h-4"></i> ${escapeHtml(v.title)}`;
hasResume = true;
}
}
if(!hasResume) hero.classList.add('hidden');
db.folders.forEach((f, idx) => {
const count = f.videos.length;
const done = f.videos.filter(v => v.watched).length;
totalVids += count; doneVids += done;
const percent = count === 0 ? 0 : Math.round((done/count)*100);
const radius = 18;
const circum = 2 * Math.PI * radius;
const offset = circum - (percent / 100) * circum;
const el = document.createElement('div');
el.draggable = true;
el.ondragstart = (e) => dragStart(e, idx, 'folder');
el.ondragover = dragOver;
el.ondrop = (e) => drop(e, idx, 'folder');
el.className = "group bg-surface/40 backdrop-blur-sm border border-border hover:border-accent-500/50 rounded-2xl p-5 cursor-pointer transition-all hover:-translate-y-1 relative overflow-hidden";
el.onclick = (e) => {
if(dragType === 'folder' && dragIdx !== null) return;
openFolder(f.id);
};
el.innerHTML = `
<div class="absolute top-0 right-0 w-32 h-32 bg-accent-600/5 rounded-full blur-2xl -translate-y-1/2 translate-x-1/2 group-hover:bg-accent-600/10 transition-colors"></div>
<div class="flex justify-between items-start mb-6 relative z-10">
<div class="w-12 h-12 rounded-xl bg-surfaceHighlight border border-white/5 flex items-center justify-center text-zinc-400 group-hover:text-white group-hover:bg-accent-500 group-hover:border-accent-400 group-hover:shadow-lg group-hover:shadow-accent-500/20 transition-all duration-300">
<i data-lucide="folder" class="w-5 h-5"></i>
</div>
<div class="relative w-12 h-12 flex items-center justify-center">
<svg class="w-full h-full transform -rotate-90">
<circle cx="24" cy="24" r="${radius}" stroke="#27272a" stroke-width="3" fill="transparent"/>
<circle cx="24" cy="24" r="${radius}" stroke="${percent===100?'#10b981':'#6366f1'}" stroke-width="3" fill="transparent" stroke-dasharray="${circum}" stroke-dashoffset="${offset}" class="transition-all duration-1000 ease-out"/>
</svg>
<span class="absolute text-[9px] font-bold text-zinc-400">${percent}%</span>
</div>
</div>
<h3 class="font-bold text-zinc-100 group-hover:text-white truncate text-base mb-1 relative z-10">${escapeHtml(f.name)}</h3>
<p class="text-xs text-zinc-500 font-mono relative z-10">${done} / ${count} Completed</p>
`;
grid.appendChild(el);
});
document.getElementById('stat-folders').innerText = db.folders.length;
document.getElementById('stat-videos').innerText = totalVids;
document.getElementById('stat-completed').innerText = doneVids;
const globalPercent = totalVids === 0 ? 0 : Math.round((doneVids/totalVids)*100);
document.getElementById('stat-percent').innerText = globalPercent + '%';
// PERFORMANCE: Only scan the grid for icons, not the whole body
lucide.createIcons({ root: grid });
// Also scan hero because we updated it
if(hasResume) lucide.createIcons({ root: hero });
if(player) {
try{ player.destroy(); } catch(e){}
player = null;
}
}
// --- PLAYER LOGIC ---
function openFolder(id) {
activeFolderId = id;
document.getElementById('view-dashboard').classList.add('hidden');
document.getElementById('view-player').classList.remove('hidden');
renderSidebar();
renderPlaylist();
if(!activeVideoId) {
const f = getFolder(id);
if(f.videos.length > 0) loadVideo(f.videos[0].id);
else loadVideo(null);
}
}
function loadVideo(id) {
activeVideoId = id;
if(!id) {
document.getElementById('yt-player-mount').innerHTML = '<div class="w-full h-full flex flex-col items-center justify-center text-zinc-700 gap-4"><i data-lucide="monitor-off" class="w-16 h-16 opacity-50"></i><p class="text-sm font-mono">No lecture selected</p></div>';
document.getElementById('player-title').innerText = "Select Video";
document.getElementById('player-folder').innerText = getFolder(activeFolderId)?.name || "";
lucide.createIcons(); // Rarely called so fine
return;
}
const f = getFolder(activeFolderId);
const v = f.videos.find(x => x.id === id);
document.getElementById('player-title').innerText = v.title;
document.getElementById('player-folder').innerText = f.name;
document.getElementById('player-tag').innerText = v.tag;
db.lastPlayed = { folderId: activeFolderId, videoId: id };
save();
if(!ytApiReady) {
setTimeout(() => loadVideo(id), 500);
return;
}
if(player) {
try { player.loadVideoById(v.ytId); }
catch(e) { createPlayer(v.ytId); }
} else {
createPlayer(v.ytId);
}
renderPlaylist();
}
function createPlayer(ytId) {
const container = document.getElementById('video-wrapper');
container.innerHTML = '<div id="yt-player-mount" class="w-full h-full"></div>';
player = new YT.Player('yt-player-mount', {
height: '100%',
width: '100%',
videoId: ytId,
playerVars: { 'autoplay': 1, 'rel': 0, 'modestbranding': 1, 'playsinline': 1 },
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}