/* ============================================
   CHAT BOT - Fixed Position
============================================ */

/* 1. الزر العائم */
#chat-bot-btn {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
    z-index: 9999 !important;
    transition: all 0.3s;
}

#chat-bot-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(79, 70, 229, 0.6);
}

/* 2. نافذة الشات - ثابتة على جنب الشاشة */
#chat-window {
    position: fixed !important;
    bottom: 100px !important;
    right: 30px !important;
    width: 380px;
    height: 550px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    z-index: 9999 !important;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

#chat-window.show {
    display: flex;
}

/* 3. هيدر الشات */
.chat-header {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.chat-header strong {
    display: block;
    font-size: 0.95rem;
}

.chat-header small {
    font-size: 0.75rem;
    opacity: 0.9;
}

.online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    margin-left: 4px;
}

.chat-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: background 0.2s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 4. منطقة الرسائل */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
}

.chat-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    max-width: 80%;
    font-size: 0.9rem;
    line-height: 1.6;
    word-wrap: break-word;
}

.chat-bubble.bot {
    background: #fff;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chat-bubble.user {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    align-self: flex-end;
    border-bottom-left-radius: 4px;
}

/* روابط داخل الشات */
.chat-bubble.bot a.chat-transfer-btn {
    display: inline-block;
    margin-top: 8px;
    margin-left: 4px;
    padding: 8px 16px;
    background: #10b981;
    color: #fff !important;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s;
}

.chat-bubble.bot a.chat-transfer-btn:hover {
    background: #059669;
    color: #fff !important;
}

/* 5. الأزرار السريعة */
.chat-quick-replies {
    padding: 10px 15px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    background: #fff;
    border-top: 1px solid #f1f5f9;
}

.chat-quick-replies button {
    padding: 6px 12px;
    border-radius: 50px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    font-family: 'Cairo', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: #4f46e5;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-quick-replies button:hover {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

/* 6. حقل الإدخال */
.chat-input {
    display: flex;
    padding: 12px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    gap: 8px;
}

.chat-input input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input input:focus {
    border-color: #4f46e5;
}

.chat-input button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.chat-input button:hover {
    transform: scale(1.05);
}

/* 7. للجوال */
@media (max-width: 576px) {
    #chat-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 130px);
        right: 15px !important;
        bottom: 90px !important;
    }

    #chat-bot-btn {
        right: 15px !important;
        bottom: 20px !important;
        width: 55px;
        height: 55px;
    }
}