
#g-a-chatBox {
    font-family: IRANSansfanum !important;
}

#g-a-chatBox * {
    font-family: IRANSansfanum !important;
}

#g-a-chatBox textarea::placeholder {
    font-family: IRANSansfanum !important;
}

/************************************
    Floating Button (Desktop + Mobile)
*************************************/
@keyframes popup-fade {
    0%, 100% { opacity: 0; transform: translateY(10px) scale(0.8); }
    10%, 80% { opacity: 1; transform: translateY(0) scale(1); } /* در ۱۰٪ زمان ظاهر و تا ۸۰٪ می‌ماند */
}

/* استایل حباب پیام */
.chat-tooltip {
    position: absolute;
    bottom: 85px; /* فاصله بالای دکمه */
    right: 0;
    background-color: #e88125; /* رنگ تیره یا سرمه‌ای به انتخاب شما */
    color: white;
    padding: 8px 15px;
    border-radius: 12px;
    font-size: 13px;
    white-space: nowrap;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    opacity: 0; /* در حالت عادی مخفی است */
    pointer-events: none;
    
    /* انیمیشن هماهنگ: ۱۰ ثانیه کل چرخه | ۱۰ ثانیه تاخیر اول | ۳ بار تکرار */
    animation: popup-fade 15s ease-in-out 10s 1 forwards;
}

/* ایجاد فلش کوچک زیر حباب */
.chat-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 25px;
    border-width: 8px;
    border-style: solid;
    border-color: #e88125 transparent transparent transparent;
}
/* تعریف انیمیشن پرش */
@keyframes jump-thrice {
    0%, 10%, 20%, 30%, 100% {
        transform: translateY(0);
    }
    5%, 15%, 25% {
        transform: translateY(-15px);
    }
}

@keyframes logo-spin {
    0% {transform: rotate(0deg);}
    10% {transform: rotate(360deg);}
    100% {transform: rotate(360deg);}
}

@keyframes button-pulse {
    0% { transform: scale(1); }
    5% { transform: scale(1.15); } /* در میانه چرخش، دکمه بزرگ می‌شود */
    10% { transform: scale(1); }    /* همزمان با پایان چرخش، به سایز عادی برمی‌گردد */
    100% { transform: scale(1); }
}

.g-a-chat-fab {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e88125, #fcb248);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    bottom: 20px;
    right: 20px;
    /* اضافه کردن ترنزیشن برای تمام تغییرات */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    animation: button-pulse 10s ease-in-out 10s 1;
    
}

.g-a-chat-fab img {
    width: 35px;
    height: 35px;
    object-fit: contain;
    /* جلوگیری از لرزش احتمالی تصویر */
    pointer-events: none;
    /*animation: jump-thrice 10s ease-in-out 10s 1;*/
    animation: logo-spin 10s ease-in-out 10s 1 backwards;
}

.g-a-chat-fab:hover {
    /* استفاده از ترکیب scale و translateY برای جلوگیری از پرش ناگهانی */
    transform: scale(1.15); 
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    /* متوقف کردن انیمیشن پرش در هنگام هاور */
    animation-play-state: paused;
}

/* برای اینکه وقتی موس برداشته شد، دکمه نرم به جای خود برگردد */
.g-a-chat-fab:active {
    transform: scale(0.95);
}


/************************************
          CHAT BOX (Desktop)
*************************************/
.g-a-chat-box {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    height: 500px;
    max-width: calc(100% - 40px);
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border: 1px solid #ddd;
    display: none;
    flex-direction: column;
    animation: slideUp 0.3s ease forwards;
    z-index: 1001;
    overflow: hidden;
}
@keyframes slideUp {
    from {transform: translateY(20px); opacity: 0;}
    to {transform: translateY(0); opacity: 1;}
}

/************************************
        CHAT HEADER
*************************************/
.g-a-chat-header {
    background-color: #1f2d3d;
    padding: 12px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    position: relative;
}
.g-a-chat-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}
.g-a-close-btn {
    position: absolute;
    left: 10px;
    top: 40%;
    transform: translateY(-50%);
    font-size: 30px;
    cursor: pointer;
    background: none;
    border: none;
    color: white;
}

/************************************
           MESSAGES
*************************************/
.g-a-messages {
    padding: 15px;
    background-color: #ffffff;
    flex: 1;
    overflow-y: auto;
}
.g-a-message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 10px;
}

.g-a-message.bot {
    flex-direction: row;
}
.g-a-message img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.g-a-bubble {
    background-color: #fff;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid #ddd;
    max-width: 100%;
    font-size: 14px;
    line-height: 1.5;
    display: inline-block;
    word-break: break-word;
    overflow-wrap: break-word;
}

