/* Fluent app shell: neutral app bar and nav on the base layer, pages on a raised content layer. */
html,
body {
    margin: 0;
    height: 100%;
    background: var(--colorNeutralBackground2);
    color: var(--colorNeutralForeground1);
    font-family: var(--fontFamilyBase, "Noto Kufi Arabic", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif);
    font-size: var(--fontSizeBase300);
    line-height: var(--lineHeightBase300);
}

.sm-shell {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

.sm-appbar {
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px 0 8px;
}

.sm-appbar-logo {
    width: 24px;
    height: 24px;
    margin-inline-start: 8px;
    border-radius: var(--borderRadiusMedium);
    object-fit: contain;
}

.sm-appbar-title {
    margin-inline-start: 12px;
    font-weight: var(--fontWeightSemibold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm-appbar--nonprod {
    box-shadow: inset 0 -3px 0 var(--colorPaletteDarkOrangeBorderActive);
}

.sm-env-badge {
    margin-inline-start: 8px;
    padding: 2px 8px;
    border-radius: var(--borderRadiusCircular);
    background: var(--colorPaletteDarkOrangeBackground2);
    color: var(--colorPaletteDarkOrangeForeground2);
    font-size: var(--fontSizeBase200);
    font-weight: var(--fontWeightSemibold);
    white-space: nowrap;
}

.sm-appbar-spacer {
    flex: 1 1 auto;
}

.sm-appbar-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-inline-start: 4px;
    padding: 0;
    border: none;
    border-radius: var(--borderRadiusCircular);
    background: transparent;
    cursor: pointer;
    transition: background-color var(--durationFaster) linear;
}

.sm-appbar-avatar:hover {
    background-color: var(--colorSubtleBackgroundHover);
}

.sm-appbar-avatar:active {
    background-color: var(--colorSubtleBackgroundPressed);
}

.sm-appbar-avatar:focus-visible {
    outline: 2px solid var(--colorStrokeFocus2);
    outline-offset: 0;
}

/* Account card under the avatar (approved profile menu idea A). */
.sm-acct {
    padding: 0;
    overflow: hidden;
}

/* Phones: the card spans the screen 8px from each side, overriding the popover's inline anchor position. */
@media (max-width: 640px) {
    .sm-acct::part(dialog) {
        width: auto !important;
        inset: 52px 8px auto 8px !important;
    }
}

.sm-acct-head {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 16px;
    background: linear-gradient(180deg, var(--colorBrandBackground2), transparent);
}

.sm-acct-av {
    position: relative;
    padding: 0;
    border: none;
    border-radius: var(--borderRadiusCircular);
    background: transparent;
    cursor: pointer;
}

.sm-acct-av:focus-visible {
    outline: 2px solid var(--colorStrokeFocus2);
    outline-offset: 2px;
}

.sm-acct-cam {
    position: absolute;
    inset-inline-end: -2px;
    bottom: -2px;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: var(--borderRadiusCircular);
    background: var(--colorNeutralBackground1);
    border: 1px solid var(--colorNeutralStroke1);
    color: var(--colorNeutralForeground2);
}

.sm-acct-who {
    min-width: 0;
}

.sm-acct-who b {
    display: block;
    font-size: var(--fontSizeBase400);
    line-height: var(--lineHeightBase400);
    font-weight: var(--fontWeightSemibold);
}

.sm-acct-who b,
.sm-acct-who > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sm-acct-who > span {
    display: block;
    font-size: var(--fontSizeBase200);
    line-height: var(--lineHeightBase200);
    color: var(--colorNeutralForeground2);
}

.sm-acct-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

/* The language tile is sized for Fluent's drop-down, which has a 160px minimum. */
.sm-acct-quick {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 182px;
    gap: 8px;
    padding: 0 12px 12px;
}

.sm-acct-tile {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 6px;
    min-width: 0;
    padding: 10px;
    border-radius: var(--borderRadiusLarge);
    background: var(--colorNeutralBackground1);
    border: 1px solid var(--colorNeutralStroke2);
}

.sm-acct-label {
    font-size: var(--fontSizeBase200);
    line-height: var(--lineHeightBase200);
    font-weight: var(--fontWeightSemibold);
    color: var(--colorNeutralForeground2);
}

.sm-acct-seg {
    display: flex;
    padding: 2px;
    border-radius: var(--borderRadiusMedium);
    background: var(--colorSubtleBackgroundHover);
}

.sm-acct-seg > * {
    flex: 1;
    max-width: none;
}

.sm-acct-seg > [pressed] {
    background: var(--colorNeutralBackground1);
    box-shadow: var(--shadow2);
}

.sm-acct-list {
    display: grid;
    padding: 4px;
}

.sm-acct-item,
.sm-acct-signout {
    justify-content: flex-start;
    font-weight: var(--fontWeightRegular);
}

.sm-acct-item {
    width: 100%;
}

.sm-acct-meta {
    margin-inline-start: auto;
    padding-inline-start: 12px;
    font-size: var(--fontSizeBase200);
    color: var(--colorNeutralForeground3);
}

.sm-acct-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px 8px 12px;
    border-top: 1px solid var(--colorNeutralStroke2);
}

.sm-acct-note {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--fontSizeBase200);
    color: var(--colorNeutralForeground3);
}

