/* متغیرها از استایل اصلی شما به ارث می‌رسند */
.support-widget-container {
    position: fixed;
    bottom: 85px; /* بالاتر از منوی پایین شما */
    right: 15px;
    z-index: 3000;
    font-family: 'Vazirmatn', sans-serif;
}

.support-fab {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--vibrant-blue), #2563eb);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(59, 130, 246, 0.5);
    transition: transform 0.3s;
    border: none;
}

.support-fab:hover { transform: scale(1.05); }

.support-panel {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 320px;
    height: 450px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: none; /* پیش‌فرض مخفی */
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    overflow: hidden;
}

.support-panel.open { display: flex; }

.support-header {
    background: rgba(15, 23, 42, 0.9);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.support-header h4 { margin: 0; font-size: 1rem; color: white; }
.support-close-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; }

.support-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* فرم شروع چت */
.support-form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 15px; }
.support-input { background: var(--dark-bg); border: 1px solid var(--border-color); color: white; padding: 10px; border-radius: 8px; font-family: inherit; font-size: 0.85rem;}
.support-submit { background: var(--vibrant-green); color: white; border: none; padding: 10px; border-radius: 8px; font-weight: bold; cursor: pointer; }

/* محیط پیام‌ها */
.msg-bubble { max-width: 80%; padding: 10px; border-radius: 12px; font-size: 0.85rem; line-height: 1.5; }
.msg-user { align-self: flex-start; background: rgba(59, 130, 246, 0.2); border: 1px solid rgba(59, 130, 246, 0.3); border-bottom-right-radius: 2px; }
.msg-admin { align-self: flex-end; background: rgba(16, 185, 129, 0.2); border: 1px solid rgba(16, 185, 129, 0.3); border-bottom-left-radius: 2px; color: #10b981; }

.support-footer { padding: 10px; border-top: 1px solid var(--border-color); display: none; gap: 8px; background: var(--dark-bg);}
.support-chat-input { flex: 1; background: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 20px; padding: 10px 15px; color: white; font-family: inherit; resize: none; height: 40px;}
.support-send-btn { width: 40px; height: 40px; background: var(--vibrant-blue); border: none; border-radius: 50%; color: white; cursor: pointer; }
.char-counter { font-size: 0.65rem; color: var(--text-muted); text-align: left; padding: 0 5px; }

/* پنل ادمین */
.admin-session-item { padding: 10px; background: var(--dark-bg); border: 1px solid var(--border-color); border-radius: 8px; cursor: pointer; transition: background 0.2s;}
.admin-session-item:hover { background: rgba(255,255,255,0.05); }
.admin-badge { background: var(--vibrant-red); color: white; font-size: 0.7rem; padding: 4px 8px; border-radius: 6px; text-align: center; margin-bottom: 10px;}


.support-fab {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--vibrant-blue), #2563eb);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(59, 130, 246, 0.5);
    transition: transform 0.3s;
    border: none;
    position: relative; /* برای قرارگیری نشانگر */
}

