/* =========================================
   CHATBOX PROFESSIONAL - DARK MODE (Light)
   ========================================= */
#chat-widget {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 10000;
}

/* ---- دکمه چت (کاملاً بدون تغییر) ---- */
.chat-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #38bdf8, #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(56,189,248,0.4);
    transition: all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    position: relative;
}
.chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 28px rgba(139,92,246,0.4);
}
.chat-toggle .material-icons {
    color: white;
    font-size: 28px;
}
.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: bold;
    min-width: 22px;
    height: 22px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid #0f172a;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s;
    pointer-events: none;
}
.chat-badge.show {
    opacity: 1;
    transform: scale(1);
}

/* ---- پنل چت (ساده‌سازی‌شده) ---- */
.chat-panel {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 380px;
    max-width: 85vw;
    height: 520px;
    background: #0f172a;  /* حذف blur و گرادیان */
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    transform-origin: bottom left;
}
.chat-panel.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.96);
    pointer-events: none;
}

/* ---- هدر ---- */
.chat-header {
    padding: 16px 20px;
    background: #1e293b;  /* رنگ ثابت به جای گرادیان */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.chat-header-info .material-icons {
    font-size: 28px;
    color: #38bdf8;
}
.chat-header-info h4 {
    margin: 0;
    font-size: 1rem;
    color: #f1f5f9;
}
.chat-header-info p {
    margin: 0;
    font-size: 0.7rem;
    color: #4ade80;
}
.chat-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: background 0.15s;
}
.chat-close-btn:hover {
    background: rgba(255,255,255,0.1);
}
.chat-close-btn .material-icons {
    color: #94a3b8;
    font-size: 20px;
}

/* ---- ناحیه پیام‌ها ---- */
.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeInUp 0.15s ease;  /* انیمیشن ساده‌تر */
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.message.system { align-items: flex-start; }
.message.user   { align-items: flex-end; align-self: flex-end; }

.message-content {
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 0.88rem;
    line-height: 1.4;
    word-break: break-word;
}
.message.system .message-content {
    background: #1e293b;
    color: #f1f5f9;
    border-bottom-left-radius: 4px;
}
.message.user .message-content {
    background: #38bdf8;  /* رنگ ثابت به جای گرادیان */
    color: white;
    border-bottom-right-radius: 4px;
}
.message-time {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: 4px;
    margin-left: 8px;
    margin-right: 8px;
}

/* ---- نشانگر تایپ ---- */
.chat-typing {
    padding: 8px 16px;
    background: rgba(30,41,59,0.6);
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}
.chat-typing.hidden { display: none; }
.chat-typing::before {
    content: '';
    width: 7px;
    height: 7px;
    background: #38bdf8;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 1; }
}

/* ---- ورودی پیام ---- */
.chat-input {
    display: flex;
    padding: 12px;
    gap: 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(15,23,42,0.5);
}
.chat-input input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.1);
    background: #0f172a;
    color: #f1f5f9;
    outline: none;
    font-size: 0.9rem;
    transition: border 0.15s;
}
.chat-input input:focus { border-color: #38bdf8; }
.chat-input button {
    background: #38bdf8;  /* رنگ ثابت به جای گرادیان */
    border: none;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.chat-input button:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 10px rgba(56,189,248,0.3);
}
.chat-input button .material-icons {
    color: white;
    font-size: 20px;
}

/* ---- نسخه موبایل (فقط ابعاد دکمه مطابق اصلی) ---- */
@media (max-width: 768px) {
    #chat-widget {
        bottom: 20px;
        left: 20px;
    }
    /* دکمه چت همان ابعاد اصلی */
    .chat-toggle {
        width: 58px;
        height: 58px;
    }
    .chat-toggle .material-icons {
        font-size: 2rem; /* 32px */
    }

    /* پنل تمام‌صفحۀ پایین */
    .chat-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 65vh;
        border-radius: 24px 24px 0 0;
        background: #1e293b;  /* رنگ تخت برای موبایل */
        box-shadow: 0 -4px 15px rgba(0,0,0,0.3);
    }

    .chat-header {
        padding: 14px;
        font-size: 1.1rem;
    }
    .chat-messages {
        padding: 12px;
    }
    .message {
        max-width: 90%;
        font-size: 0.9rem;
    }
    .chat-input input {
        padding: 12px 16px;
        font-size: 1rem;
    }
}