

/* تعریف فونت استعداد (Estedad) */
@font-face {
    font-family: 'Estedad';
    src: url('fonts/Estedad-Medium.woff2') format('woff2'),
         url('fonts/Estedad-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap; /* برای بارگذاری بهتر در مرورگرها */
}
@font-face {
    font-family: 'KalamehWeb-Medium';
    src: url('fonts/KalamehWeb-Medium.woff2') format('woff2'),
         url('fonts/KalamehWeb-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap; /* برای بارگذاری بهتر در مرورگرها */
}
@font-face {
    font-family: 'Morabba-Medium';
    src: url('fonts/Morabba-Medium.woff2') format('woff2'),
         url('fonts/Morabba-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap; /* برای بارگذاری بهتر در مرورگرها */
}

/* استفاده از فونت استعداد به عنوان فونت اصلی برنامه */

/* ========================================================= */
/* ۰. رفع مشکل اسکرول افقی در موبایل */
/* ========================================================= */
html, body {
    /* این دو خط اسکرول افقی اضافی را پنهان کرده و تضمین می‌کند که عرض از کادر بیرون نمی‌زند */
    overflow-x: hidden; 
    width: 100%;
}

/* ========================================================= */
/* ۱. تنظیمات پایه و وسط چین کردن (Centering) */
/* ========================================================= */
body {
   font-family: 'Estedad', Tahoma, sans-serif; 
    bac1kground: #f8f9fa; 
    display: flex;
    justify-content: center; /* وسط‌چین کردن افقی */
    align-items: center;    /* وسط‌چین کردن عمودی */
    min-height: 100vh;
    margin: 0;
    direction: rtl; 
    font-size: 15px;
    color: #343a40;
    padding: 20px;
}

/* کانتینر اصلی تمام محتوا (وسط‌چین شده) */
.chatbot-wrapper {
    width: 480px; 
    max-width: 90%;
    box-shadow: none; 
    display: flex;
    flex-direction: column;
    align-items: center; 
}

/* ========================================================= */
/* ۲. استایل هدر (ربات کارشناس هوشمند بیمه) */
/* ========================================================= */
.header-2025 {
    background: #26389c; 
    color: white;
    padding: 20px; /* <--- کاهش پدینگ برای فضای دکمه */
    z-index: 9999;
    /* ***** تغییرات اساسی در اینجا ***** */
    display: flex; /* فعال‌سازی Flexbox */
    flex-direction: column; /* چیدن محتوا به صورت عمودی (زیر هم) */
    align-items: flex-end; /* همه‌ی محتوا (از جمله دکمه) به سمت راست می‌رود */
    text-align: right; /* متن‌ها به سمت راست می‌روند */
    padding-right: 20px; /* <--- حذف padding-right اضافه شده در مرحله قبل */
    /* ************************ */
    
    width: 100%;
    box-sizing: border-box; 
    position: relative; /* حفظ می‌شود، اما دیگر برای دکمه استفاده نمی‌شود */
}

/* کانتینر متن (جدید) */
.header-text-content {
    width: 100%; /* مطمئن می‌شویم متن تمام عرض را اشغال کند */
    margin-bottom: 10px; /* فاصله از دکمه */
}
.header-2025 h1 {
    
    margin: 0 0 5px 0;
    font-size: 1.6em;
    font-weight: 300;

}
.header-2025 p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.9;
    font-weight: 300;
}

/* ========================================================= */
/* ۳. کادر چت اصلی (Chat Card) */
/* ========================================================= */
.chat-card {
    background-color: white;
    width: 100%;
    height: 65vh; 
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1); 
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    margin-top: -1px; 
}

/* ناحیه نمایش پیام‌ها */
.messages-area {
    padding: 20px 15px;
    overflow-y: auto;
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    background-color: #fcfdff; 
}

/* استایل اسکرول‌بار (مدرن) */
.messages-area::-webkit-scrollbar {
    width: 5px;
}
.messages-area::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 10px;
}

/* ========================================================= */
/* ۴. حباب‌های گفتگو (Bubbles) */
/* ========================================================= */

.message {
    display: flex;
    margin: 8px 0;
    width: 100%;
}

.bubble {
    padding: 12px 18px;
    border-radius: 20px;
    max-width: 75%;
    line-height: 1.6;
    word-wrap: break-word; 
}

/* پیام کاربر (راست) */
.user-message {
    justify-content: flex-end; 
}
.user-message .bubble {
    background-color:#4e4e4f; 
    color: white;
    border-bottom-left-radius: 6px;
    margin-bottom:10px;
}

/* پیام ربات (چپ) */
.bot-message {
    justify-content: flex-start; 
}
.bot-message .bubble {
   display: flex;
    flex-direction: column; /* چیدمان زیر هم */
    align-items: flex-start; /* در حالت RTL یعنی چسبیدن به سمت راست */
    padding: 12px 15px;
    direction: rtl;
    text-align: right;
 line-height: 1.6;
}