/* استایل نشانگر قرمز (Badge) */
/* استایل جدید نشانگر دارای شمارنده */
.chat-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 24px;
    height: 24px;
    background-color: var(--vibrant-red, #ef4444);
    color: white; /* رنگ متن شمارنده */
    border: 2px solid var(--dark-bg, #0f172a);
    border-radius: 12px;
    display: none; /* پیش‌فرض مخفی */
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 0 4px;
    box-sizing: border-box;
    animation: pulseBadge 1.5s infinite;
    z-index: 2;
}

.chat-unread-badge.active {
    display: flex; /* استفاده از flex برای وسط‌چین کردن عدد */
}

@keyframes pulseBadge {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* =========================================
   استایل‌های مدرن داشبورد مدیریت پشتیبانی
========================================= */

/* هدر اختصاصی پنل مدیریت */
.admin-dashboard-header {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(15, 23, 42, 0.5));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
}

.admin-dashboard-title {
    color: #10b981;
    font-weight: 900;
    font-size: 1.1rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.admin-dashboard-subtitle {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* لیست نشست‌ها */
.admin-sessions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 10px;
}

/* کارت هر مکالمه */
.admin-session-item { 
    display: flex;
    align-items: center;
    padding: 12px; 
    background: rgba(30, 41, 59, 0.6); 
    border: 1px solid rgba(255, 255, 255, 0.08); 
    border-radius: 12px; 
    cursor: pointer; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.admin-session-item:hover { 
    background: rgba(30, 41, 59, 0.95); 
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* نوار رنگی کناری هنگام هاور (حس گیمینگ) */
.admin-session-item::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--vibrant-blue, #3b82f6);
    transform: scaleY(0);
    transition: transform 0.3s ease;
    border-radius: 0 4px 4px 0;
}
.admin-session-item:hover::before { transform: scaleY(1); }

/* آواتار کاربر */
.admin-session-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--vibrant-gold, #fbbf24);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.admin-session-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.admin-session-name {
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-session-subject {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* نشانگر خوانده‌نشده‌های اختصاصی هر نشست */
.session-unread-badge {
    background: var(--vibrant-red, #ef4444);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
    animation: pulseBadge 2s infinite;
}

/* وضعیت خالی پنل ادمین */
.empty-sessions {
    text-align: center;
    padding: 40px 10px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.empty-sessions i { font-size: 3rem; color: rgba(16, 185, 129, 0.2); }

/* دکمه‌های اکشن بالای صفحه چت ادمین */
.admin-chat-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    width: 100%;
    gap: 10px;
}

.btn-chat-back, .btn-chat-delete {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    font-family: inherit;
    font-weight: bold;
}

.btn-chat-back {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}
.btn-chat-back:hover { background: rgba(255, 255, 255, 0.15); }

.btn-chat-delete {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}
.btn-chat-delete:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}
.msg-container {
    display: flex;
    width: 100%;
}
.dir-user { justify-content: flex-start; }
.dir-admin { justify-content: flex-end; }

.msg-bubble-modern {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: bubbleAppear 0.3s ease-out forwards;
}

/* پیام کاربر عادی */
.bubble-user {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border-top-right-radius: 2px;
}

/* پیام متمایز مدیریت (بر اساس تم ایران رپ) */
.bubble-admin {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.25));
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #10b981;
    border-top-left-radius: 2px;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.1);
}

/* تگ رسمی تیم پشتیبانی داخل پیام ادمین */
.support-team-tag {
    font-size: 0.68rem;
    font-weight: 900;
    background: #10b981;
    color: #0f172a;
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
    text-transform: uppercase;
}
.msg-text-content {
    word-break: break-word;
}

/* پانویس یا فوتر چت */
.support-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #0f172a;
    flex-direction: column;
}
.support-chat-input {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 10px 16px;
    color: white;
    font-family: inherit;
    resize: none;
    height: 42px;
    outline: none;
    box-sizing: border-box;
    font-size: 0.85rem;
}
.support-chat-input:focus { border-color: #3b82f6; }
.support-send-btn {
    width: 42px;
    height: 42px;
    background: #3b82f6;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}
.support-send-btn:hover { background: #2563eb; transform: scale(1.05); }

@keyframes bubbleAppear {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modern-subject-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 10px;
    align-items: center;
}
.modern-form-icon {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(239, 68, 68, 0.1));
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fbbf24;
    margin-bottom: 5px;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.15);
}
.modern-label {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 8px;
    display: inline-block;
    font-weight: 700;
}
.input-glow-wrapper {
    position: relative;
    width: 100%;
}
.support-input-modern {
    width: 100%;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.3s;
    box-sizing: border-box;
}
.support-input-modern:focus {
    border-color: #3b82f6;
    background: rgba(30, 41, 59, 0.9);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.25);
}
.support-submit-modern {
    width: 100%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    transition: all 0.3s;
}
.support-submit-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}
