/* Global styles. Components use MudBlazor theme classes; keep this file small. */

#blazor-error-ui {
    background: var(--mud-palette-warning-lighten, #fff4e5);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
}

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

/* FocusOnNavigate moves focus to the page's heading after each navigation, so screen readers announce the new page. The
   heading isn't something anyone can operate, so it shows no focus outline. */
h1:focus {
    outline: none;
}

.validation-message {
    color: var(--mud-palette-error, #b00020);
}

/* Workspace settings: the details for those who can't change them, and the plan's usage. */
.workspace-settings dt {
    font-weight: 600;
    margin-top: 0.75rem;
}

.workspace-settings dd {
    margin: 0.25rem 0 0;
}

/* Support requests: the diagnostic info offered, the request's details and its conversation. */
.support-diagnostics,
.support-messages {
    list-style: none;
    margin: 0;
    padding: 0;
}

.support-request dt {
    font-weight: 600;
    margin-top: 0.75rem;
}

.support-request dd {
    margin: 0.25rem 0 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.support-messages li {
    border-left: 3px solid var(--mud-palette-lines-default);
    margin-bottom: 0.75rem;
    padding: 0.25rem 0 0.25rem 0.75rem;
}

.support-messages li.from-team {
    border-left-color: var(--mud-palette-primary);
}

.support-messages li.internal-note {
    background: color-mix(in srgb, var(--mud-palette-warning) 10%, transparent);
    border-left-color: var(--mud-palette-warning);
}

.support-message-body {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

/* Public pages: the landing hero, the plans, the legal documents and the footer. */
.public-hero {
    padding: 2rem 0 1rem;
}

.pricing-plan {
    height: 100%;
}

.pricing-plan ul {
    margin: 0;
    padding-left: 1.25rem;
}

.legal-document h2 {
    font-size: 1.25rem;
    margin: 1.75rem 0 0.5rem;
}

.legal-document p,
.legal-document li {
    line-height: 1.6;
}

.legal-document ul {
    padding-left: 1.25rem;
}

/* Every layout's footer: the product and its copyright holder, then the legal links. It wraps on narrow screens. */
.site-footer {
    align-items: center;
    border-top: 1px solid var(--mud-palette-lines-default);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    justify-content: space-between;
    margin-top: 3rem;
    padding: 1.25rem 1rem;
}

.site-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}

/* The signed-in app keeps its footer at the bottom of a short page. */
.main-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content .main-container {
    flex: 1 0 auto;
}

.main-content .site-footer {
    margin-top: 1.5rem;
}

/* A long workspace name is cut short on phones, so the app bar's buttons stay on one line. */
/* The label is a block so the name can end in an ellipsis; the arrow sits at its end, outside the text's flow. */
.main-app-bar .workspace-switcher .mud-button-label {
    display: block;
    max-width: 40vw;
    overflow: hidden;
    padding-right: 24px;
    position: relative;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.main-app-bar .workspace-switcher .mud-button-icon-end {
    margin: 0;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* Phones (MudBlazor's xs): less padding and a shorter name, so menu, switcher, help, account and sign-out fit. */
@media (max-width: 599.98px) {
    .main-app-bar .mud-toolbar {
        padding-inline: 8px;
    }

    .main-app-bar .workspace-switcher {
        margin-right: 0 !important;
    }

    .main-app-bar .workspace-switcher .mud-button-label {
        max-width: 34vw;
    }
}

.app-bar-product-name {
    white-space: nowrap;
}

/* Server-rendered account forms (sign in, password reset): plain inputs, since MudBlazor inputs need interactivity. */
.account-form .account-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

/* Every text field, whatever its type: Blazor's InputText writes no type unless given one (the two-factor codes). */
.account-form .account-field input:not([type="checkbox"], [type="radio"], [type="hidden"]) {
    border: 1px solid var(--mud-palette-lines-inputs, #9e9e9e);
    border-radius: var(--mud-default-borderradius, 4px);
    font: inherit;
    padding: 0.6rem 0.75rem;
}

.account-form .account-field small {
    color: var(--mud-palette-text-secondary);
}

.account-form .account-field input:focus-visible {
    outline: 2px solid var(--mud-palette-primary, #2b5797);
    outline-offset: 1px;
}

.account-form .account-check {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.account-form button[type="submit"] {
    width: 100%;
}

.account-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* Account settings: what's set now, then a link to change it. */
.account-settings dt {
    font-weight: 600;
    margin-top: 1rem;
}

.account-settings dd {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin: 0.25rem 0 0;
}

.account-external-logins {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.account-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
}

.account-activity {
    list-style: none;
    margin: 0;
    padding: 0;
}

.account-activity li {
    border-bottom: 1px solid var(--mud-palette-lines-default, #e0e0e0);
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    justify-content: space-between;
    padding: 0.4rem 0;
}

.authenticator-steps li {
    margin-bottom: 0.75rem;
}

.authenticator-steps kbd {
    font-family: ui-monospace, monospace;
    overflow-wrap: anywhere;
}

/* Scanners need dark modules on light, whatever the theme. */
.authenticator-qr-code {
    display: block;
    height: auto;
    margin-top: 0.5rem;
    max-width: 100%;
    width: 12rem;
}

.recovery-codes {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}

/* The site page's location tree: nested lists, each level indented with a guide line. */
.location-tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

.location-tree .location-tree {
    border-left: 1px solid var(--mud-palette-lines-default, #e0e0e0);
    margin-left: 0.6rem;
    padding-left: 1rem;
}

/* A printer's facts as label and value pairs, side by side, wrapping under each other on a phone. */
.printer-facts {
    display: grid;
    grid-template-columns: minmax(7rem, max-content) 1fr;
    gap: 0.25rem 1rem;
    margin: 0;
}

.printer-facts dt {
    color: var(--mud-palette-text-secondary);
}

.printer-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* AppForm's fieldset only disables the fields until the browser app takes over; it adds no frame of its own. */
.app-form-fields {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

/* The date and counter stay on one line; a void reason wraps in the status column instead. */
.printer-readings td:nth-child(-n + 2) {
    white-space: nowrap;
}

/* What to do with the ticked rows stays in reach under the app bar while the person scrolls the list to tick more. */
.selection-bar {
    position: sticky;
    top: var(--mud-appbar-height);
    z-index: 2;
}

/* A printer's timeline and maintenance tasks, and the Required maintenance list: one entry per line group, with a rule
   between entries. The log-service form's task checklist drops the bullets only. */
.printer-timeline,
.printer-maintenance,
.required-maintenance,
.log-service-tasks {
    list-style: none;
    margin: 0;
    padding: 0;
}

.supplier-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.supplier-links li + li {
    border-top: 1px solid var(--mud-palette-divider);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

/* Long shop names and SKUs wrap rather than push the buttons off a phone's screen. */
.supplier-link-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* The add-printer flow's default parts: a row per part, its details under the checkbox. */
.default-parts {
    list-style: none;
    margin: 0;
    padding: 0;
}

.default-parts li + li {
    border-top: 1px solid var(--mud-palette-divider);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

.default-part-text {
    min-width: 0;
    flex: 1 1 14rem;
    overflow-wrap: anywhere;
}

.default-part-details {
    padding-left: 2.75rem;
}

/* A printer's compatible parts: a row per part, its stock wrapping under it on a phone. */
.compatible-parts {
    list-style: none;
    margin: 0;
    padding: 0;
}

.compatible-parts li + li {
    border-top: 1px solid var(--mud-palette-divider);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

.compatible-part-text {
    min-width: 0;
    flex: 1 1 14rem;
    overflow-wrap: anywhere;
}

/* "Add from catalog": a row per part, its Add button wrapping under it on a phone. */
.catalog-parts {
    list-style: none;
    margin: 0;
    padding: 0;
}

.catalog-parts li + li {
    border-top: 1px solid var(--mud-palette-divider);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

.catalog-part-text {
    min-width: 0;
    flex: 1 1 14rem;
    overflow-wrap: anywhere;
}

/* The dashboard's low-stock widget: a row per item, its reorder link wrapping under it on a phone. */
.low-stock {
    list-style: none;
    margin: 0;
    padding: 0;
}

.low-stock li + li {
    border-top: 1px solid var(--mud-palette-divider);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

.low-stock-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* A compatibility rule's two fields share a row where there's room, and stack on a phone. */
.compatibility-rule-kind {
    flex: 0 0 9rem;
}

.compatibility-rule-target {
    flex: 1 1 12rem;
    min-width: 0;
}

.compatibility-printers {
    overflow-wrap: anywhere;
}

/* A replaced part's choices sit under its checkbox. */
.log-service-replacement {
    margin: 0 0 1rem 2.5rem;
}

.log-service-supply {
    flex: 1 1 16rem;
}

.log-service-quantity {
    flex: 0 1 8rem;
}

.printer-timeline li,
.printer-maintenance li,
.required-maintenance li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    overflow-wrap: anywhere;
}

/* The inventory's kind tabs: the chosen one keeps the brand's underline but reads in the text colour, since the brand's
   blue is too dark to read on the dark theme's background. */
.inventory-tab-active {
    color: var(--mud-palette-text-primary) !important;
}

/* A filament's or resin's colour beside its name in the inventory list. */
.colour-swatch {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 50%;
    display: inline-block;
    height: 0.85em;
    margin-right: 0.35em;
    vertical-align: -0.1em;
    width: 0.85em;
}

/* The inventory's brand and type filters: wide enough for a brand's name, and the full width on a phone. */
.inventory-filter {
    flex: 0 1 14rem;
    min-width: 10rem;
}