.g-a-time {
    font-size: 11px;
    color: #888;
    margin-top: 5px;
    text-align: end;
}
.g-a-message.user {
    flex-direction: row-reverse;
    gap: 0px;
}


/************************************
          FORM SECTION (اصلاح شده)
*************************************/
.g-a-form-section {
    /* اگر می‌خواهی مثل عکس وسط‌چین باشد و حاشیه داشته باشد */
    padding: 20px; 
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center; /* برای وسط‌چین کردن متن */
}

.g-a-form-section p {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

.g-a-form-section input.g-a-input {
    width: 100%;
    /* نکته طلایی: برای اینکه پدینگ باعث بیرون زدن اینپوت نشود */
    box-sizing: border-box; 
    
    padding: 12px;
    margin-top: 8px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-size: 15px;
    display: block;
    text-align: center;
    background-color: #fdfdfd;
    transition: border-color 0.2s;
}

.g-a-form-section input.g-a-input:focus {
    border-color: #1f2d3d;
    outline: none;
}

.g-a-start-btn {
    width: 100%;
    background-color: #243447; /* رنگ تیره داخل عکس */
    color: white;
    padding: 12px;
    margin-top: 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background 0.3s;
}

.g-a-start-btn:hover {
    background-color: #1a2533;
}


/************************************
            INPUT MESSAGE
*************************************/
.g-a-input-message {
    display: flex;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 8px;
    background: #fff;
    padding: 8px 12px;
    box-sizing: border-box;
}

.g-a-input-message button {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #666;
}
.g-a-input-message button:hover {
    background: #f1f1f1;
}

.g-a-message-box {
    flex: 1 1 auto !important;
    width: 100% !important;
    resize: none;
    border: none;
    outline: none;
    min-height: 40px;
    max-height: 140px;
    padding: 10px 0;
    font-size: 14px;
    overflow-y: auto;
}

.g-a-chat-header,
.g-a-message-box,
.g-a-message-box::placeholder {
    font-family: inherit !important;
    direction: rtl;
}

.g-a-date-header {
    text-align: center;
    padding: 6px 0;
    font-size: 13px;
    color: #555;
    background: #e5e5e5;
    margin: 10px auto;
    border-radius: 7px;
    width: fit-content;
    padding: 4px 10px;
}

/************************************
        Emoji Panel
*************************************/
.g-a-emoji-panel{
    position:absolute;
    bottom:60px;
    right:10px;
    width:260px;
    background:#fff;
    border:1px solid #ddd;
    border-radius:10px;
    box-shadow:0 4px 10px rgba(0,0,0,0.1);
    padding:10px;
    display:none;
    flex-wrap:wrap;
    gap:6px;
    z-index:2000;
}
.g-a-emoji-panel span{
    font-size:22px;
    cursor:pointer;
    padding:4px;
}
.g-a-emoji-panel span:hover{
    background:#f1f1f1;
    border-radius:6px;
}

/************************************
            FILE BUBBLE
*************************************/
.g-a-file-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f1f3f4;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid #d5d5d5;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    max-width: 220px;
    width: fit-content;
}
.g-a-file-icon {
    font-size: 20px;
    flex-shrink: 0;
}
.g-a-file-info {
    display: flex;
    flex-direction: column;
    line-height: 1.4;
}
.g-a-file-name {
    font-weight: 500;
}
.g-a-file-size {
    font-size: 12px;
    color: #777;
}

/************************************
            IMAGE BUBBLE
*************************************/
.g-a-image-bubble {
    display: block;
    max-width: 180px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: 0.25s ease;
}
.g-a-image-bubble:hover {
    transform: scale(1.02);
}
.g-a-image-bubble img {
    width: 100%;
    display: block;
}

/************************************
         UPLOAD OVERLAY
*************************************/
.g-a-upload-progress{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.g-a-upload-box{
    width: 220px;
    text-align: center;
}
.g-a-upload-text{
    font-size: 13px;
    margin-bottom: 8px;
}
.g-a-upload-bar{
    width: 100%;
    height: 8px;
    background: #e9e9e9;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 5px;
}
.g-a-upload-fill{
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg,#4caf50,#1e88e5);
    transition: width 0.1s linear;
}
.g-a-upload-percent{
    font-size: 12px;
    color: #333;
}

/*****************************************
   >>>>>>>>>  FULLSCREEN MOBILE MODE <<<<<<<<
******************************************/
@media (max-width: 768px) {


    .g-a-chat-box {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100dvh;
        border-radius: 0 !important;
        box-shadow: none !important;
        bottom: 0 !important;
        right: 0 !important;
        max-width: 100% !important;
    }

    .g-a-messages {
        padding: 12px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .g-a-input-message {
        padding: 10px;
    }
}

#g-a-Toast {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff4f4f;
    color: #fff;
    padding: 12px 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: 0.35s ease;
    z-index: 99999;
    width: 80%;
    text-align: center;
}

#g-a-Toast.show {
    opacity: 1;
    bottom: 40px;
}





