/* Sidebar Chat Widget Styles */

.sidebar-chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Allow shrinking in flex context */
    overflow: hidden; /* Contain children within available space */
}

.sidebar-chat-container .llm-chat-input-form {
    flex-shrink: 0; /* Keep input bar from shrinking */

    .llm-chat-input {
        font-size: 0.9em;
        padding: 0.5em;
    }
}

.sidebar-chat-messages {
    flex: 1;
    min-height: 0; /* Allow flex shrinking for scroll containment */
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Reuse llm-chat-message styles but make them more compact */
.sidebar-chat-messages .llm-chat-message-wrapper {
    margin-top: 0;
    max-width: 100%;
}

.sidebar-chat-messages .llm-chat-message {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.sidebar-chat-messages .llm-chat-message-role {
    font-size: 0.75rem;
}

.sidebar-chat-messages .llm-chat-tool-activity {
    font-size: 0.85rem;
    padding: 0.375rem 0.75rem;
    margin-bottom: 0;
    max-width: 100%;
}

/* Make the sidebar chat widget grow to fill available space when expanded */
#right-pane .widget.grow:not(.collapsed) {
    flex: 1;
    flex-shrink: 1; /* Override flex-shrink: 0 from main styles */
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#right-pane .widget.grow:not(.collapsed) .body-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Override overflow: auto from main styles */
}

#right-pane .widget.grow:not(.collapsed) .card-body {
    flex: 1;
    min-height: 0;
    overflow: hidden; /* Override overflow: auto - let child handle scrolling */
    display: flex;
    flex-direction: column;
}

/* Compact markdown in sidebar */
.sidebar-chat-messages .llm-chat-markdown {
    font-size: 0.9rem;
    line-height: 1.5;
}

.sidebar-chat-messages .llm-chat-markdown p {
    margin: 0 0 0.5em 0;
}

.sidebar-chat-messages .llm-chat-markdown pre {
    padding: 0.5rem;
    font-size: 0.8rem;
}

.sidebar-chat-messages .llm-chat-markdown code {
    font-size: 0.85em;
}

.sidebar-chat-history-item-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-chat-history-item-content span,
.sidebar-chat-history-item-content strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-chat-history-date {
    font-size: 0.75rem;
    color: var(--muted-text-color);
    margin-top: 0.125rem;
}
