Jaouadart commited on
Commit
c67dfbd
·
verified ·
1 Parent(s): f99e57b

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +448 -221
index.html CHANGED
@@ -217,289 +217,516 @@
217
  { word_tifinagh: 'ⴰⵏⴱⴷⵓ', word_arabic: 'الصيف', image: 'images/6da33d4175e50b17309485c8b33cfe0e.jpg', audio: 'audio/AUD-20250926-WA0001.opus' },
218
  { word_tifinagh: 'ⴰⵎⴰⵡⴰⵏ', word_arabic: 'الخريف', image: 'images/e6c5c6a800de512091faa20db36472f8.jpg', audio: 'audio/AUD-20250926-WA0000.opus' }
219
  ];
220
- const fruitsData = [
 
221
  { word_tifinagh: 'ⵜⴰⴷⴼⴼⵓⵢⵜ', word_arabic: 'تفاحة', image: 'images/da1da4f2015a32322f547ae5fff5236c.jpg', audio: 'audio/fruits/apple.mp3' },
222
  { word_tifinagh: 'ⵜⴰⴱⴰⵏⴰⵏⵜ', word_arabic: 'موزة', image: 'images/11bde7577165c2edef985a3cbd9458ae.jpg', audio: 'audio/fruits/banana.mp3' },
223
  { word_tifinagh: 'ⵍⵍⵜⵛⵉⵏ', word_arabic: 'برتقال', image: 'images/1efc88aa2e2e9bb97af6b059a4c05b91.jpg', audio: 'audio/fruits/orange.mp3' },
 
224
  { word_tifinagh: 'ⴰⴹⵉⵍ', word_arabic: 'عنب', image: 'images/1987ab2c045824929e7b8e5004f1c503.jpg', audio: 'audio/fruits/grapes.mp3' },
225
- { word_tifinagh: 'ⴰⵙⵓⴽⵔⵉ', word_arabic: 'فراولة', image: 'images/1f2c4176709f984534a413d98042456f.jpg', audio: 'audio/fruits/strawberry.mp3' },
226
- { word_tifinagh: 'ⴰⴼⵉⵔⵙ', word_arabic: 'توت', image: 'images/841022378f77be1c164746f362a2233f.jpg', audio: 'audio/fruits/raspberry.mp3' },
227
- { word_tifinagh: 'ⵜⴰⵄⵏⴰⴱⵜ', word_arabic: 'كمثرى', image: 'images/63510e470878a87353f0648df479b183.jpg', audio: 'audio/fruits/pear.mp3' },
228
- { word_tifinagh: 'ⵜⵉⵏⵉ', word_arabic: 'تمر', image: 'images/0675231c50821213426e8387071a5ff6.jpg', audio: 'audio/fruits/date.mp3' },
229
- { word_tifinagh: 'ⴰⵙⴽⵙⵓ', word_arabic: 'خوخ', image: 'images/7d36a5c1f0340c24c29367d34199a531.jpg', audio: 'audio/fruits/peach.mp3' },
230
- { word_tifinagh: 'ⴰⵔⵉⵎ', word_arabic: 'ليمون', image: 'images/8470a1e0501be802e3b2c6a91d1e4e3e.jpg', audio: 'audio/fruits/lemon.mp3' }
231
  ];
232
 
233
- // --- 3. بيانات التصنيفات الرئيسية ---
234
-
235
- const CATEGORIES = [
236
- { id: 'tifinagh', title: 'حروف تيفيناغ', icon: 'Menu', data: tifinaghData, color: 'text-red-500', bg: 'bg-red-100', hoverBg: 'hover:bg-red-200' },
237
- { id: 'numbers', title: 'الأرقام', icon: 'Info', data: numbersData, color: 'text-blue-500', bg: 'bg-blue-100', hoverBg: 'hover:bg-blue-200' },
238
- { id: 'animals', title: 'الحيوانات', icon: 'Settings', data: animalsData, color: 'text-green-500', bg: 'bg-green-100', hoverBg: 'hover:bg-green-200' },
239
- { id: 'school-supplies', title: 'أدوات مدرسية', icon: 'Mic', data: schoolSuppliesData, color: 'text-yellow-600', bg: 'bg-yellow-100', hoverBg: 'hover:bg-yellow-200' },
240
- { id: 'seasons', title: 'فصول السنة', icon: 'Volume2', data: seasonsData, color: 'text-purple-600', bg: 'bg-purple-100', hoverBg: 'hover:bg-purple-200' },
241
- { id: 'fruits', title: 'الفواكه', icon: 'ChevronRight', data: fruitsData, color: 'text-pink-500', bg: 'bg-pink-100', hoverBg: 'hover:bg-pink-200' },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  ];
243
 
 
 
 
 
 
 
 
 
 
 
 
 
244
 
245
- // --- 4. إدارة حالة التطبيق (State Management) ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
 
247
- let appState = {
248
- currentScreen: 'home', // 'home', 'tifinagh', 'numbers', 'animals', etc.
249
- selectedCategory: null, // الكائن الكامل للفئة المختارة
250
- currentIndex: 0, // مؤشر العنصر الحالي في قائمة الفئة
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  };
252
 
253
- const setState = (newState) => {
254
- // تحديث الحالة
255
- appState = { ...appState, ...newState };
256
 
257
- // إعادة رسم التطبيق
258
- renderApp();
259
- };
 
 
 
 
 
 
 
 
 
 
 
 
260
 
261
- // --- 5. دالة تشغيل الصوت ---
262
 
263
- const playAudio = (audioPath) => {
264
- if (!audioPath) return;
265
 
266
- // بناء مسار افتراضي (يجب أن تكون المسارات صحيحة في ملفاتك)
267
- const fullPath = audioPath;
268
-
269
- try {
270
- const audio = new Audio(fullPath);
271
- audio.play().catch(e => console.error("Error playing audio:", e));
272
- } catch (error) {
273
- console.error("Failed to create or play audio:", error);
274
- }
275
  };
276
 
 
 
 
 
 
277
 
278
- // --- 6. مكونات الرسم (Rendering Components) ---
 
 
279
 
280
- // *************** الشريط العلوي (Header) ***************
281
 