/* ===== ۳. بخش محتوای چت ===== */
.g-a-slim_scroll {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.g-a-chat-widget {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* ===== ۴. ساختار ردیف‌های پیام ===== */
.g-a-chat-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 15px;
    width: 100%;
}

/* برای یوزر: عکس سمت راست */
.g-a-chat-row.g-a-right-side {
    flex-direction: row-reverse;
}

.g-a-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.g-a-chat-bubble-wrapper {
    flex: 1;
    position: relative;
    min-width: 0; /* جلوگیری از سرریز در فلکس */
}

/* ===== ۵. حباب‌های پیام ===== */
.g-a-chat-msg-left, .g-a-chat-msg-right {
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.6;
    display: block;
    position: relative;
    border-radius: 8px;
    color: #020202;
}

/* پیام ادمین (چپ) */
.g-a-chat-msg-left {
    background: #f1f1f1;
    color: #333;
    border-radius: 8px;
    margin-right: 10px; /* فاصله از سمت راست وقتی پیام چپ است */
}

.g-a-chat-msg-right:after {
    content: '';
    position: absolute;
    left: -10px; /* بیرون زدن به سمت عکس */
    top: 10px;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 10px solid #f2a435; /* هم‌رنگ حباب */
}
/* پیام یوزر (راست) */
.g-a-chat-msg-right {
    background: #f2a435;
    margin-left: 10px; /* فاصله از سمت چپ */
    text-align: right;
    direction: rtl;
}

/* ایجاد مثلث برای پیام راست */
.g-a-chat-msg-left:after {
    content: '';
    position: absolute;
    right: -10px; /* بیرون زدن به سمت عکس */
    top: 10px;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 10px solid #f1f1f1; /* هم‌رنگ حباب */
}

/* ===== ۶. بخش ورودی پایین ===== */
.g-a-chat-input-fixed {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #eee;
}

.g-a-chat-input-fixed textarea {
    width: 100%;
    resize: none;
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 10px;
}

/* کانتینر اصلی ورودی در پایین */
.g-a-chat-input-fixed {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}

/* ردیف دربرگیرنده المان‌ها */
.g-a-chat-input-wrapper {
    display: flex;
    align-items: center; /* دکمه‌ها پایین بمانند اگر متن طولانی شد */
    gap: 8px;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 25px; /* حالت کپسولی مدرن */
    border: 1px solid #eee;
    transition: all 0.3s ease;
}

.g-a-chat-input-wrapper:focus-within {
    background: #fff;
    border-color: #f2a435;
    box-shadow: 0 2px 8px rgba(139, 106, 43, 0.1);
}

/* استایل باکس متن */
.g-a-chat-input-field {
    flex: 1;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 8px 5px;
    font-size: 13px;
    line-height: 20px;
    max-height: 100px;
    overflow-y: auto;
    resize: none;
    align-self: center;
}

/* استایل مشترک دکمه‌ها */
.g-a-btn-chat-action {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
}

/* دکمه ارسال */
.g-a-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-bottom: 0 !important; /* حذف مارجین احتمالی */
}

.g-a-send-btn:hover {
    color: white;
    background: #f2a435;
    transform: scale(1.05);
}

.g-a-send-btn i {
    margin-left: -2px; /* اصلاح بصری آیکون هواپیما */
    font-size: 12px;
}

.g-a-chat-time {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    display: block;
}

/* تراز کردن زمان برای پیام‌های ادمین (سمت چپ) */
.g-a-chat-row:not(.g-a-right-side) .g-a-chat-time {
    text-align: left;
    margin-left: 2px;
}

/* تراز کردن زمان برای پیام‌های یوزر (سمت راست) */
.g-a-chat-row.g-a-right-side .g-a-chat-time {
    text-align: right;
    margin-right: 2px;
}
.g-a-chat-date-divider {
    text-align: center;
    margin: 20px 0 10px;
    font-size: 13px;
    color: #777;
    position: relative;
}

.g-a-chat-date-divider:before,
.g-a-chat-date-divider:after {
    content: "";
    display: inline-block;
    width: 40px;
    height: 1px;
    background: #ddd;
    vertical-align: middle;
    margin: 0 8px;
}

/* تصویر */
.g-a-chat-img-thumb{
    max-width:120px;
    max-height:120px;
    border-radius:8px;
    margin-top:6px;
    cursor:pointer;
    transition:0.2s;
}

.g-a-chat-img-thumb:hover{
    transform:scale(1.05);
}


/* باکس فایل */
.g-a-chat-file-box{
    margin-top:6px;
}

