/* تعریف فونت Yekan */
@font-face {
    font-family: 'Yekan';
    src: url('font/Yekan.woff2') format('woff2'), /* برای مرورگرهای مدرن */
         url('font/Yekan.woff') format('woff'),   /* پشتیبانی گسترده */
         url('font/Yekan.ttf') format('truetype'); /* برای پشتیبانی از مرورگرهای قدیمی */
    font-weight: normal;
    font-style: normal;
}

/* استفاده از فونت Yekan برای کل متن‌ها */
body {
    font-family: 'Yekan', Arial, sans-serif;
    direction: rtl;
    text-align: right;
}

#chatForm input, #chatForm button {
    font-family: 'Yekan', Arial, sans-serif;
}

/* دکمه چت دایره‌ای */
#chatIcon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #007BFF;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    font-size: 28px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    z-index: 1000;
}

#chatIcon:hover {
    background-color: #0056b3;
    transform: scale(1.05); /* تغییر سایز کوچک در هاور بدون جابجایی */
}

/* حالت پیام جدید برای آیکون */
#chatIcon.new-message {
    background-color: #ff9800; /* تغییر رنگ به نارنجی هنگام دریافت پیام جدید */
    animation: pulse 1.5s infinite; /* انیمیشن پالس */
}

/* انیمیشن پالس با تغییر سایه و بدون تغییر مکان */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
    }
    50% {
        transform: scale(1.1); /* بزرگ‌نمایی بدون تغییر مکان */
        box-shadow: 0px 6px 15px rgba(0, 0, 0, 0.5);
    }
    100% {
        transform: scale(1);
        box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
    }
}

/* نشانگر نقطه قرمز در گوشه آیکون هنگام پیام جدید */
#chatIcon.new-message::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px; /* تنظیم مکان نقطه قرمز برای حالت راست به چپ */
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: red;
}

/* کادر چت */
#chatContainer {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    max-height: 500px;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    z-index: 999;
}

/* استایل سفارشی اسکرول */
#messages {
    max-height: 250px;
    overflow-y: auto;
    padding: 8px;
    background-color: #ffffff;
    border-radius: 5px;
    scrollbar-width: thin;
    scrollbar-color: #007BFF #f1f1f1;
}

#messages::-webkit-scrollbar {
    width: 8px;
}

#messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

#messages::-webkit-scrollbar-thumb {
    background-color: #007BFF;
    border-radius: 5px;
}

/* استایل نام فرستنده */
.sender-name {
    font-weight: bold;
    font-size: 0.9em;
    color: #555;
    margin-bottom: 2px;
}

/* گروه پیام‌های مشتری و ادمین */
.user-message-group,
.admin-message-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 4px; /* کاهش فاصله بین گروه‌های پیام */
    padding: 4px 10px; /* کاهش padding داخل گروه پیام‌ها */
    border-radius: 8px;
    width: fit-content;
    max-width: 70%;
    box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
}

.user-message-group {
    background-color: #e1f5fe;
    align-self: flex-end; /* پیام یوزر در سمت راست */
}

.admin-message-group {
    background-color: #c8e6c9;
    align-self: flex-start; /* پیام ادمین در سمت چپ */
}

/* پیام‌های داخلی گروه */
.user-message,
.admin-message {
    margin: 1px 0; /* کاهش فاصله بین پیام‌های داخلی */
    padding: 4px 8px; /* کاهش padding داخلی پیام‌ها */
    border-radius: 5px;
    word-wrap: break-word;
    font-size: 15px;
    line-height: 0.1; /* کاهش فاصله بین خطوط پیام‌ها */
}

/* استایل فرم چت */
#chatForm {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    flex-wrap: nowrap;
}

/* ورودی پیام */
#chatForm input {
    font-size: 16px;
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    outline: none;
    transition: border-color 0.3s;
}

#chatForm input:focus {
    border-color: #007BFF;
}

/* دکمه ارسال پیام */
#chatForm button {
    padding: 8px 15px;
    background-color: #007BFF;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#chatForm button:hover {
    background-color: #0056b3;
}

/* آیکون سنجاق برای آپلود عکس */
#uploadIcon {
    font-size: 20px;
    cursor: pointer;
    color: #007BFF;
}

#uploadIcon:hover {
    color: #0056b3;
}

/* مخفی‌سازی input فایل */
#imageUpload {
    display: none;
}

/* استایل تصاویر در چت */
.chat-image {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin-top: 5px;
    box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.2);
}

