/*
    MudBlazor overrides, ONCE and globally (never per page). Loaded after MudBlazor.min.css and app.css.
    Colours come from MudBlazor's palette (WaterlijnTheme.cs, same values as tokens.css) or directly from the tokens.
    MudBlazor sets several styles with high specificity; each !important below says why it is needed.
*/

/* ---------- Surfaces: flat, hairlines, radius 10 on panels ---------- */
.mud-paper {
    color: var(--ink);
}

.mud-paper-outlined {
    border-color: var(--line);
    border-radius: var(--r-panel);
}

/* Overlays are the only elements with a shadow. */
.mud-popover,
.mud-dialog,
.mud-snackbar {
    box-shadow: var(--shadow-overlay) !important; /* MudBlazor writes the elevation shadow per class with a theme value; use the token */
}

/* ---------- Buttons: sentence case, 36px, radius 6, no ripple, no shadow ---------- */
.mud-button-root {
    border-radius: var(--r-control);
}

.mud-button {
    min-height: var(--control-height);
    padding: 0 14px;
    font-weight: var(--fw-medium);
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none !important; /* filled buttons get a hover/active elevation from MudBlazor; the design is flat */
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

    .mud-button.mud-button-size-small,
    .mud-button[class*="-size-small"] {
        min-height: var(--control-height-sm);
        padding: 0 10px;
        font-size: var(--fs-small);
    }

/* Quiet secondary action: outlined, hairline strong, ink text. */
.mud-button-outlined.mud-button-outlined-default,
.mud-button-outlined.mud-button-outlined-inherit,
.mud-button-outlined.mud-button-outlined-primary,
.mud-button-outlined.mud-button-outlined-secondary {
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
}

    .mud-button-outlined.mud-button-outlined-default:hover,
    .mud-button-outlined.mud-button-outlined-inherit:hover,
    .mud-button-outlined.mud-button-outlined-primary:hover,
    .mud-button-outlined.mud-button-outlined-secondary:hover {
        background: var(--sunken);
    }

.mud-button-filled.mud-button-filled-primary {
    background: var(--petrol);
    color: var(--on-petrol);
}

    .mud-button-filled.mud-button-filled-primary:hover {
        background: var(--petrol-hover);
    }

.mud-button-text {
    color: var(--petrol);
}

.mud-ripple::after,
.mud-ripple-icon::after {
    display: none !important; /* no ripple anywhere (RippleOpacity is 0 as well; this also removes the paint) */
}

.mud-icon-button {
    border-radius: var(--r-control);
    padding: 6px;
}

/* ---------- Focus: one visible 2px ring, never removed ---------- */
.mud-button-root:focus-visible,
.mud-nav-link:focus-visible,
.mud-list-item:focus-visible,
.mud-menu-item:focus-visible,
.mud-tab:focus-visible,
.mud-chip:focus-visible,
.mud-checkbox input:focus-visible + *,
.mud-radio input:focus-visible + *,
a:focus-visible {
    outline: var(--focus-width) solid var(--focus) !important; /* MudBlazor resets outline on several of these */
    outline-offset: var(--focus-offset);
}

/* The keyboard-focus overlay MudBlazor paints on buttons is replaced by the ring above. */
.mud-button-root:focus-visible::before {
    display: none;
}

/* ---------- Inputs: label above the field, 36px, radius 6, 3:1 border ---------- */
.mud-input-control {
    margin: 0;
}

    .mud-input-control > .mud-input-control-input-container {
        display: flex;
        flex-direction: column;
    }

/* Label above the field (outlined variant, the only variant the app uses). */
.mud-input-control .mud-input-label.mud-input-label-outlined {
    position: static;
    order: -1;
    transform: none !important; /* MudBlazor animates the label inside the field with an inline-level transform rule */
    margin: 0 0 6px;
    padding: 0;
    max-width: none;
    background: none;
    color: var(--ink-2);
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    line-height: 1.3;
    white-space: normal;
    pointer-events: auto;
}

.mud-input-control.mud-input-error .mud-input-label.mud-input-label-outlined,
.mud-input-control .mud-input-label.mud-input-label-outlined.mud-input-error {
    color: var(--ink-2);
}

/* The notch in the border is for a floating label; labels sit above, so no notch. */
.mud-input-outlined-border legend {
    display: none;
}

.mud-input.mud-input-outlined {
    border-radius: var(--r-control);
    background: var(--surface);
    font-weight: var(--fw-regular);
    color: var(--ink);
}

    .mud-input.mud-input-outlined .mud-input-outlined-border {
        border-color: var(--line-input);
        border-radius: var(--r-control);
        top: 0;
    }

    .mud-input.mud-input-outlined:hover:not(.mud-disabled) .mud-input-outlined-border {
        border-color: var(--ink-2);
    }

    .mud-input.mud-input-outlined.mud-focused .mud-input-outlined-border,
    .mud-input.mud-input-outlined:focus-within .mud-input-outlined-border {
        border-color: var(--focus);
        border-width: 2px;
    }

    .mud-input.mud-input-outlined.mud-input-error .mud-input-outlined-border {
        border-color: var(--bad);
    }

    .mud-input.mud-input-outlined > input.mud-input-root-outlined,
    .mud-input.mud-input-outlined .mud-input-slot.mud-input-root-outlined,
    .mud-input.mud-input-outlined div.mud-input-slot.mud-input-root-outlined {
        padding: 8px 12px;
        min-height: var(--control-height);
        box-sizing: border-box;
        font-size: var(--fs-body);
    }

    .mud-input.mud-input-outlined textarea.mud-input-root-outlined {
        padding: 8px 12px;
    }

/* A placeholder may show even though the label is not "shrunk" (it is outside the field). */
.mud-input > input.mud-input-root::placeholder,
.mud-input > textarea.mud-input-root::placeholder {
    opacity: 1 !important; /* MudBlazor hides the placeholder until the floating label moves; the label never floats here */
    color: var(--ink-3);
}

.mud-input-helper-text {
    color: var(--ink-3);
    font-size: var(--fs-caption);
    margin-top: 4px;
}

    .mud-input-helper-text.mud-input-error {
        color: var(--bad);
        font-weight: var(--fw-medium);
    }

.mud-input-control-helper-container {
    padding: 0;
}

.mud-input-adornment {
    color: var(--ink-3);
}

/* ---------- Selection controls ---------- */
.mud-checkbox .mud-icon-root,
.mud-radio .mud-icon-root {
    color: var(--ink-2);
}

/* ---------- Lists and menus ---------- */
.mud-popover {
    border: 1px solid var(--line);
    border-radius: var(--r-control);
    background: var(--surface);
}

.mud-menu .mud-list,
.mud-popover .mud-list {
    padding: var(--space-1) 0;
}

.mud-list-item,
.mud-menu-item {
    min-height: 36px;
    padding: 6px 14px;
    font-size: var(--fs-body);
    color: var(--ink);
}

    .mud-list-item:hover,
    .mud-menu-item:hover {
        background: var(--sunken);
    }

.mud-list-item .mud-list-item-text,
.mud-menu-item .mud-menu-item-text {
    margin: 0;
}

.mud-divider {
    border-color: var(--line);
}

/* ---------- Tabs: underline in petrol, no caps ---------- */
.mud-tabs-tabbar {
    background: transparent;
    border-bottom: 1px solid var(--line);
}

.mud-tab {
    flex: 0 0 auto;
    width: auto;
    min-width: 0 !important; /* MudTabs writes MinimumTabWidth (160px) as an inline style; tabs are compact and left-aligned in this design */
    min-height: 42px;
    padding: 10px 14px;
    text-transform: none;
    font-weight: var(--fw-medium);
    color: var(--ink-2);
    letter-spacing: normal;
}

    .mud-tab.mud-tab-active {
        color: var(--ink);
    }

.mud-tab-slider {
    background: var(--petrol);
}

.mud-tabs {
    margin-top: 20px;
}

    .mud-tabs .mud-tabs-panels {
        padding-top: 18px;
    }

/* A count in a tab header (for example missing documents): <span class="tab-count">2</span> + hidden text with its meaning. */
.tab-count {
    font-size: 12px;
    background: var(--bad-soft);
    color: var(--bad);
    border-radius: var(--r-pill);
    padding: 1px 7px;
    margin-left: 6px;
    font-weight: 650;
    font-stretch: 100%;
}

/* ---------- Chips: filter pills as in the mockup ---------- */
.mud-chip {
    border-radius: var(--r-pill);
    font-size: var(--fs-small);
    height: 32px;
    padding: 0 12px;
}

    .mud-chip.mud-chip-outlined {
        border-color: var(--line);
        background: var(--surface);
        color: var(--ink-2);
    }

    .mud-chip.mud-chip-selected,
    .mud-chip.mud-chip-filled.mud-chip-color-dark {
        background: var(--ink);
        border-color: var(--ink);
        color: var(--surface);
        font-weight: var(--fw-medium);
    }

/* ---------- Tables (MudTable); the Waterlijn table look itself lives in DataTable.razor.css ---------- */
.mud-table {
    background: var(--surface);
    color: var(--ink);
}

.mud-table-cell {
    border-bottom-color: var(--line);
    color: inherit;
    font-size: var(--fs-body);
}

/* ---------- Dialogs ---------- */
.mud-dialog {
    border-radius: var(--r-panel);
    background: var(--surface);
    color: var(--ink);
}

    .mud-dialog .mud-dialog-title {
        padding: 18px 22px 6px;
    }

        .mud-dialog .mud-dialog-title h6,
        .mud-dialog .mud-dialog-title .mud-typography {
            font-size: 18px;
            font-weight: var(--fw-title);
            font-stretch: var(--wdth-title);
        }

    .mud-dialog .mud-dialog-content {
        padding: 6px 22px 12px;
        color: var(--ink-2);
    }

    .mud-dialog .mud-dialog-actions {
        padding: 12px 22px 18px;
        gap: var(--space-2);
    }

        .mud-dialog .mud-dialog-actions > :not(:first-child) {
            margin-left: 0;
        }

.mud-overlay .mud-overlay-scrim.mud-overlay-dark {
    background-color: var(--scrim);
}

/* ---------- Snackbar: surface with status edge, not saturated blocks ---------- */
.mud-snackbar {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: var(--r-control);
    min-width: 0;
}

    .mud-snackbar.mud-alert-filled-success,
    .mud-snackbar.mud-alert-text-success {
        border-left-color: var(--ok);
    }

    .mud-snackbar.mud-alert-filled-warning,
    .mud-snackbar.mud-alert-text-warning {
        border-left-color: var(--warn);
    }

    .mud-snackbar.mud-alert-filled-error,
    .mud-snackbar.mud-alert-text-error {
        border-left-color: var(--bad);
    }

    .mud-snackbar.mud-alert-filled-info,
    .mud-snackbar.mud-alert-text-info,
    .mud-snackbar.mud-alert-filled-normal,
    .mud-snackbar.mud-alert-text-normal {
        border-left-color: var(--petrol);
    }

    .mud-snackbar .mud-snackbar-icon {
        color: inherit;
    }

/* ---------- Date picker ---------- */
.mud-picker .mud-picker-toolbar {
    background: var(--petrol);
    color: var(--on-petrol);
}

.mud-picker-calendar-header-switch .mud-button-root,
.mud-picker-calendar .mud-day.mud-current {
    font-weight: var(--fw-semibold);
}

/* ---------- Tooltips ---------- */
.mud-tooltip {
    background: var(--ink);
    color: var(--surface);
    font-size: var(--fs-caption);
    border-radius: var(--r-control);
}

/* ---------- Skeleton ---------- */
.mud-skeleton {
    background-color: var(--skeleton);
}

/* ---------- Touch widths: hit targets of at least 44px tall ---------- */
@media (max-width: 959.98px) and (pointer: coarse), (max-width: 599.98px) {
    .mud-button,
    .mud-icon-button,
    .mud-menu-item,
    .mud-list-item {
        min-height: 44px;
    }

    .mud-icon-button {
        min-width: 44px;
    }

    .mud-input.mud-input-outlined > input.mud-input-root-outlined,
    .mud-input.mud-input-outlined div.mud-input-slot.mud-input-root-outlined {
        min-height: 44px;
        font-size: 16px; /* prevents iOS from zooming into a focused field */
    }
}
