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

:root {
    color-scheme: dark;
    --app-background: #090d18;
    --app-background-secondary: #101a2b;
    --app-surface: rgb(17 27 45 / 82%);
    --app-surface-raised: rgb(23 36 58 / 90%);
    --app-glass-surface: rgb(255 255 255 / 7%);
    --app-glass-hover: rgb(255 255 255 / 13%);
    --app-glass-border: rgb(180 207 255 / 18%);
    --app-foreground: #edf4ff;
    --app-text-muted: #a8b6ce;
    --app-input-background: #111c2e;
    --app-input-border: #7890b3;
    --app-error-text: #ffb4b4;
    --app-error-surface: rgb(140 26 39 / 22%);
    --app-success-text: #9be7bd;
    --app-success-surface: rgb(23 113 69 / 22%);
    --app-danger-text: #ff9caa;
    --app-nav-surface: rgb(11 20 35 / 88%);
    --app-nav-hover: rgb(101 199 247 / 12%);
    --app-nav-active: rgb(37 139 210 / 22%);
    --app-nav-accent: #65c7f7;
    --app-accent: #65c7f7;
    --app-accent-strong: #258bd2;
    /* Credit billing pages (Customers, Credit customers, Monthly bills) share this colour in the nav. */
    --app-credit-accent: #f6b85c;
    --app-credit-surface: rgb(246 184 92 / 9%);
    --app-credit-active: rgb(246 184 92 / 20%);
    --app-shadow: 0 20px 55px rgb(0 0 0 / 34%);
    --neutral-foreground-rest: #edf4ff;
    --neutral-foreground-hint: #a8b6ce;
    --neutral-foreground2-rest: #c7d5eb;
    --neutral-layer-1: #101a2b;
    --neutral-layer-2: #152238;
    --neutral-layer-3: #1b2a43;
    --neutral-layer-4: #223550;
    --neutral-fill-rest: #1b2a43;
    --neutral-fill-hover: #263b5b;
    --neutral-fill-input-rest: #111c2e;
    --neutral-fill-input-hover: #182840;
    --neutral-stroke-rest: #405575;
    --neutral-stroke-divider-rest: rgb(177 201 235 / 16%);
    --accent-fill-rest: #258bd2;
    --accent-fill-hover: #42a7e8;
    --accent-foreground-rest: #8cdbff;
}

html[data-theme="light"] {
    color-scheme: light;
    --app-background: #edf3fb;
    --app-background-secondary: #dce8f6;
    --app-surface: rgb(255 255 255 / 86%);
    --app-surface-raised: #fff;
    --app-glass-surface: rgb(255 255 255 / 66%);
    --app-glass-hover: rgb(255 255 255 / 92%);
    --app-glass-border: rgb(48 76 115 / 18%);
    --app-foreground: #17263b;
    --app-text-muted: #53647c;
    --app-input-background: #fff;
    --app-input-border: #9aabc0;
    --app-error-text: #8b0000;
    --app-error-surface: #fff0f0;
    --app-success-text: #174d17;
    --app-success-surface: #eef8ee;
    --app-danger-text: #b42335;
    --app-nav-surface: rgb(255 255 255 / 76%);
    --app-nav-hover: rgb(8 127 184 / 9%);
    --app-nav-active: rgb(8 127 184 / 15%);
    --app-nav-accent: #087fb8;
    --app-accent: #087fb8;
    --app-accent-strong: #096da5;
    --app-credit-accent: #a65a00;
    --app-credit-surface: rgb(196 112 0 / 7%);
    --app-credit-active: rgb(196 112 0 / 15%);
    --app-shadow: 0 18px 45px rgb(27 51 84 / 13%);
    --neutral-foreground-rest: #17263b;
    --neutral-foreground-hint: #53647c;
    --neutral-foreground2-rest: #344760;
    --neutral-layer-1: #fff;
    --neutral-layer-2: #f5f8fc;
    --neutral-layer-3: #edf3fa;
    --neutral-layer-4: #e1eaf5;
    --neutral-fill-rest: #e8eef6;
    --neutral-fill-hover: #dce6f2;
    --neutral-fill-input-rest: #fff;
    --neutral-fill-input-hover: #f6f9fd;
    --neutral-stroke-rest: #9aabc0;
    --neutral-stroke-divider-rest: rgb(38 62 93 / 14%);
    --accent-fill-rest: #087fb8;
    --accent-fill-hover: #096da5;
    --accent-foreground-rest: #075d8c;
}

