/* Chat Widget Styles */
.rag-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.rag-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #007cba;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.rag-chat-button:hover {
    background: #005a87;
    transform: scale(1.05);
}

.rag-chat-button svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.rag-chat-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.rag-chat-panel.open {
    display: flex;
}

.rag-chat-header {
    background: #007cba;
    color: white;
    padding: 16px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rag-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    width: 24px;
    height: 24px;
}

.rag-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 12px;
}

.rag-chat-message {
    max-width: 80%;
    padding: 12px;
    border-radius: 12px;
    word-wrap: break-word;
}

.rag-chat-message.user {
    background: #007cba;
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.rag-chat-message.bot {
    background: #f1f1f1;
    color: #333;
    align-self: flex-start;
}

.rag-chat-sources {
    margin-top: 8px;
    font-size: 10px;
    color: #666;
}

.rag-chat-sources a {
    color: #007cba;
    text-decoration: none;
    display: block;
    margin-top: 4px;
}

.rag-chat-sources a:hover {
    text-decoration: underline;
}

.rag-chat-input-area {
    padding: 16px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
}

.rag-chat-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 24px;
    outline: none;
    font-size: 12px;
}

.rag-chat-input:focus {
    border-color: #007cba;
}

.rag-chat-send {
    padding: 12px 16px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.rag-chat-send:hover:not(:disabled) {
    background: #005a87;
}

.rag-chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.rag-chat-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-style: italic;
}

.rag-chat-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile responsive */
@media (max-width: 480px) {
    .rag-chat-panel {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 20px;
    }
}