#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    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: 1000;
}

    #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+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.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");
    }

/* css above this comment line was part of the visual studio template, need to refactor this (remove)? */

/*
Responsive column width utility classes for MudBlazor DataGrids/Tables.
These widths apply only on devices with a minimum width of 768px (tablet and up).
On smaller screens (mobile), columns default to full width for optimal readability.
*/
@media (min-width: 768px) {
    .col-10 {
        width: 10%;
    }

    .col-15 {
        width: 15%;
    }

    .col-20 {
        width: 20%;
    }

    .col-25 {
        width: 25%;
    }

    .col-30 {
        width: 30%;
    }

    .col-40 {
        width: 40%;
    }

    .col-50 {
        width: 50%;
    }

    .col-60 {
        width: 60%;
    }

    .col-70 {
        width: 70%;
    }

    .col-80 {
        width: 80%;
    }

    .col-90 {
        width: 90%;
    }
}

.font-bold {
    font-weight: 700 !important;
}

/* Sizing utilities (logos, avatars). border-radius via MudBlazor's rounded-* classes. */
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.w-32 { width: 8rem; }
.h-32 { height: 8rem; }
.w-full { width: 100%; }

/* Subtle theme-aware separators (used in the nav drawer header/footer). */
.mud-nav-link:hover:not(.active) {
    background-color: var(--mud-palette-divider) !important;
}

.border-subtle-top {
    border-top: 1px solid var(--mud-palette-divider);
}

.border-subtle-bottom {
    border-bottom: 1px solid var(--mud-palette-divider);
}

/* Split-screen / branding gradient + contrast text (aligned with the Salubris platform). */
:root {
    --salubris-gradient-from: #16261b;
    --salubris-gradient-to: #2e8b57;
    --salubris-splash-bg: #16261b;
}

.gradient-salubris-dark {
    background: linear-gradient(135deg, var(--salubris-gradient-from), var(--salubris-gradient-to));
}

.gradient-salubris-radial-center {
    background-image: radial-gradient(ellipse at center, color-mix(in srgb, var(--salubris-gradient-to) 30%, transparent), transparent 70%);
}

.mud-primary-contrast-text {
    color: var(--mud-palette-primary-text) !important;
}

.mud-primary-contrast-text\/60 {
    color: color-mix(in srgb, var(--mud-palette-primary-text) 60%, transparent) !important;
}

.filter-white {
    filter: brightness(0) invert(1);
}

.max-w-full {
    max-width: 100% !important;
}

.h-16 {
    height: 4rem !important;
}

@media (min-width: 1280px) {
    .w-lg-75 {
        width: 75% !important;
    }
}

/* Initial load splash (shown before Blazor boots). */
.splash {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--salubris-splash-bg);
}

.splash-logo {
    width: 12rem;
    height: 12rem;
    border-radius: 1rem;
}

/* Hide the inline page header (title/subtitle) below the Lg breakpoint;
   the title is shown in the appbar instead via SectionOutlet. */
@media (max-width: 1279px) {
    .page-header-hide-mobile.page-header-hide-mobile {
        display: none !important;
    }
}

/* Default styling overrides for mud DataGrid */
.mud-data-grid .mud-table-row:hover {
    background: var(--mud-palette-table-hover);
}

@media (max-width: 600px) {
    .mud-data-grid.mud-xs-table .mud-table-cell {
        text-align: right !important;
    }

    .mud-data-grid.mud-xs-table .mud-table-cell::before {
        text-align: start !important;
    }
}

.selected-row {
    background: var(--mud-palette-table-hover);
}

    .selected-row:hover {
        background: var(--mud-palette-table-hover);
    }

.no-headers .mud-table-head {
    display: none !important;
}

/* Custom round button */
.mud-button.round-icon {
    border-radius: 50%;
    aspect-ratio: 1;
    min-width: auto;
    height: 100%;
    padding: 0;
}

    .mud-button.round-icon .mud-button-icon-start {
        margin: 0 !important;
    }

.skeleton-formfield {
    border: 1px solid var(--mud-palette-skeleton);
    border-radius: 4px;
    padding: 17.5px;
    box-sizing: border-box;
    margin-top: 8px;
    margin-bottom: 4px;
}

