#rag-chat-bubble {
    position: fixed;
    /* Default position set by JS/Inline style, fallback values */
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #0073aa;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

#rag-chat-bubble:hover {
    transform: scale(1.1);
}

#rag-chat-window {
    position: fixed;
    /* Initial position set by JS/CSS helper classes */
    width: 300px;
    height: 400px;
    min-width: 250px;
    /* Resize constraints */
    min-height: 300px;
    max-width: 80vw;
    max-height: 80vh;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 10px;
    display: none;
    flex-direction: column;
    z-index: 9999;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    /* Base font size */
}

/* Font Size Modifiers */
#rag-chat-window.text-sm {
    font-size: 12px;
}

#rag-chat-window.text-md {
    font-size: 14px;
}

#rag-chat-window.text-lg {
    font-size: 16px;
}

/* Position Modifiers */
.rag-pos-right {
    right: 20px;
}

.rag-pos-left {
    left: 20px;
}

#rag-chat-header {
    background-color: #0073aa;
    color: white;
    padding: 10px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    display: flex;
    align-items: center;
    /* Vertical center */
    padding-right: 40px;
    /* Make space for absolute close button */
    position: relative;
    /* For absolute positioning of close button */
    cursor: move;
    user-select: none;
}

#rag-chat-header>span:first-child {
    margin-right: auto;
    /* Push title to left */
    font-weight: bold;
}

#rag-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: 10px;
}

.rag-font-btn {
    background-color: rgba(0, 0, 0, 0.2) !important;
    /* Darker background for contrast */
    color: #ffffff !important;
    /* Force white text */
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    font-size: 11px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    box-shadow: none !important;
    text-shadow: none !important;
}

.rag-font-btn:hover {
    background-color: rgba(0, 0, 0, 0.4) !important;
    border-color: #ffffff !important;
}

#rag-chat-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    color: white;
    opacity: 0.8;
}

#rag-chat-close:hover {
    opacity: 1;
}

#rag-chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
}

.rag-message {
    margin-bottom: 10px;
}

.rag-message p {
    margin: 0;
    padding: 8px 12px;
    border-radius: 15px;
    max-width: 80%;
}

.rag-message-user {
    text-align: right;
}

.rag-message-user p {
    background-color: #0073aa;
    color: white;
    display: inline-block;
}

.rag-message-ai {
    text-align: left;
}

.rag-message-ai p {
    background-color: #f1f1f1;
    color: black;
    display: inline-block;
}

#rag-chat-input-area {
    padding: 10px;
    border-top: 1px solid #eee;
    display: flex;
}

#rag-chat-input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 20px;
}

#rag-chat-submit {
    margin-left: 5px;
    padding: 8px 15px;
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

/* Resize Handle */
#rag-resize-handle {
    position: absolute;
    width: 15px;
    height: 15px;
    bottom: 0;
    left: 0;
    /* Resize from bottom-left as requested generally, or bottom-right? Usually bottom-right */
    cursor: nesw-resize;
    z-index: 10000;
}

/* If right-aligned, resize from left? Standard is usually bottom-right. 
   Assuming standard bottom-right resize for simplicity unless customized. 
   Wait, if position is right, resize handle should be left-bottom? 
   Let's stick to standard browser resize behavior for now, but custom handle allows better control.
   Let's put handle at bottom-left per intuitive UX for right-aligned chat. 
*/
.rag-resize-handle-left {
    left: 0;
    bottom: 0;
    cursor: sw-resize;
    background: linear-gradient(45deg, transparent 50%, #ccc 50%);
}

.rag-resize-handle-right {
    right: 0;
    bottom: 0;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 50%, #ccc 50%);
}