/* =========================================
   استایل‌های پشتیبانی آنلاین (Support Drawer)
========================================= */

/* دکمه شناور پشتیبانی - طراحی الهام گرفته از پورتال */
.support-float-btn {
    position: fixed;
    bottom: 95px; 
    right: 20px; 
    left: auto;
    width: 55px; 
    height: 55px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(14, 165, 233, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 5px;
    box-shadow: 0 10px 30px rgba(14, 165, 233, 0.15), inset 0 0 15px rgba(14, 165, 233, 0.05);
    z-index: 9998;
    cursor: pointer;
    /* 🔴 عامل برش خوردن بج (overflow: hidden) حذف شد */
    transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}
.support-icon-wrapper {
    min-width: 43px; /* متناسب با دکمه جدید */
    height: 43px;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(14, 165, 233, 0.02) 100%);
    border: 1px solid rgba(14, 165, 233, 0.2);
    transition: all 0.4s ease;
    position: relative;
}

.support-icon-wrapper img {
    width: 80%;
    height: 80%;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(14, 165, 233, 0.4));
    transition: all 0.4s ease;
}

.support-btn-text {
    color: #0284c7; 
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 800;
    font-size: 0.95rem; /* کمی کوچکتر برای زیبایی */
    white-space: nowrap;
    opacity: 0;
    margin-right: 10px; 
    transform: translateX(-20px); 
    /* انیمیشن جداگانه و نرم برای لغزیدن متن به داخل نوار */
    transition: opacity 0.3s ease, transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

/* هاور و باز شدن خودکار */
.support-float-btn:hover, .support-float-btn.auto-open {
    width: 170px; /* جلوگیری از بزرگ شدن بیش از حد */
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(14, 165, 233, 0.4);
    box-shadow: 0 15px 35px rgba(14, 165, 233, 0.25), inset 0 0 25px rgba(14, 165, 233, 0.1);
    transform: translateY(-5px);
}

.support-float-btn:hover .support-icon-wrapper, .support-float-btn.auto-open .support-icon-wrapper {
    background: rgba(14, 165, 233, 0.25);
    border-color: rgba(14, 165, 233, 0.5);
}

.support-float-btn:hover .support-icon-wrapper img, .support-float-btn.auto-open .support-icon-wrapper img {
    filter: drop-shadow(0 0 10px rgba(14, 165, 233, 0.8));
    transform: scale(1.1);
}

.support-float-btn:hover .support-btn-text, .support-float-btn.auto-open .support-btn-text {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.1s; /* متن با کمی تاخیر ظاهر می‌شود تا نوار اول باز شود و حس مینیمال بدهد */
}
/* چراغ وضعیت آنلاین */
.support-status-dot {
    position: absolute; top: -2px; right: -2px;
    width: 12px; height: 12px; background: #10b981;
    border-radius: 50%; border: 2px solid white;
    box-shadow: 0 0 8px #10b981;
    animation: blinkOnline 2s infinite;
    z-index: 2;
}

@keyframes blinkOnline { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* بج حبابی پیام نخوانده کاربر با انیمیشن */
@keyframes popInUser {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.user-unread-badge {
    position: absolute; 
    top: -6px; 
    right: -6px; /* 🔴 اصلاح جهت برای هماهنگی با قرارگیری دکمه در راست */
    left: auto;
    background: #ef4444; 
    color: white;
    min-width: 24px; 
    height: 24px; 
    border-radius: 50px;
    display: flex; justify-content: center; align-items: center;
    font-size: 0.85rem; font-weight: bold; 
    border: 3px solid #ffffff; 
    z-index: 10;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
    transform: scale(0); /* مخفی بودن پیش‌فرض برای انیمیشن */
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}
.user-unread-badge.show {
    display: flex !important;
    animation: popInUser 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@media (max-width: 768px) {
    .support-float-btn {
        width: 50px; height: 50px;
        bottom: calc(90px + env(safe-area-inset-bottom, 0px));
        right: 15px; left: auto; padding: 4px; border-radius: 16px;
    }
   .support-icon-wrapper { min-width: 40px; height: 40px; border-radius: 12px; }
    .support-float-btn.auto-open, .support-float-btn:hover { width: 155px; }
    .support-btn-text { font-size: 0.85rem; margin-right: 10px; }
} /* <--- 🔴 رفع باگ حیاتی: این آکولاد جا افتاده بود و کل ساختار را فلج می‌کرد */

/* بک‌گراند تاریک پشت پنل */
.support-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.support-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* پنل کشویی پشتیبانی (از سمت راست باز می‌شود) */
.support-drawer {
    position: fixed;
    top: 0;
    right: -400px; /* مخفی در خارج از کادر سمت راست */
    left: auto;
    width: 350px;
    height: 100%;
    background: #f8fafc;
    box-shadow: -10px 0 30px rgba(0,0,0,0.2); /* سایه به سمت چپ */
    z-index: 10000;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.support-drawer.active {
    right: 0;
}

@media (max-width: 400px) {
    .support-drawer { width: 100%; right: -100%; left: auto; }
}

/* هدر پنل */
.support-header {
    background: linear-gradient(135deg, #ffffff, #f1f5f9);
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.support-title {
    font-family: 'Lalezar', cursive;
    color: #0284c7;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.online-dot {
    width: 10px; height: 10px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: blink 1.5s infinite;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.support-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #94a3b8;
    cursor: pointer;
    transition: 0.2s;
    line-height: 1;
}
.support-close:hover { color: #ef4444; transform: scale(1.1); }

/* بدنه چت */
.support-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f1f5f9;
}

.chat-msg {
    max-width: 85%;
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.6;
    font-weight: 500;
}

.system-msg {
    background: white;
    color: #334155;
    align-self: flex-start;
    border: 1px solid #e2e8f0;
    border-bottom-right-radius: 2px;
}

.user-msg {
    background: #0ea5e9;
    color: white;
    align-self: flex-end;
    border-bottom-left-radius: 2px;
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.2);
}

/* فوتر و ورودی متن */
.support-footer {
    padding: 15px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}

.support-footer input {
    flex: 1;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: 'Vazirmatn';
    outline: none;
    background: #f8fafc;
}
.support-footer input:focus { border-color: #0ea5e9; }

.support-footer button {
    background: #0ea5e9;
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 8px;
    font-family: 'Vazirmatn';
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}
.support-footer button:hover { background: #0284c7; }