@import '_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css';

/* Base taken from CommerceSuite (PulseVenture.CommerceSuite/wwwroot/app.css), helpers from the
   CommerceSuite Orchestrator, followed by what only Core Services needs. */

:root {
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
    }
}

:root:has(body[data-theme="light"]),
body[data-theme="light"] {
    color-scheme: light;
}

:root:has(body[data-theme="dark"]),
body[data-theme="dark"] {
    color-scheme: dark;
}

body {
    --body-font: "Segoe UI Variable", "Segoe UI", sans-serif;
    margin: 0;
    padding: 0;
    font-family: var(--body-font);
    font-size:   var(--type-ramp-base-font-size);
    line-height: var(--type-ramp-base-line-height);
    font-weight: var(--font-weight);
    color:       var(--neutral-foreground-rest);
    background:  var(--neutral-fill-layer-rest);
}

.layout {
    height: 100dvh;
}

.navmenu-icon {
    display: none;
}

/* 81px are the header and the footer of the main layout. */
.main {
    min-height: calc(100dvh - 81px);
    color: var(--neutral-foreground-rest);
    align-items: stretch !important;
}

.body-content {
    align-self: stretch;
    height: calc(100dvh - 81px) !important;
    display: flex;
    scrollbar-width: none !important;
}

.content {
    padding: 0 1.5rem 0.5rem 1.5rem;
    align-self: stretch !important;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* The list card of a page fills what the header leaves and grows with a long list. With FluentCard's own
   height: 100% it was as high as the whole content area, and the rows below that ran out of the card.
   Cards that set a height themselves keep it. FluentDataGrid 4.x renders a table.fluent-data-grid. */
.content > fluent-card:has(table.fluent-data-grid):not([style*="height"]) {
    flex: 1 0 auto;
    height: auto;
}

.manage {
    width: 100dvw;
}

footer {
    background: var(--neutral-layer-4);
    color: var(--neutral-foreground-rest);
    align-items: center;
    padding: 5px 10px;
}

    footer a {
        color: var(--neutral-foreground-rest);
        text-decoration: none;
    }

        footer a:focus {
            outline: 1px dashed;
            outline-offset: 3px;
        }

        footer a:hover {
            text-decoration: underline;
        }

.alert {
    border: 1px dashed var(--accent-fill-rest);
    padding: 5px;
    margin: 10px 0;
}

.alert-danger {
    border: 1px dashed var(--error);
}

.alert-success {
    border: 1px dashed var(--success);
}

.alert-warning {
    border: 1px dashed var(--warning);
}

/* FluentUI gives the message bar a light intent background (#FDF6F3 and friends)
   and only swaps to the dark palette when the component also carries a `dark`
   class. That class is not applied here, so in the dark theme the inherited
   near-white --neutral-foreground-rest lands on a near-white background and the
   text is unreadable.

   Pin a dark foreground for as long as the light background is the one actually
   rendered. Scoped with :not(.dark) so this stops applying the moment FluentUI
   does switch the bar to its dark palette. Two classes plus :not() outweighs the
   single-class base rule, so no !important is needed. */
.fluent-messagebar:not(.dark).intent-info,
.fluent-messagebar:not(.dark).intent-warning,
.fluent-messagebar:not(.dark).intent-error,
.fluent-messagebar:not(.dark).intent-success {
    color: #242424;
}

/* Links and inline code inside those bars sit on the same light background. */
.fluent-messagebar:not(.dark).intent-info fluent-anchor,
.fluent-messagebar:not(.dark).intent-warning fluent-anchor,
.fluent-messagebar:not(.dark).intent-error fluent-anchor,
.fluent-messagebar:not(.dark).intent-success fluent-anchor {
    --accent-fill-rest: #0f548c;
    --neutral-foreground-rest: #242424;
}

.fluent-messagebar:not(.dark).intent-info code,
.fluent-messagebar:not(.dark).intent-warning code,
.fluent-messagebar:not(.dark).intent-error code,
.fluent-messagebar:not(.dark).intent-success code {
    color: #a4262c;
}

/* Waiting state for a page that has nothing to show yet. */
.page-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 40vh;
    width: 100%;
}

