Ahmad140 commited on
Commit
f69b06b
·
verified ·
1 Parent(s): 82d9792

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +393 -45
index.html CHANGED
@@ -1,69 +1,381 @@
1
  <!DOCTYPE html>
2
- <html lang="ur">
3
  <head>
4
  <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Elite Visuals AI Assistant</title>
 
7
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
 
 
8
  <style>
9
- * { margin: 0; padding: 0; box-sizing: border-box; }
10
- body { background: white; height: 100vh; width: 100%; }
11
- .chat-icon { position: fixed; bottom: 25px; right: 25px; width: 60px; height: 60px; background-color: #25D366; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.2); transition: 0.3s; z-index: 1000; }
12
- .chat-icon:hover { transform: scale(1.1); background-color: #128C7E; }
13
- .chat-icon i { font-size: 30px; color: white; }
14
- .chat-modal { position: fixed; bottom: 100px; right: 25px; width: 350px; height: 500px; background: white; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.3); display: none; flex-direction: column; overflow: hidden; z-index: 1001; border: 1px solid #ddd; }
15
- .chat-header { background: #075E54; color: white; padding: 12px; font-weight: bold; display: flex; justify-content: space-between; }
16
- .chat-messages { flex: 1; padding: 10px; overflow-y: auto; background: #ECE5DD; display: flex; flex-direction: column; }
17
- .message { margin: 8px 0; padding: 8px 12px; border-radius: 10px; max-width: 80%; white-space: pre-line; line-height: 1.4; }
18
- .user-msg { background: #DCF8C6; margin-left: auto; text-align: right; }
19
- .bot-msg { background: white; margin-right: auto; }
20
- .questions-container { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; justify-content: flex-start; }
21
- .question-bubble { background: #e4e6eb; color: #050505; padding: 6px 12px; border-radius: 18px; font-size: 12px; cursor: pointer; transition: 0.2s; }
22
- .question-bubble:hover { background: #d1d3d8; transform: scale(1.02); }
23
- .chat-input-area { display: flex; padding: 10px; background: #f0f0f0; }
24
- .chat-input-area input { flex: 1; padding: 8px; border: 1px solid #ccc; border-radius: 20px; outline: none; }
25
- .chat-input-area button { margin-left: 8px; background: #25D366; border: none; color: white; border-radius: 50%; width: 36px; height: 36px; cursor: pointer; }
26
- .close-btn { cursor: pointer; background: none; border: none; color: white; font-size: 18px; }
27
- .typing-indicator { background: white; padding: 8px 12px; border-radius: 10px; display: inline-block; margin: 8px 0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  </style>
29
  </head>
30
  <body>
 
 
31
  <div class="chat-icon" id="chatIcon">
32
  <i class="fas fa-comment-dots"></i>
33
  </div>
 
 
34
  <div class="chat-modal" id="chatModal">
35
  <div class="chat-header">
36
- <span>Elite Visuals AI 🤖</span>
37
  <button class="close-btn" id="closeChat"><i class="fas fa-times"></i></button>
38
  </div>
39
  <div class="chat-messages" id="chatMessages">
40
- <div class="message bot-msg">Assalam-o-Alaikum! Main Elite Visuals ka assistant hoon. Main aapki premium imagery services mein madad kar sakta hoon.</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  <div id="defaultQuestionsContainer" class="questions-container"></div>
42
  </div>
43
  <div class="chat-input-area">
44
- <input type="text" id="userInput" placeholder="Apna sawal likhein...">
45
  <button id="sendBtn"><i class="fas fa-paper-plane"></i></button>
46
  </div>
47
  </div>
 
48
  <script>
49
- // Generate or retrieve session ID from localStorage
50
  let sessionId = localStorage.getItem('chat_session_id');
51
  if (!sessionId) {
52
  sessionId = 'user_' + Date.now() + '_' + Math.random().toString(36).substr(2, 8);
53
  localStorage.setItem('chat_session_id', sessionId);
54
  }
55
- console.log('Session ID:', sessionId);
56
-
57
  const API_URL = "/api/chat";
 
 
58
  const DEFAULT_QUESTIONS = [
59
- "Aapke contact number kya hai?",
60
- "Product photography ki price kya hai?",
61
- "Portfolio kahan dekh sakta hoon?",
62
- "Kya aap drone videography karte hain?",
63
- "Wedding photography karte ho?",
64
- "Architecture rendering ka sample chahiye"
 
65
  ];
66
-
 
67
  const chatIcon = document.getElementById('chatIcon');
68
  const chatModal = document.getElementById('chatModal');
69
  const closeChat = document.getElementById('closeChat');
@@ -72,17 +384,42 @@
72
  const chatMessages = document.getElementById('chatMessages');
73
  const questionsContainer = document.getElementById('defaultQuestionsContainer');
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  function renderQuestionBubbles() {
76
  questionsContainer.innerHTML = '';
77
  DEFAULT_QUESTIONS.forEach(q => {
78
  const bubble = document.createElement('div');
79
  bubble.className = 'question-bubble';
80
  bubble.innerText = q;
81
- bubble.onclick = () => { userInput.value = q; sendMessage(); };
 
 
 
82
  questionsContainer.appendChild(bubble);
83
  });
84
  }
85
-
 
86
  function addMessage(text, sender) {
87
  const div = document.createElement('div');
88
  div.className = `message ${sender === 'user' ? 'user-msg' : 'bot-msg'}`;
@@ -90,20 +427,25 @@
90
  chatMessages.appendChild(div);
91
  chatMessages.scrollTop = chatMessages.scrollHeight;
92
  }
93
-
 
94
  let typingDiv = null;
95
  function showTyping() {
96
  if (typingDiv) return;
97
  typingDiv = document.createElement('div');
98
- typingDiv.className = 'message bot-msg typing-indicator';
99
- typingDiv.innerText = '🤔 Soch raha hoon...';
100
  chatMessages.appendChild(typingDiv);
101
  chatMessages.scrollTop = chatMessages.scrollHeight;
102
  }
103
  function hideTyping() {
104
- if (typingDiv) { typingDiv.remove(); typingDiv = null; }
 
 
 
105
  }
106
-
 
107
  async function sendMessage() {
108
  const msg = userInput.value.trim();
109
  if (!msg) return;
@@ -122,14 +464,20 @@
122
  addMessage(data.reply, 'bot');
123
  } catch (err) {
124
  hideTyping();
125
- addMessage("❌ Server error: Kuch galat ho gaya. Baad mein try karein.", 'bot');
 
126
  }
127
  }
128
-
129
- chatIcon.onclick = () => { chatModal.style.display = 'flex'; if (questionsContainer.children.length === 0) renderQuestionBubbles(); };
 
 
 
 
130
  closeChat.onclick = () => chatModal.style.display = 'none';
131
  sendBtn.onclick = sendMessage;
132
  userInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') sendMessage(); });
 
133
  renderQuestionBubbles();
134
  </script>
135
  </body>
 
1
  <!DOCTYPE html>
2
+ <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
6
+ <title>Elite Visuals AI | Smart Assistant</title>
7
+ <!-- Font Awesome 6 -->
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
9
+ <!-- Google Fonts -->
10
+ <link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600;14..32,700&display=swap" rel="stylesheet">
11
  <style>
12
+ * {
13
+ margin: 0;
14
+ padding: 0;
15
+ box-sizing: border-box;
16
+ }
17
+ body {
18
+ background: linear-gradient(135deg, #f5f7fa 0%, #e9eef5 100%);
19
+ font-family: 'Inter', sans-serif;
20
+ height: 100vh;
21
+ width: 100%;
22
+ overflow-x: hidden;
23
+ }
24
+ /* --- Floating Chat Icon (pulse) --- */
25
+ .chat-icon {
26
+ position: fixed;
27
+ bottom: 28px;
28
+ right: 28px;
29
+ width: 64px;
30
+ height: 64px;
31
+ background: linear-gradient(145deg, #25D366, #128C7E);
32
+ border-radius: 50%;
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ cursor: pointer;
37
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(37, 211, 102, 0.5);
38
+ transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
39
+ z-index: 1000;
40
+ animation: pulse 1.8s infinite;
41
+ }
42
+ @keyframes pulse {
43
+ 0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
44
+ 70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
45
+ 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
46
+ }
47
+ .chat-icon:hover {
48
+ transform: scale(1.08) rotate(5deg);
49
+ background: linear-gradient(145deg, #20b859, #0e6b5e);
50
+ box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
51
+ }
52
+ .chat-icon i { font-size: 32px; color: white; }
53
+
54
+ /* --- Chat Modal --- */
55
+ .chat-modal {
56
+ position: fixed;
57
+ bottom: 100px;
58
+ right: 28px;
59
+ width: 400px;
60
+ height: 620px;
61
+ background: rgba(255, 255, 255, 0.98);
62
+ backdrop-filter: blur(10px);
63
+ border-radius: 28px;
64
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
65
+ display: none;
66
+ flex-direction: column;
67
+ overflow: hidden;
68
+ z-index: 1001;
69
+ animation: slideUpFade 0.3s ease-out;
70
+ }
71
+ @keyframes slideUpFade {
72
+ from { opacity: 0; transform: translateY(30px) scale(0.95); }
73
+ to { opacity: 1; transform: translateY(0) scale(1); }
74
+ }
75
+ .chat-header {
76
+ background: linear-gradient(135deg, #075E54, #0b3b32);
77
+ color: white;
78
+ padding: 16px 20px;
79
+ display: flex;
80
+ justify-content: space-between;
81
+ align-items: center;
82
+ }
83
+ .chat-header h3 {
84
+ font-weight: 600;
85
+ font-size: 1.1rem;
86
+ display: flex;
87
+ align-items: center;
88
+ gap: 8px;
89
+ }
90
+ .close-btn {
91
+ background: rgba(255,255,255,0.2);
92
+ border: none;
93
+ color: white;
94
+ width: 32px;
95
+ height: 32px;
96
+ border-radius: 50%;
97
+ cursor: pointer;
98
+ transition: 0.2s;
99
+ }
100
+ .close-btn:hover {
101
+ background: rgba(255,255,255,0.4);
102
+ transform: rotate(90deg);
103
+ }
104
+ .chat-messages {
105
+ flex: 1;
106
+ padding: 16px;
107
+ overflow-y: auto;
108
+ background: #f0f2f5;
109
+ display: flex;
110
+ flex-direction: column;
111
+ gap: 12px;
112
+ }
113
+ /* --- Service Info Widget (Collapsible, inside chat) --- */
114
+ .service-widget {
115
+ background: white;
116
+ border-radius: 20px;
117
+ margin-bottom: 8px;
118
+ overflow: hidden;
119
+ box-shadow: 0 2px 8px rgba(0,0,0,0.05);
120
+ transition: all 0.2s;
121
+ }
122
+ .widget-header {
123
+ background: linear-gradient(135deg, #1e2a3a, #0f172a);
124
+ color: white;
125
+ padding: 12px 16px;
126
+ display: flex;
127
+ justify-content: space-between;
128
+ align-items: center;
129
+ cursor: pointer;
130
+ font-weight: 600;
131
+ }
132
+ .widget-header i {
133
+ transition: transform 0.2s;
134
+ }
135
+ .widget-content {
136
+ padding: 16px;
137
+ display: none;
138
+ background: #ffffff;
139
+ border-top: 1px solid #e2e8f0;
140
+ max-height: 350px;
141
+ overflow-y: auto;
142
+ }
143
+ .widget-content.show {
144
+ display: block;
145
+ }
146
+ .package-card {
147
+ background: #f8fafc;
148
+ border-radius: 16px;
149
+ padding: 12px;
150
+ margin-bottom: 12px;
151
+ border-left: 4px solid #25D366;
152
+ }
153
+ .package-card h4 {
154
+ margin: 0 0 6px 0;
155
+ color: #075E54;
156
+ }
157
+ .package-card p {
158
+ font-size: 0.8rem;
159
+ margin: 4px 0;
160
+ }
161
+ .extra-note {
162
+ background: #fff3cd;
163
+ padding: 10px;
164
+ border-radius: 12px;
165
+ font-size: 0.8rem;
166
+ border-left: 4px solid #ffc107;
167
+ margin-top: 8px;
168
+ }
169
+ .service-list {
170
+ display: flex;
171
+ flex-wrap: wrap;
172
+ gap: 8px;
173
+ margin: 10px 0;
174
+ }
175
+ .service-tag {
176
+ background: #e4e6eb;
177
+ padding: 4px 12px;
178
+ border-radius: 20px;
179
+ font-size: 0.7rem;
180
+ font-weight: 500;
181
+ }
182
+ /* --- Messages --- */
183
+ .message {
184
+ max-width: 85%;
185
+ padding: 10px 14px;
186
+ border-radius: 22px;
187
+ font-size: 0.9rem;
188
+ line-height: 1.45;
189
+ white-space: pre-line;
190
+ word-wrap: break-word;
191
+ animation: messagePop 0.25s ease-out;
192
+ }
193
+ @keyframes messagePop {
194
+ from { opacity: 0; transform: translateY(8px) scale(0.96); }
195
+ to { opacity: 1; transform: translateY(0) scale(1); }
196
+ }
197
+ .user-msg {
198
+ background: #DCF8C6;
199
+ margin-left: auto;
200
+ border-bottom-right-radius: 6px;
201
+ }
202
+ .bot-msg {
203
+ background: white;
204
+ margin-right: auto;
205
+ border-bottom-left-radius: 6px;
206
+ box-shadow: 0 2px 6px rgba(0,0,0,0.05);
207
+ }
208
+ .questions-container {
209
+ display: flex;
210
+ flex-wrap: wrap;
211
+ gap: 10px;
212
+ margin: 8px 0;
213
+ }
214
+ .question-bubble {
215
+ background: #e4e6eb;
216
+ color: #1f2a3e;
217
+ padding: 8px 14px;
218
+ border-radius: 30px;
219
+ font-size: 0.75rem;
220
+ font-weight: 500;
221
+ cursor: pointer;
222
+ transition: 0.2s;
223
+ }
224
+ .question-bubble:hover {
225
+ background: #d1d4db;
226
+ transform: translateY(-2px) scale(1.02);
227
+ }
228
+ .typing-indicator {
229
+ background: white;
230
+ padding: 10px 16px;
231
+ border-radius: 24px;
232
+ display: inline-flex;
233
+ align-items: center;
234
+ gap: 6px;
235
+ width: fit-content;
236
+ }
237
+ .typing-indicator span {
238
+ width: 8px;
239
+ height: 8px;
240
+ background: #888;
241
+ border-radius: 50%;
242
+ display: inline-block;
243
+ animation: typingWave 1.2s infinite ease-in-out both;
244
+ }
245
+ .typing-indicator span:nth-child(1) { animation-delay: 0s; }
246
+ .typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
247
+ .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
248
+ @keyframes typingWave {
249
+ 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
250
+ 30% { transform: translateY(-6px); opacity: 1; }
251
+ }
252
+ .chat-input-area {
253
+ display: flex;
254
+ padding: 14px;
255
+ background: white;
256
+ border-top: 1px solid #e2e8f0;
257
+ gap: 10px;
258
+ }
259
+ .chat-input-area input {
260
+ flex: 1;
261
+ padding: 12px 16px;
262
+ border: 1px solid #cbd5e1;
263
+ border-radius: 40px;
264
+ outline: none;
265
+ }
266
+ .chat-input-area input:focus {
267
+ border-color: #25D366;
268
+ box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2);
269
+ }
270
+ .chat-input-area button {
271
+ background: #25D366;
272
+ border: none;
273
+ color: white;
274
+ width: 44px;
275
+ height: 44px;
276
+ border-radius: 50%;
277
+ cursor: pointer;
278
+ transition: 0.2s;
279
+ }
280
+ .chat-input-area button:hover {
281
+ background: #128C7E;
282
+ transform: scale(1.05);
283
+ }
284
+ .chat-messages::-webkit-scrollbar { width: 5px; }
285
+ .chat-messages::-webkit-scrollbar-track { background: #e0e4e8; border-radius: 5px; }
286
+ .chat-messages::-webkit-scrollbar-thumb { background: #aaa; border-radius: 5px; }
287
  </style>
288
  </head>
289
  <body>
290
+
291
+ <!-- Floating Chat Icon -->
292
  <div class="chat-icon" id="chatIcon">
293
  <i class="fas fa-comment-dots"></i>
294
  </div>
295
+
296
+ <!-- Chat Modal -->
297
  <div class="chat-modal" id="chatModal">
298
  <div class="chat-header">
299
+ <h3><i class="fas fa-robot"></i> Elite Visuals AI</h3>
300
  <button class="close-btn" id="closeChat"><i class="fas fa-times"></i></button>
301
  </div>
302
  <div class="chat-messages" id="chatMessages">
303
+ <!-- Welcome message (static) -->
304
+ <div class="message bot-msg">✨ Assalam-o-Alaikum! I'm Elite Visuals AI assistant. Ask me about websites, e‑commerce, SEO, chatbots & more. Extra features? I'll tell you price/timeline increase!</div>
305
+
306
+ <!-- VISUAL SERVICE WIDGET (collapsible, inside chat) -->
307
+ <div class="service-widget" id="serviceWidget">
308
+ <div class="widget-header" id="widgetHeader">
309
+ <span><i class="fas fa-crown"></i> 📦 Services & Pricing (click to expand)</span>
310
+ <i class="fas fa-chevron-down" id="toggleIcon"></i>
311
+ </div>
312
+ <div class="widget-content" id="widgetContent">
313
+ <!-- Basic Package -->
314
+ <div class="package-card">
315
+ <h4>✅ Basic Website</h4>
316
+ <p><strong>💰 Price:</strong> PKR 50,000</p>
317
+ <p><strong>⏱️ Timeline:</strong> 7-10 working days</p>
318
+ <p><strong>📌 Includes:</strong> 5 pages, mobile responsive, basic SEO, contact form, social media links.</p>
319
+ </div>
320
+ <!-- Standard Package -->
321
+ <div class="package-card">
322
+ <h4>⭐ Standard Website</h4>
323
+ <p><strong>💰 Price:</strong> PKR 1,20,000</p>
324
+ <p><strong>⏱️ Timeline:</strong> 15-20 working days</p>
325
+ <p><strong>📌 Includes:</strong> 10 pages, CMS (WordPress/custom), advanced SEO, blog integration, chatbot, 1 month free support.</p>
326
+ </div>
327
+ <!-- Premium Package -->
328
+ <div class="package-card">
329
+ <h4>🏆 Premium Website</h4>
330
+ <p><strong>💰 Price:</strong> PKR 2,50,000</p>
331
+ <p><strong>⏱️ Timeline:</strong> 25-30 working days</p>
332
+ <p><strong>📌 Includes:</strong> Unlimited pages, e‑commerce, payment gateway, user accounts, custom animations, database, 6 months support, training.</p>
333
+ </div>
334
+ <div class="service-list">
335
+ <span class="service-tag">🛒 E‑commerce</span>
336
+ <span class="service-tag">🔍 SEO</span>
337
+ <span class="service-tag">🤖 Chatbot</span>
338
+ <span class="service-tag">🖌️ Graphic Design</span>
339
+ <span class="service-tag">📱 Digital Marketing</span>
340
+ <span class="service-tag">🛠️ Maintenance</span>
341
+ </div>
342
+ <div class="extra-note">
343
+ <strong>⚠️ Extra Requirements?</strong><br>
344
+ Agar aap basic package mein extra features chahoge (live chat, booking system, multi‑language, custom backend, etc.) to <strong>price aur timeline increase</strong> hogi. Hum custom quote denge. Chat mein pooch sakte hain!
345
+ </div>
346
+ </div>
347
+ </div>
348
+
349
+ <!-- Default Questions Bubbles -->
350
  <div id="defaultQuestionsContainer" class="questions-container"></div>
351
  </div>
352
  <div class="chat-input-area">
353
+ <input type="text" id="userInput" placeholder="Type your question...">
354
  <button id="sendBtn"><i class="fas fa-paper-plane"></i></button>
355
  </div>
356
  </div>
357
+
358
  <script>
359
+ // Session ID
360
  let sessionId = localStorage.getItem('chat_session_id');
361
  if (!sessionId) {
362
  sessionId = 'user_' + Date.now() + '_' + Math.random().toString(36).substr(2, 8);
363
  localStorage.setItem('chat_session_id', sessionId);
364
  }
 
 
365
  const API_URL = "/api/chat";
366
+
367
+ // Default questions (including extra features examples)
368
  const DEFAULT_QUESTIONS = [
369
+ "📞 Contact number?",
370
+ "💰 Basic website package price & timeline?",
371
+ "📦 What's included in Standard package?",
372
+ "🛒 Do you build e‑commerce websites?",
373
+ "⚡ Extra features like live chat – cost increase?",
374
+ "🔍 SEO services available?",
375
+ "➕ I want multi‑language website – extra price?"
376
  ];
377
+
378
+ // DOM elements
379
  const chatIcon = document.getElementById('chatIcon');
380
  const chatModal = document.getElementById('chatModal');
381
  const closeChat = document.getElementById('closeChat');
 
384
  const chatMessages = document.getElementById('chatMessages');
385
  const questionsContainer = document.getElementById('defaultQuestionsContainer');
386
 
387
+ // Service widget collapsible
388
+ const widgetHeader = document.getElementById('widgetHeader');
389
+ const widgetContent = document.getElementById('widgetContent');
390
+ const toggleIcon = document.getElementById('toggleIcon');
391
+ let widgetOpen = false;
392
+
393
+ widgetHeader.addEventListener('click', () => {
394
+ if (widgetOpen) {
395
+ widgetContent.classList.remove('show');
396
+ toggleIcon.classList.remove('fa-chevron-up');
397
+ toggleIcon.classList.add('fa-chevron-down');
398
+ widgetOpen = false;
399
+ } else {
400
+ widgetContent.classList.add('show');
401
+ toggleIcon.classList.remove('fa-chevron-down');
402
+ toggleIcon.classList.add('fa-chevron-up');
403
+ widgetOpen = true;
404
+ }
405
+ });
406
+
407
+ // Render question bubbles
408
  function renderQuestionBubbles() {
409
  questionsContainer.innerHTML = '';
410
  DEFAULT_QUESTIONS.forEach(q => {
411
  const bubble = document.createElement('div');
412
  bubble.className = 'question-bubble';
413
  bubble.innerText = q;
414
+ bubble.onclick = () => {
415
+ userInput.value = q.replace(/^[📞💰📦🛒⚡🔍➕]\s*/, '');
416
+ sendMessage();
417
+ };
418
  questionsContainer.appendChild(bubble);
419
  });
420
  }
421
+
422
+ // Add message to chat
423
  function addMessage(text, sender) {
424
  const div = document.createElement('div');
425
  div.className = `message ${sender === 'user' ? 'user-msg' : 'bot-msg'}`;
 
427
  chatMessages.appendChild(div);
428
  chatMessages.scrollTop = chatMessages.scrollHeight;
429
  }
430
+
431
+ // Typing indicator
432
  let typingDiv = null;
433
  function showTyping() {
434
  if (typingDiv) return;
435
  typingDiv = document.createElement('div');
436
+ typingDiv.className = 'typing-indicator';
437
+ typingDiv.innerHTML = '<span></span><span></span><span></span>';
438
  chatMessages.appendChild(typingDiv);
439
  chatMessages.scrollTop = chatMessages.scrollHeight;
440
  }
441
  function hideTyping() {
442
+ if (typingDiv) {
443
+ typingDiv.remove();
444
+ typingDiv = null;
445
+ }
446
  }
447
+
448
+ // Send message to backend
449
  async function sendMessage() {
450
  const msg = userInput.value.trim();
451
  if (!msg) return;
 
464
  addMessage(data.reply, 'bot');
465
  } catch (err) {
466
  hideTyping();
467
+ addMessage("❌ Server error. Please try again later.", 'bot');
468
+ console.error(err);
469
  }
470
  }
471
+
472
+ // Event listeners
473
+ chatIcon.onclick = () => {
474
+ chatModal.style.display = 'flex';
475
+ if (questionsContainer.children.length === 0) renderQuestionBubbles();
476
+ };
477
  closeChat.onclick = () => chatModal.style.display = 'none';
478
  sendBtn.onclick = sendMessage;
479
  userInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') sendMessage(); });
480
+
481
  renderQuestionBubbles();
482
  </script>
483
  </body>