html,
body {
    --body-font: "Segoe UI Variable", "Segoe UI", sans-serif;
    --neutral-foreground-rest: var(--app-foreground);
    --neutral-foreground-hint: var(--app-text-muted);
    --neutral-foreground2-rest: var(--app-foreground);
    --neutral-layer-1: var(--app-surface);
    --neutral-layer-2: var(--app-surface-raised);
    --neutral-layer-3: var(--app-surface-raised);
    --neutral-layer-4: var(--app-surface-raised);
    --neutral-fill-rest: var(--app-surface);
    --neutral-fill-hover: var(--app-glass-hover);
    --neutral-fill-input-rest: var(--app-input-background);
    --neutral-fill-input-hover: var(--app-input-background);
    --neutral-stroke-rest: var(--app-input-border);
    --neutral-stroke-divider-rest: var(--app-glass-border);
    --fill-color: var(--app-foreground);
    font-family: var(--body-font);
    font-size: var(--type-ramp-base-font-size);
    line-height: var(--type-ramp-base-line-height);
    margin: 0;
    color: var(--app-foreground);
}

body {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 12% 0%, rgb(38 119 190 / 22%), transparent 36rem),
        radial-gradient(ellipse at 92% 12%, rgb(113 77 183 / 17%), transparent 34rem),
        linear-gradient(145deg, var(--app-background), var(--app-background-secondary) 58%, var(--app-background));
    background-attachment: fixed;
}

fluent-layout {
    min-height: 100vh;
    color: var(--app-foreground);
    background: transparent;
}

.layout,
.body,
.main,
.body-content,
.content,
.navmenu,
.sitenav,
.header,
.footer,
fluent-design-system-provider,
fluent-button,
fluent-badge,
fluent-data-grid,
fluent-nav-menu,
fluent-nav-link {
    --neutral-foreground-rest: var(--app-foreground);
    --neutral-foreground-hint: var(--app-text-muted);
    --neutral-foreground2-rest: var(--app-foreground);
    --neutral-layer-1: var(--app-surface);
    --neutral-layer-2: var(--app-surface-raised);
    --neutral-layer-3: var(--app-surface-raised);
    --neutral-layer-4: var(--app-surface-raised);
    --neutral-fill-rest: var(--app-surface);
    --neutral-fill-hover: var(--app-glass-hover);
    --neutral-fill-input-rest: var(--app-input-background);
    --neutral-fill-input-hover: var(--app-input-background);
    --neutral-stroke-rest: var(--app-input-border);
    --neutral-stroke-divider-rest: var(--app-glass-border);
    --fill-color: var(--app-foreground);
    color: var(--app-foreground);
}

.header {
    color: var(--app-foreground);
    background: linear-gradient(115deg, rgb(21 44 74 / 92%), rgb(29 61 94 / 82%)) !important;
    border-bottom: 1px solid var(--app-glass-border);
    box-shadow: 0 10px 35px rgb(0 0 0 / 22%), inset 0 1px rgb(255 255 255 / 9%);
    backdrop-filter: blur(20px);
}

html[data-theme="light"] .header {
    background: linear-gradient(115deg, rgb(255 255 255 / 95%), rgb(222 235 249 / 92%)) !important;
    box-shadow: 0 8px 28px rgb(27 51 84 / 10%);
}

.header .app-brand {
    font-weight: 700;
    letter-spacing: 0.025em;
    text-shadow: 0 1px 14px rgb(101 199 247 / 28%);
}

.header-actions {
    align-items: center;
    display: flex;
    gap: 1rem;
    /* User name, sign-out and theme switcher always sit at the right edge of the header. */
    margin-left: auto;
}

[dir="rtl"] .header-actions {
    margin-right: auto;
    margin-left: 0;
}

.current-user {
    color: var(--app-foreground);
    font-weight: 600;
}

.logout-button {
    align-items: center;
    background: transparent;
    border: 1px solid var(--app-glass-border);
    border-radius: 0.45rem;
    color: var(--app-foreground);
    cursor: pointer;
    display: inline-flex;
    height: 2.25rem;
    justify-content: center;
    padding: 0.35rem;
    width: 2.25rem;
}

.logout-button:hover {
    background: var(--app-glass-hover);
}

.logout-button svg {
    fill: currentColor;
    height: 1.25rem;
    width: 1.25rem;
}

.access-denied {
    margin: 2rem auto;
    max-width: 38rem;
}

.navmenu-icon {
    display: none;
}

.main {
    min-height: calc(100dvh - 86px);
    color: var(--app-foreground);
    align-items: stretch !important;
    background: transparent;
}

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