.page-loader-message {
    color: var(--neutral-foreground-hint);
    font-size: 13px;
}

/* A button carrying an icon and a label sizes its host from the label alone - the slotted icon is
   not counted - while the control inside the shadow root still reserves room for both. Inside a
   FluentStack, which is a flex row, the host is then shrunk to the label width and the control
   overflows it, overlapping the next button by about the width of the icon.

   A toolbar button should never shrink below its own content anyway. */
fluent-button {
    flex-shrink: 0;
}

/* Row actions need room to breathe and should sit against the right edge. */
.grid-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    width: 100%;
}

/* The key and description under a field in an edit dialog. Pulled up against the input, since the
   dialog's own stack gap would otherwise read as belonging to the next field rather than this one. */
.field-hint {
    font-size: 11px;
    color: var(--neutral-foreground-hint);
    line-height: 15px;
    margin-top: 4px;
}

/* Secondary line under a primary value in a grid cell. */
.cell-subtitle {
    font-size: 11px;
    color: var(--neutral-foreground-hint);
    line-height: 14px;
}

#blazor-error-ui {
    background: var(--neutral-layer-floating);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    margin: 20px 0;
}

#blazor-error-ui::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: -1;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5M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MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::before {
        content: "Es ist ein Fehler aufgetreten. "
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Wird geladen…");
    }

code {
    color: #c02d76;
}

@media (max-width: 600px) {
    .header-gutters {
        margin: 0.5rem 3rem 0.5rem 1.5rem !important;
    }

    [dir="rtl"] .header-gutters {
        margin: 0.5rem 1.5rem 0.5rem 3rem !important;
    }

    .main {
        flex-direction: column !important;
        row-gap: 0 !important;
    }

    nav.sitenav {
        width: 100%;
        height: 100%;
    }

    #main-menu {
        width: 100% !important;
    }

        #main-menu > div:first-child:is(.expander) {
            display: none;
        }

    .navmenu {
        width: 100%;
    }

    #navmenu-toggle {
        appearance: none;
    }

        #navmenu-toggle ~ nav {
            display: none;
        }

        #navmenu-toggle:checked ~ nav {
            display: block;
        }

    .navmenu-icon {
        cursor: pointer;
        z-index: 10;
        display: block;
        position: absolute;
        top: 15px;
        left: unset;
        right: 20px;
        width: 20px;
        height: 20px;
        border: none;
    }

    [dir="rtl"] .navmenu-icon {
        left: 20px;
        right: unset;
    }
}

/* Table */

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

    table td,
    table th {
        padding: var(--spacingVerticalS) var(--spacingHorizontalM);
        text-align: left;
        vertical-align: middle;
        border-bottom: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
    }

/* Core Services */

/* Sticky bar at the top of a page (PageHeader): breadcrumb left, actions right. */
.page-header {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    position: sticky;
    top: 0;
    z-index: 1;
    padding-top: 0.5rem;
    margin-bottom: 10px;
    background-color: var(--neutral-fill-layer-rest);
}

/* Key figure on the home page; the whole card is the link. */
.metric-card {
    text-decoration: none;
    color: inherit;
}

/* Billing statement (StatementView), after the sample statement of the billing plan. */
.statement {
    max-width: 820px;
    font-variant-numeric: tabular-nums;
}

.statement-head {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--neutral-stroke-rest);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.statement-title {
    font-weight: 600;
    letter-spacing: 0.05em;
}

.statement-group {
    font-weight: 600;
    margin-top: 12px;
}

.statement-license {
    padding-left: 12px;
    color: var(--neutral-foreground-hint);
}

.statement-table td.num,
.statement-table th.num {
    text-align: right;
    white-space: nowrap;
}

.statement-block td,
.statement-usage-title td {
    font-weight: 600;
}

.statement-sub td {
    color: var(--neutral-foreground-hint);
    border-bottom: none !important;
}

