﻿.blurry-background {
    backdrop-filter: blur(10px);
}

td.actions, th.actions {
    text-align: center;
    width: 1%;
    white-space: nowrap;
}

.no-wrap {
    white-space: nowrap;
}

.cursor-pointer tbody tr {
    cursor: pointer;
}

td.hex-cell {
    width: 1%;
    white-space: nowrap;
}

.hex-dump {
    font-family: "SFMono-Regular", "Consolas", "Liberation Mono", Menlo, monospace;
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    color: var(--mud-palette-success);
    background-color: var(--mud-palette-background-grey);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.context-menu {
    opacity: 0.1;
}

[data-hovering] .context-menu {
    opacity: 1;
}

.device-image-dialog__img {
    max-height: 70vh;
}

.device-image-tile__preview {
    cursor: pointer;
}

.position-picker-map {
    height: 320px;
    width: 100%;
    border-radius: 4px;
    /* stacking context so Leaflet's high z-index panes stay below the MudBlazor appbar/drawer */
    position: relative;
    z-index: 0;
}

/* ── Device list ── */

/* A device that has not reported in a week: the whole row reads muted-warning, including the
   caption, so a stale entry is visible without opening it. */
.device-stale {
    color: var(--mud-palette-warning);
}

.filter-select {
    max-width: 220px;
}

.filter-search {
    max-width: 280px;
}

/* MudTable reserves a column for the group expander and then pads it three times over: the header
   holds an empty `ml-4 mr-5` div (36px), every data row an empty `d-flex` div with an inline
   `padding-left: 34px`, and each cell carries the table's own 16px/24px. The column can never be
   narrower than about 76px, which is the empty gap between the chevron and the group heading it
   belongs to — the chevron itself needs none of it.

   Both spacers have to be neutralised, not just the cell: the header's is a margin and the data
   row's an inline style, so a width on the cell alone is overruled by either. */
.grouped-table .mud-table-root tr > :first-child {
    width: 1px;
    padding-inline-start: 8px;
    padding-inline-end: 0;
}

.grouped-table .mud-table-root tr > :first-child > .ml-4,
.grouped-table .mud-table-root tr > :first-child > .d-flex {
    margin-inline: 0 !important;
    padding-left: 0 !important;
}

.device-group {
    font-weight: 500;
}

.device-group--area-group {
    background-color: var(--mud-palette-background-grey);
}

/* Indents the area row under its group without MudTable's own indentation, which also shifts
   the data rows and knocks the columns out of alignment. */
.device-group--area {
    padding-left: 32px;
}

/* Expanded uplink payload: wrap long single-line JSON instead of scrolling the table sideways. */
.json-dump {
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
    font-size: 0.8rem;
}

/* ── Device message log ── */

/* Time, direction and status shrink to their content so the message column absorbs the slack
   instead of pushing the status chips off the right edge. */
td.log-narrow, th.log-narrow {
    width: 1%;
    white-space: nowrap;
}

/* The payload preview would otherwise stretch the row to the width of one long JSON line. */
td.log-message {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-time {
    font-variant-numeric: tabular-nums;
}

/* ── Notification log ── */

.notification-detail {
    word-break: break-word;
}

.notification-email-preview {
    width: 100%;
    height: 420px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    background: var(--mud-palette-surface);
}

.notification-sms-text {
    white-space: pre-wrap;
    margin: 0;
    font-family: inherit;
    font-size: 0.875rem;
}

.alarm-level-select {
    min-width: 140px;
}

.duration-unit-select {
    max-width: 140px;
}

/* ── Uplink timeline ── */

/* One cell per expected reporting cycle, so a dropout reads as a run of red rather than as a
   chart that silently stopped moving. */
.uplink-timeline {
    display: flex;
    gap: 2px;
    height: 28px;
}

/* MudTooltip wraps each cell in its own element, which becomes the flex item — the cells only
   share the width evenly if that wrapper stretches too. */
.uplink-timeline > .mud-tooltip-root {
    flex: 1 1 0;
    min-width: 0;
}

.uplink-slot {
    height: 100%;
    border-radius: 2px;
    background-color: var(--mud-palette-success);
}

.uplink-slot--missed {
    background-color: var(--mud-palette-error);
}

.reception-row {
    cursor: pointer;
}

.reception-row--selected {
    background-color: var(--mud-palette-action-default-hover);
}

/* ── Layout ── */

.app-main {
    padding-inline: 32px;
}

.app-main__body {
    padding-block: 24px;
}

.page-header {
    margin-bottom: 32px;
}

/* Grows to take the row, but wraps the action button below it before the description gets
   squeezed into a column a few words wide. */
.page-header__title {
    flex: 1 1 320px;
    min-width: 0;
}

.app-user-menu--compact {
    display: none;
}

/* Wide admin tables scroll inside their card instead of being clipped by the page, which hides
   horizontal overflow so the drawer animation never adds a page-wide scrollbar. */
.mud-table-container,
.mud-simple-table .mud-table-container {
    overflow-x: auto;
}

/* ── Small screens ── */

/* MudBlazor's xs breakpoint. Below it every pixel of width goes to content: the layout drops its
   own gutter and relies on MudContainer's, and cards and the app bar tighten up. */
@media (max-width: 599.98px) {
    .app-main {
        padding-inline: 0;
    }

    .app-main__body {
        padding-block: 12px;
    }

    .app-main .mud-container {
        padding-inline: 12px;
    }

    .page-header {
        margin-bottom: 16px;
    }

    /* Once wrapped below the title, the actions line up from the left like the content below.
       !important because MudStack sets its alignment through MudBlazor's !important utility classes. */
    .page-header__actions,
    .page-header__actions .d-flex {
        align-items: flex-start !important;
        justify-content: flex-start !important;
    }

    .page-header__actions .mud-button-root {
        font-size: 0.8125rem;
        padding: 4px 10px;
    }

    .app-title {
        font-size: 1.25rem;
    }

    .app-user-menu {
        display: none;
    }

    .app-user-menu--compact {
        display: inline-flex;
    }

    .mud-card-header,
    .mud-card-content,
    .mud-card-actions {
        padding: 12px;
    }

    /* Header actions (filters, refresh) drop below the title instead of squeezing it. */
    .mud-card-header {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .mud-card-header .mud-card-header-content {
        flex-basis: 220px;
    }

    .filter-select,
    .filter-search {
        max-width: none;
        width: 100%;
    }

    .mud-typography-h2 {
        font-size: 1.2rem;
    }
}

/* ── Navigation progress ── */

/* Toggled by js/nav-progress.js; sits above the app bar so it is visible on every page. */
.nav-progress {
    display: none;
    position: fixed;
    inset: 0 0 auto 0;
    z-index: calc(var(--mud-zindex-appbar) + 1);
}

.app-navigating .nav-progress {
    display: block;
}

/* ── Gateway detail ── */

/* Devices this gateway hears best: the ones that depend on it if it goes down. */
.gateway-device-row--strongest > td:first-child {
    box-shadow: inset 3px 0 0 var(--mud-palette-success);
}

.text-tabular {
    font-variant-numeric: tabular-nums;
}

/* ── Gateway test comparison ── */

/* The run that hears a device best: marked by an edge, so the cell's own text stays neutral. */
.compare-cell--best {
    box-shadow: inset 3px 0 0 var(--mud-palette-success);
}

/* ── Gateway availability ── */

/* Reuses the uplink-timeline strip: one cell per period, green while the gateway was connected. */
.availability-cell {
    height: 100%;
    border-radius: 2px;
    background-color: var(--mud-palette-success);
}

.availability-cell--partial {
    background-color: var(--mud-palette-warning);
}

.availability-cell--offline {
    background-color: var(--mud-palette-error);
}

.availability-cell--unknown {
    background-color: var(--mud-palette-lines-default);
}

.coverage-map {
    height: 420px;
    width: 100%;
    border-radius: 4px;
    /* stacking context so Leaflet's high z-index panes stay below the MudBlazor appbar/drawer */
    position: relative;
    z-index: 0;
}

/* Same colours the map draws with (GatewayCoverageMap.GradeColor). */
.coverage-map__swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.coverage-map__swatch--excellent {
    background-color: var(--mud-palette-primary);
}

.coverage-map__swatch--fair {
    background-color: var(--mud-palette-warning);
}

.coverage-map__swatch--poor {
    background-color: var(--mud-palette-error);
}

@media (max-width: 599.98px) {
    .coverage-map {
        height: 300px;
    }
}
