/* استایل‌های کلی دستیار */
.smart-assistant-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    font-family: 'Tahoma', 'Arial', sans-serif;
    direction: rtl;
    font-size: 14px; /* فونت پایه متعادل */
}

.smart-assistant-toggle {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    border-radius: 30px;
    padding: 9px 18px; /* پدینگ متعادل */
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.smart-assistant-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.smart-assistant-icon {
    width: 24px; /* اندازه متعادل */
    height: 24px; /* اندازه متعادل */
    background-color: white;
    color: #6e8efb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px; /* فاصله متعادل */
    font-weight: bold;
    font-size: 16px; /* فونت متعادل */
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.smart-assistant-toggle span {
    font-weight: 500;
    font-size: 14px; /* فونت متعادل */
}

/* واکنش‌گرایی برای موبایل و تبلت */
@media (max-width: 1024px) {
    .smart-assistant-container {

        bottom: 95px; /* افزایش فاصله از پایین صفحه */
        right: 15px; /* کاهش فاصله از راست */
    }
    
    .smart-assistant-toggle {
        padding: 6px 12px; /* کاهش پدینگ */
        transform: scale(0.9); /* کوچکتر کردن دکمه */
    }
    
    .smart-assistant-icon {
        width: 30px; /* کاهش اندازه آیکون */
        height: 30px;
        font-size: 14px;
    }
    
    .smart-assistant-toggle span {
        font-size: 12px; /* کاهش اندازه فونت */
    }
}

/* واکنش‌گرایی برای موبایل‌های کوچک */
@media (max-width: 768px) {
    .smart-assistant-container {
        bottom: 60px; /* افزایش بیشتر فاصله از پایین صفحه */
        right: 10px;
    }
    
        .smart-assistant-icon {
        width: 20px; /* کاهش اندازه آیکون */
        height: 20px;
        font-size: 14px;
    }
    
    .smart-assistant-toggle {
        padding: 5px 10px; /* کاهش بیشتر پدینگ */
        transform: scale(0.85); /* کوچکتر کردن بیشتر دکمه */
    }
    
    .smart-assistant-popup {
        bottom: 60px;
        right: 0;
    }
}

/* افزایش اندازه پنجره سوال (1.3 برابر) */
.smart-assistant-popup {
    display: none;
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 429px; /* 330px * 1.3 */
    height: 559px; /* 430px * 1.3 */
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* تنظیم اندازه‌های دیگر متناسب با افزایش اندازه */
.smart-assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    padding: 15px 20px; /* افزایش پدینگ متناسب با اندازه */
}

.smart-assistant-header h3 {
    margin: 0;
    font-size: 18px; /* افزایش اندازه فونت */
    font-weight: 600;
}

.smart-assistant-close {
    cursor: pointer;
    font-size: 26px; /* افزایش اندازه */
    transition: transform 0.2s;
}

.smart-assistant-close:hover {
    transform: rotate(90deg);
}

/* بدنه دستیار */
.smart-assistant-body {
    display: flex;
    flex-direction: column;
    height: calc(100% - 48px); /* متناسب با هدر */
}

/* تنظیم اندازه بخش پیام‌ها */
.smart-assistant-messages {
    flex: 1;
    padding: 20px; /* افزایش پدینگ */
    overflow-y: auto;
    background-color: #f8f9fb;
}



.smart-assistant-welcome {
    background-color: white;
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.smart-assistant-welcome p {
    margin: 0;
    line-height: 1.5;
    font-size: 14px; /* فونت متعادل */
}

.smart-assistant-conversation .user-message {
    background-color: #e3f2fd;
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 10px;
    margin-left: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: fadeIn 0.3s ease;
    font-size: 14px; /* فونت متعادل */
}

.smart-assistant-conversation .assistant-message {
    background-color: white;
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 10px;
    margin-right: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: fadeIn 0.3s ease;
    font-size: 14px; /* فونت متعادل */
}

/* تنظیم اندازه بخش سوالات */
.smart-assistant-questions {
    max-height: 188px; /* 145px * 1.3 */
    overflow-y: auto;
    padding: 13px 7px 35px 20px; /* افزایش پدینگ */
    border-top: 1px solid #eaeaea;
    overflow-x: hidden;
    scrollbar-width: thin;
}


/* کانتینر سوالات با فاصله یکسان */
.smart-assistant-questions-container {
    padding: 0; /* حذف پدینگ اضافی */
    width: 100%; /* تضمین عرض کامل */
}

/* گرید سوالات - با فاصله یکسان بین گروه‌ها */
.smart-assistant-questions-grid {
    width: 100%; /* تضمین عرض کامل */
    margin-bottom: 8px; /* فاصله یکسان بین گروه‌های سوال */
    display: flex;
    flex-direction: column; /* تغییر به نمایش عمودی */
    gap: 8px; /* فاصله یکسان بین سوالات در یک گروه */
}

/* حذف مارجین از آخرین گروه */
.smart-assistant-questions-grid:last-child {
    margin-bottom: 0;
}

/* هر سوال با عرض کامل و اندازه کوچکتر */
.smart-assistant-question {
    width: calc(100% - 10px); /* عرض کمتر برای جلوگیری از تداخل با اسکرول‌بار */
    background-color: #f0f4ff;
    border: 1px solid #e0e6fa;
    border-radius: 8px;
    padding: 8px 10px; /* پدینگ کمتر برای جمع‌وجورتر بودن */
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: right; /* راست‌چین کردن متن */
    font-size: 13px; /* فونت متعادل */
    line-height: 1.4;
    word-wrap: break-word; /* شکستن کلمات طولانی */
    overflow: hidden; /* مخفی کردن محتوای سرریز */
    text-overflow: ellipsis; /* نمایش سه نقطه برای متن طولانی */
    margin-bottom: 0; /* حذف حاشیه اضافی */
    display: block; /* تغییر به بلاک برای عرض کامل */
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* سایه ظریف */
}

.smart-assistant-question:hover {
    background-color: #e6edff;
    border-color: #c5d1f8;
    transform: translateY(-1px); /* کاهش میزان جابجایی */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* استایل اسکرول‌بار برای مرورگرهای وبکیت (کروم، سافاری) */
.smart-assistant-questions::-webkit-scrollbar {
    width: 5px; /* عرض کم */
}

.smart-assistant-questions::-webkit-scrollbar-track {
    background: #f1f1f1; /* رنگ روشن پس‌زمینه */
    border-radius: 10px;
}

.smart-assistant-questions::-webkit-scrollbar-thumb {
    background: #ccc; /* رنگ متوسط برای نوار اسکرول */
    border-radius: 10px;
}

.smart-assistant-questions::-webkit-scrollbar-thumb:hover {
    background: #aaa; /* رنگ تیره‌تر برای حالت هاور */
}

/* استایل گزینه‌های چند مرحله‌ای */
.smart-assistant-options {
    margin-top: 10px;
    width: 100%; /* تضمین عرض کامل */
}

.smart-assistant-option {
    background-color: #f0f4ff;
    border: 1px solid #e0e6fa;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 13px; /* فونت متعادل */
    line-height: 1.4;
    word-wrap: break-word; /* شکستن کلمات طولانی */
}

.smart-assistant-option:hover {
    background-color: #e6edff;
    border-color: #c5d1f8;
}

/* نشانگر تایپ */
.smart-assistant-typing {
    display: flex;
    gap: 4px;
    padding: 10px;
    background-color: white;
    border-radius: 10px;
    margin-bottom: 10px;
    margin-right: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    width: fit-content;
}

.smart-assistant-typing span {
    width: 7px; /* اندازه متعادل */
    height: 7px; /* اندازه متعادل */
    border-radius: 50%;
    background-color: #a0a0a0;
    display: inline-block;
    animation: typingAnimation 1.4s infinite ease-in-out both;
}

.smart-assistant-typing span:nth-child(1) {
    animation-delay: -0.32s;
}

.smart-assistant-typing span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingAnimation {
    0%, 80%, 100% { 
        transform: scale(0.6);
    }
    40% { 
        transform: scale(1);
    }
}

/* انیمیشن‌ها */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* واکنش‌گرایی برای موبایل */
@media (max-width: 480px) {
    .smart-assistant-popup {
        width: calc(100vw - 40px);
        height: 60vh;
        bottom: 80px;
        right: 0;
    }
    
    .smart-assistant-toggle {
        padding: 8px 16px;
    }
}

/* استایل‌های تصویر در پاسخ */
.smart-assistant-image {
    margin-top: 10px;
    border-radius: 8px;
    max-width: 100%;
    height: auto;
    display: block;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e6fa;
}

/* افزایش ارتفاع بخش پیام‌ها برای جا دادن تصاویر */
.smart-assistant-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f8f9fb;
}

/* بهبود استایل پیام‌ها برای تصاویر */
.smart-assistant-conversation .assistant-message {
    background-color: white;
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 10px;
    margin-right: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: fadeIn 0.3s ease;
    font-size: 14px;
    max-width: 85%;
}

/* انیمیشن بارگذاری تصویر */
@keyframes imageLoading {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.image-loading {
    animation: imageLoading 0.5s ease;
}

/* نمایش آیکون بارگذاری تصویر */
.image-loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: #f0f4ff;
    border-radius: 8px;
    margin-top: 10px;
}

.image-loading-indicator:after {
    content: "در حال بارگذاری تصویر...";
    font-size: 12px;
    color: #6e8efb;
}

/* استایل‌های تصویر در پیام جداگانه */
.assistant-image-message {
    padding: 10px !important;
    text-align: center;
}

.smart-assistant-image {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
}

/* نشانگر بارگذاری تصویر */
.image-loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: #f0f4ff;
    border-radius: 6px;
    position: relative;
    min-height: 60px;
}

.image-loading-indicator:after {
    content: "در حال بارگذاری تصویر...";
    font-size: 12px;
    color: #6e8efb;
    position: absolute;
}

/* انیمیشن بارگذاری تصویر */
@keyframes imageLoading {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.image-loading {
    animation: imageLoading 0.5s ease;
}

/* پیام خطای تصویر */
.image-error {
    margin: 0;
    padding: 10px;
    background-color: #fef2f2;
    border-radius: 6px;
    border: 1px solid #fad2d2;
}

/* بهبود استایل پیام‌های متنی */
.assistant-message, .user-message {
    white-space: pre-line; /* حفظ خط‌های جدید */
    line-height: 1.5;
}

/* استایل لینک‌ها در پیام‌ها */
.assistant-message a {
    color: #4a6cf7;
    text-decoration: underline;
}

.assistant-message a:hover {
    color: #3451b2;
}

/* استایل‌های لینک در پیام‌ها */
.assistant-message a {
    color: #4a6cf7;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.assistant-message a:hover {
    color: #3451b2;
}

.assistant-message a:visited {
    color: #6b46c1;
}

/* بهبود استایل پیام‌های متنی */
.assistant-message, .user-message {
    line-height: 1.5;
}

/* استایل تصویر در پیام جداگانه */
.assistant-image-message {
    padding: 10px !important;
    text-align: center;
}

.smart-assistant-image {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
}

/* انیمیشن برای پیام‌های متوالی */
@keyframes messageIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.assistant-message, .user-message {
    animation: messageIn 0.3s ease forwards;
}

/* بهبود استایل ویرایشگرها */
.editor-container, .editor-container-single, .editor-container-option-single {
    margin-bottom: 15px;
}

.editor-container .mce-tinymce,
.editor-container-single .mce-tinymce,
.editor-container-option-single .mce-tinymce {
    border: 1px solid #ddd !important;
}

.editor-container iframe,
.editor-container-single iframe,
.editor-container-option-single iframe {
    min-height: 150px !important;
}

/* بهبود استایل پیام‌ها */
.message-item {
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 3px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    background: #f0f0f0;
    padding: 5px 10px;
    border-radius: 3px;
}

.message-header h4 {
    margin: 0;
    font-size: 14px;
    color: #444;
    font-weight: 600;
}

.remove-message {
    color: #a00;
    cursor: pointer;
}

.remove-message:hover {
    color: #dc3232;
}

/* بهبود استایل دکمه‌های افزودن پیام */
.add-message, .add-option-message {
    margin-bottom: 15px;
    background-color: #f7f7f7;
    color: #555;
}

.add-message:hover, .add-option-message:hover {
    background-color: #f0f0f0;
    color: #23282d;
}

/* اعمال فونت وزیر به تمام اجزای پلاگین */
.smart-assistant-container,
.smart-assistant-toggle,
.smart-assistant-popup,
.smart-assistant-header,
.smart-assistant-header h3,
.smart-assistant-welcome p,
.smart-assistant-conversation .user-message,
.smart-assistant-conversation .assistant-message,
.smart-assistant-question,
.smart-assistant-option,
.smart-assistant-typing,
.image-loading-indicator:after,
.image-error {
    font-family: "فونت وزیر", "Vazir", tahoma, arial, sans-serif !important;
}