File size: 32,770 Bytes
0615069
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>PPT Presentation Viewer</title>
    <style>
        :root {
            --text-color: #111111;
            --secondary-text: #666666;
            --bg-color: #ffffff;
            --light-bg: #f8f8f8;
            --dark-bg: #111111;
            --border-color: #e0e0e0;
            --hover-color: #f0f0f0;
            --active-color: #000000;
            --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 4px rgba(0, 0, 0, 0.05), 0 2px 8px rgba(0, 0, 0, 0.05);
            --btn-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
            --card-radius: 4px;
            --btn-radius: 4px;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
        }
        
        body {
            background-color: var(--light-bg);
            color: var(--text-color);
            line-height: 1.5;
            -webkit-font-smoothing: antialiased;
        }
        
        .container {
            max-width: 1800px;
            margin: 0 auto;
            padding: 24px;
        }
        
        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 24px;
            background-color: var(--dark-bg);
            color: white;
            margin-bottom: 32px;
            box-shadow: var(--shadow);
        }
        
        header h1 {
            font-size: 18px;
            font-weight: 500;
            letter-spacing: 0.2px;
            display: flex;
            align-items: center;
        }
        
        header h1 svg {
            margin-right: 12px;
        }
        
        .controls {
            display: flex;
            gap: 16px;
            align-items: center;
        }
        
        .view-controls {
            display: flex;
            background: rgba(255, 255, 255, 0.1);
            border-radius: var(--btn-radius);
            overflow: hidden;
        }
        
        .view-controls button {
            background: none;
            color: white;
            border: none;
            padding: 6px 12px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
            transition: all 0.2s ease;
        }
        
        .view-controls button.active {
            background: rgba(255, 255, 255, 0.2);
        }
        
        .play-button {
            background-color: white;
            color: var(--dark-bg);
            border: none;
            padding: 8px 16px;
            border-radius: var(--btn-radius);
            cursor: pointer;
            display: flex;
            align-items: center;
            transition: all 0.2s ease;
            font-weight: 500;
            font-size: 13px;
            box-shadow: var(--btn-shadow);
        }
        
        .play-button:hover {
            background-color: var(--hover-color);
            transform: translateY(-1px);
        }
        
        .play-button svg {
            margin-right: 8px;
        }
        
        /* Grid View */
        .preview-container {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
            gap: 24px;
            margin-top: 24px;
        }
        
        /* Grid mode specific styles */
        .preview-container:not(.list-view) .slide-frame-container {
            position: relative;
            padding-top: 56.25%; /* 16:9 Aspect Ratio */
            width: 100%;
            overflow: hidden;
        }
        
        .preview-container:not(.list-view) .slide-frame {
            position: absolute;
            top: 50%;
            left: 50%;
            width: 1280px;
            height: 720px;
            border: none;
            transform-origin: center center;
            transform: translate(-50%, -50%) scale(1);
        }
        
        /* List View */
        .preview-container.list-view {
            display: flex;
            flex-direction: column;
            gap: 32px;
            align-items: center;
        }
        
        .preview-container.list-view .slide-preview {
            width: 1280px;
            height: 720px;
            max-width: 90vw;
        }
        
        .preview-container.list-view .slide-frame-container {
            width: 100%;
            height: 100%;
            position: relative;
            padding-top: 0;
        }
        
        .preview-container.list-view .slide-frame {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border: none;
        }
        
        .slide-preview {
            background: var(--bg-color);
            border-radius: var(--card-radius);
            overflow: hidden;
            box-shadow: var(--shadow);
            transition: transform 0.2s ease, box-shadow 0.2s ease;
            cursor: pointer;
            position: relative;
            border: 1px solid var(--border-color);
        }
        
        .slide-preview:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
        }
        
        .slide-preview.active {
            border: 1px solid var(--active-color);
        }
        
        .slide-number {
            position: absolute;
            top: 12px;
            left: 12px;
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            border-radius: 50%;
            width: 28px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: 600;
            z-index: 2;
        }
        
        /* Presentation mode */
        .presentation-mode {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: #000;
            z-index: 1000;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }
        
        /* Fullscreen mode adjustments */
        .presentation-mode:fullscreen {
            width: 100vw;
            height: 100vh;
        }
        
        .presentation-mode:-webkit-full-screen {
            width: 100vw;
            height: 100vh;
        }
        
        .presentation-mode:-moz-full-screen {
            width: 100vw;
            height: 100vh;
        }
        
        .presentation-mode:-ms-fullscreen {
            width: 100vw;
            height: 100vh;
        }
        
        .presentation-slide {
            width: 1280px;
            height: 720px;
            border: none;
            transform-origin: center center;
        }
        
        .presentation-slide-container {
            display: flex;
            align-items: center;
            justify-content: center;
            flex: 1;
            width: 100%;
            padding: 20px;
        }
        
        .presentation-controls {
            height: 48px;
            background-color: rgba(0, 0, 0, 0.9);
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 24px;
            padding: 0 24px;
            position: relative;
            z-index: 1001;
        }
        
        .presentation-controls.fullscreen {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .presentation-controls.fullscreen:hover,
        .presentation-controls.fullscreen.show {
            opacity: 1;
        }
        
        .progress-bar {
            flex: 1;
            max-width: 400px;
            height: 2px;
            background-color: rgba(255, 255, 255, 0.2);
            border-radius: 1px;
            overflow: hidden;
            position: relative;
        }
        
        .progress-fill {
            height: 100%;
            background-color: white;
            width: 0%;
            transition: width 0.3s ease;
        }
        
        .slide-indicators {
            color: white;
            font-size: 12px;
            min-width: 40px;
            text-align: center;
        }
        
        .presentation-controls button {
            background-color: transparent;
            color: white;
            border: none;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background-color 0.2s ease;
        }
        
        .presentation-controls button:hover {
            background-color: rgba(255, 255, 255, 0.1);
        }
        
        /* Responsive adjustments */
        @media (max-width: 1200px) {
            .preview-container:not(.list-view) {
                grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
            }
        }
        
        @media (max-width: 900px) {
            .preview-container:not(.list-view) {
                grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
            }
        }
        
        @media (max-width: 640px) {
            .container {
                padding: 16px;
            }
            
            .preview-container:not(.list-view) {
                grid-template-columns: 1fr;
                gap: 16px;
            }
            
            header {
                flex-direction: column;
                align-items: flex-start;
                gap: 16px;
                padding: 16px;
            }
            
            .controls {
                width: 100%;
                justify-content: space-between;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <h1>
                Presentation Viewer
            </h1>
            <div class="controls">
                <div class="view-controls">
                    <button id="grid-view-btn">Grid</button>
                    <button id="list-view-btn" class="active">List</button>
                </div>
                <button id="play-button" class="play-button">
                    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                        <polygon points="5 3 19 12 5 21 5 3"></polygon>
                    </svg>
                    Play Slides
                </button>
            </div>
        </header>
        
        <div class="preview-container list-view" id="preview-container">
            <!-- Slide previews will be dynamically inserted here -->
        </div>
    </div>
    
    <div class="presentation-mode" id="presentation-mode">
        <div class="presentation-slide-container">
            <iframe id="presentation-slide" class="presentation-slide" src="" frameborder="0"></iframe>
        </div>
        <div class="presentation-controls">
            <button id="prev-slide">
                <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                    <line x1="19" y1="12" x2="5" y2="12"></line>
                    <polyline points="12 19 5 12 12 5"></polyline>
                </svg>
            </button>
            <div class="progress-bar">
                <div class="progress-fill" id="progress-fill"></div>
            </div>
            <div class="slide-indicators">
                <span id="current-slide">1</span>/<span id="total-slides">0</span>
            </div>
            <button id="next-slide">
                <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                    <line x1="5" y1="12" x2="19" y2="12"></line>
                    <polyline points="12 5 19 12 12 19"></polyline>
                </svg>
            </button>
            <button id="fullscreen-toggle" title="Toggle Fullscreen">
                <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                    <path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"></path>
                </svg>
            </button>
            <button id="exit-presentation">
                <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                    <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
                    <line x1="9" y1="9" x2="15" y2="15"></line>
                    <line x1="15" y1="9" x2="9" y2="15"></line>
                </svg>
            </button>
        </div>
    </div>

    <script>
        // Load the slides data
        const slides = ["slides/slide01_titulo.html", "slides/slide02_resumen.html", "slides/slide03_modelo1.html", "slides/slide04_modelo2.html", "slides/slide05_comparativo.html", "slides/slide06_caso_ecuador.html", "slides/slide07_ecosistema_academico.html", "slides/slide08_indicadores.html", "slides/slide09_brechas_oportunidades.html", "slides/slide10_tendencias.html", "slides/slide11_csb_argentina.html", "slides/slide12_analisis_cuantitativo_v2.html", "slides/slide13_correlacion_educacion.html", "slides/slide14_modelos_comparativos.html", "slides/slide15_america_latina.html", "slides/slide16_casos_estudio_simple.html", "slides/slide17_conclusiones.html", "slides/slide18_bibliografia.html", "slides/slide19_agradecimientos.html"];
        let currentSlideIndex = 0;
        let viewMode = 'list'; // 'grid' or 'list'
        
        // DOM elements
        const previewContainer = document.getElementById('preview-container');
        const presentationMode = document.getElementById('presentation-mode');
        const presentationSlide = document.getElementById('presentation-slide');
        const playButton = document.getElementById('play-button');
        const prevButton = document.getElementById('prev-slide');
        const nextButton = document.getElementById('next-slide');
        const exitButton = document.getElementById('exit-presentation');
        const fullscreenToggle = document.getElementById('fullscreen-toggle');
        const presentationControls = document.querySelector('.presentation-controls');
        const progressFill = document.getElementById('progress-fill');
        const currentSlideElement = document.getElementById('current-slide');
        const totalSlidesElement = document.getElementById('total-slides');
        const gridViewBtn = document.getElementById('grid-view-btn');
        const listViewBtn = document.getElementById('list-view-btn');
        
        // Fullscreen state
        let isFullscreen = false;
        let controlsTimeout;
        
        // Initialize the viewer
        function initViewer() {
            // Set total slides
            totalSlidesElement.textContent = slides.length;
            
            // Generate slide previews
            generatePreviews();
            
            // Set up view mode buttons
            gridViewBtn.addEventListener('click', () => setViewMode('grid'));
            listViewBtn.addEventListener('click', () => setViewMode('list'));
        }
        
        // Generate slide previews
        function generatePreviews() {
            previewContainer.innerHTML = '';
            
            slides.forEach((slide, index) => {
                const slidePreview = document.createElement('div');
                slidePreview.className = 'slide-preview';
                if (index === currentSlideIndex) {
                    slidePreview.classList.add('active');
                }
                
                slidePreview.innerHTML = `
                    <div class="slide-number">${index + 1}</div>
                    <div class="slide-frame-container">
                        <iframe class="slide-frame" src="${slide}" frameborder="0"></iframe>
                    </div>
                `;
                
                slidePreview.addEventListener('click', () => {
                    startPresentation(index);
                });
                
                previewContainer.appendChild(slidePreview);
            });
            
            // Scale grid previews after generating
            if (viewMode === 'grid') {
                setTimeout(scaleGridPreviews, 100);
            }
        }
        
        // Set view mode (grid or list)
        function setViewMode(mode) {
            viewMode = mode;
            
            if (mode === 'grid') {
                previewContainer.classList.remove('list-view');
                gridViewBtn.classList.add('active');
                listViewBtn.classList.remove('active');
                
                // Scale grid previews after mode change
                setTimeout(scaleGridPreviews, 100);
            } else {
                previewContainer.classList.add('list-view');
                gridViewBtn.classList.remove('active');
                listViewBtn.classList.add('active');
                
                // Reset all iframe transforms for list mode
                resetListPreviews();
            }
        }
        
        // Reset transforms for list mode
        function resetListPreviews() {
            const slideFrames = document.querySelectorAll('.slide-frame');
            slideFrames.forEach(frame => {
                frame.style.transform = '';
            });
        }
        
        // Scale grid mode previews
        function scaleGridPreviews() {
            if (viewMode !== 'grid') return;
            
            const slideFrames = document.querySelectorAll('.preview-container:not(.list-view) .slide-frame');
            slideFrames.forEach(frame => {
                const container = frame.closest('.slide-frame-container');
                if (!container) return;
                
                const containerWidth = container.clientWidth;
                const containerHeight = container.clientHeight;
                
                // Calculate scale to fit 1280x720 within container
                const scaleX = containerWidth / 1280;
                const scaleY = containerHeight / 720;
                const scale = Math.min(scaleX, scaleY);
                
                frame.style.transform = `translate(-50%, -50%) scale(${scale})`;
            });
        }
        
        // Start presentation mode
        function startPresentation(index = 0) {
            currentSlideIndex = index;
            presentationMode.style.display = 'flex';
            document.body.style.overflow = 'hidden';
            updateSlide();
            
            // Auto-enter fullscreen
            requestFullscreen();
        }
        
        // Request fullscreen
        function requestFullscreen() {
            const element = presentationMode;
            
            if (element.requestFullscreen) {
                element.requestFullscreen();
            } else if (element.webkitRequestFullscreen) {
                element.webkitRequestFullscreen();
            } else if (element.mozRequestFullScreen) {
                element.mozRequestFullScreen();
            } else if (element.msRequestFullscreen) {
                element.msRequestFullscreen();
            }
        }
        
        // Exit fullscreen
        function exitFullscreen() {
            if (document.exitFullscreen) {
                document.exitFullscreen();
            } else if (document.webkitExitFullscreen) {
                document.webkitExitFullscreen();
            } else if (document.mozCancelFullScreen) {
                document.mozCancelFullScreen();
            } else if (document.msExitFullscreen) {
                document.msExitFullscreen();
            }
        }
        
        // Toggle fullscreen
        function toggleFullscreen() {
            if (isFullscreen) {
                exitFullscreen();
            } else {
                requestFullscreen();
            }
        }
        
        // Handle fullscreen change
        function handleFullscreenChange() {
            isFullscreen = !!(document.fullscreenElement || 
                            document.webkitFullscreenElement || 
                            document.mozFullScreenElement || 
                            document.msFullscreenElement);
            
            if (isFullscreen) {
                presentationControls.classList.add('fullscreen');
                setupControlsAutoHide();
            } else {
                presentationControls.classList.remove('fullscreen');
                clearTimeout(controlsTimeout);
            }
            
            // Re-scale slide when fullscreen changes
            setTimeout(scalePresentationSlide, 100);
        }
        
        // Setup auto-hide controls in fullscreen
        function setupControlsAutoHide() {
            if (!isFullscreen) return;
            
            // Show controls initially
            presentationControls.classList.add('show');
            
            // Auto-hide after 3 seconds
            controlsTimeout = setTimeout(() => {
                if (isFullscreen) {
                    presentationControls.classList.remove('show');
                }
            }, 3000);
        }
        
        // Show controls temporarily
        function showControlsTemporarily() {
            if (!isFullscreen) return;
            
            presentationControls.classList.add('show');
            clearTimeout(controlsTimeout);
            
            controlsTimeout = setTimeout(() => {
                if (isFullscreen) {
                    presentationControls.classList.remove('show');
                }
            }, 3000);
        }
        
        // Exit presentation mode
        function exitPresentation() {
            // Exit fullscreen if in fullscreen mode
            if (isFullscreen) {
                exitFullscreen();
            }
            
            presentationMode.style.display = 'none';
            document.body.style.overflow = 'auto';
        }
        
        // Update current slide
        function updateSlide() {
            presentationSlide.src = slides[currentSlideIndex];
            currentSlideElement.textContent = currentSlideIndex + 1;
            
            // Update progress bar
            const progress = ((currentSlideIndex + 1) / slides.length) * 100;
            progressFill.style.width = `${progress}%`;
            
            // Scale presentation slide to fit container
            scalePresentationSlide();
            
            // Update preview highlighting
            document.querySelectorAll('.slide-preview').forEach((preview, index) => {
                if (index === currentSlideIndex) {
                    preview.classList.add('active');
                } else {
                    preview.classList.remove('active');
                }
            });
        }
        
        // Scale presentation slide to fit container
        function scalePresentationSlide() {
            const container = document.querySelector('.presentation-slide-container');
            const containerWidth = container.clientWidth - 40; // Account for padding
            const containerHeight = container.clientHeight - 40;
            
            // In fullscreen mode, use full viewport dimensions
            if (isFullscreen) {
                const viewportWidth = window.innerWidth;
                const viewportHeight = window.innerHeight - 48; // Account for controls height
                
                const scaleX = viewportWidth / 1280;
                const scaleY = viewportHeight / 720;
                const scale = Math.min(scaleX, scaleY);
                
                presentationSlide.style.transform = `scale(${scale})`;
            } else {
                // Calculate scale based on container size and slide dimensions (1280x720)
                const scaleX = containerWidth / 1280;
                const scaleY = containerHeight / 720;
                const scale = Math.min(scaleX, scaleY);
                
                presentationSlide.style.transform = `scale(${scale})`;
            }
        }
        
        // Go to next slide
        function nextSlide() {
            if (currentSlideIndex < slides.length - 1) {
                currentSlideIndex++;
                updateSlide();
            }
        }
        
        // Go to previous slide
        function prevSlide() {
            if (currentSlideIndex > 0) {
                currentSlideIndex--;
                updateSlide();
            }
        }
        
        // Event listeners
        playButton.addEventListener('click', () => startPresentation(0));
        prevButton.addEventListener('click', () => {
            prevSlide();
            showControlsTemporarily();
        });
        nextButton.addEventListener('click', () => {
            nextSlide();
            showControlsTemporarily();
        });
        exitButton.addEventListener('click', exitPresentation);
        fullscreenToggle.addEventListener('click', () => {
            toggleFullscreen();
            showControlsTemporarily();
        });
        
        // Fullscreen change listeners
        document.addEventListener('fullscreenchange', handleFullscreenChange);
        document.addEventListener('webkitfullscreenchange', handleFullscreenChange);
        document.addEventListener('mozfullscreenchange', handleFullscreenChange);
        document.addEventListener('MSFullscreenChange', handleFullscreenChange);
        
        // Mouse movement in fullscreen mode
        presentationMode.addEventListener('mousemove', showControlsTemporarily);
        
        // Keyboard navigation
        document.addEventListener('keydown', (e) => {
            if (presentationMode.style.display === 'flex') {
                if (e.key === 'ArrowRight' || e.key === ' ' || e.key === 'n') {
                    nextSlide();
                    showControlsTemporarily();
                } else if (e.key === 'ArrowLeft' || e.key === 'p') {
                    prevSlide();
                    showControlsTemporarily();
                } else if (e.key === 'Escape') {
                    if (isFullscreen) {
                        exitFullscreen();
                    } else {
                        exitPresentation();
                    }
                } else if (e.key === 'f' || e.key === 'F') {
                    toggleFullscreen();
                    showControlsTemporarily();
                }
            }
        });
        
        // Initialize the viewer when the page loads
        window.addEventListener('load', initViewer);
        
        // Handle window resize for presentation mode scaling
        window.addEventListener('resize', () => {
            if (presentationMode.style.display === 'flex') {
                scalePresentationSlide();
            }
            
            // Also scale grid previews on resize
            if (viewMode === 'grid') {
                scaleGridPreviews();
            }
        });
    </script>

<style>
#minimax-floating-ball {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 12px;
  background: #222222;
  border-radius: 12px;
  display: flex;
  align-items: center;
  color: #F8F8F8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  z-index: 9999;
  transition: all 0.3s ease;
  overflow: hidden;
  cursor: pointer;
}

#minimax-floating-ball:hover {
  transform: translateY(-2px);
  background: #383838;
}

.minimax-ball-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.minimax-logo-wave {
  width: 26px;
  height: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='22' viewBox='0 0 26 22' fill='none'%3E%3Cg clip-path='url(%23clip0_3442_102412)'%3E%3Cpath d='M12.8405 14.6775C12.8405 14.9897 13.0932 15.2424 13.4055 15.2424C13.7178 15.2424 13.9705 14.9897 13.9705 14.6775V2.98254C13.9705 1.88957 13.0809 1 11.9879 1C10.895 1 10.0054 1.88957 10.0054 2.98254V11.566V17.1068C10.0054 17.5773 9.62327 17.9594 9.1528 17.9594C8.68233 17.9594 8.30021 17.5773 8.30021 17.1068V8.04469C8.30021 6.95172 7.41063 6.06215 6.31767 6.06215C5.22471 6.06215 4.33513 6.95172 4.33513 8.04469V11.8855C4.33513 12.3559 3.953 12.7381 3.48254 12.7381C3.01207 12.7381 2.62994 12.3559 2.62994 11.8855V10.4936C2.62994 10.1813 2.37725 9.92861 2.06497 9.92861C1.7527 9.92861 1.5 10.1813 1.5 10.4936V11.8855C1.5 12.9784 2.38957 13.868 3.48254 13.868C4.5755 13.868 5.46508 12.9784 5.46508 11.8855V8.04469C5.46508 7.57422 5.8472 7.19209 6.31767 7.19209C6.78814 7.19209 7.17026 7.57422 7.17026 8.04469V17.1068C7.17026 18.1998 8.05984 19.0894 9.1528 19.0894C10.2458 19.0894 11.1353 18.1998 11.1353 17.1068V2.98254C11.1353 2.51207 11.5175 2.12994 11.9879 2.12994C12.4584 2.12994 12.8405 2.51207 12.8405 2.98254V14.6775Z' fill='%23F8F8F8'/%3E%3Cpath d='M23.3278 6.06215C22.2348 6.06215 21.3452 6.95172 21.3452 8.04469V15.6143C21.3452 16.0847 20.9631 16.4669 20.4926 16.4669C20.0222 16.4669 19.6401 16.0847 19.6401 15.6143V2.98254C19.6401 1.88957 18.7505 1 17.6575 1C16.5645 1 15.675 1.88957 15.675 2.98254V19.0175C15.675 19.4879 15.2928 19.8701 14.8224 19.8701C14.3519 19.8701 13.9698 19.4879 13.9698 19.0175V17.0329C13.9698 16.7206 13.7171 16.4679 13.4048 16.4679C13.0925 16.4679 12.8398 16.7206 12.8398 17.0329V19.0175C12.8398 20.1104 13.7294 21 14.8224 21C15.9153 21 16.8049 20.1104 16.8049 19.0175V2.98254C16.8049 2.51207 17.187 2.12994 17.6575 2.12994C18.128 2.12994 18.5101 2.51207 18.5101 2.98254V15.6143C18.5101 16.7072 19.3997 17.5968 20.4926 17.5968C21.5856 17.5968 22.4752 16.7072 22.4752 15.6143V8.04469C22.4752 7.57422 22.8573 7.19209 23.3278 7.19209C23.7982 7.19209 24.1804 7.57422 24.1804 8.04469V14.6775C24.1804 14.9897 24.4331 15.2424 24.7453 15.2424C25.0576 15.2424 25.3103 14.9897 25.3103 14.6775V8.04469C25.3103 6.95172 24.4207 6.06215 23.3278 6.06215Z' fill='%23F8F8F8'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_3442_102412'%3E%3Crect width='25' height='22' fill='white' transform='translate(0.5)'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.minimax-ball-text {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.minimax-close-icon {
  margin-left: 8px;
  font-size: 16px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.minimax-close-icon:hover {
  opacity: 1;
}
</style>
<div id="minimax-floating-ball">
  <div class="minimax-ball-content">
    <div class="minimax-logo-wave"></div>
    <span class="minimax-ball-text">Created by MiniMax Agent</span>
  </div>
  <div class="minimax-close-icon">×</div>
</div>
<script>
// Initialize floating ball functionality
function initFloatingBall() {
  const ball = document.getElementById('minimax-floating-ball');
  if (!ball) return;

  // Initial animation
  ball.style.opacity = '0';
  ball.style.transform = 'translateY(20px)';

  setTimeout(() => {
    ball.style.opacity = '1';
    ball.style.transform = 'translateY(0)';
  }, 500);

  // Handle logo click
  const ballContent = ball.querySelector('.minimax-ball-content');
  ballContent.addEventListener('click', function (e) {
    e.stopPropagation();
    window.open('https://agent.minimax.io/agent', '_blank');
    ball.style.transform = 'scale(0.95)';
    setTimeout(() => {
      ball.style.transform = 'scale(1)';
    }, 100);
  });

  // Handle close button click
  const closeIcon = ball.querySelector('.minimax-close-icon');
  closeIcon.addEventListener('click', function (e) {
    e.stopPropagation();
    ball.style.opacity = '0';
    ball.style.transform = 'translateY(20px)';

    setTimeout(() => {
      ball.style.display = 'none';
    }, 300);
  });
}

// Initialize when DOM is ready
document.addEventListener('DOMContentLoaded', initFloatingBall); 
</script>

</body>
</html>