File size: 26,365 Bytes
1e12df9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Conversor Word para HTML - AmeliCA Redalyc</title>
    <style>
        :root {
            --primary-color: #2c3e50;
            --secondary-color: #3498db;
            --accent-color: #e74c3c;
            --light-color: #ecf0f1;
            --dark-color: #34495e;
            --success-color: #27ae60;
            --warning-color: #f39c12;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            color: #333;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }

        .header {
            background: var(--primary-color);
            color: white;
            padding: 1rem 0;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            position: relative;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 2rem;
        }

        .header-content {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .logo-icon {
            font-size: 2rem;
            background: var(--secondary-color);
            width: 50px;
            height: 50px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .header h1 {
            font-size: 1.5rem;
            font-weight: 600;
        }

        .built-with {
            color: var(--light-color);
            text-decoration: none;
            font-size: 0.9rem;
            opacity: 0.8;
            transition: opacity 0.3s;
        }

        .built-with:hover {
            opacity: 1;
        }

        .main-content {
            padding: 2rem 0;
        }

        .converter-card {
            background: white;
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            overflow: hidden;
            margin-bottom: 2rem;
        }

        .card-header {
            background: var(--secondary-color);
            color: white;
            padding: 1.5rem;
            text-align: center;
        }

        .card-header h2 {
            font-size: 1.5rem;
            margin-bottom: 0.5rem;
        }

        .card-body {
            padding: 2rem;
        }

        .upload-area {
            border: 3px dashed var(--secondary-color);
            border-radius: 8px;
            padding: 3rem 2rem;
            text-align: center;
            transition: all 0.3s ease;
            cursor: pointer;
            margin-bottom: 2rem;
        }

        .upload-area:hover {
            background: #f8f9fa;
            border-color: var(--primary-color);
        }

        .upload-area.active {
            background: #e3f2fd;
            border-color: var(--success-color);
        }

        .upload-icon {
            font-size: 3rem;
            color: var(--secondary-color);
            margin-bottom: 1rem;
        }

        .file-input {
            display: none;
        }

        .file-info {
            margin-top: 1rem;
            padding: 1rem;
            background: var(--light-color);
            border-radius: 6px;
            display: none;
        }

        .file-info.show {
            display: block;
        }

        .conversion-options {
            margin: 2rem 0;
        }

        .options-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 1.5rem;
            margin-top: 1rem;
        }

        .option-group {
            background: #f8f9fa;
            padding: 1.5rem;
            border-radius: 8px;
            border-left: 4px solid var(--secondary-color);
        }

        .option-group h4 {
            margin-bottom: 1rem;
            color: var(--primary-color);
        }

        .checkbox-group {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .checkbox-item {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .checkbox-item input {
            width: 18px;
            height: 18px;
        }

        .actions {
            display: flex;
            gap: 1rem;
            justify-content: center;
            flex-wrap: wrap;
            margin-top: 2rem;
        }

        .btn {
            padding: 0.75rem 2rem;
            border: none;
            border-radius: 6px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .btn-primary {
            background: var(--secondary-color);
            color: white;
        }

        .btn-primary:hover {
            background: var(--primary-color);
            transform: translateY(-2px);
        }

        .btn-secondary {
            background: var(--light-color);
            color: var(--dark-color);
        }

        .btn-secondary:hover {
            background: #d5dbdb;
        }

        .btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }

        .preview-section {
            margin-top: 3rem;
            display: none;
        }

        .preview-section.show {
            display: block;
        }

        .preview-header {
            display: flex;
            justify-content: between;
            align-items: center;
            margin-bottom: 1rem;
        }

        .preview-content {
            background: white;
            border: 1px solid #ddd;
            border-radius: 8px;
            padding: 2rem;
            max-height: 500px;
            overflow-y: auto;
            font-family: 'Times New Roman', serif;
            line-height: 1.8;
        }

        .article-title {
            font-size: 1.8rem;
            text-align: center;
            margin-bottom: 1rem;
            color: var(--primary-color);
        }

        .article-author {
            text-align: center;
            font-style: italic;
            margin-bottom: 2rem;
            color: var(--dark-color);
        }

        .article-abstract {
            background: #f8f9fa;
            padding: 1.5rem;
            border-radius: 6px;
            margin-bottom: 2rem;
        }

        .article-keywords {
            margin-bottom: 2rem;
        }

        .keyword-tag {
            display: inline-block;
            background: var(--secondary-color);
            color: white;
            padding: 0.3rem 0.8rem;
            border-radius: 20px;
            margin: 0.2rem;
            font-size: 0.9rem;
        }

        .download-section {
            text-align: center;
            margin-top: 2rem;
        }

        .btn-success {
            background: var(--success-color);
            color: white;
        }

        .btn-success:hover {
            background: #219653;
        }

        .loading {
            display: none;
            text-align: center;
            padding: 2rem;
        }

        .loading.show {
            display: block;
        }

        .spinner {
            border: 4px solid #f3f3f3;
            border-top: 4px solid var(--secondary-color);
            border-radius: 50%;
            width: 40px;
            height: 40px;
            animation: spin 1s linear infinite;
            margin: 0 auto 1rem;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .footer {
            background: var(--dark-color);
            color: white;
            text-align: center;
            padding: 2rem 0;
            margin-top: 3rem;
        }

        @media (max-width: 768px) {
            .header-content {
                flex-direction: column;
                gap: 1rem;
                text-align: center;
            }

            .options-grid {
                grid-template-columns: 1fr;
            }

            .actions {
                flex-direction: column;
            }

            .btn {
                width: 100%;
                justify-content: center;
            }

            .card-body {
                padding: 1.5rem;
            }
        }

        @media (max-width: 480px) {
            .container {
                padding: 0 1rem;
            }

            .upload-area {
                padding: 2rem 1rem;
            }
        }
    </style>
</head>
<body>
    <header class="header">
        <div class="container">
            <div class="header-content">
                <div class="logo">
                    <div class="logo-icon">📄</div>
                    <h1>Conversor Word para HTML - AmeliCA Redalyc</h1>
                </div>
                <a href="https://huggingface.co/spaces/akhaliq/anycoder" class="built-with" target="_blank">
                    Built with anycoder
                </a>
            </div>
        </div>
    </header>

    <main class="main-content">
        <div class="container">
            <div class="converter-card">
                <div class="card-header">
                    <h2>Conversor de Artigo Científico</h2>
                    <p>Converta seu arquivo Word para HTML UTF-8 compatível com a plataforma AmeliCA Redalyc</p>
                </div>
                
                <div class="card-body">
                    <div class="upload-area" id="uploadArea">
                        <div class="upload-icon">📤</div>
                        <h3>Arraste e solte seu arquivo Word aqui</h3>
                        <p>ou clique para selecionar o arquivo</p>
                        <p style="font-size: 0.9rem; margin-top: 0.5rem; opacity: 0.8;">
                            Formatos suportados: .doc, .docx
                        </p>
                        <input type="file" id="fileInput" class="file-input" accept=".doc,.docx">
                    </div>

                    <div class="file-info" id="fileInfo">
                        <strong>Arquivo selecionado:</strong> 
                        <span id="fileName"></span> 
                        (<span id="fileSize"></span>)
                    </div>

                    <div class="conversion-options">
                        <h3>Opções de Conversão</h3>
                        <div class="options-grid">
                            <div class="option-group">
                                <h4>Metadados</h4>
                                <div class="checkbox-group">
                                    <label class="checkbox-item">
                                        <input type="checkbox" id="includeAbstract" checked>
                                        Incluir resumo
                                    </label>
                                    <label class="checkbox-item">
                                        <input type="checkbox" id="includeKeywords" checked>
                                        Incluir palavras-chave
                                    </label>
                                    <label class="checkbox-item">
                                        <input type="checkbox" id="includeAuthors" checked>
                                        Incluir informações dos autores
                                    </label>
                                </div>
                            </div>
                            
                            <div class="option-group">
                                <h4>Formatação</h4>
                                <div class="checkbox-group">
                                    <label class="checkbox-item">
                                        <input type="checkbox" id="preserveFormatting" checked>
                                        Preservar formatação original
                                    </label>
                                    <label class="checkbox-item">
                                        <input type="checkbox" id="convertTables" checked>
                                        Converter tabelas para HTML
                                    </label>
                                    <label class="checkbox-item">
                                        <input type="checkbox" id="convertImages" checked>
                                        Converter imagens para base64
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="actions">
                        <button class="btn btn-primary" id="convertBtn" disabled>
                            <span>🔄</span> Converter para HTML
                        </button>
                        <button class="btn btn-secondary" id="resetBtn">
                            <span>🗑️</span> Limpar
                        </button>
                    </div>

                    <div class="loading" id="loading">
                        <div class="spinner"></div>
                        <p>Convertendo arquivo... Aguarde</p>
                    </div>

                    <div class="preview-section" id="previewSection">
                        <div class="preview-header">
                            <h3>Prévia do HTML Gerado</h3>
                        </div>
                        <div class="preview-content" id="previewContent">
                            <!-- Conteúdo HTML será inserido aqui -->
                        </div>
                        <div class="download-section">
                            <button class="btn btn-success" id="downloadBtn">
                                <span>💾</span> Baixar HTML
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <footer class="footer">
        <div class="container">
            <p>&copy; 2024 Conversor AmeliCA Redalyc. Desenvolvido para a comunidade científica.</p>
        </div>
    </footer>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const uploadArea = document.getElementById('uploadArea');
            const fileInput = document.getElementById('fileInput');
            const fileInfo = document.getElementById('fileInfo');
            const fileName = document.getElementById('fileName');
            const fileSize = document.getElementById('fileSize');
            const convertBtn = document.getElementById('convertBtn');
            const resetBtn = document.getElementById('resetBtn');
            const loading = document.getElementById('loading');
            const previewSection = document.getElementById('previewSection');
            const previewContent = document.getElementById('previewContent');
            const downloadBtn = document.getElementById('downloadBtn');

            let currentFile = null;

            // Eventos de drag and drop
            ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
                uploadArea.addEventListener(eventName, preventDefaults, false);
            });

            function preventDefaults(e) {
                e.preventDefault();
                e.stopPropagation();
            }

            ['dragenter', 'dragover'].forEach(eventName => {
                uploadArea.addEventListener(eventName, () => {
                    uploadArea.classList.add('active');
                }, false);
            });

            ['dragleave', 'drop'].forEach(eventName => {
                uploadArea.addEventListener(eventName, () => {
                    uploadArea.classList.remove('active');
                }, false);
            });

            uploadArea.addEventListener('drop', handleDrop, false);
            uploadArea.addEventListener('click', () => fileInput.click());
            fileInput.addEventListener('change', handleFileSelect);

            function handleDrop(e) {
                const dt = e.dataTransfer;
                const files = dt.files;
                handleFiles(files);
            }

            function handleFileSelect(e) {
                const files = e.target.files;
                handleFiles(files);
            }

            function handleFiles(files) {
                if (files.length > 0) {
                    const file = files[0];
                    if (file.type.includes('word') || file.name.endsWith('.doc') || file.name.endsWith('.docx')) {
                        currentFile = file;
                        updateFileInfo(file);
                        convertBtn.disabled = false;
                    } else {
                        alert('Por favor, selecione um arquivo Word válido (.doc ou .docx)');
                    }
                }
            }

            function updateFileInfo(file) {
                fileName.textContent = file.name;
                fileSize.textContent = formatFileSize(file.size);
                fileInfo.classList.add('show');
            }

            function formatFileSize(bytes) {
                if (bytes === 0) return '0 Bytes';
                const k = 1024;
                const sizes = ['Bytes', 'KB', 'MB', 'GB'];
                const i = Math.floor(Math.log(bytes) / Math.log(k));
                return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
            }

            // Evento de conversão
            convertBtn.addEventListener('click', convertFile);

            function convertFile() {
                if (!currentFile) return;

                loading.classList.add('show');
                previewSection.classList.remove('show');

                // Simulação de conversão (em um ambiente real, isso seria feito no backend)
                setTimeout(() => {
                    const includeAbstract = document.getElementById('includeAbstract').checked;
                    const includeKeywords = document.getElementById('includeKeywords').checked;
                    const includeAuthors = document.getElementById('includeAuthors').checked;
                    const preserveFormatting = document.getElementById('preserveFormatting').checked;
                    const convertTables = document.getElementById('convertTables').checked;
                    const convertImages = document.getElementById('convertImages').checked;

                    generatePreviewHTML(includeAbstract, includeKeywords, includeAuthors, preserveFormatting, convertTables, convertImages);
                    
                    loading.classList.remove('show');
                    previewSection.classList.add('show');
                }, 2000);
            }

            function generatePreviewHTML(includeAbstract, includeKeywords, includeAuthors, preserveFormatting, convertTables, convertImages) {
                let htmlContent = '';

                // Título do artigo
                htmlContent += `<h1 class="article-title">Título do Artigo Científico: Análise de Dados em Pesquisa Qualitativa</h1>`;

                // Autores
                if (includeAuthors) {
                    htmlContent += `<div class="article-author">
                        <p>Autor Principal<sup>1</sup>, Coautor<sup>2</sup>, Terceiro Autor<sup>1</sup></p>
                        <p><sup>1</sup>Universidade Exemplo, <sup>2</sup>Instituto de Pesquisa</p>
                    </div>`;
                }

                // Resumo
                if (includeAbstract) {
                    htmlContent += `<div class="article-abstract">
                        <h3>Resumo</h3>
                        <p>Este artigo apresenta uma análise detalhada sobre métodos de pesquisa qualitativa aplicados em estudos científicos. A metodologia utilizada baseia-se em revisão sistemática da literatura e estudo de caso. Os resultados demonstram a eficácia das abordagens qualitativas em contextos complexos.</p>
                    </div>`;
                }

                // Palavras-chave
                if (includeKeywords) {
                    htmlContent += `<div class="article-keywords">
                        <h3>Palavras-chave</h3>
                        <div>
                            <span class="keyword-tag">pesquisa qualitativa</span>
                            <span class="keyword-tag">análise de dados</span>
                            <span class="keyword-tag">metodologia científica</span>
                        </div>
                    </div>`;
                }

                // Corpo do artigo
                htmlContent += `<div class="article-body">
                    <h2>1. Introdução</h2>
                    <p>A pesquisa qualitativa tem se mostrado fundamental para a compreensão de fenômenos sociais complexos. Este estudo visa explorar as principais técnicas e ferramentas utilizadas nesse tipo de investigação.</p>
                    
                    <h2>2. Metodologia</h2>
                    <p>Utilizamos uma abordagem mista, combinando análise documental com entrevistas semiestruturadas. A amostra foi composta por 15 participantes selecionados por critérios específicos.</p>`;

                // Tabela simulada
                if (convertTables) {
                    htmlContent += `<table style="width: 100%; border-collapse: collapse; margin: 1rem 0;">
                        <thead>
                            <tr style="background: #f8f9fa;">
                                <th style="border: 1px solid #ddd; padding: 0.75rem;">Variável</th>
                                <th style="border: 1px solid #ddd; padding: 0.75rem;">Descrição</th>
                                <th style="border: 1px solid #ddd; padding: 0.75rem;">Valor</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td style="border: 1px solid #ddd; padding: 0.75rem;">Tamanho da amostra</td>
                                <td style="border: 1px solid #ddd; padding: 0.75rem;">Número de participantes</td>
                                <td style="border: 1px solid #ddd; padding: 0.75rem;">15</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid #ddd; padding: 0.75rem;">Período</td>
                                <td style="border: 1px solid #ddd; padding: 0.75rem;">Duração do estudo</td>
                                <td style="border: 1px solid #ddd; padding: 0.75rem;">6 meses</td>
                            </tr>
                        </tbody>
                    </table>`;
                }

                htmlContent += `<h2>3. Resultados e Discussão</h2>
                    <p>Os resultados indicam uma forte correlação entre as variáveis analisadas. A discussão aprofunda as implicações práticas desses achados.</p>
                    
                    <h2>4. Conclusão</h2>
                    <p>Concluímos que a abordagem qualitativa oferece insights valiosos para a compreensão de fenômenos complexos.</p>
                </div>`;

                // Referências
                htmlContent += `<div class="references">
                    <h2>Referências</h2>
                    <p>SOBRENOME, A. B. <em>Título do livro</em>. Editora, 2023.</p>
                </div>`;

                previewContent.innerHTML = htmlContent;
            }

            // Evento de reset
            resetBtn.addEventListener('click', resetConverter);

            function resetConverter() {
                fileInput.value = '';
                currentFile = null;
                fileInfo.classList.remove('show');
                convertBtn.disabled = true;
                previewSection.classList.remove('show');
                loading.classList.remove('show');
            }

            // Evento de download
            downloadBtn.addEventListener('click', downloadHTML);

            function downloadHTML() {
                const htmlContent = `<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Artigo Científico - AmeliCA Redalyc</title>
    <style>
        body {
            font-family: 'Times New Roman', serif;
            line-height: 1.8;
            max-width: 800px;
            margin: 0 auto;
            padding: 2rem;
        }
        .article-title {
            text-align: center;
            font-size: 1.8rem;
            margin-bottom: 1rem;
        }
        .article-author {
            text-align: center;
            font-style: italic;
            margin-bottom: 2rem;
        }
        .article-abstract {
            background: #f8f9fa;
            padding: 1.5rem;
            border-radius: 6px;
            margin-bottom: 2rem;
        }
        .keyword-tag {
            display: inline-block;
            background: #3498db;
            color: white;
            padding: 0.3rem 0.8rem;
            border-radius: 20px;
            margin: 0.2rem;
            font-size: 0.9rem;
        }
    </style>
</head>
<body>
    ${previewContent.innerHTML}
</body>
</html>`;

                const blob = new Blob([htmlContent], { type: 'text/html' });
                const url = URL.createObjectURL(blob);
                const a = document.createElement('a');
                a.href = url;
                a.download = 'artigo_cientifico_amelica_redalyc.html';
                document.body.appendChild(a);
                a.click();
                document.body.removeChild(a);
                URL.revokeObjectURL(url);
            }
        });
    </script>
</body>
</html>