#matan-ai-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
}

#matan-chat-toggle {
    background: #00d4aa;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s;
}

#matan-chat-toggle:hover {
    transform: scale(1.05);
}

#matan-chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 500px;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s, transform 0.3s;
}

#matan-chat-window.hidden {
    display: none;
    /* simple toggle */
}

.chat-header {
    background: #1a1a1a;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

#matan-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.4;
}

.message.bot {
    align-self: flex-start;
    /* RTL: Start is right? No, flex-start is right in RTL context if dir=rtl on container */
    background: #e0e0e0;
    color: #333;
    border-bottom-right-radius: 2px;
}

.message.user {
    align-self: flex-end;
    /* Left side in RTL */
    background: #00d4aa;
    color: white;
    border-bottom-left-radius: 2px;
}

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

#matan-chat-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    direction: rtl;
}

#matan-chat-send {
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0 20px;
    cursor: pointer;
    font-weight: bold;
}

/* Animations */
.typing-dot {
    animation: typing 1.4s infinite ease-in-out both;
}

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

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

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

#matan-chat-send:disabled,
#matan-chat-input:disabled {
    cursor: not-allowed;
    background-color: #ccc !important;
    opacity: 0.6;
}