
@font-face {
    font-family: "Vazir";
    src:url("../fonts/vazir.ttf") format("truetype");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --jahesh-font: "Vazir", Tahoma, Arial, sans-serif;
}

.jahesh-chat-box{

    height:550px;

    overflow-y:auto;

    background:#f5f7fb;

    padding:25px;

    border-radius:18px;

    border:1px solid #e5e7eb;

}

.jahesh-message{

    max-width:70%;

    padding:15px 18px;

    margin-bottom:18px;

    border-radius:18px;

    position:relative;

    line-height:1.9;

    word-break:break-word;

    box-shadow:0 3px 10px rgba(0,0,0,.06);

}

.jahesh-message.student{

    background:#2563eb;

    color:#fff;

    margin-right:auto;

    margin-left:0;

    border-bottom-left-radius:5px;

}

.jahesh-message.admin{

    background:#ffffff;

    color:#222;

    margin-left:auto;

    margin-right:0;

    border-bottom-right-radius:5px;

}

.jahesh-message strong{

    display:block;

    margin-bottom:10px;

    font-size:13px;

    opacity:.8;

}

.message-time{

    margin-top:12px;

    font-size:11px;

    opacity:.7;

    text-align:left;

}

.chat-send-box{

    margin-top:25px;

}

.chat-send-box textarea{

    width:100%;

    border-radius:15px;

    border:1px solid #ddd;

    padding:15px;

    resize:none;

    min-height:120px;

    font-family:inherit;

}

.chat-send-box button{

    margin-top:15px;

}

/* =========================================================
   FIX CHAT MESSAGE OVERFLOW
========================================================= */

.jahesh-consultation-chat-page,
.consultation-chat-container,
.consultation-chat-messages {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}


/* ردیف هر پیام */

.consultation-message-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}


/* محتوای پیام */

.consultation-message-content {
    min-width: 0;
    max-width: calc(100% - 70px);
    box-sizing: border-box;
}


/* هدر پیام */

.consultation-message-header {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}


/* حباب پیام */

.consultation-message-bubble {
    max-width: 100%;
    min-width: 0;

    box-sizing: border-box;

    /*
     * مهم‌ترین قسمت:
     * متن‌های خیلی طولانی و بدون فاصله را می‌شکند
     */

    overflow-wrap: anywhere;
    word-break: break-word;

    /*
     * اجازه نمی‌دهد متن در یک خط
     * از عرض حباب خارج شود
     */

    white-space: normal;

    /*
     * جلوگیری از اسکرول افقی
     */

    overflow-x: hidden;

    /*
     * ظاهر بهتر متن
     */

    line-height: 2;

}


/* پاراگراف‌های داخل پیام */

.consultation-message-bubble p {
    max-width: 100%;
    margin: 0 0 10px;

    overflow-wrap: anywhere;
    word-break: break-word;

    white-space: normal;
}


.consultation-message-bubble p:last-child {
    margin-bottom: 0;
}


/* لینک‌ها داخل پیام هم نباید صفحه را خراب کنند */

.consultation-message-bubble a {
    max-width: 100%;

    overflow-wrap: anywhere;
    word-break: break-word;

}


/* اگر کاربر متن خیلی خیلی طولانی بدون فاصله بفرستد */

.consultation-message-bubble,
.consultation-message-bubble * {
    overflow-wrap: anywhere;
}


/* =========================================================
   پیام‌های کاربر
========================================================= */

.consultation-message-row.message-me {
    min-width: 0;
}


/* =========================================================
   پیام‌های مشاور
========================================================= */

.consultation-message-row.message-advisor {
    min-width: 0;
}


/* =========================================================
   موبایل
========================================================= */

@media (max-width: 768px) {

    .consultation-message-content {
        max-width: calc(100% - 55px);
    }

    .consultation-message-bubble {
        max-width: 100%;
        font-size: 14px;
        line-height: 1.9;
    }

}

.consultation-message-bubble {
    width: auto;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}




/* =========================================================
   CHAT
========================================================= */

.jahesh-consultation-chat-page {
    direction: rtl;
}