.statement-subtotal td {
    font-weight: 600;
}

.statement-total {
    display: flex;
    justify-content: flex-end;
    gap: 48px;
    font-weight: 700;
    border-top: 3px double var(--neutral-stroke-rest);
    border-bottom: 3px double var(--neutral-stroke-rest);
    padding: 6px 0;
    margin-top: 12px;
}

/* Virtualized logs: inline-block content (buttons, checkbox) sits on the baseline and stretches the cell
   beyond its height; centred, every row stays at the grid's ItemSize. */
.logs-grid td > * {
    vertical-align: middle;
}

/* Log level colors, used by the level badges on the logs page. */
fluent-badge {
    /* Verbose */
    --badge-fill-Verbose: #A0A0A0;
    --badge-color-Verbose: #000000;

    /* Debug */
    --badge-fill-Debug: #6CA0DC;
    --badge-color-Debug: #000000;

    /* Information */
    --badge-fill-Information: #2E8B57;
    --badge-color-Information: #ffffff;

    /* Warning */
    --badge-fill-Warning: #FFB733;
    --badge-color-Warning: #000000;

    /* Error */
    --badge-fill-Error: #E74C3C;
    --badge-color-Error: #ffffff;

    /* Fatal */
    --badge-fill-Fatal: #8B0000;
    --badge-color-Fatal: #ffffff;

    /* Default fallback */
    --badge-fill-Default: #000000;
    --badge-color-Default: #ffffff;
}

/* Permission matrix in the API key dialog. The row divider sits on the rows, so the cell border
   from the generic table rule above is switched off here. */
.scope-table {
    width: 100%;
    border-collapse: collapse;
}

.scope-table th {
    font-weight: 500;
    text-align: center;
    padding: 4px 8px;
    border-bottom: none;
}

.scope-table th:first-child,
.scope-table td:first-child {
    text-align: left;
}

.scope-table td {
    text-align: center;
    padding: 4px 8px;
    border-bottom: none;
}

.scope-table tbody tr:not(:last-child) {
    border-bottom: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
}

/* Recovery codes: two columns, monospace, easy to copy. */
.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    gap: 6px 24px;
    font-size: 1.1em;
}

/* Form rows in dialogs: fields side by side while each can be at least 160px wide, otherwise on the
   next row - deliberate rows instead of a flex row that wraps wherever it overflows. */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px 12px;
    align-items: end;
    width: 100%;
}

.form-grid > * {
    width: 100%;
    min-width: 0;
}

/* A cell holds one field: FluentUI renders the label as a sibling element before the field, so label
   and field need a container of their own - in a row or grid they would otherwise sit side by side. */
.form-grid > div,
.field-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.form-grid > div > fluent-text-field,
.form-grid > div > fluent-number-field,
.form-grid > div > fluent-select,
.form-grid > div > fluent-combobox,
.field-cell > fluent-text-field,
.field-cell > fluent-number-field,
.field-cell > fluent-select {
    width: 100%;
}

.form-grid > .span-2 {
    grid-column: span 2;
}

.form-grid > .span-all {
    grid-column: 1 / -1;
}

/* One item of a subscription or plan: a head row (kind, position, description, remove) and the fields. */
.billing-item {
    height: auto;
    padding: 8px 12px;
}

.billing-item-head {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 8px;
}

.billing-item-head > .grow {
    flex: 1;
}

/* Dialog content scrolls inside the dialog instead of running past it onto the backdrop (many items,
   small screens). Dialog and wizard are grids whose content row would otherwise grow with its content
   (min-height: auto). In a wizard only the step content scrolls; steps and buttons stay in place. */
fluent-dialog .fluent-dialog-body {
    min-height: 0;
    overflow-y: auto;
}

fluent-dialog .fluent-dialog-body:has(.fluent-wizard) {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.fluent-wizard {
    min-height: 0;
    flex: 1;
}

.fluent-wizard .fluent-wizard-content {
    min-height: 0;
    overflow-y: auto;
}
