#docuagent-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#docuagent-chat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    overflow: hidden; /* Important for containing the image */
    position: relative; /* Added for proper image positioning */
}

/* When using custom icon, make background transparent */
#docuagent-chat-icon.has-custom-icon {
    background-color: transparent !important;
}

#docuagent-chat-icon span {
    z-index: 2; /* Ensure text is above image if both present */
}

#docuagent-chat-icon img {
    position: absolute; /* Absolute positioning to ensure image fills container */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

#docuagent-chat-window {
    margin-bottom: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#docuagent-chat-messages {
    padding: 10px;
    height: calc(100% - 50px);
    overflow-y: auto;
    background-color: #fff;
    display: flex;
    flex-direction: column;
}

/* Chat input area */
#docuagent-chat-input {
    display: flex;
    border-top: 1px solid #ccc;
}

#docuagent-chat-input input {
    flex: 1;
    padding: 10px;
    border: none;
}

#docuagent-chat-input button {
    padding: 10px;
    background-color: #ff0188;
    border: none;
    color: #fff;
    cursor: pointer;
}

/* Speech bubbles */
.bubble {
    padding: 8px 12px;
    border-radius: 12px;
    margin: 5px 0;
    max-width: 80%;
    word-wrap: break-word;
}

.docuagent-user-message.bubble {
    background-color: #d4fcd4; /* Light green */
    color: #000;
    align-self: flex-end;
}

.docuagent-api-message.bubble {
    background-color: #f0f0f0; /* Light grey */
    color: #000;
    align-self: flex-start;
}

/* Typing indicator styling */
.docuagent-typing-indicator.bubble {
    background-color: #f0f0f0;
    color: #000;
    align-self: flex-start;
}

.docuagent-typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 2px;
    background-color: #555;
    border-radius: 50%;
    animation: blink 1s infinite;
}

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

@keyframes blink {
    0%, 20%, 50%, 80%, 100% {
        opacity: 0.2;
    }
    40% {
        opacity: 1;
    }
    60% {
        opacity: 1;
    }
}

/* Optional: Style for error messages */
.docuagent-api-message.bubble.error {
    border: 1px solid red;
}