/* === Conversation chat layout (WhatsApp-style) ===
   User messages align right (purple, high-emphasis); agent messages align left on a subtle surface
   that still reads with contrast against the page background. Message text is intentionally small. */
.chat-row {
    display: flex;
    margin-bottom: 8px;
}

.chat-row-user {
    justify-content: flex-end;
}

.chat-row-agent {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 80%;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 0.82rem;
    line-height: 1.5;
}

.chat-bubble-user {
    background: #7B1FA2;
    color: #fff;
    border-bottom-right-radius: 3px;
}

.chat-bubble-agent {
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    border: 1px solid var(--mud-palette-lines-default);
    border-bottom-left-radius: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.chat-meta {
    font-size: 0.68rem;
    font-weight: 600;
    opacity: 0.8;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-bubble-user .chat-meta {
    color: rgba(255, 255, 255, 0.85);
}

.chat-bubble-agent .chat-meta {
    color: var(--mud-palette-text-secondary);
}

.chat-bubble-text {
    white-space: pre-wrap;
    word-break: break-word;
}

/* Agent-side wide content (collapsible response, activity steps) sits left, indented slightly so it
   visually belongs to the agent column without being constrained to a narrow bubble. */
.chat-agent-block {
    margin-right: 12%;
    margin-bottom: 8px;
}

/* === Streaming output === */
/* No inner scroll box: the conversation scrolls at the window level (investigationScroll.js drives
   document.scrollingElement). Capping height here would trap overflow in a nested scroll box the
   window-level auto-scroll cannot follow, so streamed content past the viewport would stop following. */
.streaming-output {
    scroll-behavior: smooth;
}

.streaming-output pre {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.85rem;
}

.streaming-output code {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
}

.thinking-text {
    color: var(--mud-palette-text-secondary);
    font-style: italic;
    font-size: 0.9rem;
}

/* === Tool call cards ===
   Each tool the agent invokes renders as a small expansion panel. On runs with 50+ tool calls the
   default MudExpansionPanel padding (~14px top/bottom) plus an mb-2 gap (8px) produces a wall of
   white space that pushes the report below the fold. The overrides below tighten the header to ~8px
   vertical and shrink the inter-card gap to 4px (mb-1) without losing the clickable target. */
.tool-call-card {
    border-left: 3px solid #1976d2;
}

.tool-call-card .mud-expand-panel-header {
    padding-top: 8px;
    padding-bottom: 8px;
}

.tool-call-card .mud-expand-panel-text {
    padding-top: 8px;
    padding-bottom: 8px;
}

.tool-result-card {
    border-left: 3px solid #4caf50;
}

.tool-error-card {
    border-left: 3px solid #f44336;
}

/* === Markdown content rendering === */
.markdown-content {
    line-height: 1.7;
    font-size: 0.925rem;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.markdown-content p {
    margin: 0.6rem 0;
    line-height: 1.7;
}

.markdown-content p:first-child {
    margin-top: 0;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

.markdown-content code {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.84rem;
    background-color: rgba(0, 0, 0, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    word-break: break-word;
}

.markdown-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

.markdown-content pre {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 12px 16px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.84rem;
    margin: 0.75rem 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid var(--mud-palette-lines-default);
    padding: 6px 12px;
    text-align: left;
}

.markdown-content th {
    background-color: var(--mud-palette-action-default-hover);
}

.markdown-content ul,
.markdown-content ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.markdown-content li {
    margin: 0.25rem 0;
}

/* Markdown blockquotes render in many investigation reports — the agent uses `>` for
   pull-quotes of business rules. The previous color (`rgba(255, 255, 255, 0.7)`) was a
   dark-theme leftover that produced white-on-white invisible text on the current light
   palette. Theme-aware variables fall back correctly in either mode. */
.markdown-content blockquote {
    border-left: 3px solid var(--mud-palette-divider);
    padding-left: 1rem;
    margin: 0.5rem 0;
    color: var(--mud-palette-text-secondary);
}

.markdown-content strong {
    font-weight: 600;
}

/* === Report sections === */
.report-summary {
    max-width: 960px;
}

/* Consistent section card used by every report block (via ReportSection.razor). */
.report-section {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
}

.report-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.report-section-icon {
    color: var(--mud-palette-primary);
}

.report-section-title {
    font-weight: 600;
}

.report-section-body {
    font-size: 0.875rem;
}

/* Recommended-action row: consistent card with a priority-coloured left accent. */
.report-action {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 6px;
}

.report-action-priority-error {
    border-left: 3px solid var(--mud-palette-error);
}

.report-action-priority-warning {
    border-left: 3px solid var(--mud-palette-warning);
}

.report-action-priority-info {
    border-left: 3px solid var(--mud-palette-info);
}

.report-action-priority-default {
    border-left: 3px solid var(--mud-palette-text-secondary);
}

/* === Tool card content shared styles ===
   Used across all ToolCards/*.razor components for consistent JSON / KQL / query rendering. */
.tool-pre {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    font-size: 0.8rem;
}

.tool-scroll-300 {
    max-height: 300px;
    overflow-y: auto;
}

.tool-scroll-200 {
    max-height: 200px;
    overflow-y: auto;
}

.tool-scroll-150 {
    max-height: 150px;
    overflow-y: auto;
}

/* Monospace label used for entity paths, file paths, exception types etc. across the support UI */
.support-mono {
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.84rem;
}

.support-mono-sm {
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.82rem;
}
