/*
 * This file is meant for global styling only: font faces, custom properties, and the overrides that
 * reach into markup we do not render ourselves, such as MudBlazor internals or third-party output.
 * Styling that belongs to a single component belongs next to that component in a `.razor.css` file,
 * the way `Assistants/VisualBriefing/VisualBriefingAssistant.razor.css` does it.
 *
 * A number of component-specific blocks below do not follow that rule yet, the log viewer and the code
 * editor being the largest. Moving them is not a matter of cutting and pasting: Blazor only adds the
 * scope attribute to elements a component writes in its own markup, and it appends that attribute to
 * the last part of a selector. Rules that target a MudBlazor component, markup injected through a
 * `MarkupString`, rendered Markdown, or nodes created by JavaScript therefore stop matching once they
 * are scoped. They have to be rewritten with `::deep`, which in turn needs an ancestor element the
 * component itself renders. The log viewer has no such element at all today.
 *
 * So please do not add component-specific rules here just because a neighbouring one is already here.
 * Nothing about a broken selector fails the build; it only looks wrong at runtime.
 */

/* roboto-300 - latin */
@font-face {
    font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 300;
    src: url('fonts/roboto-v30-latin-300.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* roboto-regular - latin */
@font-face {
    font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400;
    src: url('fonts/roboto-v30-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* roboto-500 - latin */
@font-face {
    font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 500;
    src: url('fonts/roboto-v30-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* roboto-700 - latin */
@font-face {
    font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 700;
    src: url('fonts/roboto-v30-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* JetBrainsMono-Regular - latin */
@font-face {
    font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400;
    src: url('fonts/JetBrainsMono-Regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}


.mud-text-list .mud-list-item-icon {
    margin-top: 4px;
}

.plugin-icon-container {
    width: var(--mud-icon-size-large);
    height: var(--mud-icon-size-large);
}

.plugin-icon-container svg {
    width: 100%;
    height: 100%;
}

.mud-popover-open.InnerScrollingFix {
    left: 0 !important;
}

:root {
    --confidence-color: #000000;
}

.confidence-icon {
    color: var(--confidence-color);
}

.confidence-border > .mud-input-control-input-container > .mud-input > .mud-input-outlined-border {
    border-width: 2px;
    border-color: var(--confidence-color) !important;
}

:root {
    --custom-icon-color: #000000;
}

.custom-icon-color > a > svg {
    color: var(--custom-icon-color) !important;
}

.improvedDiff .wikEdDiffFragment {
    background-color: initial !important;
}

.improvedDiff .wikEdDiffNoChange {
    background-color: initial !important;
}

.improvedDiff .wikEdDiffDelete {
    text-decoration-line: line-through;
    text-decoration-style: double;
    text-decoration-color: red;
    text-decoration-thickness: 2px;
}

/* Fix for MudBlazor, tooltips inside of navmenu */
.mud-navmenu .mud-tooltip-root {
    display: initial !important;
}

/* MudStepperWithoutActions overrides the stepper actions with empty content. MudBlazor still renders
   the action bar around them, which would leave an empty padded row below the last step. */
.mud-stepper-without-actions .mud-stepper-actions {
    display: none;
}

/* Context div for inner scrolling component */
.inner-scrolling-context {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Fixed MudSplitter inside context div for inner scrolling component */
.inner-scrolling-context > .mud-splitter {
    flex-grow: 1;
    overflow: hidden;
}

/* Fixed the slider part of MudSplitter inside context div for inner scrolling component */
.inner-scrolling-context > .mud-splitter > .mud-slider > .mud-slider-container {
    padding-bottom: 12px;
}

/* Fixed the margin for the Markdown code blocks */
.mud-card-content .mud-markdown-body .hljs.mud-markdown-code-highlight {
    margin-bottom:2em;
}

.justified-markdown .mud-markdown-body p,
.justified-markdown .mud-markdown-body li,
.justified-markdown .mud-markdown-body blockquote p {
    text-align: justify;
    hyphens: auto;
}

.justified-markdown .mud-markdown-body pre,
.justified-markdown .mud-markdown-body code,
.justified-markdown .mud-markdown-body h1,
.justified-markdown .mud-markdown-body h2,
.justified-markdown .mud-markdown-body h3,
.justified-markdown .mud-markdown-body h4,
.justified-markdown .mud-markdown-body h5,
.justified-markdown .mud-markdown-body h6,
.justified-markdown .mud-markdown-body table {
    text-align: left;
}

.configuration-help-justified .mud-input-helper-text,
.configuration-help-justified .mud-form-helpertext {
    text-align: justify;
    hyphens: auto;
    word-break: auto-phrase;
}

.code-block {
    background-color: #2d2d2d;
    color: #f8f8f2;
    border-radius: 6px !important;
    overflow: auto !important;
    font-family: Consolas, "Courier New", monospace  !important;
    text-align: left !important;
}

.code-block pre {
    margin: 0 !important;
}

.code-block code {
    font-family: inherit !important;
}

.inline-code-block {
    background-color: #2d2d2d;
    color: #f8f8f2;
    border-radius: 6px;
    font-family: Consolas, "Courier New", monospace;
    text-align: left;
    padding: 4px 6px;
    margin: 0 2px;
}

.no-elevation {
    box-shadow: none !important;
}

.sources-card-header {
    top: 0em !important;
    left: 2.2em !important;
}

.chat-mathjax-block {
    text-align: left;
}

.chat-mathjax-block mjx-container[display="true"] {
    text-align: left !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.chat-mathjax-block mjx-container[display="true"] mjx-math {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.log-viewer-shell {
    min-width: 0;
}

.log-viewer-select {
    min-width: 12rem;
}

.log-viewer-number {
    max-width: 9rem;
}

.log-viewer-filter {
    min-width: 18rem;
    max-width: 32rem;
}

.log-viewer-multiselect {
    min-width: 16rem;
    max-width: 34rem;
}

.log-viewer-path {
    color: var(--mud-palette-text-secondary);
    word-break: break-all;
}

.log-viewer-pane {
    min-height: 28rem;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 6px;
    background-color: var(--mud-palette-background-grey);
}

.log-viewer-lines {
    margin: 0;
    padding: 0.5rem 0;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.875rem;
    line-height: 1.45;
}

.log-viewer-line {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    min-height: 1.25rem;
}

.log-viewer-line:hover {
    background-color: var(--mud-palette-action-default-hover);
}

.log-viewer-line-number {
    padding-right: 0.75rem;
    color: var(--mud-palette-text-secondary);
    text-align: right;
    user-select: none;
    border-right: 1px solid var(--mud-palette-lines-default);
}

.log-viewer-line-text {
    padding-left: 0.75rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.log-viewer-line-error {
    color: var(--mud-palette-error);
}

.log-viewer-line-warn {
    color: var(--mud-palette-warning-darken);
}

.log-viewer-line-info {
    color: var(--mud-palette-info);
}

.log-viewer-line-debug,
.log-viewer-line-trace {
    color: var(--mud-palette-text-secondary);
}

.log-viewer-highlight {
    padding: 0 2px;
    border-radius: 2px;
    background-color: var(--mud-palette-warning);
    color: var(--mud-palette-warning-text);
}

.log-viewer-empty {
    display: flex;
    min-height: 20rem;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--mud-palette-text-secondary);
}

.code-editor {
    display: grid;
    grid-template-columns: minmax(2.8rem, auto) minmax(0, 1fr);
    min-height: 32rem;
    height: auto;
    width: 100%;
    overflow: hidden;
    border: 3px solid var(--mw-code-editor-border, rgba(0,0,0,0.11764705882352941));
    border-radius: 4px;
    background: var(--mw-code-editor-background, rgba(255,255,255,1));
    color: var(--mw-code-editor-foreground, rgba(66,66,66,1));
    font-family: "JetBrains Mono", monospace;
    font-size: 0.65rem;
    line-height: 1.45;
    tab-size: 4;
}

.code-editor-line-numbers {
    overflow: hidden;
    padding: 0.8rem 0.65rem 0.8rem 0.5rem;
    border-right: 1px solid var(--mw-code-editor-border, rgba(0,0,0,0.11764705882352941));
    color: var(--mw-code-editor-foreground, rgba(66,66,66,1));
    opacity: 0.55;
    text-align: right;
    white-space: pre;
    user-select: none;
    font: inherit;
    font-variant-numeric: tabular-nums;
}

.code-editor-input {
    min-width: 0;
    height: 100%;
    overflow: auto;
    padding: 0.8rem;
    color: var(--mw-code-editor-foreground, rgba(66,66,66,1));
    caret-color: var(--mw-code-editor-foreground, rgba(66,66,66,1));
    font: inherit;
    line-height: inherit;
    tab-size: inherit;
    outline: none;
}

.code-editor .lua-comment {
    color: var(--mw-code-editor-comment, #6a9955);
    font-style: italic;
}

.code-editor .lua-string {
    color: var(--mw-code-editor-string, #a31515);
}

.code-editor .lua-number {
    color: var(--mw-code-editor-number, #098658);
}

.code-editor .lua-keyword {
    color: var(--mw-code-editor-keyword, #0000ff);
    font-weight: 600;
}

.code-editor .lua-literal {
    color: var(--mw-code-editor-literal, #0000ff);
}

.code-editor .lua-built-in {
    color: var(--mw-code-editor-built-in, #795e26);
}

.code-editor .lua-constant {
    color: var(--mw-code-editor-constant, #0070c1);
    font-weight: 500;
}

.code-editor .lua-function {
    color: var(--mw-code-editor-function, #795e26);
}

.code-editor .lua-property {
    color: var(--mw-code-editor-property, #001080);
}

.code-editor .lua-variable {
    color: var(--mw-code-editor-variable, #267f99);
}