/*
Extra Bootstrap util classes
Could be improved? -> https://stackoverflow.com/a/72531706
*/
@media (min-width: 768px) {
    .w-md-auto {
        width: auto !important;
    }
}

/* Own global css */

.full-height-container {
    height: 100vh;
}

/* Fills the viewport minus the app bar (mobile, where the app bar is shown);
   full viewport on Lg+ where the drawer is permanent and there is no app bar. */
.max-available-height-container {
    height: calc(100vh - var(--mud-appbar-height));
}

@media (min-width: 1280px) {
    .max-available-height-container {
        height: 100vh;
    }
}

.scrollable-footer { /* refactor this one later, if not used anymore, this is for save and cancel buttons stick on the bottom of a page */
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.table-wrapper {
    min-height: 0; /* Allows this flex item to shrink if needed */
}

    .table-wrapper .mud-table {
        display: flex; /* Make the MudTable root itself a flex container */
        flex-direction: column; /* Stack its internal parts vertically */
        height: 100%; /* Make the MudTable root fill 100% of its parent (.my-table-wrapper) */
        min-height: 0; /* Crucial for flex items with intrinsic content to allow shrinking */
    }

    /* Now, target the internal mud-table-container (where the rows are) */
    /* This is the part that needs to scroll */
    .table-wrapper .mud-table-container {
        flex-grow: 1; /* Make the table body grow to fill remaining space */
        min-height: 0; /* Allows the table body to shrink */
    }

    /* Ensure the MudTablePager (if used) doesn't grow */
    .table-wrapper .mud-table-pagination {
        flex-shrink: 0; /* Prevent it from shrinking */
    }

    /* If you have a MudTableToolBar (e.g., for search/filter), ensure it doesn't grow (if used) */
    .table-wrapper .mud-table-toolbar {
        flex-shrink: 0;
    }

.full-height {
    height: 100%; /* Makes this flex item take 100% of its parent's available height */
}

    .full-height .mud-table {
        height: 100%; /* Make the MudTable root fill 100% of its parent (.my-table-wrapper) */
    }

.max-full-height {
    max-height: 100%; /* Makes this flex item take 100% of its parent's available height */
}

    .max-full-height .mud-table {
        max-height: 100%; /* Make the MudTable root fill 100% of its parent (.my-table-wrapper) */
    }

.mud-list-item:hover .mud-link {
    color: var(--mud-palette-primary) !important;
}

.mud-list-item .mud-link {
    color: var(--mud-palette-text-primary) !important;
}

.table-wrapper .mud-table-row:hover .primary {
    color: var(--mud-palette-primary) !important;
}

.table-wrapper .mud-table-row .primary-action-button {
    opacity: 0;
    padding: 8px;
}

.table-wrapper .mud-table-row:hover .primary-action-button {
    opacity: 1;
}

.inactive-row .row-data {
    opacity: 0.4;
}

/* Shared card-list layout (sensor list, gateway list). */
/* Wrapper so the selection toolbar can sit on the tab-bar row (top-right) without being
   inside the bordered tab bar. Mirrors the flex behaviour MudTabs had as the direct child. */
.card-list-container {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.card-list-toolbar {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
}

/* Match the 36px tab height so the toolbar buttons line up with the tab bar. */
.card-list-toolbar .mud-button-root {
    height: 36px;
}

.card-list {
    overflow-y: auto;
}

.card-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
}

/* Gateway cards: give "Last access" (first column) a bit more room than "Customer". */
.gateway-card-fields {
    grid-template-columns: 3fr 2fr;
}

/* Gateway cards without a customer field (customer environment): the single field spans
   the full card width instead of leaving the empty customer column. */
.card-fields-single {
    grid-template-columns: 1fr;
}

/* Let long values (e.g. a long customer name) wrap inside their column instead of
   overflowing the card. min-width:0 overrides the grid item's default min-width:auto so
   the column can shrink; overflow-wrap breaks words with no natural break opportunity. */
.card-fields > div {
    min-width: 0;
    overflow-wrap: anywhere;
}

.card-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
}

.entity-card.selected-row .card-paper {
    border-color: var(--mud-palette-primary);
    background-color: var(--mud-palette-table-hover);
}