.content {
    padding: 1rem 1.5rem;
    align-self: stretch !important;
    width: 100%;
    color: var(--app-foreground);
}

.manage {
    width: 100dvw;
}

footer {
    background: var(--app-glass-surface);
    color: var(--app-foreground);
    align-items: center;
    padding: 10px 10px;
    border-top: 1px solid var(--app-glass-border);
    backdrop-filter: blur(16px);
}

.footer {
    background: var(--app-glass-surface);
    border-top: 1px solid var(--app-glass-border);
    box-shadow: 0 -8px 25px rgb(0 0 0 / 12%);
    backdrop-filter: blur(16px);
}

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

footer a:focus {
    outline: 1px dashed var(--app-accent);
    outline-offset: 3px;
}

footer a:hover {
    color: var(--app-accent);
    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);
}

#blazor-error-ui {
    color: var(--app-foreground);
    background: var(--app-surface-raised);
    border: 1px solid var(--app-glass-border);
    box-shadow: var(--app-shadow);
    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 .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5O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red. "
    }

.text-danger {
    color: var(--app-danger-text) !important;
}

.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: var(--app-accent);
}

button,
input,
select,
textarea {
    font: inherit;
}

input,
select,
textarea {
    color: var(--app-foreground);
    background-color: var(--app-input-background);
    border-color: var(--app-input-border);
}

input::placeholder,
textarea::placeholder {
    color: var(--app-text-muted);
    opacity: 1;
}

table th,
table td {
    color: var(--app-foreground);
    border-color: var(--app-glass-border);
}

/* Phone and small-tablet layout: the nav collapses behind the header toggle. */
@media (max-width: 768px) {
    .header-gutters {
        /* The menu toggle now sits at the left (see .navmenu-icon), so no space is reserved on the right. */
        margin: 0.5rem 0.75rem !important;
    }

    /* Use the full width on phones: one small gutter here, and pages drop their own side padding. */
    .content {
        padding: 0.25rem 0.75rem 1rem;
    }

    /* Tables scroll sideways inside .table-container on phones, so keep each cell on one line. */
    .table-container th,
    .table-container td {
        white-space: nowrap;
    }

    /* Keep the header on one line on phones: shrink and truncate the names instead of wrapping. */
    .header .app-brand {
        min-width: 0;
        overflow: hidden;
        font-size: 0.95rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-actions {
        flex-shrink: 0;
        gap: 0.5rem;
    }

    .current-user {
        max-width: 6.5rem;
        overflow: hidden;
        font-size: 0.85rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    [dir="rtl"] .header-gutters {
        margin: 0.5rem 0.75rem !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%;
    }

    /* The checkbox sits transparently on top of the label and receives the tap. */
    #navmenu-toggle {
        appearance: none;
        margin: 0;
        background: transparent;
    }

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

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

    /* The menu toggle sits in the header row, left of the business name, so it takes no space from the page. */
    .navmenu-icon {
        cursor: pointer;
        z-index: 20;
        display: block;
        position: fixed;
        top: 6px;
        left: 10px;
        right: auto;
        width: 38px;
        height: 38px;
        border: none;
    }

    .header .app-brand {
        /* Clears the 38px menu toggle at left: 10px. */
        margin-left: 3rem;
    }

    label.navmenu-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--app-glass-border);
        border-radius: 10px;
        background: var(--app-glass-surface);
    }

    /* FluentIcon's Color.Fill maps to a surface token, which matches the background; use the text color instead. */
    .navmenu-icon svg {
        fill: var(--app-foreground) !important;
    }

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

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

/* Printing: drop the app shell and theme colours so pages print as plain black-on-white documents. */
@media print {
    :root,
    html[data-theme="light"] {
        color-scheme: light;
    }

    .header,
    .navmenu,
    .footer,
    #blazor-error-ui,
    #components-reconnect-modal {
        display: none !important;
    }

    body,
    .main,
    .body-content,
    .content {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding: 0 !important;
        background: #fff !important;
    }

    .content *,
    .content *::before,
    .content *::after {
        color: #000 !important;
        background: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
}

/* Phones: larger type. The root and Fluent's type-ramp tokens drive every rem- and token-based size,
   so raising them here scales text across the app (15px, about 7% over the 14px desktop base). */
@media (max-width: 600px) {
    html,
    body {
        --type-ramp-base-font-size: 15px !important;
        --type-ramp-base-line-height: 21px !important;
        --type-ramp-minus-1-font-size: 13px !important;
        --type-ramp-minus-1-line-height: 18px !important;
        font-size: 15px !important;
        line-height: 1.45;
    }
}
