File size: 5,030 Bytes
a214147 fc9eac3 a214147 fc9eac3 a214147 fc9eac3 a214147 fc9eac3 a214147 | 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 | <!DOCTYPE html>
<html lang="en" class="scroll-smooth">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cosmic Chatter</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Space Grotesk', sans-serif;
}
.gradient-text {
background: linear-gradient(90deg, #0ea5e9 0%, #8b5cf6 100%);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.chat-bubble {
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
</style>
</head>
<body class="bg-gray-900 text-white min-h-screen">
<div class="max-w-3xl mx-auto p-4">
<header class="py-6 border-b border-gray-700">
<h1 class="text-3xl font-bold gradient-text">المحادثة الكونية</h1>
<p class="text-gray-400">رفيقك في المحادثات بين النجوم</p>
</header>
<div id="chat-container" class="h-[70vh] overflow-y-auto py-4 space-y-4">
<div class="chat-bubble bg-gray-800 p-4 rounded-lg max-w-[80%]">
<div class="flex items-center mb-2">
<div class="w-8 h-8 rounded-full bg-primary-500 flex items-center justify-center mr-2">
<i data-feather="star" class="w-4 h-4"></i>
</div>
<span class="font-bold">كوزمو</span>
</div>
<p class="text-gray-200">مرحباً أيها المسافر الفضائي! 🌌 كيف يمكنني مساعدتك اليوم؟</p>
</div>
</div>
<div class="mt-4 flex gap-2">
<input type="text" id="user-input" placeholder="اكتب رسالتك هنا..."
class="flex-1 bg-gray-800 border border-gray-700 rounded-lg px-4 py-3 focus:outline-none focus:ring-2 focus:ring-primary-500">
<button id="send-btn" class="bg-primary-600 hover:bg-primary-700 px-6 py-3 rounded-lg font-medium transition-all">
<i data-feather="send"></i>
</button>
</div>
</div>
<script>
feather.replace();
const chatContainer = document.getElementById('chat-container');
const userInput = document.getElementById('user-input');
const sendBtn = document.getElementById('send-btn');
function addMessage(sender, text, isUser = false) {
const bubble = document.createElement('div');
bubble.className = `chat-bubble bg-gray-800 p-4 rounded-lg max-w-[80%] ${isUser ? 'ml-auto bg-primary-900/30' : ''}`;
if (!isUser) {
bubble.innerHTML = `
<div class="flex items-center mb-2">
<div class="w-8 h-8 rounded-full bg-primary-500 flex items-center justify-center mr-2">
<i data-feather="star" class="w-4 h-4"></i>
</div>
<span class="font-bold">Cosmo</span>
</div>
`;
}
const textElement = document.createElement('p');
textElement.className = 'text-gray-200';
textElement.textContent = text;
bubble.appendChild(textElement);
chatContainer.appendChild(bubble);
chatContainer.scrollTop = chatContainer.scrollHeight;
feather.replace();
}
sendBtn.addEventListener('click', () => {
const message = userInput.value.trim();
if (message) {
addMessage('You', message, true);
userInput.value = '';
// Simulate bot response
setTimeout(() => {
const responses = [
"مثير للاهتمام! أخبرني المزيد عن ذلك.",
"من منظوري الكوني، هذا مثير للاهتمام حقاً!",
"أنا أحلل ذلك من خلال قاعدة بيانات النجوم الخاصة بي...",
"دعني أستشير قاعدة المعرفة المجرية الخاصة بي...",
"✨ هذا يذكرني بمجرة أندروميدا!"
];
addMessage('Cosmo', responses[Math.floor(Math.random() * responses.length)]);
}, 1000);
}
});
userInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') {
sendBtn.click();
}
});
</script>
</body>
</html> |