/* ========================================================= */
/* ۵. ناحیه ورودی (Input Area) */
/* ========================================================= */
.input-area {
    display: flex;
    padding: 16px;
    border-top: 1px solid #dee2e6;
    background-color: #ffffff;
    align-items: center;
}

#user-input {
    font-family: 'Estedad', Tahoma, sans-serif;
    flex-grow: 1;
    padding: 12px 18px;
    border: 1px solid #ced4da;
    border-radius: 25px;
    font-size: 1em;
    margin-left: 10px; 
    transition: border-color 0.3s, box-shadow 0.3s;
    margin-top: 10px;
}

#user-input:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
    outline: none;
}
#user-input:disabled {
    background-color: #f8f9fa;
}

#send-btn {
    background-color: #1e6c7e; 
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.1s;
}

#send-btn:hover {
    background-color: #1e6c7e;
}
#send-btn:active {
    transform: scale(0.96);
}
#send-btn:disabled {
    background-color: #adb5bd;
}


/* ========================================================= */
/* ۶. ریسپانسیو (برای موبایل) */
/* ========================================================= */
@media (max-width: 600px) {
    
    body {
        padding: 0;
        align-items: flex-start;
    }
    
    .chatbot-wrapper {
        width: 100%; 
        max-width: 100%;
        height: 100vh; /* کل ارتفاع Viewport را می‌گیرد */
    }

    .chat-card {
        height: auto; 
        flex-grow: 1; /* تمام فضای باقی‌مانده را اشغال می‌کند */
        border-radius: 0; 
        box-shadow: none; 
    }
    
    .header-2025 {
        border-radius: 0;
    }

    .messages-area {
        padding: 15px 10px;
    }
    
    .input-area {
    display: flex;
    padding: 8px;
    border-top: 1px solid #dee2e6;
    background-color: #ffffff;
    align-items: center;
}

    
    .user-message .bubble, .bot-message .bubble {
        max-width: 90%; 
        font-size: 0.95em;
        line-height: 1.6;
    }
}
/* در فایل style.css */

.bubble {
    /* ... کدهای قبلی ... */
    white-space: pre-wrap; /* <--- این خط باید وجود داشته باشد */
    word-wrap: break-word; 
    /* ... کدهای بعدی ... */
}

/* استایل برای نمایش نام کارشناس در داخل حباب پیام */
.sender-name {
    display: block; /* باعث می‌شود نام و پیام در خطوط جدا باشند */
    font-weight: bold;
    color: #4a90e2; 
    margin-bottom: 5px; /* کمی فاصله از پیام اصلی */
    
    /* white-space: pre-wrap; نیز باید در .bubble وجود داشته باشد */
}
/* ========================================================= */
/* ۰. رفع مشکل اسکرول افقی در موبایل */
/* ========================================================= */
html, body {
    /* تضمین می‌کند که عرض از کادر بیرون نمی‌زند */
    overflow-x: hidden; 
    width: 100%;
}

/* ========================================================= */
/* استایل برای صفحه آغازین (Start Overlay) */
/* ========================================================= */
#start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); 
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#start-btn {
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: bold;
    background-color: #28a745; 
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#start-btn:hover {
    background-color: #1e7e34;
}


/* ========================================================= */
/* ۱. تنظیمات پایه و کانتینر اصلی */
/* ========================================================= */
body {
   font-family: 'Estedad', Tahoma, sans-serif;
    backg1round: #f8f9fa; 
    background-image: url('pic/login-bg2.svg');
background-size: cover;       /* عکس کل محیط را پر می‌کند */
background-position: center;  /* عکس در مرکز قرار می‌گیرد */
background-repeat: no-repeat; /* از تکرار شدن عکس جلوگیری می‌کند */
background-attachment: fixed; /* (اختیاری) عکس هنگام اسکرول ثابت می‌ماند */
    display: flex;
    justify-content: center; 
    align-items: center;    
    min-height: 100vh;
    margin: 0;
    direction: rtl; 
    font-size: 15px;
    color: #343a40;
    padding: 0px;
}

/* کانتینر اصلی چت‌بات */
.chatbot-wrapper {
    width: 780px; 
    max-width: 90%;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1); /* اضافه کردن سایه به wrapper */
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* مهم: برای نگهداری border-radius */
    height: 85vh; /* ارتفاع ثابت در دسکتاپ */
}

