/* RAG Chatbot CSS - WhatsApp Style */

:root {
    --rag-primary: #25d366;
    /* Default specific to WhatsApp, will be overridden by PHP */
    --rag-bg: #e5ddd5;
    --rag-white: #ffffff;
    --rag-incoming: #ffffff;
    --rag-outgoing: #dcf8c6;
    --rag-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#rag-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Toggle Button */
#rag-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--rag-primary);
    box-shadow: var(--rag-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    color: white;
    font-size: 30px;
}

#rag-chatbot-toggle:hover {
    transform: scale(1.05);
}

#rag-chatbot-widget.active #rag-chatbot-toggle {
    display: none;
}

/* Chat Window */
#rag-chatbot-container {
    display: none;
    /* Hidden by default */
    width: 350px;
    height: 500px;
    max-height: 80vh;
    background-color: var(--rag-bg);
    border-radius: 12px;
    box-shadow: var(--rag-shadow);
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 0;
    right: 0;
}

#rag-chatbot-widget.active #rag-chatbot-container {
    display: flex;
}

/* Header */
#rag-chatbot-header {
    background-color: var(--rag-primary);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

#rag-chatbot-header h4 {
    color: var(--rag-title-color, white) !important;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#rag-chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#rag-chatbot-close {
    cursor: pointer;
    font-size: 20px;
    color: var(--rag-title-color, #ffffff);
    line-height: 1;
}

/* Body */
#rag-chatbot-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    /* Pattern WhatsApp Optional */
    background-blend-mode: soft-light;
}

/* Messages */
.rag-message {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
}

.rag-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 7.5px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

/* Bot (Incoming) */
.rag-message-bot {
    align-items: flex-start;
}

.rag-message-bot .rag-bubble {
    background-color: var(--rag-incoming);
    border-top-left-radius: 2px;
    /* Modern subtle corner */
    color: #333;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* User (Outgoing) */
.rag-message-user {
    align-items: flex-end;
}

.rag-message-user .rag-bubble {
    background-color: var(--rag-outgoing);
    /* Will be overridden/matched to theme */
    border-top-right-radius: 2px;
    color: #111;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Markdown Styles inside Bubbles */
.rag-bubble strong {
    font-weight: 700;
    color: #000;
}

.rag-bubble ul {
    margin: 5px 0 5px 20px;
    padding: 0;
}

.rag-bubble li {
    margin-bottom: 3px;
}

.rag-bubble p {
    margin: 0 0 5px 0;
}

.rag-bubble p:last-child {
    margin-bottom: 0;
}

/* Footer (Input) */
#rag-chatbot-footer {
    background-color: #f0f0f0;
    padding: 10px;
    display: flex;
    align-items: center;
}

#rag-chatbot-input {
    flex: 1;
    border: none;
    padding: 10px;
    border-radius: 20px;
    outline: none;
    margin-right: 10px;
}

#rag-chatbot-send {
    background: none;
    border: none;
    color: var(--rag-primary);
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
}