/* Chatbot Styles */
.chatbot-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 1000;
    font-family: 'Tajawal', sans-serif;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Mobile menu open state */
.mobile-menu-open .chatbot-container {
    transform: translateX(150px) scale(0.9);
    opacity: 0.8;
}

/* Mobile-specific styles */
@media (max-width: 992px) {
    .chatbot-container {
        left: 20px;
        bottom: 20px;
    }
    
    .chatbot-button {
        width: 56px;
        height: 56px;
    }
    
    .mobile-menu-open .chatbot-button {
        animation: pulse 2s infinite;
    }
    
    @keyframes pulse {
        0% {
            box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);
        }
        70% {
            box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);
        }
        100% {
            box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
        }
    }
}

.chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    z-index: 1001;
}

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

.chatbot-button i {
    font-size: 28px;
}

.chatbot-button .unread {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ef4444;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 350px;
    max-width: 90vw;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.chatbot-window.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

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

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

.chat-header .close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background-color: #f9fafb;
}

.message {
    margin-bottom: 15px;
    max-width: 80%;
    clear: both;
}

.message.bot {
    float: right;
    background: #4f46e5;
    color: white;
    border-radius: 18px 18px 0 18px;
    padding: 12px 16px;
    margin-left: auto;
}

.message.user {
    float: left;
    background: #e5e7eb;
    color: #111827;
    border-radius: 18px 18px 18px 0;
    padding: 12px 16px;
    margin-right: auto;
}

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

.chat-input input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    outline: none;
    font-family: 'Tajawal', sans-serif;
    transition: border-color 0.3s;
}

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

.chat-input button {
    background: #4f46e5;
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    margin-right: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.chat-input button:hover {
    background: #4338ca;
}

.chat-input button:disabled {
    background: #a5b4fc;
    cursor: not-allowed;
}

.typing-indicator {
    display: flex;
    padding: 10px 15px;
    background: #eef2ff;
    border-radius: 18px;
    width: fit-content;
    margin-bottom: 15px;
    float: right;
    clear: both;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #4f46e5;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% { 
        transform: scale(0);
    } 40% { 
        transform: scale(1.0);
    }
}

/* RTL Support */
[dir="rtl"] .chatbot-container {
    left: auto;
    right: 30px;
}

[dir="rtl"] .chatbot-window {
    left: auto;
    right: 0;
}

[dir="rtl"] .chat-input button {
    margin-right: 0;
    margin-left: 10px;
}

[dir="rtl"] .message.bot {
    float: left;
    border-radius: 18px 18px 18px 0;
}

[dir="rtl"] .message.user {
    float: right;
    border-radius: 18px 18px 0 18px;
}

[dir="rtl"] .typing-indicator {
    float: left;
}

/* Responsive Design */
@media (max-width: 480px) {
    .chatbot-container {
        bottom: 15px;
        left: 15px;
    }
    
    [dir="rtl"] .chatbot-container {
        right: 15px;
        left: auto;
    }
    
    .chatbot-window {
        width: 90vw;
        left: 5vw;
    }
    
    [dir="rtl"] .chatbot-window {
        right: 5vw;
        left: auto;
    }
}