.sm-acct-signout {
    color: var(--colorPaletteRedForeground1);
}

.sm-shell-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
}

.sm-shell-nav {
    width: 260px;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 4px 8px 8px;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

/* Windows 11 style: the thumb stays hidden until the pointer or keyboard focus is in the nav. */
.sm-shell-nav:hover,
.sm-shell-nav:focus-within {
    scrollbar-color: var(--colorNeutralStrokeAccessible) transparent;
}

/* Fluent's category rows are buttons (centred text) and its items top-align icons, which shrink beside long labels. */
.fluent-nav.sm-nav .fluent-navitem,
.fluent-nav.sm-nav .fluent-navcategoryitem {
    text-align: start;
    align-items: center;
}

.fluent-nav.sm-nav .icon,
.fluent-nav.sm-nav .expand-icon {
    flex-shrink: 0;
}

.fluent-nav.sm-nav .sm-nav-badge {
    margin-inline-start: auto;
    padding-inline: 6px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: var(--colorBrandBackground);
    color: var(--colorNeutralForegroundOnBrand);
    font: var(--fontWeightSemibold) var(--fontSizeBase200)/20px var(--fontFamilyBase);
    text-align: center;
    flex-shrink: 0;
}

.sm-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.sm-shell-content {
    flex: 1 1 auto;
    min-width: 0;
    overflow: auto;
    padding: 20px 24px;
    background: var(--colorNeutralBackground3);
    border-top: 1px solid var(--colorNeutralStroke2);
    border-inline-start: 1px solid var(--colorNeutralStroke2);
    border-start-start-radius: var(--borderRadiusXLarge);
}

.sm-shell-scrim {
    display: none;
}

#blazor-error-ui {
    background: var(--colorPaletteYellowBackground2);
    color: var(--colorNeutralForeground1);
    bottom: 0;
    box-shadow: var(--shadow8);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 12px 20px;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    inset-inline-end: 12px;
    top: 8px;
}

@media (max-width: 1007px) {
    .sm-shell-content {
        padding: 12px;
    }
}

@media (max-width: 640px) {
    .sm-appbar-title {
        display: none;
    }

    .sm-shell-nav-open .sm-shell-nav {
        position: fixed;
        inset-block: 48px 0;
        inset-inline-start: 0;
        z-index: 20;
        width: min(300px, 85vw);
        background: var(--colorNeutralBackground1);
        box-shadow: var(--shadow16);
    }

    .sm-shell-scrim {
        display: block;
        position: fixed;
        inset: 48px 0 0 0;
        z-index: 19;
        padding: 0;
        border: none;
        background: rgba(0, 0, 0, 0.4);
        cursor: default;
    }

    .sm-shell-content {
        border-radius: 0;
        border-inline-start: none;
    }
}

