/* أنماط الدردشة الذكية */
#chatbot-toggle {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a6cf7, #6a11cb);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 1000;
    transition: all 0.3s ease;
}

#chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

#chatbot-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
    font-family: 'Cairo', sans-serif;
    direction: rtl;
}

.chat-header {
    background: linear-gradient(135deg, #4a6cf7, #6a11cb);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#chatbot-close:hover {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f8f9fa;
}

.chat-message {
    margin-bottom: 15px;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

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

.user-message {
    margin-right: auto;
    margin-left: 0;
}

.assistant-message {
    margin-right: 0;
    margin-left: auto;
}

.message-content {
    padding: 10px 15px;
    border-radius: 15px;
    line-height: 1.5;
    font-size: 14px;
    position: relative;
    word-wrap: break-word;
}

.user-message .message-content {
    background-color: #4a6cf7;
    color: white;
    border-bottom-right-radius: 5px;
}

.assistant-message .message-content {
    background-color: #e9ecef;
    color: #212529;
    border-bottom-left-radius: 5px;
}

.message-time {
    font-size: 11px;
    color: #6c757d;
    margin-top: 5px;
    text-align: left;
    padding-right: 10px;
}

.user-message .message-time {
    text-align: right;
    padding-right: 0;
    padding-left: 10px;
}

.chat-input-container {
    display: flex;
    padding: 15px;
    background-color: white;
    border-top: 1px solid #e9ecef;
}

#chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #dee2e6;
    border-radius: 25px;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

#chat-input:focus {
    border-color: #4a6cf7;
}

#chat-send {
    background: linear-gradient(135deg, #4a6cf7, #6a11cb);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    margin-right: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

#chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(74, 108, 247, 0.4);
}

#chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* مؤشر الكتابة */
.typing-indicator {
    display: flex;
    padding: 10px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    margin: 0 2px;
    background-color: #6c757d;
    border-radius: 50%;
    display: inline-block;
    opacity: 0.4;
}

.typing-indicator span:nth-child(1) {
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation: typing 1s infinite 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation: typing 1s infinite 0.4s;
}

@keyframes typing {
    0% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-5px); }
    100% { opacity: 0.4; transform: translateY(0); }
}

/* رسالة التحميل */
.loading-message .message-content {
    background: none;
    padding: 5px 0;
}

/* التجاوب مع الشاشات الصغيرة */
@media (max-width: 480px) {
    #chatbot-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        left: 0;
        border-radius: 0;
    }
    
    .chat-message {
        max-width: 90%;
    }
}