/* ========================================================= */
/* ۲. استایل هدر */
/* ========================================================= */
.header-2025 {
    background:#2b3339; 
    color: white;
    padding: 20px 20px;
    text-align: center;
    width: 100%;
    box-sizing: border-box; /* اطمینان از محاسبات درست عرض */
}
.header-2025 h1 {
    font-family: 'KalamehWeb-Medium', Tahoma, sans-serif;
    margin: 0px 0 1px 0;
    font-size: 1.2em;
    font-weight: 300;
 
}
.header-2025 p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.9;
    font-weight: 300;
}

/* ========================================================= */
/* ۳. کادر چت اصلی و پیام‌ها */
/* ========================================================= */
.chat-card {
    background-color: white;
    width: 100%;
    flex-grow: 1; /* اجازه رشد برای پر کردن فضای بین هدر و فوتر در دسکتاپ */
    display: flex;
    flex-direction: column;
    overflow: hidden; 
}

/* ناحیه نمایش پیام‌ها */
.messages-area {
    padding: 20px 15px;
    overflow-y: auto; /* ناحیه اسکرولی */
    flex-grow: 1; 
    background-color: #fcfdff; 
}

/* استایل اسکرول‌بار (مدرن) */
.messages-area::-webkit-scrollbar {
    width: 5px;
}
.messages-area::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 10px;
}

/* ========================================================= */
/* ۴. حباب‌های گفتگو و نام فرستنده */
/* ========================================================= */
.message {
    display: flex;
    margin: 8px 0;
    width: 100%;
}

.bubble {
    padding: 12px 18px;
    border-radius: 20px;
    max-width: 90%;
    line-height: 1.6;
    word-wrap: break-word; 
    white-space: pre-wrap; 
}

/* استایل برای نمایش نام کارشناس در داخل حباب پیام */
.sender-name {
    display: block;
    font-weight: bold;
    color: #4a90e2; 
    margin-bottom: 5px;
    white-space: pre-wrap;
}

/* پیام کاربر (راست) */
.user-message {
    justify-content: flex-end; 
}
.user-message .bubble {
    background-color: #4e4e4f; 
    color: white;
    border-bottom-left-radius: 6px;
}

/* پیام ربات (چپ) */
.bot-message {
    justify-content: flex-start; 
}
.bot-message .bubble {
    background-color: #e9ecef8f; 
    color: #343a40;
    border-bottom-right-radius: 6px;
    line-height: 2;
    
}

/* ========================================================= */
/* ۵. ناحیه ورودی (Input Area) - فوتر */
/* ========================================================= */
.input-area {
    display: flex;
    padding: 16px;
    border-top: 1px solid #dee2e6;
    background-color: #ffffff;
    align-items: center;
    box-sizing: border-box; /* مهم برای Fixed بودن */
}

#user-input {
    flex-grow: 1;
    padding: 12px 18px;
    border: 1px solid #ced4da;
    border-radius: 25px;
    font-size: 1em;
    margin-left: 10px; 
    transition: border-color 0.3s, box-shadow 0.3s;
}

#user-input:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
    outline: none;
}
#user-input:disabled {
    background-color: #f8f9fa;
}

#send-btn {
    font-family: 'Estedad', Tahoma, sans-serif;
    background-color: #2b3339; 
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.1s;
}

#send-btn:hover {
    background-color: #2b3339;
}
#send-btn:active {
    transform: scale(0.96);
}
#send-btn:disabled {
    background-color: #adb5bd;
}


/* ========================================================= */
/* ۶. ریسپانسیو (برای ثابت‌سازی هدر و فوتر در موبایل) */
/* ========================================================= */
@media (max-width: 600px) {
    
    body {
        padding: 0;
        align-items: flex-start;
    }
    
    /* کانتینر اصلی چت‌بات را Fixed می‌کنیم */
    .chatbot-wrapper {
        position: fixed; /* Fixed شدن در viewport موبایل */
        top: 0;
        left: 0;
        width: 100%; 
        max-width: 100%;
        height: 100vh; /* تمام ارتفاع Viewport را می‌گیرد */
        border-radius: 0;
        box-shadow: none;
    }

    /* هدر - Fixed در بالا */
    .header-2025 {
        position: fixed;
        top: 0;
        width: 100%;
        border-radius: 0;
        z-index: 10;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
          z-index: 9999;
    }
    
    .header-2025 h1 {
    font-family: 'KalamehWeb-Medium', Tahoma, sans-serif;
    margin: 5px 0 1px 0;
    font-size: 13px;
    font-weight: 300;

}
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    /* ناحیه ورودی - Fixed در پایین */
    .input-area {
        position: fixed;
        margin-top: 10px;
        bottom: 0;
        width: 100%;
        z-index: 10;
        box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    }
    
    /* ناحیه پیام‌ها: باید فضای خالی برای هدر و فوتر Fixed ایجاد کنیم */
    .chat-card {
        height: 100%;
        display: block; /* برای مدیریت بهتر padding */
    }
    
    .messages-area {
        /* محاسبه فضای خالی: ارتفاع هدر (تقریباً 80px) + ارتفاع فوتر (تقریباً 60px) */
        padding-top: 105px; /* جبران ارتفاع هدر Fixed */
        padding-bottom: 230px; /* جبران ارتفاع فوتر Fixed */
        height: 100vh; /* کل ارتفاع را بگیرد */
        box-sizing: border-box; /* برای در نظر گرفتن padding در محاسبه height */
    }
    
    /* استایل‌های حباب پیام در موبایل */
    .user-message .bubble, .bot-message .bubble {
        max-width: 90%; 
        font-size: 0.75em;
    }
}