/* Dark mode in Windows 11's dark values; brand-coloured text moves to #99ebff because #005FB8 on dark is ~2.3:1. */
body[data-theme="dark"] {
    --colorBrandForeground1: #99ebff;
    --colorBrandForeground2: #99ebff;
    --colorBrandForeground2Hover: #b8f1ff;
    --colorBrandForeground2Pressed: #7fe3fb;
    --colorBrandForegroundLink: #99ebff;
    --colorBrandForegroundLinkHover: #b8f1ff;
    --colorBrandForegroundLinkPressed: #7fe3fb;
    --colorBrandForegroundLinkSelected: #99ebff;
    --colorCompoundBrandForeground1: #60cdff;
    --colorCompoundBrandForeground1Hover: #7dd6ff;
    --colorCompoundBrandForeground1Pressed: #4fc1f5;
    --colorNeutralForeground2BrandHover: #99ebff;
    --colorNeutralForeground2BrandPressed: #7fe3fb;
    --colorNeutralForeground2BrandSelected: #99ebff;
    --colorNeutralForeground3BrandHover: #99ebff;
    --colorNeutralForeground3BrandPressed: #7fe3fb;
    --colorNeutralForeground3BrandSelected: #99ebff;

    /* Surfaces: base #202020 (Mica fallback), content layer ≈ #282828, cards, dialogs and controls #2b2b2b. */
    --colorNeutralBackground1: #2b2b2b;
    --colorNeutralBackground1Hover: #323232;
    --colorNeutralBackground1Pressed: #272727;
    --colorNeutralBackground1Selected: #2e2e2e;
    --colorNeutralBackground2: #202020;
    --colorNeutralBackground2Hover: #272727;
    --colorNeutralBackground2Pressed: #1d1d1d;
    --colorNeutralBackground2Selected: #252525;
    --colorNeutralBackground3: #282828;
    --colorNeutralBackground3Hover: #2e2e2e;
    --colorNeutralBackground3Pressed: #262626;
    --colorNeutralBackground3Selected: #2c2c2c;

    /* Quiet strokes: control outline, divider and the strong bottom edge of inputs. */
    --colorNeutralStroke1: rgba(255, 255, 255, 0.093);
    --colorNeutralStroke1Hover: rgba(255, 255, 255, 0.12);
    --colorNeutralStroke1Pressed: rgba(255, 255, 255, 0.07);
    --colorNeutralStroke1Selected: rgba(255, 255, 255, 0.093);
    --colorNeutralStroke2: rgba(255, 255, 255, 0.084);
    --colorNeutralStroke3: rgba(255, 255, 255, 0.06);
    --colorNeutralStrokeAccessible: rgba(255, 255, 255, 0.545);
    --colorNeutralStrokeAccessibleHover: rgba(255, 255, 255, 0.62);
    --colorNeutralStrokeAccessiblePressed: rgba(255, 255, 255, 0.45);
    --colorNeutralStrokeAccessibleSelected: rgba(255, 255, 255, 0.545);
}

/* Light mode in Windows 11's light values: #f3f3f3 base, content one step lighter, faint borders, #003e92 links. */
body:not([data-theme="dark"]) {
    --colorBrandForegroundLink: #003e92;
    --colorBrandForegroundLinkHover: #002f6e;
    --colorBrandForegroundLinkPressed: #00285c;
    --colorBrandForegroundLinkSelected: #003e92;
    --colorBrandForeground1: #003e92;
    --colorBrandForeground2: #003e92;

    --colorNeutralBackground2: #f3f3f3;
    --colorNeutralBackground3: #f9f9f9;

    --colorNeutralStroke1: rgba(0, 0, 0, 0.058);
    --colorNeutralStroke1Hover: rgba(0, 0, 0, 0.1);
    --colorNeutralStroke1Pressed: rgba(0, 0, 0, 0.07);
    --colorNeutralStroke1Selected: rgba(0, 0, 0, 0.058);
    --colorNeutralStroke2: rgba(0, 0, 0, 0.058);
    --colorNeutralStroke3: rgba(0, 0, 0, 0.04);
    --colorNeutralStrokeAccessible: rgba(0, 0, 0, 0.446);
    --colorNeutralStrokeAccessibleHover: rgba(0, 0, 0, 0.55);
    --colorNeutralStrokeAccessiblePressed: rgba(0, 0, 0, 0.4);
    --colorNeutralStrokeAccessibleSelected: rgba(0, 0, 0, 0.446);
}

