/* ==========================================================================
   فونت‌ها و متغیرهای پایه (مدرن و مینیمال)
   ========================================================================== */
@font-face { font-family: 'Peyda'; src: url('../fonts/PeydaWeb-Regular.woff2') format('woff2'); font-weight: normal; font-style: normal; }
@font-face { font-family: 'Peyda'; src: url('../fonts/PeydaWeb-Bold.woff2') format('woff2'); font-weight: bold; font-style: normal; }
@font-face { font-family: 'Vazir Code'; src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-code-font@v1.1.2/dist/Vazir-Code.woff2') format('woff2'); font-weight: normal; font-style: normal; }

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --border-soft: #e2e8f0;
    --primary: #2563eb;
    --radius-md: 12px;
    --radius-lg: 16px;
    --chat-sent-bg: #f1f5f9; /* طوسی بسیار روشن برای پیام فرستاده شده */
    --chat-recv-bg: #ffffff; /* سفید برای پیام دریافتی */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Peyda', Tahoma, sans-serif; background-color: var(--bg-main); color: var(--text-dark); direction: rtl; line-height: 1.7; font-size: 15px; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: var(--primary); transition: 0.2s; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.card { background: var(--bg-card); border-radius: var(--radius-md); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03); padding: 25px; margin-bottom: 25px; border: 1px solid var(--border-soft); }

/* فرم‌ها و دکمه‌ها */
input[type="text"], input[type="password"], input[type="url"], textarea, select { width: 100%; padding: 12px 16px; border: 1px solid var(--border-soft); border-radius: 8px; font-family: inherit; font-size: 14px; outline: none; transition: border 0.2s; }
input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; border: none; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: bold; transition: 0.2s; gap: 8px; }
.btn-blue { background: #2563eb; color: #fff; } .btn-blue:hover { background: #1d4ed8; }
.btn-green { background: #10b981; color: #fff; }
.btn-gray { background: #f1f5f9; color: #475569; } .btn-gray:hover { background: #e2e8f0; }

/* ==========================================================================
   محیط چت (حرفه‌ای و مینیمال)
   ========================================================================== */
.chat-container { display: flex; flex-direction: column; height: calc(100vh - 120px); background: #fff; border-radius: var(--radius-lg); box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05); border: 1px solid var(--border-soft); overflow: hidden; }
.chat-header { background: #fff; padding: 15px 25px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; gap: 15px; font-weight: bold; }
.chat-messages { flex: 1; padding: 25px; overflow-y: auto; background-color: #fafafa; }

.msg-wrapper { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 20px; clear: both; }
.msg-wrapper.sent { flex-direction: row-reverse; float: left; width: 100%; }
.msg-wrapper.recv { float: right; width: 100%; }

.msg-bubble { max-width: 75%; padding: 14px 18px; position: relative; line-height: 1.6; font-size: 15px; word-wrap: break-word; }
.msg-wrapper.sent .msg-bubble { background-color: var(--chat-sent-bg); border-radius: 16px 16px 16px 4px; color: var(--text-dark); border: 1px solid #e2e8f0; }
.msg-wrapper.recv .msg-bubble { background-color: var(--chat-recv-bg); border-radius: 16px 16px 4px 16px; border: 1px solid var(--border-soft); box-shadow: 0 1px 2px rgba(0,0,0,0.02); }

/* آواتارها */
.avatar-circle { width: 36px; height: 36px; min-width: 36px; border-radius: 50%; background: #e2e8f0; color: #475569; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 16px; border: 1px solid #cbd5e1; }
.avatar-img { width: 36px; height: 36px; min-width: 36px; border-radius: 50%; object-fit: cover; border: 1px solid #cbd5e1; }

/* استایل کدهای داخل پیام (لایت و حرفه‌ای) */
.msg-bubble pre, code { background: #ffffff; color: #0f172a; padding: 12px; border-radius: 8px; border: 1px solid #e2e8f0; direction: ltr; text-align: left; font-family: 'Vazir Code', monospace; font-size: 14px; margin-top: 10px; overflow-x: auto; }
.msg-wrapper.recv .msg-bubble pre { background: #f8fafc; }

/* اکشن‌های پیام (کپی و ...) */
.msg-actions { display: flex; gap: 5px; margin-top: 8px; border-top: 1px solid rgba(0,0,0,0.05); padding-top: 8px; }
.action-icon { background: transparent; border: none; cursor: pointer; color: #64748b; font-size: 14px; padding: 4px; border-radius: 4px; transition: 0.2s; display: inline-flex; align-items: center; gap: 4px; }
.action-icon:hover { background: #e2e8f0; color: #0f172a; }

/* عکس‌های درون چت */
.chat-image-preview { max-width: 100%; border-radius: 8px; margin-bottom: 10px; border: 1px solid #e2e8f0; }

.chat-input-area { padding: 15px 25px; background: #fff; border-top: 1px solid var(--border-soft); }
.ql-container { font-family: 'Peyda', sans-serif !important; font-size: 15px !important; border-radius: 0 0 8px 8px; border-color: var(--border-soft) !important; }
.ql-toolbar { border-radius: 8px 8px 0 0; background: #f8fafc; border-color: var(--border-soft) !important; }