.g-a-chat-file-link{
    display:flex;
    align-items:center;
    gap:10px;
    padding:8px 10px;
    background:#f4f6f8;
    border-radius:8px;
    text-decoration:none;
    max-width:220px;
}

.g-a-chat-file-icon{
    font-size:28px;
    color:#e53935;
}

.g-a-chat-file-name{
    font-size:13px;
    color:#333;
    word-break:break-all;
}

.g-a-chat-file-action{
    font-size:11px;
    color:#777;
}

.g-a-emoji-container {
    position: relative;
    display: inline-block;
}

.g-a-custom-emoji-picker {
    display: none;
    position: absolute;
    bottom: 55px;   /* کمی فاصله بیشتر از پایین برای نچسبیدن به دکمه */
    right: 0;       /* تراز با سمت راست دکمه */
    transform: translateX(-80%); /* کل پنجره را به اندازه 80 درصد عرضش به سمت چپ هل می‌دهد */
    width: 280px;   /* عرض پنجره را کمی بیشتر کردم مشابه تصویرت */
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 1000;
    padding: 15px;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.g-a-emoji-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 8px;
    gap: 5px;
    max-height: 200px;
    overflow-y: auto;
}

.g-a-emoji-grid span {
    font-size: 24px;
    padding: 8px;
    cursor: pointer;
    text-align: center;
    border-radius: 8px;
    transition: all 0.2s;
    user-select: none;
}

.g-a-emoji-grid span:hover {
    background: #f0f2f5;
    transform: scale(1.15);
}

/* اسکرول‌بار زیبا */
.g-a-emoji-grid::-webkit-scrollbar { width: 4px; }
.g-a-emoji-grid::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }

/* فلش پایین پاپ‌آپ */
.g-a-emoji-picker-arrow {
    position: absolute;
    bottom: -8px;
    right: 32px;
    width: 15px;
    height: 15px;
    background: #fff;
    transform: rotate(45deg);
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

/* حذف کادر دور دکمه در تمامی حالت‌ها */
#g-a-emoji-btn, #g-a-emoji-btn:focus, #g-a-emoji-btn:active, #g-a-emoji-btn:hover {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
    -webkit-tap-highlight-color: transparent;
}

/* کانتینر دکمه‌های عمودی */
.g-a-chat-actions-vertical {
    display: flex;
    flex-direction: column; /* چیدمان زیر هم */
    gap: 2px;
    border-left: 1px solid #eee; /* یک خط جداکننده ظریف */
    padding-left: 5px;
}

/* استایل دکمه‌های عمودی */
.g-a-vertical-action {
    width: 32px !important; /* کمی کوچکتر برای جایگیری بهتر */
    height: 30px !important;
    background: transparent !important;
    color: #888 !important;
    transition: color 0.2s;
}

.g-a-vertical-action:hover {
    color: #f2a435 !important; /* رنگ برند شما هنگام هاور */
}

.g-a-vertical-action i {
    font-size: 16px !important;
}

/* اصلاح موقعیت پاپ‌آپ ایموجی با توجه به چیدمان جدید */
.g-a-custom-emoji-picker {
    bottom: 40px;
    left: 0;
    right: auto;
}

/* حذف حاشیه و سایه اضافه دکمه‌ها */
.g-a-vertical-action, .g-a-vertical-action:focus, .g-a-vertical-action:active {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}


@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.g-a-chat-input-fixed { background: #fff; border-top: 1px solid #ddd; }
/* مطمئن شوید wrapper دارای flex-direction: row است */
.g-a-chat-input-wrapper { 
    display: flex; 
    align-items: center; /* تغییر از flex-end به center برای وسط‌چین شدن دکمه‌ها */
    padding: 10px; 
    gap: 8px; 
    background: #fff;
    border-radius: 30px; /* اگر می‌خواهید مثل تصویر کاملا گرد باشد */
}
.g-a-emoji-close-button {
    width: 100%;
    margin-top: 10px;
    padding: 6px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.g-a-emoji-close-button:hover {
    background-color: #fee2e2; /* متمایل به قرمز روشن */
    color: #ef4444;
    border-color: #fecaca;
}

/* اضافه کردن آیکون یا متن ضربدر از طریق CSS */
.g-a-emoji-close-button::before {
    content: '✖';
    font-size: 10px;
    margin-left: 5px;
}

/* متن دکمه (اگر در HTML ننوشته‌اید) */
.g-a-emoji-close-button::after {
    content: 'بستن';
}

/* حذف کادر سیاه هنگام کلیک روی textarea */
#g-a-chat-message-input,
.g-a-chat-input-field,
.g-a-message-box {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

#g-a-chat-message-input:focus,
.g-a-chat-input-field:focus,
.g-a-message-box:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

body.g-a-chat-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}