/* Global console styles: MudBlazor overrides (component roots cannot be reached from scoped CSS), shared utilities and
   the server-rendered sign-in page. Logical properties (inline-start/end) keep Arabic right to left correct. */

/* Semantic colours, derived from the MudBlazor palette so they follow light and dark mode. */
:root {
    --console-ok: var(--mud-palette-success);
    --console-danger: var(--mud-palette-error);
    --console-warn-text: var(--mud-palette-warning);
    --console-accent: var(--mud-palette-tertiary);
    --console-accent-text: color-mix(in srgb, var(--mud-palette-tertiary) 62%, var(--mud-palette-text-primary));
}

/* Skip link: the first thing keyboard users reach; shown only when focused. */
.skip-link {
    position: absolute;
    inset-inline-start: 12px;
    top: -60px;
    z-index: 2000;
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    top: 10px;
}

main.console-content:focus {
    outline: none;
}

/* Text for screen readers only. */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Code in documents and the Postman viewer: dark block, coloured tokens (Documents/CodeHighlighter.cs), a copy button
   wired by js/console.js, keyboard scrolling (tabindex on the pre). */
.code-block {
    position: relative;
}

.code-block pre {
    margin: 0;
    padding: 12px 14px;
    border-radius: 8px;
    overflow: auto;
    background: #1f2933;
    color: #e3edf3;
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: .82rem;
    line-height: 1.5;
}

.code-block pre code {
    padding: 0;
    background: none;
    color: inherit;
    font-size: inherit;
}

.code-block pre:focus-visible,
.code-body:focus-visible,
[tabindex="0"]:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

.code-copy {
    position: absolute;
    top: 6px;
    inset-inline-end: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-family: inherit;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    opacity: .85;
}

.code-copy:hover,
.code-copy:focus-visible {
    opacity: 1;
    background: rgba(255, 255, 255, .2);
}

/* "Copied" beside a copy button (js/console.js); read out by screen readers. Inverted colours in both themes. */
.copy-status {
    position: fixed;
    z-index: 2000;
    transform: translateX(-50%);
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--mud-palette-text-primary);
    color: var(--mud-palette-surface);
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
}

.copy-status.is-visible {
    opacity: 1;
}

.tok-c { color: #8b9bb0; font-style: italic; }
.tok-s { color: #a8e07f; }
.tok-k { color: #ffcb6b; }
.tok-v { color: #89ddff; }
.tok-f { color: #c3a6ff; }
.tok-n { color: #f78c6c; }
.tok-p { color: #82aaff; }

/* Printing a document: the text only, code on white. */
@media print {
    .console-appbar,
    .console-drawer,
    .skip-link,
    .crumbs,
    .family,
    .page-actions,
    .code-copy,
    .copy-status,
    .doc-contents,
    #blazor-error-ui,
    .mud-snackbar-provider {
        display: none !important;
    }

    .mud-main-content {
        padding-top: 0 !important;
        margin: 0 !important;
    }

    .card {
        border: 0;
    }

    .code-block pre,
    .code-body {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #999;
        white-space: pre-wrap;
    }

    [class^="tok-"] {
        color: #000 !important;
    }
}

h1:focus {
    outline: none;
}

/* Shell */
.console-appbar {
    border-bottom: 1px solid var(--mud-palette-lines-default);
    padding-inline: 8px;
}

.console-appbar .lang-button .mud-button-root { /* the menu's own button */
    min-width: 0;
    font-weight: 700;
}

.console-appbar .user-avatar {
    font-size: .75rem;
    font-weight: 700;
}

.console-drawer {
    border-inline-end: 1px solid var(--mud-palette-lines-default);
}

.console-nav {
    padding: 10px 8px;
}

.console-nav .mud-nav-link {
    border-radius: 8px;
    margin-block: 1px;
    padding-block: 8px;
}

.console-nav .mud-nav-link.active {
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
    color: var(--mud-palette-primary);
    font-weight: 600;
}

/* Cards: thin borders instead of shadows */
.card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    background: var(--mud-palette-surface);
}

.card-pad {
    padding: 18px 20px;
}

@media (max-width: 599.98px) {
    .card-pad {
        padding: 14px;
    }
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.card-title .mud-typography-h6 {
    margin: 0;
}

/* Data */
.mono,
.num {
    font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
    font-variant-numeric: tabular-nums;
}

.num {
    direction: ltr;
    unicode-bidi: isolate;
}

.muted {
    color: var(--mud-palette-text-secondary);
}

.nowrap {
    white-space: nowrap;
}

.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: start;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .03em;
    color: var(--mud-palette-text-secondary);
    padding: 10px 12px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--mud-palette-table-lines);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--mud-palette-action-default-hover);
}

.data-table a {
    color: var(--mud-palette-primary);
    text-decoration: none;
}

.data-table a:hover {
    text-decoration: underline;
}

.mud-table-root .mud-table-cell {
    text-align: start;
}

/* Numbers are laid out left to right; in a right-to-left page their cells still align to the start (right). */
html[dir="rtl"] :is(td, th, dd, div).num,
html[dir="rtl"] .metric .value {
    text-align: right;
}

@media (max-width: 599.98px) {
    .hide-xs {
        display: none;
    }
}

/* Validation messages of static forms */
.validation-message {
    color: #b3261e;
    font-size: .85rem;
}


/* Server-rendered sign-in and sign-out pages */
.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Sans", Roboto, Arial, sans-serif;
    background: #f3f5f9;
    color: #1b2733;
}

.login-brand {
    background: linear-gradient(145deg, #163a69 0%, #1f4e8c 55%, #2f6fbf 100%);
    color: #fff;
    padding: 56px 64px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.15rem;
}

.login-logo-mark {
    display: inline-flex;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .16);
    align-items: center;
    justify-content: center;
}

.login-logo-mark svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

.login-brand h2 {
    font-size: 2rem;
    line-height: 1.25;
    margin: 0 0 18px;
    max-width: 22ch;
}

.login-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
    font-size: 1rem;
    opacity: .95;
}

.login-features li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.login-features li::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    margin-top: .5em;
    border-radius: 50%;
    background: #ffb74d;
}

.login-foot {
    font-size: .8rem;
    opacity: .7;
}

.login-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    position: relative;
}

