:root {
    --chatbot-primary: #007bff;
    --chatbot-light: #f8f9fa;
    --chatbot-text: #212529;
    --chatbot-bubble-size: 60px;
}

#chat-bubble {
    position: fixed;
    bottom: 50px;
    right: 20px;
    width: var(--chatbot-bubble-size);
    height: var(--chatbot-bubble-size);
    background-color: var(--chatbot-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: scale(0);
    transition: transform 0.3s ease;
    z-index: 9998;
}

#chat-bubble.visible {
    transform: scale(1);
}

#chat-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 350px;
    max-width: 90vw;
    height: 500px;
    max-height: 70vh;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease;
    z-index: 9999;
}

#chat-window.visible {
    transform: scale(1);
}

.chat-header {
    background-color: var(--chatbot-primary);
    color: white;
    padding: 10px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.chat-messages {
    flex-grow: 1;
    padding: 10px;
    overflow-y: auto;
    background-color: var(--chatbot-light);
}

.chat-message {
    padding: 8px 12px;
    border-radius: 18px;
    margin-bottom: 10px;
    max-width: 80%;
    word-wrap: break-word;
}

.chat-message.bot {
    background-color: #e9ecef;
    color: var(--chatbot-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message.user {
    background-color: var(--chatbot-primary);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.chat-form {
    display: flex;
    border-top: 1px solid #dee2e6;
    padding: 10px;
}

.chat-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 15px;
    margin-right: 10px;
}

.chat-send-btn {
    background-color: var(--chatbot-primary);
    border: none;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
}
.chat-message.typing {
    display: flex;
    align-items: center;
    background-color: #e9ecef;
    padding: 12px 15px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: #888;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: -1.0s; }
.typing-dot:nth-child(3) { animation-delay: -0.8s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}