#ai-chat-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 10px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #004488;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

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

#ai-chat-container {
    position: fixed;
    bottom: 160px; 
    right: 10px;
    width: 650px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 120px);
    border: 1px solid #ccc;
    border-radius: 12px;
    font-family: sans-serif;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    z-index: 999999;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform-origin: bottom right;
}

#ai-chat-container.ai-chat-hidden {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
}

#ai-chat-header {
    background: #004488;
    color: white;
    padding: 15px;
    border-radius: 12px 12px 0 0;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#ai-chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

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

.ai-msg {
    background: #e0e0e0;
    padding: 10px;
    border-radius: 8px;
    align-self: flex-start;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.4;
}

.user-msg {
    background: #004488;
    color: white;
    padding: 10px;
    border-radius: 8px;
    align-self: flex-end;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.4;
}

#ai-chat-input-area {
    display: flex;
    padding: 15px 10px;
    border-top: 1px solid #eee;
    background: #fff;
    border-radius: 0 0 12px 12px;
    margin-top: auto;
}

#ai-chat-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
}

#ai-chat-send {
    background: #004488;
    color: white;
    border: none;
    padding: 0 15px;
    margin-left: 10px;
    border-radius: 4px;
    cursor: pointer;
}

.typing-dots {
    display: flex;
    gap: 5px;
    align-items: center;
    height: 15px;
    padding: 2px 5px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background-color: #888;
    border-radius: 50%;
    animation: ai-bounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes ai-bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; } 
    40% { transform: scale(1); opacity: 1; }
}