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

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

.navmenu-icon {
    display: none;
}

.main {
    min-height: calc(100dvh - 90px);
    color: var(--neutral-foreground-rest);
    align-items: stretch !important;
}

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

.content {
    padding: 0.5rem 1.5rem;
    align-self: stretch !important;
    width: 100%;
}

footer {
    background: var(--neutral-layer-4);
    color: var(--neutral-foreground-rest);
    align-items: center;
    padding: 10px 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;
        }

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.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, "Loading");
    }

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);
    }

/* Showcase page styles */
.showcase-section {
    margin-bottom: 2rem;
    padding: 1rem;
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: var(--layer-corner-radius);
}

.showcase-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--accent-fill-rest);
}

.component-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

/* Fix FluentMessageBar in dark mode - apply dark backgrounds when system prefers dark mode */
/* This is needed because GlobalState.Luminance isn't available during static SSR rendering */
/* Using !important to override Fluent UI's scoped CSS which has higher specificity */
/* Using color-mix() with Fluent's intent variables instead of hardcoded colors */
@media (prefers-color-scheme: dark) {
    .fluent-messagebar.intent-info {
        background-color: color-mix(in srgb, var(--info) 15%, var(--neutral-layer-1)) !important;
        border-color: var(--info) !important;
    }

    .fluent-messagebar.intent-warning {
        background-color: color-mix(in srgb, var(--warning) 15%, var(--neutral-layer-1)) !important;
        border-color: var(--warning) !important;
    }

    .fluent-messagebar.intent-error {
        background-color: color-mix(in srgb, var(--error) 15%, var(--neutral-layer-1)) !important;
        border-color: var(--error) !important;
    }

    .fluent-messagebar.intent-success {
        background-color: color-mix(in srgb, var(--success) 15%, var(--neutral-layer-1)) !important;
        border-color: var(--success) !important;
    }
}

/* Split button — style shadow DOM via ::part(control) on host element */
fluent-button.split-create::part(control) {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

fluent-button.split-menu::part(control) {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    padding: 0 4px !important;
    min-width: 0 !important;
    border-left: 1px solid rgba(255, 255, 255, 0.15) !important;
}

fluent-button.split-menu::part(start),
fluent-button.split-menu::part(content) {
    display: none !important;
}

fluent-button.split-menu::part(end) {
    margin-inline-start: 0 !important;
}

/* ─── Full-height modal — grow with content, scroll with the page ─────────
   Opt-in pattern for long-form dialogs (TaskDialog, future entity editors,
   etc.) that shouldn't be locked to the viewport height. Any FluentDialog
   that contains an element with class "full-height-modal" anywhere in its
   subtree gets:
     • position: absolute, height: auto — dialog flows in document, sized
       by its content instead of capped to a fraction of the viewport
     • 5vh margin top/bottom on ::part(positioning-region) — visible page
       background gap above and below the dialog frame when scrolled

   Usage: add class="full-height-modal" to any element inside your
   IDialogContentComponent (typically the outermost wrapper div). No other
   wiring needed.

   Uses `:has()` which is supported in all modern browsers.
   ────────────────────────────────────────────────────────────────────────── */
fluent-dialog:has(.full-height-modal) {
    position: absolute !important;
    height: auto !important;
    max-height: none !important;
}

/* Margin (not padding — padding is invisible because the children fill the part).
   positioning-region is the outermost shadow part wrapping .overlay + .control,
   so margin on it pushes the entire dialog away from its edges and extends the document. */
fluent-dialog:has(.full-height-modal)::part(positioning-region) {
    margin-top: 5vh !important;
    margin-bottom: 5vh !important;
}

fluent-dialog:has(.task-dialog-form)::part(overlay) {
    position: fixed !important;
    inset: 0 !important;
}

/* ─── Nested dialog stacking ─────────────────────────────────────────────
   When NestedDialogService opens a child dialog over a parent, the parent
   gets the .nested-dialog-parent class (applied by wwwroot/js/nested-dialogs.js
   alongside `inert` and `trap-focus="false"`). These rules dim the parent's
   content and suppress its backdrop so only the top-most child's backdrop
   paints the viewport tint.

   Dim is applied via `filter: brightness()` on the shadow `control` part
   (the dialog frame). Backdrop is suppressed via `::part(overlay)`.
   Interactivity is already blocked by the `inert` attribute — the
   `pointer-events: none` rule is a belt-and-braces safeguard in case
   inert does not fully propagate into the web component's shadow DOM.
   ──────────────────────────────────────────────────────────────────────── */
:root {
    --nested-dim: 0.7;
}

fluent-dialog.nested-dialog-parent::part(control) {
    filter: brightness(var(--nested-dim)) !important;
    pointer-events: none !important;
    transition: filter 120ms ease;
}

fluent-dialog.nested-dialog-parent::part(overlay) {
    opacity: 0 !important;
    pointer-events: none !important;
}
