body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f9f9f9;
    color: #202124;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
}

.chat-container { width: 100%; max-width: 800px; height: 95vh; max-height: 900px; background-color: #ffffff; border: 1px solid #e0e0e0; border-radius: 12px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); display: flex; flex-direction: column; overflow: hidden; position: relative; }
.chat-header { background-color: #ffffff; padding: 15px 20px; border-bottom: 1px solid #f0f0f0; display: flex; align-items: center; justify-content: space-between; }
.chat-header h1 { margin: 0; font-size: 1.1rem; color: #202124; font-weight: 600; }
.status-light { width: 10px; height: 10px; background-color: #34a853; border-radius: 50%; }

.chat-window { flex-grow: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 25px; }
.chat-window::-webkit-scrollbar { width: 8px; }
.chat-window::-webkit-scrollbar-track { background: transparent; }
.chat-window::-webkit-scrollbar-thumb { background-color: #d1d5db; border-radius: 10px; }

.message { display: flex; align-items: flex-start; gap: 15px; max-width: 90%; animation: fadeIn 0.5s ease-in-out; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar svg { width: 65%; height: 65%; }

.message-content { display: flex; flex-direction: column; padding-top: 2px; position: relative; }
.speaker-name { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }

.message-text {
    padding: 0;
    line-height: 1.75;
    margin: 0;
    font-size: 1rem;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* All CSS for .typing-cursor and its keyframes has been removed. */

.speaker-نواف .avatar { background-color: #e0f0ff; }
.speaker-نواف .speaker-name { color: #005a9c; }

.speaker-لينا .avatar { background-color: #f3e8ff; }
.speaker-لينا .speaker-name { color: #5f0f99; }

.speaker-صقر .avatar { background-color: #e6f4ea; }
.speaker-صقر .speaker-name { color: #1e6e3c; }

/* System Message Styling */
.speaker-مجتمع, .speaker-نظام, .speaker-الحوار { align-self: center; max-width: 100%; font-style: italic; color: #5f6368; font-size: 0.9rem; padding: 10px 0; border-top: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0; text-align: center; }
.speaker-مجتمع .avatar, .speaker-مجتمع .message-content, .speaker-نظام .avatar, .speaker-نظام .message-content, .speaker-الحوار .avatar, .speaker-الحوار .message-content { display: none; }
.speaker-مجتمع::before, .speaker-نظام::before, .speaker-الحوار::before { content: attr(data-message); }

/* Typing Indicator & Scroll Button */
.typing-indicator { padding: 10px 20px; height: 40px; box-sizing: border-box; font-style: italic; color: #5f6368; opacity: 0; transition: opacity 0.3s; }
.typing-indicator.visible { opacity: 1; }
.typing-dots span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background-color: #9ca3af; margin: 0 2px; animation: blink 1.4s infinite both; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

.scroll-to-bottom { position: absolute; bottom: 60px; left: 50%; transform: translateX(50%); background-color: #ffffff; color: #343541; border: 1px solid #e0e0e0; border-radius: 50%; width: 40px; height: 40px; padding: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.15); opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s, transform 0.3s; }
.scroll-to-bottom.visible { opacity: 1; visibility: visible; transform: translateX(50%) translateY(-10px); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 50% { opacity: 0; } } /* This is only used by the "is typing" dots now */