File size: 21,316 Bytes
d919708
 
 
1b86d8a
 
 
 
 
 
 
58b8f48
1b86d8a
87b09dd
 
 
 
 
 
 
 
 
 
 
 
1b86d8a
 
 
b5a1241
1b86d8a
 
 
 
 
 
b5a1241
1b86d8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b5a1241
1b86d8a
 
 
 
58b8f48
 
 
1b86d8a
58b8f48
1b86d8a
58b8f48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1b86d8a
58b8f48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d919708
58b8f48
 
1b86d8a
58b8f48
 
 
1b86d8a
 
b5a1241
58b8f48
1b86d8a
58b8f48
1b86d8a
 
 
58b8f48
 
 
 
 
 
 
 
 
b5a1241
58b8f48
 
 
 
1b86d8a
 
 
58b8f48
1b86d8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58b8f48
 
 
1b86d8a
58b8f48
 
1b86d8a
58b8f48
 
1b86d8a
58b8f48
1b86d8a
58b8f48
d919708
58b8f48
 
1b86d8a
58b8f48
 
1b86d8a
58b8f48
1b86d8a
58b8f48
8f6aeec
58b8f48
1b86d8a
 
 
 
 
 
 
 
d919708
58b8f48
d919708
58b8f48
 
 
1b86d8a
58b8f48
 
1b86d8a
 
58b8f48
 
 
1b86d8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58b8f48
 
 
 
 
 
 
 
b5a1241
58b8f48
1b86d8a
 
58b8f48
 
 
 
 
1b86d8a
58b8f48
 
 
 
 
 
 
 
 
 
 
 
 
d919708
58b8f48
 
 
1b86d8a
58b8f48
 
 
 
 
 
 
 
1b86d8a
58b8f48
 
 
 
 
 
 
 
1b86d8a
58b8f48
 
 
 
 
 
 
 
1b86d8a
58b8f48
 
 
 
 
 
 
1b86d8a
 
 
58b8f48
 
 
87b09dd
 
 
58b8f48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1b86d8a
58b8f48
 
 
 
 
 
 
 
 
 
 
1b86d8a
 
 
 
 
 
87b09dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58b8f48
d919708
 
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
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="MGZon Chatbot – AI-powered assistant for code generation, web search, and e-commerce solutions by Mark Al-Asfar from Alexandria, Egypt.">
  <meta name="keywords" content="MGZon Chatbot, AI assistant, code generation, e-commerce, Mark Al-Asfar, 
United States, FastAPI, Gradio">
  <meta name="author" content="Mark Al-Asfar">
  <meta name="robots" content="index, follow">
  <title>MGZon Chatbot – Powered by AI</title>
  <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<!-- manifest for Android/Chrome -->
<link rel="manifest" href="/static/manifest.json">

<!-- iOS Web App Support -->
<link rel="apple-touch-icon" sizes="180x180" href="/static/images/icons/mg-180.png">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="MGZon">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">

