/* Styles for the product assistant page (/assistant). Loaded globally from Components/App.razor.
   Colors come from the MudBlazor palette variables so the page follows the portal theme. */

.nlas-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
}

.nlas-row { display: flex; }
.nlas-row-user { justify-content: flex-end; }
.nlas-row-assistant { justify-content: flex-start; }

.nlas-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
}

/* The own question: a faint tint of the accent colour on the dark surface, so the text stays as
   readable as in an answer bubble. A solid accent fill with white text was too bright to read. */
.nlas-bubble-user {
    background: rgba(var(--mud-palette-primary-rgb), .14);
    border-color: rgba(var(--mud-palette-primary-rgb), .35);
    color: var(--mud-palette-text-primary);
    border-bottom-right-radius: 4px;
}

.nlas-bubble-user .nlas-sender { color: var(--mud-palette-primary); }

.nlas-bubble-assistant { border-bottom-left-radius: 4px; }

.nlas-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
    font-size: .72rem;
}

.nlas-meta .nlas-sender, .nlas-meta .nlas-time { opacity: .75; }

/* Pengu, the mascot: the plane next to the page heading, the head as avatar in every answer bubble. */
.nlas-hero {
    height: 72px;
    width: auto;
    flex-shrink: 0;
}

.nlas-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(var(--mud-palette-primary-rgb), .18);
    flex-shrink: 0;
}

.nlas-sender {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}

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

/* Rendered markdown of an answer. */
.nlas-md {
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.5;
}

.nlas-md p { margin: 0 0 .6em; }
.nlas-md p:last-child { margin-bottom: 0; }
.nlas-md h3, .nlas-md h4, .nlas-md h5 { margin: .8em 0 .3em; font-weight: 600; line-height: 1.3; }
.nlas-md h3 { font-size: 1.1rem; }
.nlas-md h4 { font-size: 1rem; }
.nlas-md h5 { font-size: .95rem; }
.nlas-md ul, .nlas-md ol { margin: 0 0 .6em; padding-left: 1.4em; }
.nlas-md li { margin: .15em 0; }

.nlas-md pre {
    overflow-x: auto;
    padding: 10px 12px;
    margin: 8px 0;
    border-radius: 8px;
    background: var(--mud-palette-background-gray);
    font-size: .85rem;
}

.nlas-md code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .85em;
}

.nlas-md :not(pre) > code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--mud-palette-background-gray);
}

.nlas-md table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 8px 0;
}

.nlas-md th, .nlas-md td {
    border: 1px solid var(--mud-palette-lines-default);
    padding: 4px 8px;
    text-align: left;
    vertical-align: top;
}

.nlas-md th { background: var(--mud-palette-background-gray); }

.nlas-md blockquote {
    margin: 8px 0;
    padding-left: 12px;
    border-left: 3px solid var(--mud-palette-lines-default);
    color: var(--mud-palette-text-secondary);
}

.nlas-md hr {
    border: 0;
    border-top: 1px solid var(--mud-palette-lines-default);
    margin: 10px 0;
}

.nlas-md a {
    color: var(--mud-palette-primary);
    text-decoration: underline;
}

.nlas-md img { max-width: 100%; height: auto; }

/* A documentation screenshot the answer copied from an excerpt; the link around it opens the file. */
.nlas-md img.ai-docs-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 8px 0;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 6px;
}

.nlas-not-covered {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}

.nlas-thinking {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    color: var(--mud-palette-text-secondary);
}

.nlas-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mud-palette-text-secondary);
    animation: nlas-bounce 1.4s infinite ease-in-out;
}

.nlas-dot:nth-child(2) { animation-delay: .2s; }
.nlas-dot:nth-child(3) { animation-delay: .4s; }
.nlas-thinking-text { margin-left: 6px; font-size: .85rem; }

@keyframes nlas-bounce {
    0%, 80%, 100% { transform: scale(.6); opacity: .5; }
    40% { transform: scale(1); opacity: 1; }
}

.nlas-empty {
    padding: 16px;
    border: 1px dashed var(--mud-palette-lines-default);
    border-radius: 12px;
    background: transparent;
}

.nlas-starters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* A starter question wraps onto several lines instead of being clipped. */
.nlas-starters .mud-chip {
    height: auto;
    min-height: 36px;
    white-space: normal;
    padding-top: 6px;
    padding-bottom: 6px;
}

/* The composer stays visible at the bottom of the viewport while the conversation scrolls. */
.nlas-composer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 12px;
    border-radius: 12px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
}

.nlas-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.nlas-actions .mud-button-root { min-height: 36px; }

@media (max-width: 600px) {
    .nlas-bubble { max-width: 100%; }
    .nlas-status { width: 100%; }
    .nlas-composer { padding: 8px; }
}
