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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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">
|
6 |
+
<title>Modern Chat Interface</title>
|
7 |
+
<style>
|
8 |
+
* {
|
9 |
+
margin: 0;
|
10 |
+
padding: 0;
|
11 |
+
box-sizing: border-box;
|
12 |
+
}
|
13 |
+
|
14 |
+
body {
|
15 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
16 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
17 |
+
height: 100vh;
|
18 |
+
display: flex;
|
19 |
+
align-items: center;
|
20 |
+
justify-content: center;
|
21 |
+
padding: 20px;
|
22 |
+
}
|
23 |
+
|
24 |
+
.chat-container {
|
25 |
+
width: 100%;
|
26 |
+
max-width: 400px;
|
27 |
+
height: 600px;
|
28 |
+
background: white;
|
29 |
+
border-radius: 20px;
|
30 |
+
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
|
31 |
+
display: flex;
|
32 |
+
flex-direction: column;
|
33 |
+
overflow: hidden;
|
34 |
+
animation: slideIn 0.5s ease-out;
|
35 |
+
}
|
36 |
+
|
37 |
+
@keyframes slideIn {
|
38 |
+
from {
|
39 |
+
opacity: 0;
|
40 |
+
transform: translateY(20px);
|
41 |
+
}
|
42 |
+
to {
|
43 |
+
opacity: 1;
|
44 |
+
transform: translateY(0);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
.chat-header {
|
49 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
50 |
+
color: white;
|
51 |
+
padding: 20px;
|
52 |
+
display: flex;
|
53 |
+
align-items: center;
|
54 |
+
gap: 10px;
|
55 |
+
}
|
56 |
+
|
57 |
+
.avatar {
|
58 |
+
width: 40px;
|
59 |
+
height: 40px;
|
60 |
+
border-radius: 50%;
|
61 |
+
background: rgba(255, 255, 255, 0.2);
|
62 |
+
display: flex;
|
63 |
+
align-items: center;
|
64 |
+
justify-content: center;
|
65 |
+
font-size: 20px;
|
66 |
+
}
|
67 |
+
|
68 |
+
.header-info h2 {
|
69 |
+
font-size: 18px;
|
70 |
+
font-weight: 600;
|
71 |
+
}
|
72 |
+
|
73 |
+
.header-info p {
|
74 |
+
font-size: 14px;
|
75 |
+
opacity: 0.8;
|
76 |
+
}
|
77 |
+
|
78 |
+
.chat-messages {
|
79 |
+
flex: 1;
|
80 |
+
overflow-y: auto;
|
81 |
+
padding: 20px;
|
82 |
+
display: flex;
|
83 |
+
flex-direction: column;
|
84 |
+
gap: 12px;
|
85 |
+
}
|
86 |
+
|
87 |
+
.chat-messages::-webkit-scrollbar {
|
88 |
+
width: 6px;
|
89 |
+
}
|
90 |
+
|
91 |
+
.chat-messages::-webkit-scrollbar-track {
|
92 |
+
background: #f1f1f1;
|
93 |
+
}
|
94 |
+
|
95 |
+
.chat-messages::-webkit-scrollbar-thumb {
|
96 |
+
background: #888;
|
97 |
+
border-radius: 3px;
|
98 |
+
}
|
99 |
+
|
100 |
+
.message {
|
101 |
+
max-width: 70%;
|
102 |
+
padding: 12px 16px;
|
103 |
+
border-radius: 18px;
|
104 |
+
animation: messageSlide 0.3s ease-out;
|
105 |
+
word-wrap: break-word;
|
106 |
+
}
|
107 |
+
|
108 |
+
@keyframes messageSlide {
|
109 |
+
from {
|
110 |
+
opacity: 0;
|
111 |
+
transform: translateY(10px);
|
112 |
+
}
|
113 |
+
to {
|
114 |
+
opacity: 1;
|
115 |
+
transform: translateY(0);
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
.message.sent {
|
120 |
+
background: #667eea;
|
121 |
+
color: white;
|
122 |
+
align-self: flex-end;
|
123 |
+
border-bottom-right-radius: 4px;
|
124 |
+
}
|
125 |
+
|
126 |
+
.message.received {
|
127 |
+
background: #f1f0f0;
|
128 |
+
color: #333;
|
129 |
+
align-self: flex-start;
|
130 |
+
border-bottom-left-radius: 4px;
|
131 |
+
}
|
132 |
+
|
133 |
+
.message-time {
|
134 |
+
font-size: 11px;
|
135 |
+
margin-top: 4px;
|
136 |
+
opacity: 0.7;
|
137 |
+
}
|
138 |
+
|
139 |
+
.chat-input-container {
|
140 |
+
padding: 20px;
|
141 |
+
background: #f9f9f9;
|
142 |
+
display: flex;
|
143 |
+
gap: 10px;
|
144 |
+
align-items: center;
|
145 |
+
}
|
146 |
+
|
147 |
+
.chat-input {
|
148 |
+
flex: 1;
|
149 |
+
padding: 12px 20px;
|
150 |
+
border: none;
|
151 |
+
border-radius: 25px;
|
152 |
+
background: white;
|
153 |
+
font-size: 16px;
|
154 |
+
outline: none;
|
155 |
+
transition: box-shadow 0.3s;
|
156 |
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
157 |
+
}
|
158 |
+
|
159 |
+
.chat-input:focus {
|
160 |
+
box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
|
161 |
+
}
|
162 |
+
|
163 |
+
.send-button {
|
164 |
+
width: 45px;
|
165 |
+
height: 45px;
|
166 |
+
border: none;
|
167 |
+
border-radius: 50%;
|
168 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
169 |
+
color: white;
|
170 |
+
cursor: pointer;
|
171 |
+
display: flex;
|
172 |
+
align-items: center;
|
173 |
+
justify-content: center;
|
174 |
+
transition: transform 0.2s, box-shadow 0.2s;
|
175 |
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
176 |
+
}
|
177 |
+
|
178 |
+
.send-button:hover {
|
179 |
+
transform: scale(1.05);
|
180 |
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
|
181 |
+
}
|
182 |
+
|
183 |
+
.send-button:active {
|
184 |
+
transform: scale(0.95);
|
185 |
+
}
|
186 |
+
|
187 |
+
.typing-indicator {
|
188 |
+
display: flex;
|
189 |
+
align-items: center;
|
190 |
+
gap: 4px;
|
191 |
+
padding: 12px 16px;
|
192 |
+
background: #f1f0f0;
|
193 |
+
border-radius: 18px;
|
194 |
+
align-self: flex-start;
|
195 |
+
margin-bottom: 12px;
|
196 |
+
opacity: 0;
|
197 |
+
transition: opacity 0.3s;
|
198 |
+
}
|
199 |
+
|
200 |
+
.typing-indicator.show {
|
201 |
+
opacity: 1;
|
202 |
+
}
|
203 |
+
|
204 |
+
.typing-dot {
|
205 |
+
width: 8px;
|
206 |
+
height: 8px;
|
207 |
+
background: #999;
|
208 |
+
border-radius: 50%;
|
209 |
+
animation: typing 1.4s infinite;
|
210 |
+
}
|
211 |
+
|
212 |
+
.typing-dot:nth-child(2) {
|
213 |
+
animation-delay: 0.2s;
|
214 |
+
}
|
215 |
+
|
216 |
+
.typing-dot:nth-child(3) {
|
217 |
+
animation-delay: 0.4s;
|
218 |
+
}
|
219 |
+
|
220 |
+
@keyframes typing {
|
221 |
+
0%, 60%, 100% {
|
222 |
+
transform: translateY(0);
|
223 |
+
}
|
224 |
+
30% {
|
225 |
+
transform: translateY(-10px);
|
226 |
+
}
|
227 |
+
}
|
228 |
+
|
229 |
+
@media (max-width: 480px) {
|
230 |
+
body {
|
231 |
+
padding: 0;
|
232 |
+
}
|
233 |
+
|
234 |
+
.chat-container {
|
235 |
+
height: 100vh;
|
236 |
+
max-width: 100%;
|
237 |
+
border-radius: 0;
|
238 |
+
}
|
239 |
+
}
|
240 |
+
</style>
|
241 |
+
</head>
|
242 |
+
<body>
|
243 |
+
<div class="chat-container">
|
244 |
+
<div class="chat-header">
|
245 |
+
<div class="avatar">💬</div>
|
246 |
+
<div class="header-info">
|
247 |
+
<h2>Chat Support</h2>
|
248 |
+
<p>Online</p>
|
249 |
+
</div>
|
250 |
+
</div>
|
251 |
+
|
252 |
+
<div class="chat-messages" id="messages">
|
253 |
+
<div class="message received">
|
254 |
+
<div>Hello! How can I help you today?</div>
|
255 |
+
<div class="message-time">2:30 PM</div>
|
256 |
+
</div>
|
257 |
+
<div class="message sent">
|
258 |
+
<div>Hi there! I'm looking for assistance with my account.</div>
|
259 |
+
<div class="message-time">2:31 PM</div>
|
260 |
+
</div>
|
261 |
+
<div class="message received">
|
262 |
+
<div>I'd be happy to help! What seems to be the issue?</div>
|
263 |
+
<div class="message-time">2:32 PM</div>
|
264 |
+
</div>
|
265 |
+
</div>
|
266 |
+
|
267 |
+
<div class="typing-indicator" id="typing">
|
268 |
+
<div class="typing-dot"></div>
|
269 |
+
<div class="typing-dot"></div>
|
270 |
+
<div class="typing-dot"></div>
|
271 |
+
</div>
|
272 |
+
|
273 |
+
<div class="chat-input-container">
|
274 |
+
<input type="text" class="chat-input" id="input" placeholder="Type a message..." maxlength="500">
|
275 |
+
<button class="send-button" id="send">
|
276 |
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
277 |
+
<path d="m22 2-7 20-4-9-9-4Z"/>
|
278 |
+
<path d="M22 2 11 13"/>
|
279 |
+
</svg>
|
280 |
+
</button>
|
281 |
+
</div>
|
282 |
+
</div>
|
283 |
+
|
284 |
+
<script>
|
285 |
+
const messagesContainer = document.getElementById('messages');
|
286 |
+
const input = document.getElementById('input');
|
287 |
+
const sendButton = document.getElementById('send');
|
288 |
+
const typingIndicator = document.getElementById('typing');
|
289 |
+
|
290 |
+
let messageHistory = JSON.parse(localStorage.getItem('chatHistory')) || [
|
291 |
+
{ text: "Hello! How can I help you today?", type: "received", time: "2:30 PM" },
|
292 |
+
{ text: "Hi there! I'm looking for assistance with my account.", type: "sent", time: "2:31 PM" },
|
293 |
+
{ text: "I'd be happy to help! What seems to be the issue?", type: "received", time: "2:32 PM" }
|
294 |
+
];
|
295 |
+
|
296 |
+
function renderMessages() {
|
297 |
+
messagesContainer.innerHTML = '';
|
298 |
+
messageHistory.forEach(msg => {
|
299 |
+
const messageDiv = document.createElement('div');
|
300 |
+
messageDiv.className = `message ${msg.type}`;
|
301 |
+
messageDiv.innerHTML = `
|
302 |
+
<div>${msg.text}</div>
|
303 |
+
<div class="message-time">${msg.time}</div>
|
304 |
+
`;
|
305 |
+
messagesContainer.appendChild(messageDiv);
|
306 |
+
});
|
307 |
+
messagesContainer.scrollTop = messagesContainer.scrollHeight;
|
308 |
+
}
|
309 |
+
|
310 |
+
function addMessage(text, type) {
|
311 |
+
const now = new Date();
|
312 |
+
const time = now.toLocaleTimeString('en-US', {
|
313 |
+
hour: 'numeric',
|
314 |
+
minute: '2-digit'
|
315 |
+
});
|
316 |
+
|
317 |
+
const message = { text, type, time };
|
318 |
+
messageHistory.push(message);
|
319 |
+
localStorage.setItem('chatHistory', JSON.stringify(messageHistory));
|
320 |
+
|
321 |
+
renderMessages();
|
322 |
+
}
|
323 |
+
|
324 |
+
function showTypingIndicator() {
|
325 |
+
typingIndicator.classList.add('show');
|
326 |
+
messagesContainer.scrollTop = messagesContainer.scrollHeight;
|
327 |
+
|
328 |
+
setTimeout(() => {
|
329 |
+
typingIndicator.classList.remove('show');
|
330 |
+
const responses = [
|
331 |
+
"Thanks for your message!",
|
332 |
+
"Let me check that for you",
|
333 |
+
"I'll get back to you shortly",
|
334 |
+
"One moment please",
|
335 |
+
"I'm looking into it"
|
336 |
+
];
|
337 |
+
const randomResponse = responses[Math.floor(Math.random() * responses.length)];
|
338 |
+
addMessage(randomResponse, "received");
|
339 |
+
}, 1500);
|
340 |
+
}
|
341 |
+
|
342 |
+
function sendMessage() {
|
343 |
+
const text = input.value.trim();
|
344 |
+
if (text) {
|
345 |
+
addMessage(text, "sent");
|
346 |
+
input.value = '';
|
347 |
+
setTimeout(showTypingIndicator, 1000);
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
sendButton.addEventListener('click', sendMessage);
|
352 |
+
|
353 |
+
input.addEventListener('keypress', (e) => {
|
354 |
+
if (e.key === 'Enter') {
|
355 |
+
sendMessage();
|
356 |
+
}
|
357 |
+
});
|
358 |
+
|
359 |
+
renderMessages();
|
360 |
+
</script>
|
361 |
+
</body>
|
362 |
+
</html>
|