.login-lang {
    position: absolute;
    top: 18px;
    inset-inline-end: 20px;
    display: flex;
    gap: 6px;
}

.login-lang a {
    font-size: .85rem;
    text-decoration: none;
    color: #33414f;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid #d7dde6;
    background: #fff;
}

.login-lang a[aria-current="true"] {
    background: #1f4e8c;
    border-color: #1f4e8c;
    color: #fff;
}

.login-card {
    background: #fff;
    padding: 32px 32px 28px;
    border-radius: 14px;
    border: 1px solid #e3e8ef;
    box-shadow: 0 10px 30px rgba(22, 58, 105, .08);
    width: min(400px, 100%);
}

.login-card h1 {
    font-size: 1.5rem;
    margin: 0 0 4px;
}

.login-hint {
    color: #5b6b7c;
    margin: 0 0 18px;
}

.login-card label {
    display: block;
    margin-top: 14px;
    font-size: .875rem;
    font-weight: 600;
}

.login-card input {
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    border: 1px solid #c9d1dc;
    border-radius: 8px;
    box-sizing: border-box;
    font: inherit;
}

.login-card input:focus {
    outline: 2px solid #8ab4f8;
    border-color: #1f4e8c;
}

.login-card button {
    margin-top: 22px;
    width: 100%;
    padding: 11px;
    border: 0;
    border-radius: 8px;
    background: #1f4e8c;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.login-card button:hover {
    background: #163a69;
}

.login-error {
    color: #b3261e;
    background: #fdecea;
    padding: 10px 12px;
    border-radius: 8px;
    margin: 0 0 6px;
}

@media (max-width: 899.98px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-brand {
        padding: 22px 20px;
    }

    .login-brand h2,
    .login-features,
    .login-foot {
        display: none;
    }

    .login-main {
        justify-content: flex-start;
        padding-top: 64px;
    }
}

@media (prefers-color-scheme: dark) {
    .login-shell {
        background: #0f141b;
        color: #e6ebf1;
    }

    .login-card {
        background: #171e28;
        border-color: #2a3441;
        box-shadow: none;
    }

    .login-hint {
        color: #9aa7b4;
    }

    .login-card input {
        background: #0f141b;
        color: #e6ebf1;
        border-color: #2a3441;
    }

    .login-lang a {
        background: #171e28;
        color: #c9d2dc;
        border-color: #2a3441;
    }
}
