/* Chat Widget Styles - Ma'had Umar bin Al-Khattab AI Bot */

#chat-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary);
    color: white;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    cursor: pointer;
    z-index: 99999;
    box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: pulseGlow 2.2s infinite ease-in-out;
}

#chat-button:hover {
    transform: scale(1.1);
}

#chat-button i {
    transition: transform 0.3s;
}

#chat-button.active i {
    transform: rotate(90deg) scale(0);
    opacity: 0;
}

/* Bubble Animation */
@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(27, 77, 62, 0.6);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(27, 77, 62, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(27, 77, 62, 0);
    }
}

#chat-widget {
    width: 360px;
    height: 500px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 120px);
    position: fixed;
    bottom: 110px;
    right: 30px;
    background: white;
    border-radius: 20px;
    box-shadow: 0px 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    z-index: 99999;
    overflow: hidden;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-header {
    background: var(--primary);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 16px;
    border-bottom: 2px solid var(--accent);
}

.chat-logo {
    width: 35px;
    height: 35px;
    background: white;
    border-radius: 50%;
    padding: 2px;
}

#chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fdfdfd;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.msg-wrapper {
    display: flex;
    align-items: flex-end;
    margin-bottom: 5px;
    max-width: 85%;
}

.msg-wrapper.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid #eee;
    background: white;
}

.msg {
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.msg.user {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.msg.bot {
    background: #f1f1f1;
    color: #333;
    border-bottom-left-radius: 2px;
}

.typing-indicator {
    font-style: italic;
    font-size: 13px;
    color: var(--text-gray);
    margin-left: 40px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-input-box {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    gap: 10px;
}

#chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.3s;
}

#chat-input:focus {
    border-color: var(--primary);
}

#chat-send {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.3s;
}

#chat-send:hover {
    background: var(--primary-dark);
    transform: rotate(15deg);
}

#chat-close {
    opacity: 0.8;
    transition: 0.3s;
}

#chat-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

[dir="rtl"] #chat-button {
    right: auto;
    left: 30px;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    #chat-button {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
        font-size: 22px;
    }

    [dir="rtl"] #chat-button {
        right: auto;
        left: 20px;
    }

    #chat-widget {
        width: 310px;
        bottom: 80px;
        right: 20px;
    }

    [dir="rtl"] #chat-widget {
        right: auto;
        left: 20px;
    }
}

[dir="rtl"] #chat-widget {
    right: auto;
    left: 30px;
}

[dir="rtl"] .bot-avatar {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .msg.user {
    border-bottom-right-radius: 15px;
    border-bottom-left-radius: 2px;
}

[dir="rtl"] .msg.bot {
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 2px;
}