Yoonc commited on
Commit
83517c2
·
verified ·
1 Parent(s): 962435f

Upload 2 files

Browse files
Files changed (2) hide show
  1. static/script.js +328 -0
  2. static/style.css +526 -0
static/script.js ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Helper function to sanitize religion names for IDs
2
+ function sanitizeReligionName(name) {
3
+ return name.replace(/\s+/g, '-');
4
+ }
5
+
6
+ // ==================== AUTHENTICATION ====================
7
+
8
+ function authenticate() {
9
+ const username = document.getElementById('authUsername').value.trim();
10
+ const password = document.getElementById('authPassword').value;
11
+
12
+ if (!username || !password) {
13
+ document.getElementById('result').innerHTML =
14
+ '<p class="error-msg">⚠️ Please fill in all fields</p>';
15
+ return;
16
+ }
17
+
18
+ const endpoint = window.location.pathname === '/signup' ? '/signup' : '/login';
19
+
20
+ fetch(endpoint, {
21
+ method: 'POST',
22
+ headers: {'Content-Type': 'application/json'},
23
+ body: JSON.stringify({username, password})
24
+ })
25
+ .then(response => response.json())
26
+ .then(data => {
27
+ if (data.success) {
28
+ window.location.href = '/';
29
+ } else {
30
+ document.getElementById('result').innerHTML =
31
+ `<p class="error-msg">${data.message}</p>`;
32
+ }
33
+ });
34
+ }
35
+
36
+ function switchAuth() {
37
+ const newPath = window.location.pathname === '/signup' ? '/login' : '/signup';
38
+ window.location.href = newPath;
39
+ }
40
+
41
+ // ==================== ASSESSMENT ====================
42
+
43
+ var currentQuestion = 1;
44
+ var maxQuestionReached = 1;
45
+ var assessmentDataEl = document.getElementById('assessmentData');
46
+ var totalQuestions = assessmentDataEl ? parseInt(assessmentDataEl.getAttribute('data-total')) : 0;
47
+ var questionIds = assessmentDataEl ? JSON.parse(assessmentDataEl.getAttribute('data-ids')) : [];
48
+
49
+ // Show first question on load
50
+ window.addEventListener('DOMContentLoaded', function() {
51
+ if (assessmentDataEl) {
52
+ showQuestion(1);
53
+ }
54
+
55
+ // Add Enter key listener for password field if it exists
56
+ const passwordField = document.getElementById('authPassword');
57
+ if (passwordField) {
58
+ passwordField.addEventListener('keypress', function(e) {
59
+ if (e.key === 'Enter') authenticate();
60
+ });
61
+ }
62
+ });
63
+
64
+ function showQuestion(questionIndex) {
65
+ if (questionIndex > maxQuestionReached + 1) return;
66
+ if (questionIndex > maxQuestionReached) maxQuestionReached = questionIndex;
67
+
68
+ document.querySelectorAll('.question-block').forEach(function(block) {
69
+ block.classList.remove('active');
70
+ var blockIndex = parseInt(block.getAttribute('data-question-index'));
71
+ if (blockIndex === questionIndex) block.classList.add('active');
72
+ if (blockIndex < questionIndex) {
73
+ block.querySelectorAll('input[type="radio"]').forEach(function(radio) {
74
+ radio.disabled = true;
75
+ });
76
+ }
77
+ });
78
+
79
+ currentQuestion = questionIndex;
80
+ document.getElementById('questionCounter').textContent = 'Question ' + questionIndex + ' of ' + totalQuestions;
81
+ document.getElementById('progressBar').style.width = ((questionIndex - 1) / totalQuestions) * 100 + '%';
82
+ updateNavigationButtons();
83
+ }
84
+
85
+ function updateNavigationButtons() {
86
+ var nextBtn = document.getElementById('nextBtn' + currentQuestion);
87
+
88
+ if (nextBtn) {
89
+ var currentQuestionId = questionIds[currentQuestion - 1];
90
+ var radioName = 'q' + currentQuestionId;
91
+ var isAnswered = document.querySelector('input[name="' + radioName + '"]:checked') !== null;
92
+
93
+ if (currentQuestion === totalQuestions && isAnswered) {
94
+ nextBtn.style.display = 'none';
95
+ document.getElementById('submitBtn').style.display = 'block';
96
+ } else {
97
+ nextBtn.disabled = !isAnswered;
98
+ nextBtn.style.display = 'inline-block';
99
+ }
100
+ }
101
+ }
102
+
103
+ function handleAnswer(radioElement) {
104
+ var questionIndex = parseInt(radioElement.getAttribute('data-question-index'));
105
+
106
+ // Only process if this is the current question
107
+ if (questionIndex !== currentQuestion) {
108
+ return;
109
+ }
110
+
111
+ updateNavigationButtons();
112
+
113
+ // Auto-advance to next question after selection
114
+ setTimeout(function() {
115
+ if (questionIndex < totalQuestions) {
116
+ showQuestion(questionIndex + 1);
117
+ } else {
118
+ // Last question - show submit button
119
+ var nextBtn = document.getElementById('nextBtn' + questionIndex);
120
+ if (nextBtn) {
121
+ nextBtn.style.display = 'none';
122
+ }
123
+ document.getElementById('submitBtn').style.display = 'block';
124
+ }
125
+ }, 400);
126
+ }
127
+
128
+ function goToNext() {
129
+ if (currentQuestion < totalQuestions) {
130
+ showQuestion(currentQuestion + 1);
131
+ }
132
+ }
133
+
134
+ function submitAssessment() {
135
+ var form = document.getElementById('assessmentForm');
136
+ var answers = [];
137
+
138
+ questionIds.forEach(function(qId) {
139
+ var radioName = 'q' + qId;
140
+ var selectedRadio = form.querySelector('input[name="' + radioName + '"]:checked');
141
+ if (selectedRadio) {
142
+ answers.push({
143
+ question_id: qId,
144
+ answer: selectedRadio.value
145
+ });
146
+ }
147
+ });
148
+
149
+ if (answers.length !== totalQuestions) {
150
+ document.getElementById('errorMsg').innerHTML =
151
+ '<p class="error-msg">⚠️ Please answer all questions</p>';
152
+ return;
153
+ }
154
+
155
+ document.getElementById('submitBtn').disabled = true;
156
+ document.getElementById('submitBtn').textContent = '✨ Calculating...';
157
+
158
+ fetch('/submit_assessment', {
159
+ method: 'POST',
160
+ headers: {'Content-Type': 'application/json'},
161
+ body: JSON.stringify({answers: answers})
162
+ })
163
+ .then(function(response) { return response.json(); })
164
+ .then(function(data) {
165
+ if (data.success) {
166
+ window.location.reload();
167
+ } else {
168
+ document.getElementById('errorMsg').innerHTML =
169
+ '<p class="error-msg">' + data.message + '</p>';
170
+ document.getElementById('submitBtn').disabled = false;
171
+ document.getElementById('submitBtn').textContent = '✨ Discover Your Path';
172
+ }
173
+ });
174
+ }
175
+
176
+ function resetAssessment() {
177
+ if (!confirm('Are you sure you want to retake the assessment? Your current results will be cleared.')) {
178
+ return;
179
+ }
180
+
181
+ fetch('/reset_assessment', {
182
+ method: 'POST',
183
+ headers: {'Content-Type': 'application/json'}
184
+ })
185
+ .then(function(response) { return response.json(); })
186
+ .then(function(data) {
187
+ if (data.success) {
188
+ window.location.reload();
189
+ }
190
+ });
191
+ }
192
+
193
+ // ==================== CHAT FUNCTIONALITY ====================
194
+
195
+ var chatHistories = {};
196
+
197
+ function formatBotResponse(text) {
198
+ var div = document.createElement('div');
199
+ div.textContent = text;
200
+ var escaped = div.innerHTML;
201
+
202
+ // Check for bullet points
203
+ if (escaped.match(/\*\s+/g) || escaped.match(/•\s+/g) || escaped.match(/^\s*-\s+/gm)) {
204
+ var lines = escaped.split(/(?:\*|•|\n-)\s+/);
205
+ if (lines.length > 1) {
206
+ var formatted = lines[0].trim() ? lines[0].trim() + '<br><br>' : '';
207
+ formatted += '<ul style="margin: 0; padding-left: 20px; line-height: 1.8;">';
208
+ for (var i = 1; i < lines.length; i++) {
209
+ if (lines[i].trim()) {
210
+ formatted += '<li style="margin-bottom: 6px;">' + lines[i].trim() + '</li>';
211
+ }
212
+ }
213
+ return formatted + '</ul>';
214
+ }
215
+ }
216
+ return escaped.replace(/\n/g, '<br>');
217
+ }
218
+
219
+ function toggleChat(religionName) {
220
+ var chatId = 'chat-' + sanitizeReligionName(religionName);
221
+ var chatWindow = document.getElementById(chatId);
222
+
223
+ if (chatWindow.classList.contains('open')) {
224
+ chatWindow.classList.remove('open');
225
+ } else {
226
+ chatWindow.classList.add('open');
227
+ var inputId = 'input-' + sanitizeReligionName(religionName);
228
+ setTimeout(function() {
229
+ document.getElementById(inputId).focus();
230
+ }, 300);
231
+ }
232
+ }
233
+
234
+ function sendMessage(religionName) {
235
+ var inputId = 'input-' + sanitizeReligionName(religionName);
236
+ var messagesId = 'messages-' + sanitizeReligionName(religionName);
237
+ var sendBtnId = 'send-' + sanitizeReligionName(religionName);
238
+
239
+ var inputEl = document.getElementById(inputId);
240
+ var messagesEl = document.getElementById(messagesId);
241
+ var sendBtn = document.getElementById(sendBtnId);
242
+
243
+ var message = inputEl.value.trim();
244
+ if (!message) return;
245
+
246
+ // Initialize chat history if not exists
247
+ if (!chatHistories[religionName]) {
248
+ chatHistories[religionName] = [];
249
+ }
250
+
251
+ // Add user message to UI
252
+ var userMsgDiv = document.createElement('div');
253
+ userMsgDiv.className = 'chat-message user';
254
+ userMsgDiv.textContent = message;
255
+ messagesEl.appendChild(userMsgDiv);
256
+
257
+ // Clear input and disable send button
258
+ inputEl.value = '';
259
+ sendBtn.disabled = true;
260
+
261
+ // Show typing indicator
262
+ var typingDiv = document.createElement('div');
263
+ typingDiv.className = 'chat-typing';
264
+ typingDiv.textContent = '💭 Thinking...';
265
+ messagesEl.appendChild(typingDiv);
266
+
267
+ // Scroll to bottom
268
+ messagesEl.scrollTop = messagesEl.scrollHeight;
269
+
270
+ // Add to chat history
271
+ chatHistories[religionName].push({
272
+ role: 'user',
273
+ content: message
274
+ });
275
+
276
+ // Send to backend
277
+ fetch('/chat', {
278
+ method: 'POST',
279
+ headers: {'Content-Type': 'application/json'},
280
+ body: JSON.stringify({
281
+ message: message,
282
+ religion: religionName,
283
+ history: chatHistories[religionName]
284
+ })
285
+ })
286
+ .then(function(response) { return response.json(); })
287
+ .then(function(data) {
288
+ messagesEl.removeChild(typingDiv);
289
+
290
+ if (data.success) {
291
+ var botMsgDiv = document.createElement('div');
292
+ botMsgDiv.className = 'chat-message bot';
293
+
294
+ // Format the response with proper bullet points
295
+ var formattedResponse = formatBotResponse(data.response);
296
+ botMsgDiv.innerHTML = formattedResponse;
297
+
298
+ messagesEl.appendChild(botMsgDiv);
299
+
300
+ chatHistories[religionName].push({
301
+ role: 'assistant',
302
+ content: data.response
303
+ });
304
+ } else {
305
+ var errorMsgDiv = document.createElement('div');
306
+ errorMsgDiv.className = 'chat-message bot';
307
+ errorMsgDiv.style.color = '#EF4444';
308
+ errorMsgDiv.textContent = '❌ ' + data.message;
309
+ messagesEl.appendChild(errorMsgDiv);
310
+ }
311
+
312
+ sendBtn.disabled = false;
313
+ messagesEl.scrollTop = messagesEl.scrollHeight;
314
+ })
315
+ .catch(function(error) {
316
+ messagesEl.removeChild(typingDiv);
317
+
318
+ var errorMsgDiv = document.createElement('div');
319
+ errorMsgDiv.className = 'chat-message bot';
320
+ errorMsgDiv.style.color = '#EF4444';
321
+ errorMsgDiv.textContent = '❌ Connection error';
322
+ messagesEl.appendChild(errorMsgDiv);
323
+
324
+ sendBtn.disabled = false;
325
+ messagesEl.scrollTop = messagesEl.scrollHeight;
326
+ });
327
+ }
328
+
static/style.css ADDED
@@ -0,0 +1,526 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ body {
8
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
9
+ background: #F5F5F5;
10
+ min-height: 100vh;
11
+ display: flex;
12
+ justify-content: center;
13
+ align-items: center;
14
+ padding: 20px;
15
+ }
16
+
17
+ .container {
18
+ background: white;
19
+ border-radius: 16px;
20
+ padding: 40px;
21
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
22
+ max-width: 700px;
23
+ width: 100%;
24
+ animation: slideIn 0.4s ease;
25
+ max-height: 90vh;
26
+ overflow-y: auto;
27
+ }
28
+
29
+ @keyframes slideIn {
30
+ from { opacity: 0; transform: translateY(20px); }
31
+ to { opacity: 1; transform: translateY(0); }
32
+ }
33
+
34
+ h1 {
35
+ color: #3D3D3D;
36
+ font-size: 32px;
37
+ margin-bottom: 8px;
38
+ text-align: center;
39
+ font-weight: 800;
40
+ }
41
+
42
+ h3 {
43
+ text-align: center;
44
+ color: #3D3D3D;
45
+ }
46
+
47
+ p {
48
+ color: #6B7280;
49
+ text-align: center;
50
+ margin-bottom: 30px;
51
+ font-size: 15px;
52
+ }
53
+
54
+ .subtitle {
55
+ color: #9CA3AF;
56
+ font-size: 14px;
57
+ text-align: center;
58
+ margin-bottom: 25px;
59
+ line-height: 1.6;
60
+ }
61
+
62
+ /* Form Inputs */
63
+ input[type="text"], input[type="password"] {
64
+ width: 100%;
65
+ padding: 12px 16px;
66
+ font-size: 15px;
67
+ border: none;
68
+ background: #F5F5F5;
69
+ border-radius: 10px;
70
+ transition: all 0.2s;
71
+ outline: none;
72
+ }
73
+
74
+ input:focus {
75
+ background: #EBEBEB;
76
+ box-shadow: 0 0 0 2px #E5E5E5;
77
+ }
78
+
79
+ /* Buttons - Consolidated styles */
80
+ button, .btn, .nav-btn, .submit-btn {
81
+ padding: 12px 24px;
82
+ font-size: 15px;
83
+ background: #3D3D3D;
84
+ color: white;
85
+ border: none;
86
+ border-radius: 10px;
87
+ cursor: pointer;
88
+ transition: all 0.2s;
89
+ font-weight: 600;
90
+ text-decoration: none;
91
+ display: inline-block;
92
+ }
93
+
94
+ button:hover, .btn:hover, .nav-btn:hover, .submit-btn:hover {
95
+ background: #1A1A1A;
96
+ transform: translateY(-1px);
97
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
98
+ }
99
+
100
+ button:active, .btn:active {
101
+ transform: translateY(0);
102
+ }
103
+
104
+ button:disabled {
105
+ background: #E5E5E5;
106
+ color: #999;
107
+ cursor: not-allowed;
108
+ transform: none;
109
+ }
110
+
111
+ .nav-btn:disabled {
112
+ opacity: 0.3;
113
+ cursor: not-allowed;
114
+ transform: none;
115
+ }
116
+
117
+ /* Secondary Buttons - Consolidated */
118
+ .logout-btn, .reset-btn {
119
+ background: #6B7280;
120
+ padding: 8px 16px;
121
+ font-size: 13px;
122
+ margin-top: 15px;
123
+ }
124
+
125
+ .logout-btn:hover, .reset-btn:hover {
126
+ background: #4B5563;
127
+ box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
128
+ }
129
+
130
+ /* Submit Button */
131
+ .submit-btn {
132
+ width: 100%;
133
+ padding: 16px;
134
+ font-size: 16px;
135
+ margin-top: 10px;
136
+ }
137
+
138
+ /* Auth Form */
139
+ .auth-form input {
140
+ width: 100%;
141
+ margin-bottom: 15px;
142
+ }
143
+
144
+ .auth-form button {
145
+ width: 100%;
146
+ }
147
+
148
+ .switch-link {
149
+ color: #3D3D3D;
150
+ text-decoration: none;
151
+ cursor: pointer;
152
+ font-weight: 600;
153
+ margin-top: 15px;
154
+ display: inline-block;
155
+ transition: color 0.2s;
156
+ }
157
+
158
+ .switch-link:hover {
159
+ color: #1A1A1A;
160
+ text-decoration: underline;
161
+ }
162
+
163
+ /* Question Blocks */
164
+ .question-block {
165
+ background: #FAFAFA;
166
+ padding: 30px;
167
+ border-radius: 12px;
168
+ margin-bottom: 20px;
169
+ border: none;
170
+ display: none;
171
+ min-height: 400px;
172
+ }
173
+
174
+ .question-block.active {
175
+ display: block;
176
+ animation: fadeIn 0.3s ease;
177
+ }
178
+
179
+ @keyframes fadeIn {
180
+ from { opacity: 0; transform: translateX(20px); }
181
+ to { opacity: 1; transform: translateX(0); }
182
+ }
183
+
184
+ .question-block h4 {
185
+ color: #3D3D3D;
186
+ margin-bottom: 25px;
187
+ font-weight: 700;
188
+ font-size: 18px;
189
+ line-height: 1.6;
190
+ }
191
+
192
+ .question-number {
193
+ display: inline-block;
194
+ background: #3D3D3D;
195
+ color: #fff;
196
+ width: 32px;
197
+ height: 32px;
198
+ border-radius: 50%;
199
+ text-align: center;
200
+ line-height: 32px;
201
+ margin-right: 12px;
202
+ font-size: 16px;
203
+ }
204
+
205
+ /* Options */
206
+ .option {
207
+ display: block;
208
+ padding: 16px 20px;
209
+ margin-bottom: 12px;
210
+ background: white;
211
+ border: none;
212
+ border-radius: 10px;
213
+ cursor: pointer;
214
+ transition: all 0.2s;
215
+ font-size: 15px;
216
+ color: #3D3D3D;
217
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
218
+ }
219
+
220
+ .option:hover {
221
+ background: #F5F5F5;
222
+ transform: translateX(5px);
223
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
224
+ }
225
+
226
+ .option input[type="radio"] {
227
+ margin-right: 12px;
228
+ cursor: pointer;
229
+ width: 18px;
230
+ height: 18px;
231
+ }
232
+
233
+ .option input[type="radio"]:disabled {
234
+ cursor: not-allowed;
235
+ opacity: 0.5;
236
+ }
237
+
238
+ .option:has(input[type="radio"]:disabled) {
239
+ opacity: 0.4;
240
+ cursor: not-allowed;
241
+ }
242
+
243
+ .option:has(input[type="radio"]:disabled):hover {
244
+ background: white;
245
+ transform: none;
246
+ }
247
+
248
+ /* Question Counter & Progress */
249
+ .question-counter {
250
+ text-align: center;
251
+ color: #999;
252
+ font-size: 14px;
253
+ margin-bottom: 15px;
254
+ font-weight: 600;
255
+ }
256
+
257
+ .progress-bar {
258
+ background: #F5F5F5;
259
+ height: 8px;
260
+ border-radius: 4px;
261
+ overflow: hidden;
262
+ margin-bottom: 20px;
263
+ }
264
+
265
+ .progress-fill {
266
+ background: #3D3D3D;
267
+ height: 100%;
268
+ transition: width 0.3s;
269
+ }
270
+
271
+ /* Navigation */
272
+ .nav-buttons {
273
+ display: flex;
274
+ gap: 12px;
275
+ justify-content: space-between;
276
+ margin-top: 20px;
277
+ }
278
+
279
+ .buttons-row {
280
+ display: flex;
281
+ gap: 10px;
282
+ justify-content: center;
283
+ margin-top: 20px;
284
+ }
285
+
286
+ /* Results */
287
+ .result-card {
288
+ padding: 25px;
289
+ border-radius: 12px;
290
+ margin-bottom: 20px;
291
+ border: none;
292
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
293
+ }
294
+
295
+ .result-card.rank-1 {
296
+ background: #FFFACD;
297
+ }
298
+
299
+ .result-card.rank-2 {
300
+ background: #B4C7E7;
301
+ }
302
+
303
+ .result-card.rank-3 {
304
+ background: #90EE90;
305
+ }
306
+
307
+ .result-header {
308
+ display: flex;
309
+ align-items: center;
310
+ justify-content: space-between;
311
+ margin-bottom: 15px;
312
+ }
313
+
314
+ .result-rank {
315
+ color: #fff;
316
+ width: 40px;
317
+ height: 40px;
318
+ border-radius: 50%;
319
+ display: flex;
320
+ align-items: center;
321
+ justify-content: center;
322
+ font-size: 20px;
323
+ font-weight: 800;
324
+ background: #3D3D3D;
325
+ }
326
+
327
+ .result-title {
328
+ flex: 1;
329
+ margin-left: 15px;
330
+ }
331
+
332
+ .result-title h3 {
333
+ font-size: 22px;
334
+ margin-bottom: 5px;
335
+ color: #3D3D3D;
336
+ }
337
+
338
+ .result-percentage {
339
+ font-size: 24px;
340
+ font-weight: 800;
341
+ color: #3D3D3D;
342
+ }
343
+
344
+ .result-description {
345
+ color: #666;
346
+ line-height: 1.6;
347
+ margin-bottom: 12px;
348
+ font-size: 14px;
349
+ }
350
+
351
+ .result-details {
352
+ background: rgba(255, 255, 255, 0.6);
353
+ border: none;
354
+ padding: 15px;
355
+ border-radius: 8px;
356
+ margin-top: 15px;
357
+ }
358
+
359
+ .result-details h5 {
360
+ color: #3D3D3D;
361
+ font-size: 13px;
362
+ margin-bottom: 8px;
363
+ font-weight: 700;
364
+ }
365
+
366
+ .result-details p {
367
+ color: #666;
368
+ font-size: 13px;
369
+ margin-bottom: 10px;
370
+ text-align: left;
371
+ }
372
+
373
+ /* Icons & Messages */
374
+ .icon {
375
+ font-size: 24px;
376
+ margin-right: 8px;
377
+ }
378
+
379
+ .success-msg {
380
+ color: #3D3D3D;
381
+ font-weight: 600;
382
+ }
383
+
384
+ .error-msg {
385
+ color: #666;
386
+ font-weight: 600;
387
+ text-align: center;
388
+ padding: 10px;
389
+ }
390
+
391
+ /* Chat Interface */
392
+ .chat-toggle-btn {
393
+ background: rgba(255, 255, 255, 0.8);
394
+ color: #3D3D3D;
395
+ border: none;
396
+ padding: 10px 20px;
397
+ border-radius: 8px;
398
+ cursor: pointer;
399
+ font-size: 14px;
400
+ font-weight: 600;
401
+ margin-top: 15px;
402
+ width: 100%;
403
+ transition: background 0.2s, color 0.2s;
404
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
405
+ }
406
+
407
+ .chat-toggle-btn:hover {
408
+ background: #3D3D3D;
409
+ color: #fff;
410
+ }
411
+
412
+ .chat-window {
413
+ display: none;
414
+ background: rgba(255, 255, 255, 0.9);
415
+ border: none;
416
+ border-radius: 10px;
417
+ margin-top: 15px;
418
+ overflow: hidden;
419
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
420
+ }
421
+
422
+ .chat-window.open {
423
+ display: block;
424
+ animation: slideDown 0.3s ease;
425
+ }
426
+
427
+ @keyframes slideDown {
428
+ from { opacity: 0; max-height: 0; }
429
+ to { opacity: 1; max-height: 500px; }
430
+ }
431
+
432
+ .chat-messages {
433
+ height: 250px;
434
+ overflow-y: auto;
435
+ padding: 15px;
436
+ background: transparent;
437
+ }
438
+
439
+ .chat-message {
440
+ margin-bottom: 12px;
441
+ padding: 10px 14px;
442
+ border-radius: 8px;
443
+ max-width: 85%;
444
+ line-height: 1.5;
445
+ font-size: 14px;
446
+ }
447
+
448
+ .chat-message.user {
449
+ background: #3D3D3D;
450
+ color: #fff;
451
+ margin-left: auto;
452
+ text-align: right;
453
+ }
454
+
455
+ .chat-message.bot {
456
+ background: white;
457
+ color: #3D3D3D;
458
+ border: none;
459
+ text-align: left;
460
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
461
+ }
462
+
463
+ .chat-message.bot ul {
464
+ margin: 8px 0 0 0;
465
+ padding-left: 20px;
466
+ }
467
+
468
+ .chat-message.bot li {
469
+ margin-bottom: 6px;
470
+ line-height: 1.6;
471
+ }
472
+
473
+ .chat-input-area {
474
+ display: flex;
475
+ gap: 8px;
476
+ padding: 12px;
477
+ background: transparent;
478
+ border-top: none;
479
+ }
480
+
481
+ .chat-input {
482
+ flex: 1;
483
+ padding: 10px 14px;
484
+ border: none;
485
+ background: white;
486
+ border-radius: 8px;
487
+ font-size: 14px;
488
+ outline: none;
489
+ color: #3D3D3D;
490
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
491
+ }
492
+
493
+ .chat-input:focus {
494
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
495
+ }
496
+
497
+ .chat-send-btn {
498
+ padding: 10px 20px;
499
+ background: #3D3D3D;
500
+ color: #fff;
501
+ border: none;
502
+ border-radius: 8px;
503
+ cursor: pointer;
504
+ font-weight: 600;
505
+ font-size: 14px;
506
+ transition: background 0.2s;
507
+ }
508
+
509
+ .chat-send-btn:hover {
510
+ background: #1A1A1A;
511
+ color: #fff;
512
+ }
513
+
514
+ .chat-send-btn:disabled {
515
+ background: #F5F5F5;
516
+ color: #999;
517
+ cursor: not-allowed;
518
+ }
519
+
520
+ .chat-typing {
521
+ color: #999;
522
+ font-style: italic;
523
+ font-size: 13px;
524
+ padding: 10px 14px;
525
+ }
526
+