/* Start-up loader (BootLoader.razor); kept in step with softmax-boot.css in SoftMax.Core.Fluent, see docs/notes/boot-loader.md. */
.sf-boot {
  --sfb-accent: var(--accent, var(--colorBrandForeground1, #005fb8));
  --sfb-text: var(--text-1, var(--colorNeutralForeground1, #1b1b1b));
  --sfb-text-2: var(--text-2, var(--colorNeutralForeground3, #616161));
  --sfb-ok: var(--success, var(--colorPaletteGreenForeground1, #0f7b0f));
  --sfb-warn: var(--caution, var(--colorPaletteDarkOrangeForeground1, #9d5d00));
  --sfb-card: var(--card, var(--colorNeutralBackground1, #ffffff));
  --sfb-stroke: var(--stroke-surface, var(--colorNeutralStroke2, rgba(0, 0, 0, .12)));
  position: relative; min-height: 100%; display: grid; place-items: center; padding: 24px 16px 96px; overflow: hidden;
  color: var(--sfb-text-2); cursor: default; touch-action: manipulation;
  animation: sf-boot-in .25s ease .3s both;
}
html.sf-boot-seen .sf-boot { animation: none; }
.sf-boot-center { display: grid; justify-items: center; gap: 18px; transform: translateY(-12px); }
.sf-boot-hello { min-height: 26px; font-size: 18px; font-weight: 600; line-height: 26px; color: var(--sfb-text); text-align: center; }
.sf-boot-hello:not(:empty) { animation: sf-boot-rise .4s ease both; }
.sf-boot-mark { position: relative; width: 170px; height: 170px; }
.sf-boot-dots { position: absolute; inset: 0; pointer-events: none; }
.sf-boot-dot { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--sfb-accent); will-change: transform; }
.sf-boot-dot.b { background: color-mix(in srgb, var(--sfb-accent) 80%, white); }
.sf-boot-dot.c { background: color-mix(in srgb, var(--sfb-accent) 60%, white); }
.sf-boot-ring { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.sf-boot-ring::after { content: ""; position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--sfb-accent) 80%, white); animation: sf-boot-ring .6s ease-out forwards; }
.sf-boot-leaving { position: fixed; inset: auto; width: 0; height: 0; z-index: 2147483000; }
.sf-boot-leaving .sf-boot-dot { transition: transform .65s cubic-bezier(.5, 0, .2, 1), opacity .25s ease .45s; }

.sf-boot-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; min-width: min(260px, 100%); }
.sf-boot-steps li { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 10px; align-items: center; font-size: 13.5px; line-height: 20px; opacity: .45; transition: opacity .3s, color .3s; }
.sf-boot-steps li.active { opacity: 1; color: var(--sfb-text); }
.sf-boot-steps li.done { opacity: .85; }
.sf-boot-st { width: 16px; height: 16px; border-radius: 50%; border: 1.6px solid var(--sfb-stroke); display: grid; place-items: center; box-sizing: border-box; }
.sf-boot-steps li.active .sf-boot-st { border-top-color: var(--sfb-accent); animation: sf-boot-spin .8s linear infinite; }
.sf-boot-steps li.done .sf-boot-st { border-color: var(--sfb-ok); background: var(--sfb-ok); }
.sf-boot-steps li.done .sf-boot-st::after { content: ""; width: 7px; height: 4px; border: solid #fff; border-width: 0 0 1.6px 1.6px; transform: translateY(-1px) rotate(-45deg); }
.sf-boot-slow { grid-column: 2; font-size: 12px; color: var(--sfb-warn); max-height: 0; opacity: 0; overflow: hidden; }
.sf-boot-steps li.active .sf-boot-slow { animation: sf-boot-late .3s ease 4s forwards; }

.sf-boot-tips { position: absolute; inset-inline: 16px; bottom: 24px; display: grid; justify-items: center; pointer-events: none; }
.sf-boot-tips p { grid-area: 1 / 1; width: min(440px, 100%); margin: 0; padding: 10px 14px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; background: var(--sfb-card); border: 1px solid var(--sfb-stroke); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); font-size: 13px; color: var(--sfb-text); opacity: 0; animation: sf-boot-tip 15s ease infinite backwards; }
.sf-boot-tips p:nth-child(1) { animation-delay: 4s; }
.sf-boot-tips p:nth-child(2) { animation-delay: 9s; }
.sf-boot-tips p:nth-child(3) { animation-delay: 14s; }
.sf-boot-tips b { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--sfb-accent); padding-top: 1px; }

@keyframes sf-boot-in { from { opacity: 0; } }
@keyframes sf-boot-rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes sf-boot-spin { to { transform: rotate(360deg); } }
@keyframes sf-boot-ring { from { transform: scale(.3); opacity: .9; } to { transform: scale(7); opacity: 0; } }
@keyframes sf-boot-late { to { max-height: 20px; opacity: 1; } }
@keyframes sf-boot-tip { 0% { opacity: 0; transform: translateY(10px); } 3%, 30% { opacity: 1; transform: none; } 33%, 100% { opacity: 0; transform: translateY(10px); } }
@keyframes sf-boot-pulse { 50% { opacity: .45; } }

@media (prefers-reduced-motion: reduce) {
  .sf-boot, .sf-boot-hello:not(:empty) { animation-duration: .01s; }
  .sf-boot-dot { animation: sf-boot-pulse 2.4s ease-in-out infinite; }
  .sf-boot-leaving .sf-boot-dot { transition: opacity .3s ease; animation: none; }
}