.mud-checkbox-field {
    .mud-input-slot {
        padding: 6px 2px !important;
    }
}

.mud-switch-field {
    .mud-input-slot {
        padding: 9px 16px !important;
    }
}

.customer-filter-menu {
    width: 550px;
}

.filter-expansion-panels .mud-expand-panel-header {
    padding-top: 8px;
    padding-bottom: 8px;
}

.filter-expansion-panels .mud-expand-panel-text {
    font-weight: 500;
}

.h-100 {
    height: 100% !important;
}

.tabs-max-full-height-container.mud-tabs {
    min-height: 0;
    max-height: 100%;
}

.tabs-max-full-height-container .mud-tabs-panels {
    min-height: 0;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tabs-max-full-height-container .mud-tab-panel[role="tabpanel"] {
    min-height: 0;
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

/* Let the rounded tab bar background only be as wide as the tabs themselves,
   instead of stretching across the full row. */
.tabs-max-full-height-container .mud-tabs-tabbar {
    width: fit-content;
    max-width: 100%;
    height: fit-content;
    /* Subtle outline matching the outlined sensor cards. */
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
}

/* Remove the extra vertical space so the bar hugs the (shorter) tabs.
   Extra .mud-tabs-tabbar in the selector raises specificity above MudBlazor's
   own `.mud-tabs-tabbar .mud-tabs-tabbar-inner { min-height:48px }`. */
.tabs-max-full-height-container .mud-tabs-tabbar .mud-tabs-tabbar-inner,
.tabs-max-full-height-container .mud-tabs-tabbar .mud-tabs-tabbar-content {
    min-height: 0;
    height: auto;
}

/* Give the tab hover/ripple effect rounded corners to match the rounded tab bar,
   and make each tab more compact (less wide, less tall, smaller text). */
.tabs-max-full-height-container .mud-tab {
    border-radius: var(--mud-default-borderradius);
    min-height: 36px;
    height: 36px;
    padding: 0;
    font-size: 0.8125rem;
    text-transform: none;
}

/* Make the active-tab indicator line narrower and centered so the rounded
   corners of the tab stay visible. */
.tabs-max-full-height-container .mud-tab-slider {
    background-color: transparent !important;
}

.tabs-max-full-height-container .mud-tab-slider::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 100%;
    background-color: var(--mud-palette-primary);
    border-radius: var(--mud-default-borderradius);
}

/*
MudSwipeArea sets `touch-action: none` on .mud-swipearea, which disables native
touch scrolling inside the area. On touch devices this blocks vertical scrolling
of the sensor detail page (except at the screen edges outside the swipe area).
`pan-y` lets the browser handle vertical scrolling on touch while horizontal
gestures still reach MudSwipeArea for previous/next sensor navigation.
*/
.horizontal-swipe-area.mud-swipearea {
    touch-action: pan-y;
}

/*
Browser autofill (e.g. Edge/Chrome remembering login credentials) fills the inputs
before Blazor is aware of a value, so MudBlazor never adds .mud-shrink and the
floating label stays on top of the autofilled text. Mirror MudBlazor's .mud-shrink
label rules whenever an input matches :-webkit-autofill.
*/
.mud-input:has(input:-webkit-autofill) ~ label.mud-input-label.mud-input-label-inputcontrol {
    transform: translate(0, 1.5px) scale(0.75);
    transform-origin: top left;
}

.mud-input:has(input:-webkit-autofill) ~ label.mud-input-label.mud-input-label-inputcontrol.mud-input-label-outlined {
    transform: translate(14px, -6px) scale(0.75);
    max-width: calc((100% - 14px) / 0.75);
}

.mud-input:has(input:-webkit-autofill) ~ label.mud-input-label.mud-input-label-inputcontrol.mud-input-label-filled {
    transform: translate(12px, 10px) scale(0.75);
    max-width: calc((100% - 12px) / 0.75);
}

/* Open the gap in the outlined border that normally appears with .mud-shrink,
   so the shrunk label doesn't sit on top of the border line. */
.mud-input.mud-input-outlined:has(input:-webkit-autofill) > .mud-input-outlined-border legend {
    width: auto;
    padding: 0 5px;
}
