Doddieko67 commited on
Commit
2ea11da
·
verified ·
1 Parent(s): 9e00d33

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +946 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: God Dipsik
3
- emoji: 📊
4
- colorFrom: green
5
- colorTo: red
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: god-dipsik
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: gray
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,946 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="es">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>ExamGen AI - Plataforma de Exámenes Personalizados</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
10
+ <style>
11
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
12
+
13
+ :root {
14
+ --primary: #6366f1;
15
+ --primary-dark: #4f46e5;
16
+ --secondary: #10b981;
17
+ --dark: #1e293b;
18
+ --light: #f8fafc;
19
+ }
20
+
21
+ body {
22
+ font-family: 'Poppins', sans-serif;
23
+ background-color: #f1f5f9;
24
+ }
25
+
26
+ .gradient-bg {
27
+ background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
28
+ }
29
+
30
+ .subject-chip {
31
+ transition: all 0.3s ease;
32
+ }
33
+
34
+ .subject-chip:hover {
35
+ transform: translateY(-2px);
36
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
37
+ }
38
+
39
+ .exam-card {
40
+ transition: all 0.3s ease;
41
+ border-left: 4px solid var(--primary);
42
+ }
43
+
44
+ .exam-card:hover {
45
+ transform: translateY(-3px);
46
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
47
+ }
48
+
49
+ .tab-active {
50
+ border-bottom: 3px solid var(--primary);
51
+ font-weight: 600;
52
+ color: var(--primary);
53
+ }
54
+
55
+ .question-item {
56
+ border-left: 3px solid var(--primary);
57
+ }
58
+
59
+ .difficulty-badge {
60
+ font-size: 0.7rem;
61
+ padding: 0.2rem 0.5rem;
62
+ border-radius: 9999px;
63
+ }
64
+
65
+ .easy {
66
+ background-color: #dcfce7;
67
+ color: #16a34a;
68
+ }
69
+
70
+ .medium {
71
+ background-color: #fef9c3;
72
+ color: #ca8a04;
73
+ }
74
+
75
+ .hard {
76
+ background-color: #fee2e2;
77
+ color: #dc2626;
78
+ }
79
+
80
+ .ai-processing {
81
+ animation: pulse 2s infinite;
82
+ }
83
+
84
+ @keyframes pulse {
85
+ 0% { opacity: 0.6; }
86
+ 50% { opacity: 1; }
87
+ 100% { opacity: 0.6; }
88
+ }
89
+
90
+ /* Custom scrollbar */
91
+ ::-webkit-scrollbar {
92
+ width: 8px;
93
+ height: 8px;
94
+ }
95
+
96
+ ::-webkit-scrollbar-track {
97
+ background: #f1f1f1;
98
+ }
99
+
100
+ ::-webkit-scrollbar-thumb {
101
+ background: #c7d2fe;
102
+ border-radius: 10px;
103
+ }
104
+
105
+ ::-webkit-scrollbar-thumb:hover {
106
+ background: #a5b4fc;
107
+ }
108
+ </style>
109
+ </head>
110
+ <body class="min-h-screen">
111
+ <!-- Navbar -->
112
+ <nav class="gradient-bg text-white shadow-lg">
113
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
114
+ <div class="flex items-center justify-between h-16">
115
+ <div class="flex items-center">
116
+ <div class="flex-shrink-0 flex items-center">
117
+ <i class="fas fa-brain text-2xl mr-2"></i>
118
+ <span class="text-xl font-bold">ExamGen AI</span>
119
+ </div>
120
+ </div>
121
+ <div class="hidden md:block">
122
+ <div class="ml-10 flex items-baseline space-x-4">
123
+ <a href="#" class="px-3 py-2 rounded-md text-sm font-medium bg-white text-indigo-600">Inicio</a>
124
+ <a href="#" class="px-3 py-2 rounded-md text-sm font-medium hover:bg-indigo-700 hover:bg-opacity-75">Mis Exámenes</a>
125
+ <a href="#" class="px-3 py-2 rounded-md text-sm font-medium hover:bg-indigo-700 hover:bg-opacity-75">Historial</a>
126
+ <a href="#" class="px-3 py-2 rounded-md text-sm font-medium hover:bg-indigo-700 hover:bg-opacity-75">Configuración</a>
127
+ </div>
128
+ </div>
129
+ <div class="hidden md:block">
130
+ <div class="ml-4 flex items-center md:ml-6">
131
+ <button class="p-1 rounded-full text-indigo-200 hover:text-white focus:outline-none">
132
+ <i class="fas fa-bell h-6 w-6"></i>
133
+ </button>
134
+ <div class="ml-3 relative">
135
+ <div>
136
+ <button id="user-menu" class="max-w-xs flex items-center text-sm rounded-full focus:outline-none">
137
+ <img class="h-8 w-8 rounded-full" src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt="">
138
+ </button>
139
+ </div>
140
+ </div>
141
+ </div>
142
+ </div>
143
+ <div class="-mr-2 flex md:hidden">
144
+ <button class="inline-flex items-center justify-center p-2 rounded-md text-indigo-200 hover:text-white hover:bg-indigo-700 focus:outline-none">
145
+ <i class="fas fa-bars h-6 w-6"></i>
146
+ </button>
147
+ </div>
148
+ </div>
149
+ </div>
150
+ </nav>
151
+
152
+ <!-- Main Content -->
153
+ <main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
154
+ <!-- Welcome Banner -->
155
+ <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
156
+ <div class="md:flex">
157
+ <div class="p-8">
158
+ <div class="uppercase tracking-wide text-sm text-indigo-600 font-semibold">Bienvenido de vuelta</div>
159
+ <h1 class="block mt-1 text-2xl font-medium text-gray-900">¿Qué examen generaremos hoy?</h1>
160
+ <p class="mt-2 text-gray-500">Selecciona entre nuestras opciones inteligentes para crear el examen perfecto para tus necesidades.</p>
161
+ </div>
162
+ <div class="md:flex-shrink-0 flex items-center justify-center p-8 md:w-1/3 bg-indigo-50">
163
+ <i class="fas fa-robot text-6xl text-indigo-400"></i>
164
+ </div>
165
+ </div>
166
+ </div>
167
+
168
+ <!-- Creation Tabs -->
169
+ <div class="mb-8 border-b border-gray-200">
170
+ <nav class="-mb-px flex space-x-8" aria-label="Tabs">
171
+ <button id="new-exam-tab" class="tab-active whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">
172
+ <i class="fas fa-plus-circle mr-2"></i> Nuevo Examen
173
+ </button>
174
+ <button id="upload-exam-tab" class="whitespace-nowrap py-4 px-1 border-b-2 border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 font-medium text-sm">
175
+ <i class="fas fa-file-upload mr-2"></i> Subir Examen
176
+ </button>
177
+ <button id="history-exam-tab" class="whitespace-nowrap py-4 px-1 border-b-2 border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 font-medium text-sm">
178
+ <i class="fas fa-history mr-2"></i> Basado en Historial
179
+ </button>
180
+ </nav>
181
+ </div>
182
+
183
+ <!-- New Exam Form -->
184
+ <div id="new-exam-section" class="bg-white rounded-xl shadow-md overflow-hidden p-6 mb-8">
185
+ <h2 class="text-xl font-semibold text-gray-800 mb-6">Configura tu examen personalizado</h2>
186
+
187
+ <!-- Subjects Selection -->
188
+ <div class="mb-8">
189
+ <h3 class="text-lg font-medium text-gray-700 mb-4">1. Selecciona las materias</h3>
190
+ <div class="flex flex-wrap gap-3 mb-4" id="selected-subjects-container">
191
+ <!-- Selected subjects will appear here -->
192
+ </div>
193
+
194
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
195
+ <!-- Subject Card 1 -->
196
+ <div class="subject-chip bg-white border border-gray-200 rounded-lg p-4 shadow-sm cursor-pointer hover:border-indigo-300" data-color="bg-blue-100" data-text="text-blue-800" data-subject="Matemáticas">
197
+ <div class="flex items-center">
198
+ <div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center mr-3">
199
+ <i class="fas fa-square-root-alt text-blue-600"></i>
200
+ </div>
201
+ <div>
202
+ <h4 class="font-medium text-gray-800">Matemáticas</h4>
203
+ <p class="text-sm text-gray-500">Álgebra, cálculo, geometría</p>
204
+ </div>
205
+ </div>
206
+ </div>
207
+
208
+ <!-- Subject Card 2 -->
209
+ <div class="subject-chip bg-white border border-gray-200 rounded-lg p-4 shadow-sm cursor-pointer hover:border-indigo-300" data-color="bg-green-100" data-text="text-green-800" data-subject="Biología">
210
+ <div class="flex items-center">
211
+ <div class="w-10 h-10 rounded-full bg-green-100 flex items-center justify-center mr-3">
212
+ <i class="fas fa-dna text-green-600"></i>
213
+ </div>
214
+ <div>
215
+ <h4 class="font-medium text-gray-800">Biología</h4>
216
+ <p class="text-sm text-gray-500">Células, genética, ecología</p>
217
+ </div>
218
+ </div>
219
+ </div>
220
+
221
+ <!-- Subject Card 3 -->
222
+ <div class="subject-chip bg-white border border-gray-200 rounded-lg p-4 shadow-sm cursor-pointer hover:border-indigo-300" data-color="bg-purple-100" data-text="text-purple-800" data-subject="Literatura">
223
+ <div class="flex items-center">
224
+ <div class="w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center mr-3">
225
+ <i class="fas fa-book-open text-purple-600"></i>
226
+ </div>
227
+ <div>
228
+ <h4 class="font-medium text-gray-800">Literatura</h4>
229
+ <p class="text-sm text-gray-500">Obras clásicas, análisis</p>
230
+ </div>
231
+ </div>
232
+ </div>
233
+
234
+ <!-- Add Custom Subject -->
235
+ <div class="bg-gray-50 border-2 border-dashed border-gray-300 rounded-lg p-4 cursor-pointer hover:border-indigo-300 hover:bg-gray-100 flex items-center justify-center" id="add-subject-btn">
236
+ <div class="text-center">
237
+ <i class="fas fa-plus-circle text-gray-400 text-2xl mb-1"></i>
238
+ <p class="text-sm font-medium text-gray-500">Añadir materia</p>
239
+ </div>
240
+ </div>
241
+ </div>
242
+ </div>
243
+
244
+ <!-- Questions Configuration -->
245
+ <div class="mb-8">
246
+ <h3 class="text-lg font-medium text-gray-700 mb-4">2. Configura las preguntas</h3>
247
+
248
+ <div class="bg-gray-50 rounded-lg p-4 mb-4" id="questions-config-container">
249
+ <!-- Configuration for each subject will appear here -->
250
+ <p class="text-gray-500 text-sm">Selecciona materias primero para configurar las preguntas.</p>
251
+ </div>
252
+
253
+ <div class="flex items-center">
254
+ <label class="block text-sm font-medium text-gray-700 mr-4">Total de preguntas:</label>
255
+ <div class="flex-1">
256
+ <input type="range" min="5" max="50" value="20" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer" id="total-questions-slider">
257
+ </div>
258
+ <span class="ml-4 text-gray-700 font-medium w-16 text-center" id="total-questions-value">20</span>
259
+ </div>
260
+ </div>
261
+
262
+ <!-- Difficulty Level -->
263
+ <div class="mb-8">
264
+ <h3 class="text-lg font-medium text-gray-700 mb-4">3. Nivel de dificultad</h3>
265
+
266
+ <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
267
+ <div class="difficulty-option border-2 border-gray-200 rounded-lg p-4 text-center cursor-pointer hover:border-indigo-300" data-difficulty="easy">
268
+ <div class="w-12 h-12 rounded-full bg-green-100 flex items-center justify-center mx-auto mb-3">
269
+ <i class="fas fa-smile text-green-600"></i>
270
+ </div>
271
+ <h4 class="font-medium text-gray-800">Fácil</h4>
272
+ <p class="text-sm text-gray-500">Conceptos básicos</p>
273
+ </div>
274
+
275
+ <div class="difficulty-option border-2 border-gray-200 rounded-lg p-4 text-center cursor-pointer hover:border-indigo-300" data-difficulty="medium">
276
+ <div class="w-12 h-12 rounded-full bg-yellow-100 flex items-center justify-center mx-auto mb-3">
277
+ <i class="fas fa-meh text-yellow-600"></i>
278
+ </div>
279
+ <h4 class="font-medium text-gray-800">Medio</h4>
280
+ <p class="text-sm text-gray-500">Reto moderado</p>
281
+ </div>
282
+
283
+ <div class="difficulty-option border-2 border-gray-200 rounded-lg p-4 text-center cursor-pointer hover:border-indigo-300" data-difficulty="hard">
284
+ <div class="w-12 h-12 rounded-full bg-red-100 flex items-center justify-center mx-auto mb-3">
285
+ <i class="fas fa-frown text-red-600"></i>
286
+ </div>
287
+ <h4 class="font-medium text-gray-800">Difícil</h4>
288
+ <p class="text-sm text-gray-500">Preguntas complejas</p>
289
+ </div>
290
+
291
+ <div class="difficulty-option border-2 border-gray-200 rounded-lg p-4 text-center cursor-pointer hover:border-indigo-300" data-difficulty="mixed">
292
+ <div class="w-12 h-12 rounded-full bg-indigo-100 flex items-center justify-center mx-auto mb-3">
293
+ <i class="fas fa-random text-indigo-600"></i>
294
+ </div>
295
+ <h4 class="font-medium text-gray-800">Mixto</h4>
296
+ <p class="text-sm text-gray-500">Variedad de niveles</p>
297
+ </div>
298
+ </div>
299
+ </div>
300
+
301
+ <!-- Advanced Options -->
302
+ <div class="mb-8">
303
+ <div class="flex items-center justify-between cursor-pointer" id="advanced-options-toggle">
304
+ <h3 class="text-lg font-medium text-gray-700">4. Opciones avanzadas (Opcional)</h3>
305
+ <i class="fas fa-chevron-down text-gray-400 transition-transform duration-200"></i>
306
+ </div>
307
+
308
+ <div class="mt-4 hidden" id="advanced-options-content">
309
+ <div class="bg-gray-50 rounded-lg p-4">
310
+ <div class="mb-4">
311
+ <label class="block text-sm font-medium text-gray-700 mb-2">Instrucciones especiales para la IA</label>
312
+ <textarea class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" rows="3" placeholder="Ej: 'Enfócate en ecuaciones cuadráticas para matemáticas y en genética mendeliana para biología.'"></textarea>
313
+ </div>
314
+
315
+ <div class="mb-4">
316
+ <label class="block text-sm font-medium text-gray-700 mb-2">Tipo de preguntas</label>
317
+ <div class="flex flex-wrap gap-3">
318
+ <div class="flex items-center">
319
+ <input id="multiple-choice" type="checkbox" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded" checked>
320
+ <label for="multiple-choice" class="ml-2 block text-sm text-gray-700">Opción múltiple</label>
321
+ </div>
322
+ <div class="flex items-center">
323
+ <input id="true-false" type="checkbox" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
324
+ <label for="true-false" class="ml-2 block text-sm text-gray-700">Verdadero/Falso</label>
325
+ </div>
326
+ <div class="flex items-center">
327
+ <input id="short-answer" type="checkbox" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
328
+ <label for="short-answer" class="ml-2 block text-sm text-gray-700">Respuesta corta</label>
329
+ </div>
330
+ <div class="flex items-center">
331
+ <input id="matching" type="checkbox" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
332
+ <label for="matching" class="ml-2 block text-sm text-gray-700">Emparejamiento</label>
333
+ </div>
334
+ </div>
335
+ </div>
336
+
337
+ <div>
338
+ <label class="block text-sm font-medium text-gray-700 mb-2">Tiempo límite (minutos)</label>
339
+ <input type="number" min="5" max="180" value="30" class="w-20 px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
340
+ </div>
341
+ </div>
342
+ </div>
343
+ </div>
344
+
345
+ <!-- Generate Button -->
346
+ <div class="flex justify-end">
347
+ <button id="generate-exam-btn" class="gradient-bg text-white px-6 py-3 rounded-lg font-medium shadow-md hover:shadow-lg transition duration-300 flex items-center">
348
+ <i class="fas fa-magic mr-2"></i> Generar Examen
349
+ </button>
350
+ </div>
351
+ </div>
352
+
353
+ <!-- Upload Exam Section (Hidden by default) -->
354
+ <div id="upload-exam-section" class="bg-white rounded-xl shadow-md overflow-hidden p-6 mb-8 hidden">
355
+ <h2 class="text-xl font-semibold text-gray-800 mb-6">Convierte archivos en exámenes interactivos</h2>
356
+
357
+ <div class="border-2 border-dashed border-gray-300 rounded-lg p-8 text-center mb-6">
358
+ <div class="flex justify-center mb-4">
359
+ <i class="fas fa-file-upload text-4xl text-indigo-400"></i>
360
+ </div>
361
+ <h3 class="text-lg font-medium text-gray-700 mb-2">Arrastra y suelta tus archivos aquí</h3>
362
+ <p class="text-sm text-gray-500 mb-4">o</p>
363
+ <label for="file-upload" class="cursor-pointer gradient-bg text-white px-4 py-2 rounded-md font-medium inline-block">
364
+ <i class="fas fa-folder-open mr-2"></i> Seleccionar archivos
365
+ </label>
366
+ <input id="file-upload" type="file" class="hidden" multiple>
367
+ <p class="text-xs text-gray-500 mt-4">Formatos soportados: PDF, DOCX, TXT (Máx. 10MB)</p>
368
+ </div>
369
+
370
+ <div class="bg-gray-50 rounded-lg p-4 mb-6">
371
+ <h3 class="text-lg font-medium text-gray-700 mb-4">O pega tu texto directamente</h3>
372
+ <textarea class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" rows="5" placeholder="Pega aquí el contenido de tu examen..."></textarea>
373
+ </div>
374
+
375
+ <div class="mb-6">
376
+ <h3 class="text-lg font-medium text-gray-700 mb-4">Configuración de procesamiento</h3>
377
+
378
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
379
+ <div>
380
+ <label class="block text-sm font-medium text-gray-700 mb-2">Tipo de preguntas a generar</label>
381
+ <select class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
382
+ <option>Detectar automáticamente</option>
383
+ <option>Opción múltiple</option>
384
+ <option>Verdadero/Falso</option>
385
+ <option>Respuesta corta</option>
386
+ <option>Mezcla de tipos</option>
387
+ </select>
388
+ </div>
389
+
390
+ <div>
391
+ <label class="block text-sm font-medium text-gray-700 mb-2">Dificultad general</label>
392
+ <select class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
393
+ <option>Detectar automáticamente</option>
394
+ <option>Fácil</option>
395
+ <option>Medio</option>
396
+ <option>Difícil</option>
397
+ </select>
398
+ </div>
399
+ </div>
400
+ </div>
401
+
402
+ <div class="flex justify-end">
403
+ <button class="gradient-bg text-white px-6 py-3 rounded-lg font-medium shadow-md hover:shadow-lg transition duration-300 flex items-center">
404
+ <i class="fas fa-robot mr-2"></i> Procesar con IA
405
+ </button>
406
+ </div>
407
+ </div>
408
+
409
+ <!-- History-Based Exam Section (Hidden by default) -->
410
+ <div id="history-exam-section" class="bg-white rounded-xl shadow-md overflow-hidden p-6 mb-8 hidden">
411
+ <h2 class="text-xl font-semibold text-gray-800 mb-6">Examen basado en tu historial</h2>
412
+
413
+ <div class="bg-indigo-50 border-l-4 border-indigo-400 p-4 mb-6">
414
+ <div class="flex">
415
+ <div class="flex-shrink-0">
416
+ <i class="fas fa-info-circle text-indigo-400"></i>
417
+ </div>
418
+ <div class="ml-3">
419
+ <p class="text-sm text-indigo-700">
420
+ Nuestra IA analizará tu historial de exámenes anteriores para crear un examen personalizado que se enfoque en tus áreas de mejora y refuerce tus conocimientos.
421
+ </p>
422
+ </div>
423
+ </div>
424
+ </div>
425
+
426
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
427
+ <div class="bg-white border border-gray-200 rounded-lg p-6 shadow-sm">
428
+ <h3 class="text-lg font-medium text-gray-800 mb-4">Tu rendimiento reciente</h3>
429
+
430
+ <div class="space-y-4">
431
+ <div>
432
+ <div class="flex justify-between mb-1">
433
+ <span class="text-sm font-medium text-gray-700">Matemáticas</span>
434
+ <span class="text-sm font-medium text-gray-700">72%</span>
435
+ </div>
436
+ <div class="w-full bg-gray-200 rounded-full h-2">
437
+ <div class="bg-yellow-500 h-2 rounded-full" style="width: 72%"></div>
438
+ </div>
439
+ </div>
440
+
441
+ <div>
442
+ <div class="flex justify-between mb-1">
443
+ <span class="text-sm font-medium text-gray-700">Biología</span>
444
+ <span class="text-sm font-medium text-gray-700">85%</span>
445
+ </div>
446
+ <div class="w-full bg-gray-200 rounded-full h-2">
447
+ <div class="bg-green-500 h-2 rounded-full" style="width: 85%"></div>
448
+ </div>
449
+ </div>
450
+
451
+ <div>
452
+ <div class="flex justify-between mb-1">
453
+ <span class="text-sm font-medium text-gray-700">Literatura</span>
454
+ <span class="text-sm font-medium text-gray-700">64%</span>
455
+ </div>
456
+ <div class="w-full bg-gray-200 rounded-full h-2">
457
+ <div class="bg-red-500 h-2 rounded-full" style="width: 64%"></div>
458
+ </div>
459
+ </div>
460
+ </div>
461
+ </div>
462
+
463
+ <div class="bg-white border border-gray-200 rounded-lg p-6 shadow-sm">
464
+ <h3 class="text-lg font-medium text-gray-800 mb-4">Áreas para mejorar</h3>
465
+
466
+ <div class="space-y-3">
467
+ <div class="flex items-center">
468
+ <div class="flex-shrink-0 h-8 w-8 rounded-full bg-red-100 flex items-center justify-center mr-3">
469
+ <i class="fas fa-exclamation text-red-500"></i>
470
+ </div>
471
+ <div>
472
+ <p class="text-sm font-medium text-gray-700">Ecuaciones cuadráticas</p>
473
+ <p class="text-xs text-gray-500">Fallaste 5 de 7 preguntas</p>
474
+ </div>
475
+ </div>
476
+
477
+ <div class="flex items-center">
478
+ <div class="flex-shrink-0 h-8 w-8 rounded-full bg-red-100 flex items-center justify-center mr-3">
479
+ <i class="fas fa-exclamation text-red-500"></i>
480
+ </div>
481
+ <div>
482
+ <p class="text-sm font-medium text-gray-700">Genética mendeliana</p>
483
+ <p class="text-xs text-gray-500">Fallaste 3 de 5 preguntas</p>
484
+ </div>
485
+ </div>
486
+
487
+ <div class="flex items-center">
488
+ <div class="flex-shrink-0 h-8 w-8 rounded-full bg-yellow-100 flex items-center justify-center mr-3">
489
+ <i class="fas fa-question text-yellow-500"></i>
490
+ </div>
491
+ <div>
492
+ <p class="text-sm font-medium text-gray-700">Literatura del siglo XIX</p>
493
+ <p class="text-xs text-gray-500">50% de acierto</p>
494
+ </div>
495
+ </div>
496
+ </div>
497
+ </div>
498
+ </div>
499
+
500
+ <div class="mb-6">
501
+ <h3 class="text-lg font-medium text-gray-700 mb-4">Configuración del examen</h3>
502
+
503
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
504
+ <div>
505
+ <label class="block text-sm font-medium text-gray-700 mb-2">Número de preguntas</label>
506
+ <select class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
507
+ <option>20 (recomendado)</option>
508
+ <option>10</option>
509
+ <option>30</option>
510
+ <option>50</option>
511
+ </select>
512
+ </div>
513
+
514
+ <div>
515
+ <label class="block text-sm font-medium text-gray-700 mb-2">Enfoque principal</label>
516
+ <select class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
517
+ <option>Áreas de mejora (recomendado)</option>
518
+ <option>Reforzar conocimientos</option>
519
+ <option>Mezcla equilibrada</option>
520
+ </select>
521
+ </div>
522
+
523
+ <div>
524
+ <label class="block text-sm font-medium text-gray-700 mb-2">Dificultad</label>
525
+ <select class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
526
+ <option>Adaptativa (recomendado)</option>
527
+ <option>Fácil</option>
528
+ <option>Medio</option>
529
+ <option>Difícil</option>
530
+ </select>
531
+ </div>
532
+ </div>
533
+ </div>
534
+
535
+ <div class="flex justify-end">
536
+ <button class="gradient-bg text-white px-6 py-3 rounded-lg font-medium shadow-md hover:shadow-lg transition duration-300 flex items-center">
537
+ <i class="fas fa-brain mr-2"></i> Generar Examen Inteligente
538
+ </button>
539
+ </div>
540
+ </div>
541
+
542
+ <!-- Recent Exams Section -->
543
+ <div class="bg-white rounded-xl shadow-md overflow-hidden p-6">
544
+ <div class="flex items-center justify-between mb-6">
545
+ <h2 class="text-xl font-semibold text-gray-800">Tus exámenes recientes</h2>
546
+ <a href="#" class="text-sm font-medium text-indigo-600 hover:text-indigo-500">Ver todo</a>
547
+ </div>
548
+
549
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
550
+ <!-- Exam Card 1 -->
551
+ <div class="exam-card bg-white border border-gray-200 rounded-lg p-5 hover:border-indigo-300">
552
+ <div class="flex justify-between items-start mb-3">
553
+ <div>
554
+ <span class="difficulty-badge easy">Fácil</span>
555
+ </div>
556
+ <span class="text-xs text-gray-500">Hace 2 días</span>
557
+ </div>
558
+ <h3 class="font-medium text-gray-800 mb-2">Matemáticas básicas</h3>
559
+ <p class="text-sm text-gray-600 mb-4">15 preguntas sobre álgebra y aritmética</p>
560
+ <div class="flex justify-between items-center">
561
+ <div class="flex items-center">
562
+ <span class="text-sm font-medium text-gray-700 mr-2">85%</span>
563
+ <div class="w-16 bg-gray-200 rounded-full h-1.5">
564
+ <div class="bg-green-500 h-1.5 rounded-full" style="width: 85%"></div>
565
+ </div>
566
+ </div>
567
+ <button class="text-xs font-medium text-indigo-600 hover:text-indigo-500">Ver detalles</button>
568
+ </div>
569
+ </div>
570
+
571
+ <!-- Exam Card 2 -->
572
+ <div class="exam-card bg-white border border-gray-200 rounded-lg p-5 hover:border-indigo-300">
573
+ <div class="flex justify-between items-start mb-3">
574
+ <div>
575
+ <span class="difficulty-badge medium">Medio</span>
576
+ </div>
577
+ <span class="text-xs text-gray-500">Hace 1 semana</span>
578
+ </div>
579
+ <h3 class="font-medium text-gray-800 mb-2">Biología celular</h3>
580
+ <p class="text-sm text-gray-600 mb-4">20 preguntas sobre células y organelos</p>
581
+ <div class="flex justify-between items-center">
582
+ <div class="flex items-center">
583
+ <span class="text-sm font-medium text-gray-700 mr-2">72%</span>
584
+ <div class="w-16 bg-gray-200 rounded-full h-1.5">
585
+ <div class="bg-yellow-500 h-1.5 rounded-full" style="width: 72%"></div>
586
+ </div>
587
+ </div>
588
+ <button class="text-xs font-medium text-indigo-600 hover:text-indigo-500">Ver detalles</button>
589
+ </div>
590
+ </div>
591
+
592
+ <!-- Exam Card 3 -->
593
+ <div class="exam-card bg-white border border-gray-200 rounded-lg p-5 hover:border-indigo-300">
594
+ <div class="flex justify-between items-start mb-3">
595
+ <div>
596
+ <span class="difficulty-badge hard">Difícil</span>
597
+ </div>
598
+ <span class="text-xs text-gray-500">Hace 2 semanas</span>
599
+ </div>
600
+ <h3 class="font-medium text-gray-800 mb-2">Literatura universal</h3>
601
+ <p class="text-sm text-gray-600 mb-4">25 preguntas sobre obras clásicas</p>
602
+ <div class="flex justify-between items-center">
603
+ <div class="flex items-center">
604
+ <span class="text-sm font-medium text-gray-700 mr-2">64%</span>
605
+ <div class="w-16 bg-gray-200 rounded-full h-1.5">
606
+ <div class="bg-red-500 h-1.5 rounded-full" style="width: 64%"></div>
607
+ </div>
608
+ </div>
609
+ <button class="text-xs font-medium text-indigo-600 hover:text-indigo-500">Ver detalles</button>
610
+ </div>
611
+ </div>
612
+ </div>
613
+ </div>
614
+ </main>
615
+
616
+ <!-- Processing Modal (Hidden by default) -->
617
+ <div id="processing-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
618
+ <div class="bg-white rounded-xl p-8 max-w-md w-full mx-4">
619
+ <div class="text-center">
620
+ <div class="ai-processing text-5xl text-indigo-500 mb-4">
621
+ <i class="fas fa-robot"></i>
622
+ </div>
623
+ <h3 class="text-xl font-semibold text-gray-800 mb-2">Generando tu examen</h3>
624
+ <p class="text-gray-600 mb-6">Nuestra IA está procesando tu solicitud y creando un examen personalizado según tus preferencias.</p>
625
+ <div class="w-full bg-gray-200 rounded-full h-2 mb-6">
626
+ <div class="bg-indigo-500 h-2 rounded-full animate-pulse" style="width: 45%"></div>
627
+ </div>
628
+ <p class="text-xs text-gray-500">Esto puede tomar unos segundos...</p>
629
+ </div>
630
+ </div>
631
+ </div>
632
+
633
+ <!-- Footer -->
634
+ <footer class="bg-gray-800 text-white py-8">
635
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
636
+ <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
637
+ <div>
638
+ <h3 class="text-lg font-semibold mb-4">ExamGen AI</h3>
639
+ <p class="text-gray-400 text-sm">La plataforma inteligente para crear exámenes personalizados con ayuda de IA.</p>
640
+ </div>
641
+ <div>
642
+ <h3 class="text-lg font-semibold mb-4">Enlaces</h3>
643
+ <ul class="space-y-2">
644
+ <li><a href="#" class="text-gray-400 hover:text-white text-sm">Inicio</a></li>
645
+ <li><a href="#" class="text-gray-400 hover:text-white text-sm">Funciones</a></li>
646
+ <li><a href="#" class="text-gray-400 hover:text-white text-sm">Precios</a></li>
647
+ <li><a href="#" class="text-gray-400 hover:text-white text-sm">Blog</a></li>
648
+ </ul>
649
+ </div>
650
+ <div>
651
+ <h3 class="text-lg font-semibold mb-4">Soporte</h3>
652
+ <ul class="space-y-2">
653
+ <li><a href="#" class="text-gray-400 hover:text-white text-sm">Centro de ayuda</a></li>
654
+ <li><a href="#" class="text-gray-400 hover:text-white text-sm">Contacto</a></li>
655
+ <li><a href="#" class="text-gray-400 hover:text-white text-sm">Privacidad</a></li>
656
+ <li><a href="#" class="text-gray-400 hover:text-white text-sm">Términos</a></li>
657
+ </ul>
658
+ </div>
659
+ <div>
660
+ <h3 class="text-lg font-semibold mb-4">Conéctate</h3>
661
+ <div class="flex space-x-4">
662
+ <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-twitter"></i></a>
663
+ <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-facebook"></i></a>
664
+ <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-instagram"></i></a>
665
+ <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-linkedin"></i></a>
666
+ </div>
667
+ <p class="text-gray-400 text-sm mt-4">Suscríbete a nuestro boletín</p>
668
+ <div class="mt-2 flex">
669
+ <input type="email" placeholder="Tu email" class="px-3 py-2 bg-gray-700 text-white rounded-l-md focus:outline-none focus:ring-1 focus:ring-indigo-500 text-sm w-full">
670
+ <button class="bg-indigo-600 text-white px-3 py-2 rounded-r-md text-sm hover:bg-indigo-700"><i class="fas fa-paper-plane"></i></button>
671
+ </div>
672
+ </div>
673
+ </div>
674
+ <div class="border-t border-gray-700 mt-8 pt-8 text-center text-gray-400 text-sm">
675
+ <p>© 2023 ExamGen AI. Todos los derechos reservados.</p>
676
+ </div>
677
+ </div>
678
+ </footer>
679
+
680
+ <script>
681
+ // Initialize Supabase
682
+ const supabaseUrl = 'https://your-project.supabase.co';
683
+ const supabaseKey = 'your-supabase-key';
684
+ const supabase = supabase.createClient(supabaseUrl, supabaseKey);
685
+
686
+ // DOM Elements
687
+ const newExamTab = document.getElementById('new-exam-tab');
688
+ const uploadExamTab = document.getElementById('upload-exam-tab');
689
+ const historyExamTab = document.getElementById('history-exam-tab');
690
+ const newExamSection = document.getElementById('new-exam-section');
691
+ const uploadExamSection = document.getElementById('upload-exam-section');
692
+ const historyExamSection = document.getElementById('history-exam-section');
693
+ const totalQuestionsSlider = document.getElementById('total-questions-slider');
694
+ const totalQuestionsValue = document.getElementById('total-questions-value');
695
+ const advancedOptionsToggle = document.getElementById('advanced-options-toggle');
696
+ const advancedOptionsContent = document.getElementById('advanced-options-content');
697
+ const generateExamBtn = document.getElementById('generate-exam-btn');
698
+ const processingModal = document.getElementById('processing-modal');
699
+ const addSubjectBtn = document.getElementById('add-subject-btn');
700
+ const selectedSubjectsContainer = document.getElementById('selected-subjects-container');
701
+ const questionsConfigContainer = document.getElementById('questions-config-container');
702
+
703
+ // Tab Switching
704
+ newExamTab.addEventListener('click', () => {
705
+ resetTabs();
706
+ newExamTab.classList.add('tab-active');
707
+ newExamSection.classList.remove('hidden');
708
+ });
709
+
710
+ uploadExamTab.addEventListener('click', () => {
711
+ resetTabs();
712
+ uploadExamTab.classList.add('tab-active');
713
+ uploadExamSection.classList.remove('hidden');
714
+ });
715
+
716
+ historyExamTab.addEventListener('click', () => {
717
+ resetTabs();
718
+ historyExamTab.classList.add('tab-active');
719
+ historyExamSection.classList.remove('hidden');
720
+ });
721
+
722
+ function resetTabs() {
723
+ newExamTab.classList.remove('tab-active');
724
+ uploadExamTab.classList.remove('tab-active');
725
+ historyExamTab.classList.remove('tab-active');
726
+ newExamSection.classList.add('hidden');
727
+ uploadExamSection.classList.add('hidden');
728
+ historyExamSection.classList.add('hidden');
729
+ }
730
+
731
+ // Total Questions Slider
732
+ totalQuestionsSlider.addEventListener('input', () => {
733
+ totalQuestionsValue.textContent = totalQuestionsSlider.value;
734
+ });
735
+
736
+ // Advanced Options Toggle
737
+ advancedOptionsToggle.addEventListener('click', () => {
738
+ const icon = advancedOptionsToggle.querySelector('i');
739
+ advancedOptionsContent.classList.toggle('hidden');
740
+
741
+ if (advancedOptionsContent.classList.contains('hidden')) {
742
+ icon.classList.remove('fa-chevron-up');
743
+ icon.classList.add('fa-chevron-down');
744
+ } else {
745
+ icon.classList.remove('fa-chevron-down');
746
+ icon.classList.add('fa-chevron-up');
747
+ }
748
+ });
749
+
750
+ // Difficulty Options
751
+ const difficultyOptions = document.querySelectorAll('.difficulty-option');
752
+ difficultyOptions.forEach(option => {
753
+ option.addEventListener('click', () => {
754
+ difficultyOptions.forEach(opt => opt.classList.remove('border-indigo-500', 'bg-indigo-50'));
755
+ option.classList.add('border-indigo-500', 'bg-indigo-50');
756
+ });
757
+ });
758
+
759
+ // Subject Selection
760
+ const subjectChips = document.querySelectorAll('.subject-chip');
761
+ const selectedSubjects = new Set();
762
+
763
+ subjectChips.forEach(chip => {
764
+ chip.addEventListener('click', () => {
765
+ const subject = chip.dataset.subject;
766
+ const color = chip.dataset.color;
767
+ const textColor = chip.dataset.text;
768
+
769
+ if (selectedSubjects.has(subject)) {
770
+ selectedSubjects.delete(subject);
771
+ chip.classList.remove('border-indigo-500', 'bg-indigo-50');
772
+ updateSelectedSubjects();
773
+ } else {
774
+ selectedSubjects.add({subject, color, textColor});
775
+ chip.classList.add('border-indigo-500', 'bg-indigo-50');
776
+ updateSelectedSubjects();
777
+ }
778
+ });
779
+ });
780
+
781
+ function updateSelectedSubjects() {
782
+ // Clear containers
783
+ selectedSubjectsContainer.innerHTML = '';
784
+ questionsConfigContainer.innerHTML = '';
785
+
786
+ if (selectedSubjects.size === 0) {
787
+ questionsConfigContainer.innerHTML = '<p class="text-gray-500 text-sm">Selecciona materias primero para configurar las preguntas.</p>';
788
+ return;
789
+ }
790
+
791
+ // Add selected subjects chips
792
+ selectedSubjects.forEach(subjectObj => {
793
+ const subject = subjectObj.subject;
794
+ const color = subjectObj.color;
795
+ const textColor = subjectObj.textColor;
796
+
797
+ const chip = document.createElement('div');
798
+ chip.className = `inline-flex items-center px-3 py-1 rounded-full text-sm font-medium ${color} ${textColor} mr-2 mb-2`;
799
+ chip.innerHTML = `${subject} <button class="ml-2 text-xs" onclick="removeSubject('${subject}')"><i class="fas fa-times"></i></button>`;
800
+ selectedSubjectsContainer.appendChild(chip);
801
+ });
802
+
803
+ // Add questions configuration for each subject
804
+ const configHTML = Array.from(selectedSubjects).map(subjectObj => {
805
+ const subject = subjectObj.subject;
806
+ return `
807
+ <div class="mb-4">
808
+ <div class="flex items-center justify-between mb-2">
809
+ <label class="block text-sm font-medium text-gray-700">${subject}</label>
810
+ <span class="text-xs text-gray-500">Preguntas: <span id="${subject.toLowerCase()}-questions-value">5</span></span>
811
+ </div>
812
+ <div class="flex items-center">
813
+ <input type="range" min="1" max="20" value="5" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer subject-slider" data-subject="${subject}">
814
+ </div>
815
+ </div>
816
+ `;
817
+ }).join('');
818
+
819
+ questionsConfigContainer.innerHTML = configHTML;
820
+
821
+ // Add event listeners to subject sliders
822
+ document.querySelectorAll('.subject-slider').forEach(slider => {
823
+ slider.addEventListener('input', () => {
824
+ const subject = slider.dataset.subject;
825
+ const value = slider.value;
826
+ document.getElementById(`${subject.toLowerCase()}-questions-value`).textContent = value;
827
+ });
828
+ });
829
+ }
830
+
831
+ // Add custom subject
832
+ addSubjectBtn.addEventListener('click', () => {
833
+ const subjectName = prompt("Ingresa el nombre de la nueva materia:");
834
+ if (subjectName) {
835
+ const colors = ['bg-blue-100', 'bg-green-100', 'bg-purple-100', 'bg-yellow-100', 'bg-pink-100', 'bg-indigo-100'];
836
+ const textColors = ['text-blue-800', 'text-green-800', 'text-purple-800', 'text-yellow-800', 'text-pink-800', 'text-indigo-800'];
837
+ const icons = ['fa-square-root-alt', 'fa-dna', 'fa-book-open', 'fa-flask', 'fa-globe-americas', 'fa-calculator'];
838
+
839
+ const randomIndex = Math.floor(Math.random() * colors.length);
840
+ const newSubject = {
841
+ subject: subjectName,
842
+ color: colors[randomIndex],
843
+ textColor: textColors[randomIndex]
844
+ };
845
+
846
+ selectedSubjects.add(newSubject);
847
+
848
+ // Add visual feedback
849
+ const tempChip = document.createElement('div');
850
+ tempChip.className = `subject-chip bg-white border-2 border-indigo-500 rounded-lg p-4 shadow-sm cursor-pointer ${newSubject.color}`;
851
+ tempChip.innerHTML = `
852
+ <div class="flex items-center">
853
+ <div class="w-10 h-10 rounded-full ${newSubject.color} flex items-center justify-center mr-3">
854
+ <i class="fas ${icons[randomIndex]} ${newSubject.textColor}"></i>
855
+ </div>
856
+ <div>
857
+ <h4 class="font-medium ${newSubject.textColor}">${subjectName}</h4>
858
+ <p class="text-sm ${newSubject.textColor} opacity-70">Nueva materia</p>
859
+ </div>
860
+ </div>
861
+ `;
862
+
863
+ addSubjectBtn.parentNode.insertBefore(tempChip, addSubjectBtn);
864
+ setTimeout(() => {
865
+ tempChip.remove();
866
+ updateSelectedSubjects();
867
+ }, 1000);
868
+ }
869
+ });
870
+
871
+ // Remove subject function (used in chips)
872
+ window.removeSubject = function(subjectName) {
873
+ // Find and remove from selectedSubjects
874
+ let subjectToRemove = null;
875
+ for (const subject of selectedSubjects) {
876
+ if (subject.subject === subjectName) {
877
+ subjectToRemove = subject;
878
+ break;
879
+ }
880
+ }
881
+
882
+ if (subjectToRemove) {
883
+ selectedSubjects.delete(subjectToRemove);
884
+
885
+ // Remove visual selection from subject chips
886
+ subjectChips.forEach(chip => {
887
+ if (chip.dataset.subject === subjectName) {
888
+ chip.classList.remove('border-indigo-500', 'bg-indigo-50');
889
+ }
890
+ });
891
+
892
+ updateSelectedSubjects();
893
+ }
894
+ };
895
+
896
+ // Generate Exam Button
897
+ generateExamBtn.addEventListener('click', () => {
898
+ // Validate at least one subject is selected
899
+ if (selectedSubjects.size === 0) {
900
+ alert('Por favor selecciona al menos una materia para generar el examen.');
901
+ return;
902
+ }
903
+
904
+ // Show processing modal
905
+ processingModal.classList.remove('hidden');
906
+
907
+ // Simulate processing (in a real app, this would be an API call)
908
+ setTimeout(() => {
909
+ processingModal.classList.add('hidden');
910
+
911
+ // In a real app, you would redirect to the exam page or show it in a modal
912
+ alert('Examen generado con éxito! Redirigiendo...');
913
+ // window.location.href = '/exam.html';
914
+ }, 3000);
915
+ });
916
+
917
+ // Initialize with first tab active
918
+ newExamTab.click();
919
+
920
+ // Google Sign-In
921
+ async function signInWithGoogle() {
922
+ const { data, error } = await supabase.auth.signInWithOAuth({
923
+ provider: 'google',
924
+ options: {
925
+ redirectTo: window.location.href
926
+ }
927
+ });
928
+
929
+ if (error) {
930
+ console.error('Error signing in with Google:', error.message);
931
+ }
932
+ }
933
+
934
+ // Check auth state
935
+ supabase.auth.onAuthStateChange((event, session) => {
936
+ if (event === 'SIGNED_IN') {
937
+ console.log('User signed in:', session.user);
938
+ // Update UI for logged in user
939
+ } else if (event === 'SIGNED_OUT') {
940
+ console.log('User signed out');
941
+ // Update UI for logged out user
942
+ }
943
+ });
944
+ </script>
945
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Doddieko67/god-dipsik" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
946
+ </html>