.consultation-chat-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.consultation-chat-messages {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}


/* =========================================================
   ردیف پیام
========================================================= */

.consultation-message-row {
    display: flex;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;

    margin-bottom: 22px;

    direction: rtl;
}


/* =========================================================
   پیام من - سمت راست
========================================================= */

.consultation-message-row.message-me {
    flex-direction: row;
    justify-content: flex-start;
}


/* =========================================================
   پیام مشاور - سمت چپ
========================================================= */

.consultation-message-row.message-advisor {
    flex-direction: row-reverse;
    justify-content: flex-start;
}


/* =========================================================
   آواتار
========================================================= */

.consultation-message-avatar {
    flex: 0 0 42px;

    width: 42px;
    height: 42px;

    margin: 0;

    box-sizing: border-box;
}


/* =========================================================
   پیام من
   آواتار و حباب کاملاً نزدیک به هم
========================================================= */

.consultation-message-row.message-me
.consultation-message-avatar {
    margin-left: 0;
    margin-right: 0;
}


/* =========================================================
   پیام مشاور
========================================================= */

.consultation-message-row.message-advisor
.consultation-message-avatar {
    margin-left: 0;
    margin-right: 0;
}


/* =========================================================
   محتوای پیام
========================================================= */

.consultation-message-content {
    min-width: 0;

    max-width: calc(100% - 42px);

    box-sizing: border-box;

    display: flex;
    flex-direction: column;
}


/* پیام من */

.message-me .consultation-message-content {
    align-items: flex-start;
}


/* پیام مشاور */

.message-advisor .consultation-message-content {
    align-items: flex-end;
}


/* =========================================================
   هدر پیام
========================================================= */

.consultation-message-header {
    display: flex;

    align-items: center;

    gap: 6px;

    width: 100%;

    margin-bottom: 5px;

    direction: rtl;
}


/* نام فرستنده */

.consultation-message-header strong {
    white-space: nowrap;
}


/* =========================================================
   زمان
   زیر پیام قرار می‌گیرد
========================================================= */

.consultation-message-header span {
    display: block;

    font-size: 11px;

    color: #8b98aa;

    white-space: nowrap;
}


/* =========================================================
   حباب پیام
========================================================= */

.consultation-message-bubble {
    display: block;

    width: fit-content;

    max-width: 100%;

    min-width: 0;

    box-sizing: border-box;

    padding: 12px 18px;

    border-radius: 14px;

    direction: rtl;

    text-align: right;

    white-space: normal;

    overflow-wrap: anywhere;

    word-break: break-word;

    overflow-x: hidden;

    line-height: 2;
}


/* =========================================================
   متن داخل حباب
========================================================= */

.consultation-message-bubble p {
    margin: 0;

    max-width: 100%;

    direction: rtl;

    text-align: right;

    white-space: normal;

    overflow-wrap: anywhere;

    word-break: break-word;

    line-height: 2;
}


/* =========================================================
   لینک‌های طولانی
========================================================= */

.consultation-message-bubble a {
    overflow-wrap: anywhere;
    word-break: break-word;
}


/* =========================================================
   مهم:
   زمان را زیر حباب قرار بده
========================================================= */

.consultation-message-header {
    flex-direction: column;

    align-items: flex-start;

    gap: 2px;
}


/* نام و زمان به صورت ستونی */


/* پیام من */

.message-me .consultation-message-header {
    align-items: flex-start;
}


/* پیام مشاور */

.message-advisor .consultation-message-header {
    align-items: flex-end;
}


/* =========================================================
   اگر ساختار HTML فعلی header بالای پیام است،
   ترتیب بصری را اصلاح می‌کنیم
========================================================= */

.consultation-message-content {
    position: relative;
}


/* =========================================================
   موبایل
========================================================= */

@media (max-width: 768px) {

    .consultation-message-avatar {
        flex-basis: 38px;

        width: 38px;
        height: 38px;
    }

    .consultation-message-content {
        max-width: calc(100% - 38px);
    }

    .consultation-message-bubble {
        max-width: 100%;

        padding: 10px 14px;

        font-size: 14px;
    }

}

