/* --- 1. پنجره اصلی چت --- */
.chat-window {
    position: fixed;
    bottom: 100px; 
    left: 25px;    
    width: 360px;   
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    z-index: 99999;
    border: 1px solid #ddd;
    display: flex !important; 
    flex-direction: column;
    height: auto !important; 
    padding-bottom: 20px;   
    
    /* تنظیمات انیمیشن نرم محو شدن و کوچک شدن */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-window.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* --- 2. هدر جدید و حرفه‌ای داخل چت --- */
.chat-internal-header {
    background: #002d5f;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.flag-wrapper { display: flex; align-items: center; gap: 10px; font-weight: 600; }

.german-flag-icon {
    display: flex; flex-direction: column; width: 24px; height: 16px; 
    border: 1px solid rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden;
}
.flag-stripe { width: 100%; height: 5px; }
.stripe-black { background: #000; }
.stripe-red { background: #ff0000; }
.stripe-gold { background: #ffcc00; }

/* --- 3. استایل بدنه و آیتم‌ها --- */
.chat-body { padding: 0; }
.chat-menu-items { 
    padding: 20px 25px; 
}

.chat-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px; /* فاصله بین دو گزینه را از 30 به 15 کاهش دادیم */
}

.chat-option img {
    width: 90px !important; height: 90px !important;
    margin-bottom: 12px;
}

.chat-option h3 {
    font-size: 15px !important;
    color: #2c3e50 !important;
    margin: 0 0 12px 0 !important;
    font-family: sans-serif;
}

.btn-action {
    background: #002d5f !important;
    color: white !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    cursor: pointer;
    transition: 0.3s;
}
.btn-action:hover { background: #004085 !important; }

/* --- 4. دکمه شناور پایین --- */
.chat-trigger {
    position: fixed !important;
    bottom: 30px !important;
    left: 25px !important;
    width: 56px !important;
    height: 56px !important;
    background: #002d5f !important;
    border-radius: 50% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2) !important;
    cursor: pointer !important;
    z-index: 99999 !important;
    border: none !important;
    transition: transform 0.3s ease !important;
}

.chat-trigger:hover { transform: scale(1.1) !important; }
.agent-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50%;
}

/* موبایل */
@media (max-width: 480px) {
    .chat-window { width: 90%; left: 5%; bottom: 100px; }
}

/* حذف فضای خالی زیر دکمه آخر */
.chat-option:last-child {
    margin-bottom: 0 !important;
}

/* کوچک کردن ظاهر اینپوت بدون ایجاد زوم ناخواسته در موبایل */
#aiQueryInput {
    font-size: 16px !important; /* برای جلوگیری از زوم موبایل */
    transform: scale(0.85);     /* کوچک کردن ظاهر متن و کادر (می‌توانید مقدارش را کم و زیاد کنید) */
    transform-origin: left center;
    width: 117% !important;     /* جبران کوچک شدن ناشی از scale */
}
/* کوچک کردن کامل ظاهر فیلدها و متن‌های فرم آنلاین در موبایل */
@media screen and (max-width: 768px) {
    /* کوچک کردن کلیه اینپوت‌ها، سلکتورها و تکست‌آریاهای فرم آنلاین */
    #preChatForm input,
    #preChatForm select,
    #preChatForm textarea {
        font-size: 16px !important;     /* الزامی برای جلوگیری از زوم خودکار مرورگر موبایل */
        transform: scale(0.6875); /* 16 × 0.6875 ≈ 11px  */
        transform-origin: left center;
        width: 150% !important;         /* جبران کوچک شدن عرض ناشی از scale */
        margin-bottom: -2px !important;
    }

    /* کوچک کردن متن‌های راهنما و وضعیت آنلاین در بالای فرم */
    #pre-chat-container div {
        font-size: 11px !important;
    }

    /* کوچک کردن متن قوانین GDPR و پاورقی فرم */
    #pre-chat-container div[style*="font-size: 10px"] {
        font-size: 9px !important;
        line-height: 1.3 !important;
    }
}
/* جلوگیری از زوم خودکار و تنظیم اندازه در بخش چت زنده با اپراتور در موبایل */
@media screen and (max-width: 768px) {
    #chatMessageInput {
        font-size: 16px !important;     /* جلوگیری از زوم خودکار مرورگر موبایل */
        transform: scale(0.75);         /* کوچک کردن ظاهر فیلد و متن داخل آن */
        transform-origin: left center;
        width: 133% !important;         /* جبران کوچک شدن عرض ناشی از scale */
    }
    
    /* کوچک کردن اندازه متن‌های داخل باکس پیام‌های چت زنده برای هماهنگی بیشتر */
    #chat-messages div {
        font-size: 11px !important;
    }
}