/* ۱. متغیرهای رنگ */
:root {
    --bg: #1e1e1e;
    --primary: #0a84ff;
    --secondary: #2c2c2c;
    --text: #e0e0e0;
    --msg-bg: #2c2c2c;
    --msg-user: #0a84ff;
    --msg-time: #888;
    --input-bg: #2c2c2c;
    --input-text: #e0e0e0;
    --border-radius: 8px;
}

/* ۲. ریسِت اولیه */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ۳. کانتینر اصلی */
#app {
    width: 100%;
    max-width: 600px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--bg);
}

/* ۴. هدر */
.chat-header {
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    text-align: center;
    font-weight: 600;
    font-size: 1.2rem;
}

/* ۵. بخش پیام‌ها */
.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    background: var(--secondary);
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: var(--border-radius);
    background: var(--msg-bg);
    word-wrap: break-word;
}

.message .meta {
    font-size: 0.85rem;
    color: var(--msg-time);
    margin-bottom: 4px;
}

.message .user {
    color: var(--msg-user);
    font-weight: 600;
    margin-right: 6px;
}

/* ۶. فرم ارسال */
.chat-form {
    display: flex;
    padding: 8px 12px;
    background: var(--bg);
    border-top: 1px solid var(--secondary);
}

.chat-form input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--secondary);
    border-radius: var(--border-radius);
    background: var(--input-bg);
    color: var(--input-text);
    font-size: 1rem;
    margin-right: 8px;
}

.chat-form button {
    padding: 10px 18px;
    border: none;
    border-radius: var(--border-radius);
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-form button:hover {
    background: #0066cc;
}

/* ۱. فاصله بین پیام‌ها */
#messages .msg {
    margin-bottom: 12px;          /* فاصله پایین هر پیام */
    padding: 10px 14px;           /* داخل‌چاپ */
    background: #2c2c2c;          /* پس‌زمینه‌ پیام */
    border-radius: 8px;           /* گوشه‌های گرد */
    color: #e0e0e0;               /* رنگ متن */
    font-size: 0.95rem;
}

/* ۲. نمایش زمان و نام کاربر به‌صورت جداگانه */
.msg .meta {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 4px;
}
.msg .meta .user {
    color: #0a84ff;               /* رنگ نام کاربر */
    font-weight: 600;
    margin-right: 6px;
}