282
  const renderHeader = () => {
283
- const header = document.getElementById('app-header');
 
284
 
285
- if (appState.currentScreen === 'home') {
286
- // شريط رئيسي في صفحة 'الرئيسية'
287
- header.innerHTML = `
288
- <div class="flex items-center justify-between p-4 bg-white shadow-md border-b border-gray-100">
289
- <h1 class="text-xl font-black text-red-600 tracking-wider flex items-center">
290
- <span class="text-3xl">${APP_NAME.charAt(0)}</span>
291
- <span class="text-gray-700">${APP_NAME.substring(1)}</span>
292
- </h1>
293
- <button onclick="setState({currentScreen: 'settings'})" class="p-2 text-gray-500 hover:text-red-600">
294
- ${renderIcon('Settings', 'w-6 h-6')}
295
- </button>
296
- </div>
297
- `;
298
- } else if (CATEGORIES.some(c => c.id === appState.currentScreen)) {
299
- // شريط الشاشة التعليمية
300
- const category = CATEGORIES.find(c => c.id === appState.currentScreen);
301
- header.innerHTML = `
302
- <div class="flex items-center justify-between p-3 bg-white shadow-lg border-b border-gray-100">
303
- <button onclick="setState({currentScreen: 'home', selectedCategory: null})"
304
- class="p-2 text-red-600 hover:text-red-700 transition duration-150">
305
- ${renderIcon('ChevronRight', 'w-8 h-8')}
306
- </button>
307
- <h2 class="text-xl font-extrabold text-gray-700">${category.title}</h2>
308
- <button onclick="playAudio(appState.selectedCategory.data[appState.currentIndex].audio)"
309
- class="p-2 ${category.color} hover:opacity-80 transition duration-150 control-btn w-12 h-12 flex items-center justify-center bg-white shadow-lg">
310
- ${renderIcon('Volume2', 'w-6 h-6', 2.5)}
311
- </button>
312
- </div>
313
- `;
314
- } else {
315
- // شريط الشاشات الفرعية الأخرى (مثل الإعدادات)
316
- let title = '';
317
- switch (appState.currentScreen) {
318
- case 'settings': title = 'الإعدادات'; break;
319
- case 'share': title = 'مشاركة التطبيق'; break;
320
- case 'profile': title = 'ملفي الشخصي'; break;
321
- case 'info': title = 'عن التطبيق'; break;
322
- default: title = 'عودة';
323
- }
324
- header.innerHTML = `
325
- <div class="flex items-center p-3 bg-white shadow-md border-b border-gray-100">
326
- <button onclick="setState({currentScreen: 'home'})"
327
- class="p-2 text-red-600 hover:text-red-700 transition duration-150">
328
- ${renderIcon('ChevronRight', 'w-8 h-8')}
329
- </button>
330
- <h2 class="text-xl font-bold text-gray-700 mr-4">${title}</h2>
331
- </div>
332
- `;
333
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  };
335
-
336
- // *************** شريط التنقل السفلي (Footer / Navigation) ***************
337
 
338
  const renderFooter = () => {
339
- const footer = document.getElementById('app-footer');
340
-
341
- // لا تظهر الشريط السفلي إلا في الشاشة الرئيسية
342
- if (appState.currentScreen !== 'home') {
343
- footer.innerHTML = '';
344
- return;
345
- }
346
-
347
  const navItems = [
348
- { id: 'info', label: 'عن', icon: 'Info' },
349
- { id: 'share', label: 'مشاركة', icon: 'Share2' },
350
- { id: 'home', label: 'الرئيسية', icon: 'Home' },
351
- { id: 'profile', label: 'ملفي', icon: 'User' },
352
- { id: 'settings', label: 'إعدادات', icon: 'Settings' },
353
  ];
354
 
355
- const navHtml = navItems.map(item => `
356
- <button onclick="setState({currentScreen: '${item.id}'})"
357
- class="flex flex-col items-center justify-center p-2 text-sm transition-colors duration-200
358
- ${appState.currentScreen === item.id ? 'text-red-600 font-bold' : 'text-gray-500 hover:text-red-600'}">
359
- ${renderIcon(item.icon, 'w-6 h-6')}
360
- <span class="mt-1">${item.label}</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  </button>
362
  `).join('');
363
 
364
- footer.innerHTML = `
365
- <nav class="bg-white border-t border-gray-200 shadow-xl">
366
- <div class="flex justify-around items-center h-16 max-w-lg mx-auto">
367
- ${navHtml}
 
368
  </div>
369
- </nav>
 
 
 
370
  `;
371
  };
372
 
373
- // *************** شاشة عرض فئة تعليمية (Learning Screen) ***************
374
 
375
  const renderLearningScreen = () => {
 
376
  const content = document.getElementById('app-content');
377
- const category = CATEGORIES.find(c => c.id === appState.currentScreen);
378
-
379
- // إذا لم يتم تحديد الفئة بعد، اضبطها
380
- if (!appState.selectedCategory || appState.selectedCategory.id !== category.id) {
381
- appState.selectedCategory = category;
382
- appState.currentIndex = 0;
383
- }
384
 
385
- const data = category.data;
386
- const index = appState.currentIndex;
387
- const currentItem = data[index];
388
- const totalItems = data.length;
 
 
 
 
 
 
 
 
389
 
390
- const handleNext = () => {
391
- const nextIndex = (index + 1) % totalItems;
392
- setState({ currentIndex: nextIndex });
 
 
 
 
 
 
 
 
 
 
 
393
  };
394
-
395
- const handlePrev = () => {
396
- const prevIndex = (index - 1 + totalItems) % totalItems;
397
- setState({ currentIndex: prevIndex });
 
398
  };
399
-
400
- const getWordParts = (word) => {
401
- const parts = word.split('-');
402
- if (parts.length === 2) {
403
- return { arabic: parts[0], tifinagh: parts[1] };
404
- }
405
- return { arabic: word, tifinagh: '' };
406
  };
407
 
408
- const wordParts = getWordParts(currentItem.word_arabic);
 
 
 
 
 
 
409
 
410
- // تشغيل الصوت تلقائيًا عند الانتقال (اختياري)
411
- window.onload = () => {
412
- playAudio(currentItem.audio);
413
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
414
 
415
  content.innerHTML = `
416
- <div class="p-4 pt-0 min-h-[calc(100vh-130px)] flex flex-col justify-between">
417
 
418
- <div class="bg-white rounded-2xl overflow-hidden shadow-2xl card-shadow mt-4">
419
 
420
- <div class="relative h-64 sm:h-80 w-full">
421
- <img src="${currentItem.image}" alt="${wordParts.arabic}" class="w-full h-full object-cover">
422
- <div class="absolute inset-0 image-overlay flex items-end justify-center pb-4">
423
- <span class="text-white text-5xl sm:text-7xl font-extrabold icon-shadow p-2 rounded-lg leading-tight">
424
- ${currentItem.letter || wordParts.tifinagh || currentItem.word_tifinagh}
425
- </span>
426
- </div>
427
- </div>
428
 
429
- <div class="p-6 text-center">
430
- ${currentItem.letter ? `<p class="text-4xl font-black text-gray-800 mb-2">${currentItem.letter}</p>` : ''}
431
- <p class="text-2xl font-extrabold text-red-600 mb-1">${wordParts.arabic}</p>
432
- ${wordParts.tifinagh ? `<p class="text-3xl font-black text-gray-600">${wordParts.tifinagh}</p>` : ''}
433
- ${!currentItem.letter && !wordParts.tifinagh ? `<p class="text-3xl font-black text-gray-600">${currentItem.word_tifinagh}</p>` : ''}
434
- </div>
435
- </div>
436
-
437
- <div class="flex justify-between items-center p-4">
438
- <div class="text-sm font-semibold text-gray-500 p-2 border border-gray-300 rounded-full w-24 text-center">
439
- ${index + 1} / ${totalItems}
440
  </div>
441
 
442
- <div class="flex space-x-4 space-x-reverse">
443
- <button onclick="handlePrev()"
444
- class="control-btn bg-red-500 text-white shadow-xl hover:bg-red-600 flex items-center justify-center">
445
- ${renderIcon('ChevronRight', 'w-8 h-8', 2.5)}
446
- </button>
447
- <button onclick="handleNext()"
448
- class="control-btn bg-red-500 text-white shadow-xl hover:bg-red-600 flex items-center justify-center">
449
- ${renderIcon('ChevronLeft', 'w-8 h-8', 2.5)}
450
- </button>
451
  </div>
452
-
453
- <button onclick="playAudio(currentItem.audio)"
454
- class="control-btn bg-yellow-500 text-white shadow-xl hover:bg-yellow-600 flex items-center justify-center w-12 h-12 p-3">
455
- ${renderIcon('Volume2', 'w-6 h-6', 2.5)}
456
- </button>
457
  </div>
458
- </div>
459
- `;
460
- };
461
 
462
- // *************** الشاشة الرئيسية (Home Screen) ***************
463
-
464
- const renderHomeScreen = () => {
465
- const content = document.getElementById('app-content');
466
-
467
- // إذا كانت الشاشة الحالية ليست الصفحة الرئيسية، نعرض شاشة "قيد الإنشاء"
468
- if (appState.currentScreen !== 'home') {
469
- // شاشة قيد الإنشاء
470
- content.innerHTML = `
471
- <div class="p-8 min-h-[calc(100vh-130px)] flex flex-col items-center justify-center bg-gray-50">
472
- <p class="text-xl font-bold text-purple-600 mb-4">هذا القسم قيد الإنشاء!</p>
473
- <button onclick="setState({currentScreen: 'home', selectedCategory: null})"
474
- class="px-6 py-3 bg-purple-600 text-white font-bold rounded-xl shadow-lg hover:bg-purple-700 card-shadow">
475
- العودة للرئيسية
476
  </button>
 
 
 
 
 
 
 
 
477
  </div>
478
- `;
479
- return;
480
- }
481
 
 
 
 
 
482
 
483
- const categoryCards = CATEGORIES.map(category => `
484
- <div onclick="setState({currentScreen: '${category.id}'})"
485
- class="flex items-center p-4 ${category.bg} rounded-xl card-shadow ${category.hoverBg} cursor-pointer transition duration-200">
486
- <div class="p-3 rounded-full ${category.color} bg-white shadow-md">
487
- ${renderIcon(category.icon, 'w-8 h-8')}
488
- </div>
489
- <div class="mr-4">
490
- <h3 class="text-lg font-extrabold text-gray-800">${category.title}</h3>
491
- <p class="text-sm text-gray-500">تعلم ${category.data.length} عنصر</p>
492
- </div>
493
- <div class="mr-auto text-gray-400">
494
- ${renderIcon('ChevronLeft', 'w-6 h-6')}
495
- </div>
496
- </div>
497
- `).join('');
498
 
499
- content.innerHTML = `
500
- <div class="p-4">
501
- <div class="grid grid-cols-1 gap-4">
502
- ${categoryCards}
503
  </div>
504
  </div>
505
  `;
 
217
  { word_tifinagh: 'ⴰⵏⴱⴷⵓ', word_arabic: 'الصيف', image: 'images/6da33d4175e50b17309485c8b33cfe0e.jpg', audio: 'audio/AUD-20250926-WA0001.opus' },
218
  { word_tifinagh: 'ⴰⵎⴰⵡⴰⵏ', word_arabic: 'الخريف', image: 'images/e6c5c6a800de512091faa20db36472f8.jpg', audio: 'audio/AUD-20250926-WA0000.opus' }
219
  ];
220
+
221
+ const fruitsData = [
222
  { word_tifinagh: 'ⵜⴰⴷⴼⴼⵓⵢⵜ', word_arabic: 'تفاحة', image: 'images/da1da4f2015a32322f547ae5fff5236c.jpg', audio: 'audio/fruits/apple.mp3' },
223
  { word_tifinagh: 'ⵜⴰⴱⴰⵏⴰⵏⵜ', word_arabic: 'موزة', image: 'images/11bde7577165c2edef985a3cbd9458ae.jpg', audio: 'audio/fruits/banana.mp3' },
224
  { word_tifinagh: 'ⵍⵍⵜⵛⵉⵏ', word_arabic: 'برتقال', image: 'images/1efc88aa2e2e9bb97af6b059a4c05b91.jpg', audio: 'audio/fruits/orange.mp3' },
225
+ { word_tifinagh: 'ⵜⵉⵣⵡⵍⵜ', word_arabic: 'فراولة', image: 'images/f70521a26fbd3b91b349493081eb3b88.jpg', audio: 'audio/fruits/strawberry.mp3' },
226
  { word_tifinagh: 'ⴰⴹⵉⵍ', word_arabic: 'عنب', image: 'images/1987ab2c045824929e7b8e5004f1c503.jpg', audio: 'audio/fruits/grapes.mp3' },
227
+ { word_tifinagh: 'ⵕⵕⵎⵎⴰⵏ', word_arabic: 'رمان', image: 'images/bf6a38717ec00ddb8394f5c7acab308e.jpg', audio: 'audio/fruits/pomegranate.mp3' },
228
+ { word_tifinagh: 'ⵜⴰⴷⴷⵍⵍⴰⵃⵜ', word_arabic: 'بطيخ', image: 'images/ae716e7b0b1009b29d2c0924aaa1cc15.jpg', audio: 'audio/fruits/watermelon.mp3' },
229
+ { word_tifinagh: 'ⴰⵎⴰⵏ', word_arabic: 'مانجو', image: 'images/afc84d4cffcfca39b86fc288758a65d9.jpg', audio: 'audio/fruits/mango.mp3' },
230
+ { word_tifinagh: 'ⴰⵏⴰⵏⴰⵚ', word_arabic: 'أناناس', image: 'images/e5a0d8fef5139197856d36bac0810210.jpg', audio: 'audio/fruits/pineapple.mp3' },
231
+ { word_tifinagh: 'ⴰⵙⵎⵎⴰⵎ', word_arabic: 'ليمون', image: 'images/3b19dbd8568f84de61fefc4d8f729e31.jpg', audio: 'audio/fruits/lemon.mp3' }
 
232
  ];
233
 
234
+ const vegetablesData = [
235
+ { word_tifinagh: 'ⵜⴰⵎⴰⵟⵉⵛⵜ', word_arabic: 'طماطم', image: 'images/6056d9839a962b5a78cddc402ef88c09.jpg', audio: 'audio/vegetables/tomato.mp3' },
236
+ { word_tifinagh: 'ⴰⵖⵙⵙⵉⵎ', word_arabic: 'خيار', image: 'images/c4267923b02091ba31923b94d5b81832.jpg', audio: 'audio/vegetables/cucumber.mp3' },
237
+ { word_tifinagh: 'ⵜⴰⵅⵉⵣⵣⵓⵜ', word_arabic: 'جزرة', image: 'images/f2c660e1af2eb42e0b2455bea8d476b5.jpg', audio: 'audio/vegetables/carrot.mp3' },
238
+ { word_tifinagh: 'ⴰⵥⴰⵍⵉⵎ', word_arabic: 'بصل', image: 'images/a1eca20822f37cef8dab2fa4feec8272.jpg', audio: 'audio/vegetables/onion.mp3' },
239
+ { word_tifinagh: 'ⵜⵉⵙⴽⵔⵜ', word_arabic: 'ثوم', image: 'images/88f83b4f34ca0aaa254aaf0eae8ee2ac.jpg', audio: 'audio/vegetables/garlic.mp3' },
240
+ { word_tifinagh: 'ⵉⴼⵉⴼⵍ', word_arabic: 'فلفل', image: 'images/44cbf575ceebda24dbb9fb28a2825744.jpg', audio: 'audio/vegetables/pepper.mp3' },
241
+ { word_tifinagh: 'ⵜⴰⵍⵍⵓⵖⴷⴰ', word_arabic: 'بطاطس', image: 'images/7b78e64a70a785fe35d853fb1568578a.jpg', audio: 'audio/vegetables/potato.mp3' },
242
+ { word_tifinagh: 'ⵜⴰⵎⴰⴼⴰⵔⵜ', word_arabic: 'خس', image: 'images/ef2153019a5f74807dfbab7194519d1e.jpg', audio: 'audio/vegetables/lettuce.mp3' },
243
+ { word_tifinagh: 'ⴱⵉⵟⵍⵊⴰⵏ', word_arabic: 'باذنجان', image: 'images/8f6a4542ebff0636e7926478d32a9bbd.jpg', audio: 'audio/vegetables/eggplant.mp3' },
244
+ { word_tifinagh: 'ⵜⵉⵇⵇⵙⵜ', word_arabic: ' فلفل حار', image: 'images/af35c440654de65e700818c36ef11dc9.jpg', audio: 'audio/vegetables/cauliflower.mp3' }
245
+ ];
246
+
247
+ const monthsData = [
248
+ { word_tifinagh: 'ⵉⵏⵏⴰⵢⵔ', word_arabic: 'يناير', image: 'images/b26681eaa5caacbf1c7bfb112f546def.jpg', audio: 'audio/months/january.mp3' },
249
+ { word_tifinagh: 'ⴱⵕⴰⵢⵕ', word_arabic: 'فبراير', image: 'images/c391d2e8b5081720ab58b167d96abd50.jpg', audio: 'audio/months/february.mp3' },
250
+ { word_tifinagh: 'ⵎⴰⵕⵚ', word_arabic: 'مارس', image: 'images/8baf8accac02f718e274f7f0efe8e208.jpg', audio: 'audio/months/march.mp3' },
251
+ { word_tifinagh: 'ⵉⴱⵔⵉⵔ', word_arabic: 'أبريل', image: 'images/5af82e7a87c9d7d1a93173d953e2c033.jpg', audio: 'audio/months/april.mp3' },
252
+ { word_tifinagh: 'ⵎⴰⵢⵢⵓ', word_arabic: 'ماي', image: 'images/569cc0c8af30f8116c776a21a230f9d0.jpg', audio: 'audio/months/may.mp3' },
253
+ { word_tifinagh: 'ⵢⵓⵏⵢⵓ', word_arabic: 'يونيو', image: 'images/8b693928c5447c7381948bd23fa0a94c.jpg', audio: 'audio/months/june.mp3' },
254
+ { word_tifinagh: 'ⵢⵓⵍⵢⵓⵣ', word_arabic: 'يوليوز', image: 'images/17a897f15be1f2e5976f0eb51f4cdbc8.jpg', audio: 'audio/months/july.mp3' },
255
+ { word_tifinagh: 'ⵖⵓⵛⵜ', word_arabic: 'غشت', image: 'images/bbf58163e3765676d6dadffbc94dd6fb.jpg', audio: 'audio/months/august.mp3' },
256
+ { word_tifinagh: 'ⵛⵓⵜⴰⵏⴱⵔ', word_arabic: ' شتنبر', image: 'images/83e98be29b454d400cc1c78160a51207.jpg', audio: 'audio/months/september.mp3' },
257
+ { word_tifinagh: 'ⴽⵜⵓⴱⵔ', word_arabic: 'أكتوبر', image: 'images/a1b9f28aa43bda697d0bff6ae52bc06c.jpg', audio: 'audio/months/october.mp3' },
258
+ { word_tifinagh: 'ⵏⵓⵡⴰⵏⴱⵉⵔ', word_arabic: 'نونبر', image: 'images/d4ef0ea2c17f056b7c67aa6553b27199.jpg', audio: 'audio/months/november.mp3' },
259
+ { word_tifinagh: 'ⴷⵓⵊⴰⵏⴱⵉⵔ', word_arabic: 'دجنبر', image: 'images/799c20391c8da09c7d215758ab073e37.jpg', audio: 'audio/months/december.mp3' }
260
+ ];
261
+ const daysData = [
262
+ { word_tifinagh: 'ⴰⵢⵏⴰⵙ', word_arabic: 'الاثنين', image: 'images/37b71533177feb9d55d55efba947309e.jpg', audio: 'audio/days/monday.mp3' },
263
+ { word_tifinagh: 'ⴰⵙⵉⵏⴰⵙ', word_arabic: 'الثلاثاء', image: 'images/37b71533177feb9d55d55efba947309e.jpg', audio: 'audio/days/tuesday.mp3' },
264
+ { word_tifinagh: 'ⴰⴽⵕⴰⵙ', word_arabic: 'الأربعاء', image: 'images/37b71533177feb9d55d55efba947309e.jpg', audio: 'audio/days/wednesday.mp3' },
265
+ { word_tifinagh: 'ⴰⴽⵡⴰⵙ', word_arabic: 'الخميس', image: 'images/37b71533177feb9d55d55efba947309e.jpg', audio: 'audio/days/thursday.mp3' },
266
+ { word_tifinagh: 'ⴰⵙⵉⵎⵡⴰⵙ', word_arabic: 'الجمعة', image: 'images/37b71533177feb9d55d55efba947309e.jpg', audio: 'audio/days/friday.mp3' },
267
+ { word_tifinagh: 'ⴰⵚⵉⴹⵢⴰⵙ', word_arabic: 'السبت', image: 'images/37b71533177feb9d55d55efba947309e.jpg', audio: 'audio/days/saturday.mp3' },
268
+ { word_tifinagh: 'ⴰⵙⴰⵎⴰⵙ', word_arabic: 'الأحد', image: 'images/37b71533177feb9d55d55efba947309e.jpg', audio: 'audio/days/sunday.mp3' }
269
  ];
270
 
271
+ const familyData = [
272
+ { word_tifinagh: 'ⵉⵎⵎⵉ', word_arabic: 'أمي', image: 'images/5957c378462b920ceb24f6aa294b5100.jpg', audio: 'audio/family/mother.mp3' },
273
+ { word_tifinagh: 'ⴱⴰⴱⴰ', word_arabic: 'أبي', image: 'images/6b957498ddc6e49e618e91f7c5ce0134.jpg', audio: 'audio/family/father.mp3' },
274
+ { word_tifinagh: 'ⴳⵯⵎⴰ', word_arabic: 'أخي', image: 'images/8ae84a445390bd1695791a7721b2ebc0.jpg', audio: 'audio/family/brother.mp3' },
275
+ { word_tifinagh: 'ⵓⵍⵜⵎⴰ', word_arabic: 'أختي', image: 'images/d959a12a45c2469850c44afd379b82f8.jpg', audio: 'audio/family/sister.mp3' },
276
+ { word_tifinagh: 'ⴱⴰⴱⴰ ⴰⵎⵇⵇⵕⴰⵏ', word_arabic: 'جدي', image: 'images/dc84969949644c410732c57215bcaa8e.jpg', audio: 'audio/family/grandfather.mp3' },
277
+ { word_tifinagh: 'ⵉⵎⵎⴰ ⵜⴰⵎⵇⵕⴰⵏⵜ', word_arabic: 'جدتي', image: 'images/2bd2ccddaf31840edde5eab74b1a25ee.jpg', audio: 'audio/family/grandmother.mp3' },
278
+ { word_tifinagh: 'ⴷⴰⴷⴷⴰ', word_arabic: 'عمي', image: 'images/036bd0ed2c2e2dd991eb3aff426e94fb.jpg', audio: 'audio/family/uncle.mp3' },
279
+ { word_tifinagh: 'ⵜⴰⴱⴰ', word_arabic: 'عمتي', image: 'images/66abe3b026ff4c492fff8367587783bd.jpg', audio: 'audio/family/aunt.mp3' },
280
+ { word_tifinagh: 'ⴰⵏⴰ', word_arabic: 'خالي', image: 'images/036bd0ed2c2e2dd991eb3aff426e94fb.jpg', audio: 'audio/family/uncle.mp3' },
281
+ { word_tifinagh: 'ⵜⴰⵏⴰⵜ', word_arabic: 'خالتي', image: 'images/ff6b0dbc0e4f8d5f5df94c6df08f9c6a.jpg', audio: 'audio/family/aunt.mp3' },
282
+ ];
283
 
284
+ const bodyPartsData = [
285
+ { word_tifinagh: 'ⵉⵅⴼ', word_arabic: 'الرأس', image: 'images/33dda7fe89cfd5526918246dae320059.jpg', audio: 'audio/bodyParts/head.mp3' },
286
+ { word_tifinagh: 'ⴰⴼⵓⵙ', word_arabic: 'اليد', image: 'images/44947c8bbf8665173c5d8836c65d6f7c.jpg', audio: 'audio/bodyParts/hand.mp3' },
287
+ { word_tifinagh: 'ⴰⴹⴰⵔ', word_arabic: 'القدم', image: 'images/641424d996e86204d032d59a4ccc09a0.jpg', audio: 'audio/bodyParts/foot.mp3' },
288
+ { word_tifinagh: 'ⵜⵉⵟ', word_arabic: 'العين', image: 'images/5e0b1a5ae043556912dec8e157f55b41.jpg', audio: 'audio/bodyParts/eye.mp3' },
289
+ { word_tifinagh: 'ⵉⵏⵅⴰⵔ', word_arabic: 'الأنف', image: 'images/ef9066caba835568e19799f187bdae6a.jpg', audio: 'audio/bodyParts/nose.mp3' },
290
+ { word_tifinagh: 'ⵉⵎⵉ', word_arabic: 'الفم', image: 'images/36ef29579225201947d3a6b0a0363dde.jpg', audio: 'audio/bodyParts/mouth.mp3' },
291
+ { word_tifinagh: 'ⴰⵎⵣⵣⵓⵖ', word_arabic: 'الأذن', image: 'images/13bc14d834265bd33a1fad47ee638f66.jpg', audio: 'audio/bodyParts/ear.mp3' },
292
+ { word_tifinagh: 'ⴰⵖⵔⵓⴹ', word_arabic: 'كتف', image: 'images/8e16145c86a1fe2b52740f204152b72f.jpg', audio: 'audio/bodyParts/arm.mp3' },
293
+ { word_tifinagh: 'ⴰⵎⴳⵔⴷ', word_arabic: 'الرقبة ', image: 'images/ce5e3ffa40b08796f6d1f758b36635db.jpg', audio: 'audio/bodyParts/leg.mp3' },
294
+ { word_tifinagh: 'ⴰⵣⵣⴰⵔ', word_arabic: 'الشعر', image: 'images/9cdb435823e315ad4767e0c8e424b8f3.jpg', audio: 'audio/bodyParts/hair.mp3' },
295
+ { word_tifinagh: 'ⵜⴰⴷⴰⵡⵜ', word_arabic: 'الظهر', image: 'images/6bb3e17ed531423f1ce78b27eb6a4bcd.jpg', audio: 'audio/bodyParts/back.mp3' },
296
+ { word_tifinagh: 'ⵉⴷⵎⴰⵔⵏ', word_arabic: 'الصدر', image: 'images/860958a31e930382525ba82294cae31c.jpg', audio: 'audio/bodyParts/chest.mp3' },
297
+ { word_tifinagh: 'ⴰⴷⵉⵙ', word_arabic: 'البطن', image: 'images/cd61420d75ef80789d9ef419ab6d78b3.jpg', audio: 'audio/bodyParts/belly.mp3' },
298
+ { word_tifinagh: 'ⵉⵍⵙ', word_arabic: 'اللسان', image: 'images/42cc4f8bfbb86fb0e60a06d523bba4d8.jpg', audio: 'audio/bodyParts/shoulder.mp3' },
299
+ { word_tifinagh: 'ⴰⴼⵓⴷ', word_arabic: 'الركبة', image: 'images/c38b399f59b84a1425d1100d7a142323.jpg', audio: 'audio/bodyParts/knee.mp3' },
300
+ { word_tifinagh: 'ⵓⵅⵙⴰⵏ', word_arabic: 'الأسنان', image: 'images/d7087ae777b9121491ddfdbbe2bf9699.jpg', audio: 'audio/bodyParts/teeth.mp3' },
301
+ ];
302
+
303
+
304
+ const colorsData = [
305
+ { word_tifinagh: 'ⴰⵣⴳⴳⵯⴰⵖ', word_arabic: 'أحمر', image: 'images/b008721ac76def4ddfdbdb51fc82d320.jpg', audio: 'audio/colors/red.mp3' },
306
+ { word_tifinagh: 'ⴰⵥⵕⵡⴰⵍ', word_arabic: 'أزرق', image: 'images/3424729aa184959857a097fb421b480e.jpg', audio: 'audio/colors/blue.mp3' },
307
+ { word_tifinagh: 'ⴰⵡⵔⴰⵖ', word_arabic: 'أصفر', image: 'images/d871dd62033ef51b734e405d2be3db6f.jpg', audio: 'audio/colors/yellow.mp3' },
308
+ { word_tifinagh: 'ⴰⵣⴳⵣⴰⵡ', word_arabic: 'أخضر', image: 'images/a58989552838c41eba05072814e62c90.jpg', audio: 'audio/colors/green.mp3' },
309
+ { word_tifinagh: 'ⴰⵍⵉⵎⵓⵏⵉ', word_arabic: 'برتقالي', image: 'images/2957461e42e514fc8f28cdfcf6a26266.jpg', audio: 'audio/colors/orange.mp3' },
310
+ { word_tifinagh: 'ⴰⵎⴽⵥⴰⵢ', word_arabic: 'بنفسجي', image: 'images/47c698f09fd37ff179f4ba31edd74b9a.jpg', audio: 'audio/colors/purple.mp3' },
311
+ { word_tifinagh: 'ⴰⴷⵎⵎⴰⵏ', word_arabic: 'بني', image: 'images/08a3dc3e988b98980e7252e07ad7356c.jpg', audio: 'audio/colors/brown.mp3' },
312
+ { word_tifinagh: 'ⴰⵣⵡⴰⵡⴰⵖ', word_arabic: 'وردي', image: 'images/18656b92846235109510e255b899a4ec.jpg', audio: 'audio/colors/pink.mp3' },
313
+ { word_tifinagh: 'ⴰⵙⴳⴳⴰⵏ', word_arabic: 'أسود', image: 'images/8a6ed41c982c97428b484ab13a95afc2.jpg', audio: 'audio/colors/black.mp3' },
314
+ { word_tifinagh: 'ⵓⵎⵍⵉⵍ', word_arabic: 'أبيض', image: 'images/4da7f34849bab634d5bc9da642d921dd.jpg', audio: 'audio/colors/white.mp3' }
315
+ ];
316
 
317
+ const storiesData = [
318
+ {
319
+ title: "أسد صغير شجاع",
320
+ image: "images/Screenshot_20250927_141840_One Read.jpg",
321
+ text: "في غابة بعيدة، عاش أسد صغير اسمه سمير. كان سمير يحلم بأن يصبح شجاعًا مثل والده الملك..."
322
+ },
323
+ {
324
+ title: "الأرنب والسلحفاة",
325
+ image: "images/Screenshot_20250927_140922_One Read.jpg",
326
+ text: "كان الأرنب يتفاخر دائمًا بأنه أسرع حيوان في الغابة. تحدته السلحفاة في سباق، فضحك الأرنب..."
327
+ },
328
+ ];
329
+
330
+ // *************** دمج وتحويل البيانات إلى هيكل التطبيق ***************
331
+
332
+ const LEARNING_DATA = {
333
+ // حروف تيفيناغ
334
+ tifinaghLetters: tifinaghData.map(item => {
335
+ const parts = item.word_arabic.split('-');
336
+ return {
337
+ main: item.letter,
338
+ word: parts.length > 1 ? parts[0].trim() : item.word_arabic.trim(), // كلمة عربية
339
+ transliteration: parts.length > 1 ? parts[1].trim() : '', // كلمة تيفيناغ كمثال
340
+ imageUrl: item.image,
341
+ audioUrl: item.audio,
342
+ };
343
+ }),
344
+ // أرقام (Numbers)
345
+ numbers: numbersData.map(item => ({
346
+ main: item.number,
347
+ word: item.word_arabic.trim(), // الكلمة العربية
348
+ transliteration: item.word_tifinagh.trim(), // الكلمة تيفيناغ
349
+ imageUrl: item.image,
350
+ audioUrl: item.audio,
351
+ })),
352
+ // أدوات مدرسية (Tools)
353
+ tools: schoolSuppliesData.map(item => ({
354
+ main: item.word_tifinagh.trim(), // الكلمة تيفيناغ
355
+ word: item.word_arabic.trim(), // الكلمة العربية
356
+ imageUrl: item.image,
357
+ audioUrl: item.audio,
358
+ })),
359
+ // فواكه (Fruits)
360
+ fruits: fruitsData.map(item => ({
361
+ main: item.word_tifinagh.trim(),
362
+ word: item.word_arabic.trim(),
363
+ imageUrl: item.image,
364
+ audioUrl: item.audio,
365
+ })),
366
+ // خضر (Vegetables)
367
+ vegetables: vegetablesData.map(item => ({
368
+ main: item.word_tifinagh.trim(),
369
+ word: item.word_arabic.trim(),
370
+ imageUrl: item.image,
371
+ audioUrl: item.audio,
372
+ })),
373
+ // حيوانات (Animals)
374
+ animals: animalsData.map(item => ({
375
+ main: item.word_tifinagh.trim(),
376
+ word: item.word_arabic.trim(),
377
+ imageUrl: item.image,
378
+ audioUrl: item.audio,
379
+ })),
380
+ // أجزاء الجسم (Body)
381
+ body: bodyPartsData.map(item => ({
382
+ main: item.word_tifinagh.trim(),
383
+ word: item.word_arabic.trim(),
384
+ imageUrl: item.image,
385
+ audioUrl: item.audio,
386
+ })),
387
+ // أيام الأسبوع (Days)
388
+ days: daysData.map(item => ({
389
+ main: item.word_tifinagh.trim(),
390
+ word: item.word_arabic.trim(),
391
+ imageUrl: item.image,
392
+ audioUrl: item.audio,
393
+ })),
394
+ // أشهر السنة (Months)
395
+ months: monthsData.map(item => ({
396
+ main: item.word_tifinagh.trim(),
397
+ word: item.word_arabic.trim(),
398
+ imageUrl: item.image,
399
+ audioUrl: item.audio,
400
+ })),
401
+ // العائلة (Family)
402
+ family: familyData.map(item => ({
403
+ main: item.word_tifinagh.trim(),
404
+ word: item.word_arabic.trim(),
405
+ imageUrl: item.image,
406
+ audioUrl: item.audio,
407
+ })),
408
+ // ألوان (Colors)
409
+ colors: colorsData.map(item => {
410
+ // تلوين مربع اللون اعتمادا على الكلمة العربية (للتجربة)
411
+ const colorMap = {
412
+ 'أحمر': 'bg-red-600', 'أزرق': 'bg-blue-600', 'أصفر': 'bg-yellow-500',
413
+ 'أخضر': 'bg-green-600', 'برتقالي': 'bg-orange-500', 'بنفسجي': 'bg-purple-600',
414
+ 'بني': 'bg-amber-800', 'وردي': 'bg-pink-500', 'أسود': 'bg-gray-800', 'أبيض': 'bg-gray-200'
415
+ };
416
+ return {
417
+ main: item.word_tifinagh.trim(),
418
+ word: item.word_arabic.trim(),
419
+ imageUrl: item.image,
420
+ audioUrl: item.audio,
421
+ colorClass: colorMap[item.word_arabic.trim()] || 'bg-gray-400',
422
+ };
423
+ }),
424
+ // فصول السنة (Seasons)
425
+ seasons: seasonsData.map(item => ({
426
+ main: item.word_tifinagh.trim(),
427
+ word: item.word_arabic.trim(),
428
+ imageUrl: item.image,
429
+ audioUrl: item.audio,
430
+ })),
431
+ // قصص وألعاب (Games)
432
+ games: storiesData.map(item => ({
433
+ main: item.title, // العنوان
434
+ word: item.text, // محتوى القصة
435
+ imageUrl: item.image,
436
+ audioUrl: null, // لا يوجد صوت محدد هنا
437
+ })),
438
  };
439
 
 
 
 
440
 
441
+ const CATEGORIES = [
442
+ { id: 'tifinaghLetters', title: 'حروف تيفيناغ', subtitle: 'ⴰ, ⴱ, ⴳ...', iconName: 'AArrowUp', imageUrl: 'https://placehold.co/300x200/ff66b2/ffffff?text=حروف+تيفيناغ' },
443
+ { id: 'numbers', title: 'أرقام', subtitle: '0, 1, 2...', iconName: 'Hash', imageUrl: 'https://placehold.co/300x200/ffa500/ffffff?text=أرقام' },
444
+ { id: 'colors', title: 'ألوان', subtitle: 'ⴰⵣⴳⴳⵯⴰⵖ, ⴰⵥⵕⵡⴰⵍ', iconName: 'Palette', imageUrl: 'https://placehold.co/300x200/40e0d0/ffffff?text=ألوان' },
445
+ { id: 'tools', title: 'أدوات مدرسية', subtitle: 'ⴰⴽⵕⵕⴰⵊ, ⴰⴷⴰⵍⵉⵙ', iconName: 'PencilRuler', imageUrl: 'https://placehold.co/300x200/6a5acd/ffffff?text=أدوات+مدرسية' },
446
+ { id: 'family', title: 'العائلة', subtitle: 'ⵉⵎⵎⵉ, ⴱⴰⴱⴰ', iconName: 'Users', imageUrl: 'https://placehold.co/300x200/dc143c/ffffff?text=العائلة' },
447
+ { id: 'vegetables', title: 'خضر', subtitle: 'ⵜⴰⵎⴰⵟⵉⵛⵜ, ⴰⵖⵙⵙⵉⵎ', iconName: 'Carrot', imageUrl: 'https://placehold.co/300x200/228b22/ffffff?text=خضر' },
448
+ { id: 'fruits', title: 'فواكه', subtitle: 'ⵜⴰⴷⴼⴼⵓⵢⵜ, ⵜⴰⴱⴰⵏⴰⵏⵜ', iconName: 'Apple', imageUrl: 'https://placehold.co/300x200/ffd700/000000?text=فواكه' },
449
+ { id: 'animals', title: 'حيوانات', subtitle: 'ⴰⵎⵓⵛⵛ, ⴰⵢⴷⵉ', iconName: 'Cat', imageUrl: 'https://placehold.co/300x200/1e90ff/ffffff?text=حيوانات' },
450
+ { id: 'body', title: 'أجزاء الجسم', subtitle: 'ⵉⵅⴼ, ⴰⴼⵓⵙ', iconName: 'Hand', imageUrl: 'https://placehold.co/300x200/ff4500/ffffff?text=أجزاء+الجسم' },
451
+ { id: 'days', title: 'أيام الأسبوع', subtitle: 'ⴰⵢⵏⴰⵙ - ⴰⵙⴰⵎⴰⵙ', iconName: 'CalendarDays', imageUrl: 'https://placehold.co/300x200/800080/ffffff?text=أيام+الأسبوع' },
452
+ { id: 'months', title: 'أشهر السنة', subtitle: 'ⵉⵏⵏⴰⵢⵔ - ⴷⵓⵊⴰⵏⴱⵉⵔ', iconName: 'CalendarClock', imageUrl: 'https://placehold.co/300x200/008080/ffffff?text=أشهر+السنة' },
453
+ { id: 'seasons', title: 'فصول السنة', subtitle: 'ⵜⴰⴳⵔⵙⵜ, ⵜⴰⴼⵙⵓⵜ', iconName: 'CloudRain', imageUrl: 'https://placehold.co/300x200/4682b4/ffffff?text=فصول+السنة' },
454
+ { id: 'games', title: 'قصص وألعاب', subtitle: 'تسلية وتعلم', iconName: 'Gamepad', imageUrl: 'https://placehold.co/300x200/808080/ffffff?text=قصص+وألعاب' },
455
+ ];
456
 
 
457
 
458
+ // --- 3. إدارة حالة التطبيق (متاحة عالمياً) ---
 
459
 
460
+ const appState = {
461
+ currentScreen: 'home',
462
+ selectedCategory: null,
463
+ currentIndex: 0,
 
 
 
 
 
464
  };
465
 
466
+ // دالة تحديث الحالة وإعادة رسم التطبيق
467
+ window.setState = (newState) => {
468
+ if (newState.currentScreen && newState.currentScreen !== appState.selectedCategory) {
469
+ appState.currentIndex = 0;
470
+ }
471
 
472
+ Object.assign(appState, newState);
473
+ renderApp();
474
+ };
475
 
476
+ // --- 4. مكونات الواجهة المشتركة (رأس الصفحة وتذييلها) ---
477
 
478
  const renderHeader = () => {
479
+ const headerElement = document.getElementById('app-header');
480
+ const categoryMeta = CATEGORIES.find(c => c.id === appState.selectedCategory);
481
 
482
+ let title = APP_NAME;
483
+ // استخدام اسم الفئة إذا لم تكن الشاشة الرئيسية
484
+ if (categoryMeta && appState.currentScreen !== 'home') {
485
+ title = categoryMeta.title;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  }
487
+
488
+ headerElement.innerHTML = `
489
+ <div class="flex items-center justify-between p-4 h-16 bg-blue-800 text-white shadow-lg rounded-b-xl">
490
+ <button onclick="setState({currentScreen: 'home', selectedCategory: null})"
491
+ class="p-1 rounded-full hover:bg-white/10 transition-colors" aria-label="القائمة الرئيسية">
492
+ ${renderIcon('Menu', 'w-6 h-6 text-white')}
493
+ </button>
494
+ <h1 class="text-xl font-extrabold text-white">${title}</h1>
495
+ <div class="w-8 h-8 rounded-full bg-yellow-400 border-2 border-white flex items-center justify-center text-sm font-bold text-blue-900 shadow-md">
496
+ ${renderIcon('User', 'w-4 h-4 text-blue-900', 3)}
497
+ </div>
498
+ </div>
499
+ `;
500
  };
 
 
501
 
502
  const renderFooter = () => {
503
+ const footerElement = document.getElementById('app-footer');
 
 
 
 
 
 
 
504
  const navItems = [
505
+ { id: 'home', iconName: 'Home', label: 'الرئيسية' },
506
+ { id: 'share', iconName: 'Share2', label: 'مشاركة' },
507
+ { id: 'profile', iconName: 'User', label: 'الملف' },
508
+ { id: 'settings', iconName: 'Settings', label: 'إعدادات' },
509
+ { id: 'info', iconName: 'Info', label: 'حول' },
510
  ];
511
 
512
+ const activeScreen = appState.currentScreen === 'home' ? 'home' : 'home';
513
+
514
+ footerElement.innerHTML = `
515
+ <div class="bg-white p-2 rounded-t-3xl shadow-[0_-5px_15px_rgba(0,0,0,0.1)]">
516
+ <div class="flex justify-around items-center">
517
+ ${navItems.map(item => {
518
+ const isActive = item.id === activeScreen;
519
+ return `
520
+ <button
521
+ onclick="setState({currentScreen: '${item.id === 'home' ? 'home' : appState.currentScreen}', selectedCategory: '${item.id === 'home' ? null : appState.selectedCategory}'})"
522
+ class="flex flex-col items-center p-2 rounded-xl transition-all ${isActive ? 'text-blue-600' : 'text-gray-400 hover:text-blue-400'}"
523
+ aria-label="${item.label}"
524
+ >
525
+ <div class="p-2 rounded-full transition-all ${isActive ? 'bg-blue-100 shadow-md' : ''}">
526
+ ${renderIcon(item.iconName, 'w-5 h-5')}
527
+ </div>
528
+ <span class="text-xs font-medium mt-1">${item.label}</span>
529
+ </button>
530
+ `;
531
+ }).join('')}
532
+ </div>
533
+ </div>
534
+ `;
535
+ };
536
+
537
+ // --- 5. شاشة 1: الشاشة الرئيسية (Home Screen) ---
538
+
539
+ const renderHomeScreen = () => {
540
+ const content = document.getElementById('app-content');
541
+
542
+ const cardsHTML = CATEGORIES.map(category => `
543
+ <button
544
+ onclick="setState({currentScreen: '${category.id}', selectedCategory: '${category.id}'})"
545
+ class="relative w-full h-32 rounded-2xl overflow-hidden card-shadow group"
546
+ aria-label="الذهاب إلى قسم ${category.title}"
547
+ >
548
+ <img
549
+ src="${category.imageUrl || 'https://placehold.co/300x200/cccccc/000000?text=صورة+بديلة'}"
550
+ alt="${category.title}"
551
+ class="w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"
552
+ onerror="this.onerror=null; this.src='https://placehold.co/300x200/cccccc/000000?text=صورة+${category.title}';"
553
+ />
554
+
555
+ <div class="absolute inset-0 flex flex-col items-center justify-center p-3 text-white font-extrabold text-lg image-overlay">
556
+ <span class="text-xl font-black text-center leading-tight drop-shadow-md">${category.title}</span>
557
+ <span class="text-xs opacity-80 mt-1 drop-shadow-sm">${category.subtitle}</span>
558
+ </div>
559
  </button>
560
  `).join('');
561
 
562
+ content.innerHTML = `
563
+ <div class="p-4 bg-gray-50 min-h-[calc(100vh-130px)]">
564
+ <h2 class="text-2xl font-bold text-gray-800 mb-4 text-center">أقسام التعلم</h2>
565
+ <div class="grid grid-cols-2 sm:grid-cols-3 gap-3">
566
+ ${cardsHTML}
567
  </div>
568
+ <p class="text-center text-gray-500 mt-6 text-sm">
569
+ اختر قسمًا لتبدأ رحلة التعلم الممتعة!
570
+ </p>
571
+ </div>
572
  `;
573
  };
574
 
575
+ // --- 6. شاشة 2 و 3: شاشة التعلم العامة (Learning Screen) ---
576
 
577
  const renderLearningScreen = () => {
578
+ const categoryId = appState.selectedCategory;
579
  const content = document.getElementById('app-content');
580
+ // استخدام البيانات المدمجة
581
+ const data = LEARNING_DATA[categoryId] || [];
582
+ const categoryMeta = CATEGORIES.find(c => c.id === categoryId);
 
 
 
 
583
 
584
+ if (data.length === 0 || !categoryMeta) {
585
+ content.innerHTML = `
586
+ <div class="p-8 min-h-[calc(100vh-130px)] flex flex-col items-center justify-center bg-gray-50">
587
+ <p class="text-xl font-bold text-red-500 mb-4">عفواً! لا توجد بيانات لهذا القسم.</p>
588
+ <button onclick="setState({currentScreen: 'home', selectedCategory: null})"
589
+ class="px-6 py-3 bg-blue-600 text-white font-bold rounded-xl shadow-lg hover:bg-blue-700 card-shadow">
590
+ العودة للرئيسية
591
+ </button>
592
+ </div>
593
+ `;
594
+ return;
595
+ }
596
 
597
+ const currentItem = data[appState.currentIndex];
598
+ const isLettersCategory = categoryId === 'tifinaghLetters'; // تم التحديث إلى tifinaghLetters
599
+ const isNumbersCategory = categoryId === 'numbers';
600
+ const isColorsCategory = categoryId === 'colors';
601
+ const isStoriesCategory = categoryId === 'games';
602
+
603
+ // دالة تشغيل الصوت
604
+ window.playAudio = () => {
605
+ if (currentItem.audioUrl) {
606
+ new Audio(currentItem.audioUrl).play().catch(e => console.error("Error playing audio:", e));
607
+ } else {
608
+ // رسالة تنبيه يمكن استبدالها بواجهة أفضل
609
+ alert('ملف صوتي غير متوفر لهذا العنصر.');
610
+ }
611
  };
612
+
613
+ // دوال التنقل
614
+ window.handleNext = () => {
615
+ const newIndex = (appState.currentIndex + 1) % data.length;
616
+ setState({ currentIndex: newIndex });
617
  };
618
+ window.handlePrev = () => {
619
+ const newIndex = (appState.currentIndex - 1 + data.length) % data.length;
620
+ setState({ currentIndex: newIndex });
 
 
 
 
621
  };
622
 
623
+ // تحديد تدرج لون البطاقة حسب الفئة (يمكن إضافة المزيد)
624
+ const mainCardGradient = isLettersCategory
625
+ ? 'from-orange-400 to-pink-300'
626
+ : isNumbersCategory
627
+ ? 'from-green-500 to-teal-400'
628
+ : 'from-blue-400 to-purple-300';
629
+
630
 
631
+ // تحديد محتوى الصورة/اللون
632
+ let illustrationContent;
633
+ if (isColorsCategory && currentItem.word !== 'أبيض') {
634
+ // للألوان: عرض مربع ملون كبير
635
+ illustrationContent = `
636
+ <div class="w-36 h-36 sm:w-40 sm:h-40 rounded-full shadow-inner ${currentItem.colorClass || 'bg-gray-400'} border-4 border-white/80"></div>
637
+ `;
638
+ } else {
639
+ // للحروف والأرقام وبقية الفئات: عرض الصورة
640
+ illustrationContent = `
641
+ <img
642
+ src="${currentItem.imageUrl || 'https://placehold.co/150x150/cccccc/000000?text=صورة'}"
643
+ alt="${currentItem.word}"
644
+ class="w-36 h-36 sm:w-40 sm:h-40 rounded-xl object-cover shadow-lg border-4 border-white/50"
645
+ onerror="this.onerror=null; this.src='https://placehold.co/150x150/cccccc/000000?text=صورة+${categoryMeta.title}';"
646
+ />
647
+ `;
648
+ }
649
+
650
+ // تحديد محتوى الكلمة الرئيسية والفرعية في المركز
651
+ let mainWordDisplay;
652
+ let secondaryText;
653
+
654
+ if (isLettersCategory) {
655
+ // للحروف: التركيز على كلمة تيفيناغ كمثال (ⴰⴳⴰⴷⵉⵔ)
656
+ mainWordDisplay = currentItem.transliteration;
657
+ secondaryText = `الحرف: ${currentItem.main} | ${currentItem.word}`; // الحرف (ⴰ) والكلمة العربية (جدار)
658
+ } else if (isNumbersCategory) {
659
+ // للأرقام: التركيز على الكلمة تيفيناغ (ⵢⴰⵏ )
660
+ mainWordDisplay = currentItem.transliteration;
661
+ secondaryText = `الرقم: ${currentItem.main} | ${currentItem.word}`; // الرقم (1) والكلمة العربية (واحد)
662
+ } else if (isStoriesCategory) {
663
+ // للقصص: العنوان والنص المختصر
664
+ mainWordDisplay = currentItem.main; // العنوان
665
+ secondaryText = currentItem.word.substring(0, 100) + '... (اضغط لتسجيل قراءتك)';
666
+ }
667
+ else {
668
+ // للمحاور الأخرى: التركيز على الكلمة تيفيناغ (ⴰⵎⵓⵛⵛ)
669
+ mainWordDisplay = currentItem.main;
670
+ secondaryText = currentItem.word; // الكلمة العربية (قط)
671
+ }
672
+
673
+ // إنشاء عنصر الزاوية الشرطي (فقط للحروف)
674
+ const cornerElementHTML = isLettersCategory ? `
675
+ <div class="absolute top-0 right-0 p-3 bg-white/20 backdrop-blur-sm rounded-tr-3xl rounded-bl-3xl shadow-md text-white">
676
+ <h2 class="font-black text-4xl icon-shadow">
677
+ ${currentItem.main}
678
+ </h2>
679
+ </div>
680
+ ` : '';
681
+
682
 
683
  content.innerHTML = `
684
+ <div class="p-4 flex flex-col items-center justify-between min-h-[calc(100vh-130px)] bg-gray-50">
685
 
686
+ <div class="w-full bg-gradient-to-br ${mainCardGradient} rounded-3xl p-4 sm:p-6 shadow-2xl mt-2 flex flex-col justify-center items-center relative">
687
 
688
+ ${cornerElementHTML}
 
 
 
 
 
 
 
689
 
690
+ <h2 class="text-white text-2xl font-bold mb-4 drop-shadow-md mt-6">${categoryMeta.title}</h2>
691
+
692
+ <div class="flex items-center justify-center w-full p-3 mb-4">
693
+ ${illustrationContent}
 
 
 
 
 
 
 
694
  </div>
695
 
696
+ <div class="mt-1 text-center text-white">
697
+ <p class="text-4xl font-black mb-1 drop-shadow-lg leading-tight">${mainWordDisplay}</p>
698
+ <p class="text-base font-medium opacity-80 italic drop-shadow-sm">
699
+ ${secondaryText}
700
+ </p>
 
 
 
 
701
  </div>
 
 
 
 
 
702
  </div>
 
 
 
703
 
704
+ <div class="w-full mt-4 bg-white p-4 rounded-xl shadow-lg flex items-center gap-3">
705
+ <button onclick="playAudio()" class="p-2 rounded-full bg-green-100 hover:bg-green-200 transition-colors" aria-label="تشغيل الصوت">
706
+ ${renderIcon('Volume2', 'w-7 h-7 text-green-600 flex-shrink-0', 3)}
 
 
 
 
 
 
 
 
 
 
 
707
  </button>
708
+ <div class="flex-grow">
709
+ <p class="text-sm text-gray-700 font-bold">استمع إلى النطق</p>
710
+ <p class="text-xs text-gray-500 mt-1 text-left">${currentItem.audioUrl ? 'ملف الصوت متوفر' : 'ملف الصوت غير متوفر'}</p>
711
+ </div>
712
+
713
+ <p class="text-sm text-blue-800 font-bold flex-shrink-0">
714
+ ${isStoriesCategory ? 'تسجيل قراءة' : 'نطق'}
715
+ </p>
716
  </div>
 
 
 
717
 
718
+ <div class="flex justify-around w-full mt-4 mb-4">
719
+ <button onclick="handlePrev()" class="control-btn bg-green-500 hover:bg-green-600 shadow-xl shadow-green-300/70" aria-label="العنصر السابق">
720
+ ${renderIcon('ChevronRight', 'w-8 h-8 text-white', 3)}
721
+ </button>
722
 
723
+ <button onclick="console.log('Microphone Activated!')" class="control-btn p-6 bg-red-500 hover:bg-red-600 shadow-2xl shadow-red-400/70" aria-label="تسجيل النطق">
724
+ ${renderIcon('Mic', 'w-10 h-10 text-white', 3)}
725
+ </button>
 
 
 
 
 
 
 
 
 
 
 
 
726
 
727
+ <button onclick="handleNext()" class="control-btn bg-blue-500 hover:bg-blue-600 shadow-xl shadow-blue-300/70" aria-label="العنصر التالي">
728
+ ${renderIcon('ChevronLeft', 'w-8 h-8 text-white', 3)}
729
+ </button>
 
730
  </div>
731
  </div>
732
  `;