/* ========================================================= */
/* استایل دکمه راهنما در هدر */
/* ========================================================= */
/* ========================================================= */
/* استایل دکمه راهنما در هدر */
/* ========================================================= */
/* ========================================================= */
/* استایل دکمه راهنما در هدر (اصلاح شده) */
/* ========================================================= */
.guide-btn {
    
    /* ***** تغییرات اساسی در اینجا ***** */
    position: static; /* <--- خارج شدن از حالت Absolute */
    display: block; /* <--- دکمه تمام عرض را اشغال می‌کند */
    width: calc(50% - 130px); /* عرض کامل هدر منهای پدینگ (20px چپ و 20px راست) */
    margin: 0 auto; /* <--- وسط‌چین شدن دکمه */
    transform: none; /* <--- حذف transform: translateY(-50%) */
    /* ************************ */
    border: 1px dashed;
    background-color: #ffffff; 
    color: #000000;
    padding: 5px 10px; /* <--- افزایش پدینگ دکمه برای بهتر دیده شدن */
    border-radius: 6px;
    text-decoration: none; 
    font-size: 14px; /* افزایش سایز فونت */
    font-weight: 500;
    transition: background-color 0.3s;
    text-align: center; /* متن داخل دکمه وسط‌چین می‌شود */
}

.guide-btn:hover {
    backg1round-color: #1e7e34;
}

/* ریسپانسیو موبایل */
@media (max-width: 600px) {
    .header-2025 {
        padding: 5px 5px 5px 5px; /* <--- پدینگ بهتر در موبایل */
    }
    .guide-btn {
        width: 60%; 
        padding: 3px 1px;
        font-size: 0.9em;
        margin-bottom: 5px;
        border: 1px dashed;
        font-weight: bold;
    }
}




/* در فایل style.css */

.stop-typing-btn {
    background-color: #4a90e2; 
    color:#ffffff;
    border: none;
    padding: 3px 8px;
    margin-top: 10px; 
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.8em;
    
    /* ***** تغییرات کلیدی برای انتقال به چپ (در حالت RTL) ***** 
    */
     float: left; 
    display: block;
    margin-top:50px;
    margin-left: auto;
    /* شناور شدن به سمت چپ */
    ma1rgin-left: 0; /* حذف مارجین اضافی از چپ */
    ma1rgin-right: 10px; /* اضافه کردن کمی فاصله از سمت راست متن پیام */
    /* ******************************************************** */
    
    width: fit-content; 
    transition: background-color 0.3s;
    font-family: inherit;
}

.stop-typing-btn:hover {
    background-color: #4a90e2;
}

/* اطمینان از اینکه پیام ربات موقعیت‌دهی درستی داشته باشد تا دکمه به آن بچسبد */
.message.bot-message .bubble {
    position: relative; /* مطمئن می‌شویم حباب پیام یک کانتینر برای دکمه است */
}









/* استایل عکس کارشناس (سازگار با کروم، فایرفاکس، اج و اینترنت اکسپلورر) */
.expert-img {
    width: 60px;
    height: 60px;
    min-width: 60px; 
    min-height: 60px;
    border-radius: 50%;
    margin-bottom: 10px; /* Zir-e Aks */
    border: 2px solid #1a73e8;
    
    /* سازگاری با Flexbox در IE */
    flex-shrink: 0; 
    flex-basis: auto; /* مخصوص IE برای جلوگیری از تغییر ابعاد نامناسب */

    /* جایگزین object-fit برای IE */
    display: block;
    overflow: hidden;

    /* پیشوندهای قدیمی مرورگر */
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    -ms-border-radius: 50%; /* مخصوص Internet Explorer 9 */
    
    /* نکته مهم: IE از object-fit پشتیبانی نمی‌کند. 
       اگر عکس شما مربع نباشد، در IE کمی کشیده می‌شود. 
       برای حل این مشکل بهتر است عکس‌های اصلی را قبل از آپلود مربع کنید. */
}

/* استایل متن معرفی پررنگ */
.intro-text-bold {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
    color: #000;
}

/* متن اصلی پاسخ */
.bot-response-text {
    line-height: 1.7;
    display: block;
}