/* Chat-specific styling that extends the app.css branding */
#chatWindow {
    height: 600px;
    max-height: calc(60vh);
    overflow-y: auto;
    border: 2px solid var(--rf-bg-panel);
    padding: 5px;
    background-color: var(--rf-bg-panel);
    border-radius: 10px;
    /* box-shadow: 0 4px 8px rgba(0,0,0,0.1); */
}

#loadingMessage {
    font-style: italic;
    color: #425CC7;
    font-weight: 600;
}

/* Styling for markdown-rendered content using brand colors */
#chatWindow h1, #chatWindow h2, #chatWindow h3, #chatWindow h4, #chatWindow h5, #chatWindow h6 {
    margin: 0.5em 0 0.3em 0;
    font-weight: bold;
    color: #243746;
}

#chatWindow ul, #chatWindow ol {
    margin: 0.5em 0 0.5em 1.5em;
}

#chatWindow li {
    margin: 0.2em 0;
}

#chatWindow p {
    margin: 0.5em 0;
    color: #243746;
}

#chatWindow code {
    background-color: #e9ecef;
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-family: monospace;
    border: 1px solid #ced4da;
}

#chatWindow pre {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 0.8em;
    overflow-x: auto;
}

#chatWindow blockquote {
    border-left: 4px solid #425CC7;
    margin: 0.5em 0;
    padding-left: 1em;
    color: #6c757d;
    background-color: #f8f9fa;
    border-radius: 0 4px 4px 0;
}

.featured_image {
    width: 300px;
    float: right;
}

/* Message styling */
.user-message {
    font-family: Inter, sans-serif !important;
    font-weight: 300 !important;
    font-size: 14px !important;
    background-color: #e7f3ff;
    padding: 10px 20px;
    margin: 10px 5px;
    border-radius: 10px;
}

.user-message {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
}

.user-message .message-icon-group{
    display: inline-block !important;
}

.user-message .message-icon-group strong{
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
}

.user-message .message-icon-group strong .bi-icon {
    font-size: 20px !important;
}

.assistant-message {
    font-family: Inter, sans-serif !important;
    font-weight: 300 !important;
    font-size: 14px !important;
    background-color: #fff;
    padding: 10px 20px;
    margin: 10px 5px;
    border-radius: 10px;
}

.assistant-message .message-icon-group {
    display: block !important;
}

.assistant-message .message-icon-group strong {
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
}

.assistant-message .message-icon-group strong img.bi-icon {
    height: 20px !important;
}

.user-message strong,
.assistant-message strong{
    font-family: Inter, sans-serif !important;
    font-weight: 700 !important;
    font-size: 14px !important;
}

/* Rating widget styling */
#ratingWidget {
    text-align: center;
    padding: 10px 20px;
    background-color: var(--rf-bg-panel-secondary);
    border-radius: 10px;
    border: 1px solid var(--rf-bg-panel-secondary);
}

#ratingWidget small {
    color: var(--rf-text-muted) !important;
}

/* Input group styling */
.chat-input-group {
    display: flex;
    gap: 10px;
}

.chat-input-group input{
    font-size: 14px !important;
    border-radius: 10px !important;
    padding: 10px 20px !important;
    background-color: var(--rf-bg-lightgray) !important;
}

.chat-input-group input::placeholder {
    color: var(--rf-text-muted) !important;
    font-style: italic !important;
}

.chat-input-group button {
    border-radius: 10px !important;
    padding: 10px 20px !important;
    text-transform: uppercase;
}

.input-group .form-control:focus {
    border-color: #425CC7;
    box-shadow: 0 0 0 0.2rem rgba(66, 92, 199, 0.25);
}

/* Chat history sidebar styling */
#historyList {
    background-color: var(--rf-bg-panel);
    border-right: 2px solid #dee2e6;
    height: calc(100vh - 120px);
    max-height: 55vh !important;
    overflow-y: auto;
    padding: 0px 0.5rem 0px 0px;
    border-radius: 0px 0px 10px 10px;
}

.history-item {
    border: 1px solid #dee2e6;
    border-radius: 0px 0px 10px 10px;
    margin-bottom: 8px;
    padding: 12px 12px 6px 12px;
    background-color: var(--rf-bg-panel-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    background-color: #e7f3ff;
    border-color: #425CC7;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.history-item.active {
    background-color: #425CC7;
    color: white;
    border-color: #243746;
}

.history-item.active:hover {
    background-color: #3a4eb5;
}

.history-title {
    font-weight: 600;
    font-size: 0.8em;
    margin-bottom: 4px;
}

.history-date {
    font-size: 0.75em;
    color: #6c757d;
    font-style: italic;
}

.history-item.active .history-date {
    color: rgba(255,255,255,0.8);
}

.history-preview {
    font-size: 0.8em;
    color: #6c757d;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item.active .history-preview {
    color: rgba(255,255,255,0.7);
}

.history-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.history-delete-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 0.8em;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.history-delete-btn:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

.history-item.active .history-delete-btn {
    color: rgba(255,255,255,0.8);
}

.history-item.active .history-delete-btn:hover {
    background-color: rgba(255,255,255,0.2);
}

/* Streaming toggle styling */
.streaming-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background-color: var(--rf-bg-panel-secondary);
    border-radius: 10px;
    border: 1px solid #dee2e6;
    margin-bottom: 10px;
    font-size: 14px !important;
}

.streaming-toggle small {
    color: var(--rf-text-muted) !important;
}

.streaming-badge {
    background-color: #28a745;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
}

/* Status indicator for streaming events */
.status-message {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 4px;
    font-style: italic;
    color: #856404;
}

.status-message.tool-call {
    background-color: #d1ecf1;
    border-left-color: #17a2b8;
    color: #0c5460;
}

.status-message.agent-update {
    background-color: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

/* Typing indicator for streaming */
.typing-indicator {
    display: inline-block;
    animation: blink 1.4s infinite;
}

@keyframes blink {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.3; }
}