<!-- General Theme -->
<meta name="theme-color" content="#2d3748">

  <!-- Open Graph -->
  <meta property="og:title" content="MGZon Chatbot – AI-Powered Solutions">
  <meta property="og:description" content="Explore MGZon Chatbot for code generation, web search, and e-commerce solutions by Mark Al-Asfar.">
  <meta property="og:image" content="/static/images/mg.svg">
  <meta property="og:url" content="https://mgzon-mgzon-app.hf.space/">
  <meta property="og:type" content="website">
  <!-- Twitter Card -->
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:title" content="MGZon Chatbot – AI-Powered Solutions">
  <meta name="twitter:description" content="Explore MGZon Chatbot for code generation, web search, and e-commerce solutions by Mark Al-Asfar.">
  <meta name="twitter:image" content="/static/images/mg.svg">
  <!-- JSON-LD -->
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "name": "MGZon Chatbot",
  "url": "https://mgzon-mgzon-app.hf.space/",
  "description": "MGZon Chatbot by Mark Al-Asfar: Your AI assistant for code generation, real-time web search, and e-commerce solutions.",
  "keywords": ["MGZon Chatbot", "AI chatbot", "Code generation AI", "E-commerce AI solutions", "Mark Al-Asfar", "AI assistant for developers", "FastAPI chatbot", "Real-time web search AI", "MGZon AI", "Python AI chatbot", "AI for coding", "E-commerce automation", "Hugging Face AI", "2025 AI trends", "chatgpt", "grok", "deepseek", "text generation"],
  "potentialAction": {
    "@type": "SearchAction",
    "target": "https://mgzon-mgzon-app.hf.space/?q={search_term_string}",
    "query-input": "required name=search_term_string"
  },
  "publisher": {
    "@type": "Organization",
    "name": "MGZon AI",
    "logo": {
      "@type": "ImageObject",
      "url": "/static/images/mg.svg"
    }
  }
}
</script>
  <!-- Tailwind (v3) -->
  <script src="https://cdn.tailwindcss.com"></script>
  <!-- Boxicons -->
  <link href="https://cdn.jsdelivr.net/npm/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
  <!-- Prism (for code highlighting) -->
  <link href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism.min.css" rel="stylesheet">
  <script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/prism.min.js"></script>
  <style>
    @keyframes gradientShift {
      0% { background-position: 0% 50%; }
      50% { background-position: 100% 50%; }
      100% { background-position: 0% 50%; }
    }
    body {
      background: linear-gradient(135deg, #0f172a, #0e7490, #065f46, #064e3b);
      background-size: 400% 400%;
      animation: gradientShift 15s ease infinite;
      font-family: system-ui, sans-serif;
    }
    .glass {
      background: rgba(255, 255, 255, 0.07);
      border-radius: 1rem;
      border: 1px solid rgba(255, 255, 255, 0.12);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }
    .sidebar {
      transition: transform 0.3s ease-in-out;
    }
    .sidebar.collapsed .logo {
      opacity: 0;
      transition: opacity 0.2s ease;
    }
    .main-content {
      min-height: calc(100vh - 4rem);
    }
    .loading {
      display: inline-block;
      width: 1rem;
      height: 1rem;
      border: 2px solid currentColor;
      border-top-color: transparent;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
      margin-left: 0.5rem;
    }
    @keyframes spin {
      to { transform: rotate(360deg); }
    }
    .glass:hover {
      transform: scale(1.05);
      box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
      background: rgba(255, 255, 255, 0.15);
    }
    @media (max-width: 768px) {
      .sidebar {
        transform: translateX(-100%);
      }
      .sidebar.active {
        transform: translateX(0);
      }
    }
  </style>
</head>
<body class="text-white flex flex-col min-h-screen">
  <!-- Mobile toggle button -->
  <button id="sidebarToggle" class="md:hidden fixed top-4 left-4 z-50 p-2 text-2xl text-white rounded bg-gray-800/60 hover:bg-gray-700/80 transition" aria-label="Toggle navigation">
    <i class="bx bx-menu"></i>
  </button>
  <!-- Sidebar -->
  <aside id="sidebar" class="sidebar fixed inset-y-0 left-0 w-64 bg-gradient-to-b from-teal-800 to-emerald-900 p-6 flex flex-col overflow-y-auto z-40">
    <button id="closeSidebar" class="md:hidden text-white text-2xl absolute top-4 right-4" aria-label="Close sidebar"></button>
    <img src="/static/images/mg.svg" alt="MGZon Logo" class="logo w-20 h-20 mx-auto mb-8 animate-pulse">
    <nav class="flex flex-col gap-3">
      <a href="/" class="px-4 py-2 rounded-lg bg-emerald-600">Home</a>
      <a href="/docs" class="px-4 py-2 rounded-lg hover:bg-emerald-600 transition">API Documentation</a>
      <a href="/about" class="px-4 py-2 rounded-lg hover:bg-emerald-600 transition">About MGZon</a>
      <a href="/login" class="px-4 py-2 rounded-lg hover:bg-emerald-600 transition">Login</a>
      <a href="/register" class="px-4 py-2 rounded-lg hover:bg-emerald-600 transition">Register</a>
      <a href="https://hager-zon.vercel.app/community" class="px-4 py-2 rounded-lg hover:bg-emerald-600 transition">Community</a>
      <a href="https://mark-elasfar.web.app/" target="_blank" class="px-4 py-2 rounded-lg hover:bg-emerald-600 transition">Mark Al-Asfar</a>
    </nav>
  </aside>
  <!-- Main content -->
  <main class="flex-1 md:ml-64 p-6 main-content">
    <section class="container max-w-6xl mx-auto">
      <!-- Hero -->
      <div class="text-center py-12">
        <img src="/static/images/mg.svg" alt="MGZon Logo" class="w-32 h-32 mx-auto mb-6 animate-bounce">
        <h1 class="text-5xl font-bold mb-4 bg-clip-text text-transparent bg-gradient-to-r from-teal-300 to-emerald-400">
          Welcome to MGZon Chatbot 🚀
        </h1>
        <p class="text-lg max-w-2xl mx-auto mb-8">
          MGZon Chatbot is an AI-powered assistant for code generation, web search, and e-commerce solutions. Built with Gradio and FastAPI by Mark Al-Asfar from 
United States. Ready to code smarter and shop better?
  Discover MGZon Chatbot, an AI-powered assistant by Mark Al-Asfar for code generation, real-time web search, and e-commerce automation. Built with FastAPI and Hugging Face AI, MGZon rivals tools like ChatGPT, Grok, and DeepSeek.
        </p>
        {% if user %}
          <div class="flex justify-center gap-4">
            <a href="/chat" id="launchBtn" class="inline-flex items-center bg-gradient-to-r from-emerald-500 to-teal-600 text-white px-8 py-4 rounded-full text-lg font-semibold hover:scale-105 transition-transform shadow-lg hover:shadow-xl">
              Launch Chatbot <i class="bx bx-rocket ml-2"></i>
              <span id="spinner" class="loading hidden"></span>
            </a>
            <a href="/auth/jwt/logout" class="inline-flex items-center bg-gradient-to-r from-red-500 to-orange-600 text-white px-8 py-4 rounded-full text-lg font-semibold hover:scale-105 transition-transform shadow-lg hover:shadow-xl">
              Logout <i class="bx bx-log-out ml-2"></i>
            </a>
          </div>
        {% else %}
          <div class="flex justify-center gap-4">
            <a href="/login" class="inline-flex items-center bg-gradient-to-r from-blue-500 to-cyan-600 text-white px-8 py-4 rounded-full text-lg font-semibold hover:scale-105 transition-transform shadow-lg hover:shadow-xl">
              Login <i class="bx bx-log-in ml-2"></i>
            </a>
            <a href="/register" class="inline-flex items-center bg-gradient-to-r from-emerald-500 to-teal-600 text-white px-8 py-4 rounded-full text-lg font-semibold hover:scale-105 transition-transform shadow-lg hover:shadow-xl">
              Sign Up <i class="bx bx-user-plus ml-2"></i>
            </a>
          </div>
        {% endif %}
      </div>
      <!-- Features -->
      <section class="my-12">
        <h2 class="text-3xl font-bold text-center mb-8">Why Choose MGZon?</h2>
        <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
          <div class="glass p-6 relative group cursor-pointer" onclick="showCardDetails('code-generation')">
            <button class="absolute top-2 right-2 text-gray-300 hover:text-white transition" onclick="event.stopPropagation(); closeCardDetails('code-generation')" aria-label="Close card">&times;</button>
            <i class="bx bx-code-alt text-4xl text-emerald-300 mb-4"></i>
            <h3 class="text-xl font-semibold mb-2">Code Generation</h3>
            <p>Generate clean, well-commented code for React, Django, Flask, Node.js, and more.</p>
            <div id="code-generation-details" class="hidden mt-4 p-4 bg-gray-700/80 rounded-lg">
              <p>Supports multiple frameworks with examples and best practices for seamless integration.</p>
              <button onclick="closeCardDetails('code-generation')" class="bg-emerald-500 text-white px-4 py-2 rounded-lg mt-2">Close</button>
            </div>
          </div>
          <div class="glass p-6 relative group cursor-pointer" onclick="showCardDetails('web-search')">
            <button class="absolute top-2 right-2 text-gray-300 hover:text-white transition" onclick="event.stopPropagation(); closeCardDetails('web-search')" aria-label="Close card">&times;</button>
            <i class="bx bx-search text-4xl text-emerald-300 mb-4"></i>
            <h3 class="text-xl font-semibold mb-2">Web Search</h3>
            <p>Real-time web search for MGZon queries and industry insights.</p>
            <div id="web-search-details" class="hidden mt-4 p-4 bg-gray-700/80 rounded-lg">
              <p>Get up-to-date answers and insights tailored to your needs.</p>
              <button onclick="closeCardDetails('web-search')" class="bg-emerald-500 text-white px-4 py-2 rounded-lg mt-2">Close</button>
            </div>
          </div>
          <div class="glass p-6 relative group cursor-pointer" onclick="showCardDetails('ecommerce')">
            <button class="absolute top-2 right-2 text-gray-300 hover:text-white transition" onclick="event.stopPropagation(); closeCardDetails('ecommerce')" aria-label="Close card">&times;</button>
            <i class="bx bx-cart text-4xl text-emerald-300 mb-4"></i>
            <h3 class="text-xl font-semibold mb-2">E-commerce Solutions</h3>
            <p>AI-driven tools to optimize your online store and boost sales.</p>
            <div id="ecommerce-details" class="hidden mt-4 p-4 bg-gray-700/80 rounded-lg">
              <p>From product recommendations to inventory management, MGZon enhances your e-commerce experience.</p>
              <button onclick="closeCardDetails('ecommerce')" class="bg-emerald-500 text-white px-4 py-2 rounded-lg mt-2">Close</button>
            </div>
          </div>
        </div>
      </section>
      <!-- News -->
      <section class="my-12">
        <h2 class="text-3xl font-bold text-center mb-8">Latest MGZon Updates</h2>
        <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
          <div class="glass p-6">
            <h3 class="text-xl font-semibold mb-2">New AI Features</h3>
            <p>Explore our latest AI updates for smarter code and e-commerce tools.</p>
            <a href="https://hager-zon.vercel.app/blog" target="_blank" class="text-emerald-300 hover:underline">Read More →</a>
          </div>
          <div class="glass p-6">
            <h3 class="text-xl font-semibold mb-2">Global Expansion</h3>
            <p>New warehouses in the USA, Canada, and China to serve you better.</p>
            <a href="https://hager-zon.vercel.app/community" target="_blank" class="text-emerald-300 hover:underline">Learn More →</a>
          </div>
        </div>
      </section>
      <!-- Testimonials -->
      <section class="my-12">
        <h2 class="text-3xl font-bold text-center mb-8">What Our Users Say</h2>
        <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
          <div class="glass p-6">
            <p class="mb-4">"MGZon Chatbot transformed how I code. The AI-generated snippets are accurate and save hours!"</p>
            <p class="font-semibold">– Ahmed, Developer</p>
          </div>
          <div class="glass p-6">
            <p class="mb-4">"The e-commerce tools helped me optimize my store and boost sales by 30%."</p>
            <p class="font-semibold">– Sarah, Store Owner</p>
          </div>
        </div>
      </section>
    </section>
  </main>
  <!-- Footer -->
  <footer class="bg-gradient-to-r from-teal-900 to-emerald-900 py-12 mt-8">
    <div class="container max-w-6xl mx-auto text-center">
     <img src="/static/images/mg.svg" alt="MGZon Chatbot Logo by Mark Al-Asfar" class="w-32 h-32 mx-auto mb-6 animate-bounce">
      <p class="mb-4">
        Developed by <a href="https://mark-elasfar.web.app/" target="_blank" class="text-emerald-300 hover:underline">Mark Al-Asfar</a>
        | Powered by <a href="https://hager-zon.vercel.app/" target="_blank" class="text-emerald-300 hover:underline">MGZon AI</a>
      </p>
      <div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-6">
        <div class="glass p-4 cursor-pointer" onclick="showCardDetails('email')">
          <i class="bx bx-mail-send text-3xl text-emerald-300 mb-2"></i>
          <h4 class="font-semibold mb-1">Email Us</h4>
          <p><a href="mailto:support@mgzon.com" class="text-emerald-300 hover:underline">support@mgzon.com</a></p>
          <div id="email-details" class="hidden mt-4 p-4 bg-gray-700/80 rounded-lg">
            <p>Reach out to our support team for any inquiries or assistance.</p>
            <button onclick="closeCardDetails('email')" class="bg-emerald-500 text-white px-4 py-2 rounded-lg mt-2">Close</button>
          </div>
        </div>
        <div class="glass p-4 cursor-pointer" onclick="showCardDetails('phone')">
          <i class="bx bx-phone text-3xl text-emerald-300 mb-2"></i>
          <h4 class="font-semibold mb-1">Phone Support</h4>
          <p>+1-800-123-4567</p>
          <div id="phone-details" class="hidden mt-4 p-4 bg-gray-700/80 rounded-lg">
            <p>Contact our support team via phone for immediate assistance.</p>
            <button onclick="closeCardDetails('phone')" class="bg-emerald-500 text-white px-4 py-2 rounded-lg mt-2">Close</button>
          </div>
        </div>
        <div class="glass p-4 cursor-pointer" onclick="showCardDetails('community')">
          <i class="bx bx-group text-3xl text-emerald-300 mb-2"></i>
          <h4 class="font-semibold mb-1">Community</h4>
          <p><a href="https://hager-zon.vercel.app/community" class="text-emerald-300 hover:underline">Join us</a></p>
          <div id="community-details" class="hidden mt-4 p-4 bg-gray-700/80 rounded-lg">
            <p>Join our vibrant community to share ideas and collaborate.</p>
            <button onclick="closeCardDetails('community')" class="bg-emerald-500 text-white px-4 py-2 rounded-lg mt-2">Close</button>
          </div>
        </div>
        <div class="glass p-4 cursor-pointer" onclick="showCardDetails('api-docs')">
          <i class="bx bx-code-alt text-3xl text-emerald-300 mb-2"></i>
          <h4 class="font-semibold mb-1">API Docs</h4>
          <p><a href="/docs" class="text-emerald-300 hover:underline">Explore Docs</a></p>
          <div id="api-docs-details" class="hidden mt-4 p-4 bg-gray-700/80 rounded-lg">
            <p>Explore our API documentation for seamless integration.</p>
            <button onclick="closeCardDetails('api-docs')" class="bg-emerald-500 text-white px-4 py-2 rounded-lg mt-2">Close</button>
          </div>
        </div>
        <div class="glass p-4 cursor-pointer" onclick="showCardDetails('faq')">
          <i class="bx bx-help-circle text-3xl text-emerald-300 mb-2"></i>
          <h4 class="font-semibold mb-1">FAQ</h4>
          <p><a href="https://hager-zon.vercel.app/faq" target="_blank" class="text-emerald-300 hover:underline">Read FAQ</a></p>
          <div id="faq-details" class="hidden mt-4 p-4 bg-gray-700/80 rounded-lg">
            <p>Find answers to common questions in our FAQ section.</p>
            <button onclick="closeCardDetails('faq')" class="bg-emerald-500 text-white px-4 py-2 rounded-lg mt-2">Close</button>
          </div>
        </div>
        <div class="glass p-4 cursor-pointer" onclick="showCardDetails('docs')">
          <i class="bx bx-book text-3xl text-emerald-300 mb-2"></i>
          <h4 class="font-semibold mb-1">Documentation</h4>
          <p><a href="/docs" class="text-emerald-300 hover:underline">Full Docs</a></p>
          <div id="docs-details" class="hidden mt-4 p-4 bg-gray-700/80 rounded-lg">
            <p>Access comprehensive documentation for MGZon Chatbot.</p>
            <button onclick="closeCardDetails('docs')" class="bg-emerald-500 text-white px-4 py-2 rounded-lg mt-2">Close</button>
          </div>
        </div>
      </div>
      <div class="flex justify-center gap-6 mt-6">
        <a href="https://github.com/Mark-Lasfar/MGZon" class="text-2xl text-white hover:text-emerald-300 transition"><i class="bx bxl-github"></i></a>
        <a href="https://x.com/MGZon" class="text-2xl text-white hover:text-emerald-300 transition"><i class="bx bxl-twitter"></i></a>
        <a href="https://www.facebook.com/people/Mark-Al-Asfar/pfbid02GMisUQ8AqWkNZjoKtWFHH1tbdHuVscN1cjcFnZWy9HkRaAsmanBfT6mhySAyqpg4l/" class="text-2xl text-white hover:text-emerald-300 transition"><i class="bx bxl-facebook"></i></a>
      </div>
      <p class="mt-6">© 2025 Mark Al-Asfar & MGZon AI. All rights reserved.</p>
    </div>
        <button id="installAppBtn" style="display: none;" class="fixed bottom-4 right-4 bg-blue-600 text-white px-4 py-2 rounded shadow-lg z-50">
      📲 Install MG Chat
    </button>
  </footer>
  <script>
    const sidebar = document.getElementById('sidebar');
    const toggleBtn = document.getElementById('sidebarToggle');
    const closeSidebarBtn = document.getElementById('closeSidebar');
    toggleBtn.addEventListener('click', () => {
      sidebar.classList.toggle('active');
      sidebar.classList.toggle('-translate-x-full');
      sidebar.classList.toggle('translate-x-0');
    });
    closeSidebarBtn.addEventListener('click', () => {
      sidebar.classList.remove('active');
      sidebar.classList.add('-translate-x-full');
      sidebar.classList.remove('translate-x-0');
    });
    document.addEventListener('click', (e) => {
      if (!sidebar.contains(e.target) && !toggleBtn.contains(e.target) && window.innerWidth < 768) {
        sidebar.classList.remove('active');
        sidebar.classList.add('-translate-x-full');
        sidebar.classList.remove('translate-x-0');
      }
    });
    function showCardDetails(cardId) {
      document.getElementById(`${cardId}-details`).classList.remove('hidden');
    }
    function closeCardDetails(cardId) {
      document.getElementById(`${cardId}-details`).classList.add('hidden');
    }
    const launchBtn = document.getElementById('launchBtn');
    const spinner = document.getElementById('spinner');
    launchBtn.addEventListener('click', (e) => {
      spinner.classList.remove('hidden');
      setTimeout(() => spinner.classList.add('hidden'), 2000);
    });
    
    if ('serviceWorker' in navigator) {
    navigator.serviceWorker.register('/static/js/sw.js')
      .then(function(reg) {
        console.log('✅ Service Worker Registered', reg);
      }).catch(function(err) {
        console.error('❌ Service Worker registration failed', err);
      });
  }

  // التعامل مع حدث beforeinstallprompt لتثبيت التطبيق
  let deferredPrompt;
  window.addEventListener('beforeinstallprompt', (e) => {
    e.preventDefault();
    deferredPrompt = e;
    const installBtn = document.getElementById('installAppBtn');
    if (installBtn) {
      installBtn.style.display = 'block';

      installBtn.addEventListener('click', () => {
        deferredPrompt.prompt();
        deferredPrompt.userChoice.then(choice => {
          if (choice.outcome === 'accepted') {
            console.log('✅ User accepted the install prompt');
          } else {
            console.log('❌ User dismissed the install prompt');
          }
          deferredPrompt = null;
        });
      });
    }
  });
  </script>
</body>
</html>