/* Bridge MudBlazor onto the RtrWeb design language. Loaded after MudBlazor.min.css
   so these win. RtrWebTheme already sets the theme font family; this guarantees it
   reaches inputs, the data grid, dialogs, chips, etc. (which reset their font),
   and keeps everything on var(--rtr-web-font). */

[class*="mud-"] {
    font-family: var(--rtr-web-font);
}

/* Native form controls Mud renders (inputs/textareas/selects) reset font-family,
   so set them explicitly too. */
.mud-input-slot,
.mud-input-root input,
.mud-input-root textarea,
.mud-select-input {
    font-family: var(--rtr-web-font);
}

/* ── Small buttons: the in-row action size ────────────────────────────────
   Size.Small is what Add / Edit / Remove use when they sit inside a table row,
   a list row, or a card rail, so their height sets the row height. Mud's small
   is ~30px tall and carries a 64px min-width, which makes those rows taller
   and wider than the text in them needs. Bring it to 24px and let the label
   decide the width.

   Scoped to the three MudButton variants rather than [class*="-size-small"]:
   MudIconButton is also a .mud-button-root and a square icon target should
   keep its own geometry. */
.mud-button-filled-size-small,
.mud-button-outlined-size-small,
.mud-button-text-size-small {
    min-width: 0;
    height: 24px;
    padding: 0 9px !important;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    gap: 4px;
}

/* Mud's ripple/label spans are inline — center them against the fixed height. */
.mud-button-filled-size-small > *,
.mud-button-outlined-size-small > *,
.mud-button-text-size-small > * {
    line-height: 1;
}

/* .rtr-web-select--compact: a Mud select/input sized to the 38px toolbar rhythm
   that RtrWebSearchBox and RtrWebSegmented share. Mud's dense outlined input is
   ~40px of content plus 4px control margins (8px more when it carries a
   floating label), so beside them it reads as a taller, heavier control. Use
   it with Placeholder rather than Label — the label needs the vertical room
   this takes away. */
.rtr-web-select--compact.mud-input-control {
    margin: 0 !important;
}

/* Trim the slot's padding to land on 38px (9 + 20 line + 9) rather than forcing
   a height on it: the value text and the clear/arrow adornments are laid out by
   Mud's own centered flex row, and pinning a height on the slot alone breaks
   that row apart — the value rides the top and the icons drop below it. */
.rtr-web-select--compact .mud-input-slot.mud-input-root-outlined {
    padding-top: 9px !important;
    padding-bottom: 9px !important;
    font-size: 14px;
    line-height: 20px;
}

/* A long option ("Project Management Staff") should ellipsize inside the
   control, not wrap it to a second line. */
.rtr-web-select--compact .mud-select-input .mud-input-slot,
.rtr-web-select--compact .mud-input-slot.mud-input-root-outlined {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Data grids tagged .rtr-web-grid: readable cell size + single-line headers. */
.rtr-web-grid .mud-table-cell {
    font-size: 13px !important;
}

.rtr-web-grid .mud-table-head .mud-table-cell,
.rtr-web-grid thead th,
.rtr-web-grid .mud-table-head .mud-table-sort-label,
.rtr-web-grid .mud-table-head .mud-table-sort-label-text {
    white-space: nowrap !important;
}

/* Column headers share the card field-label look (the .sd-k detail-grid style):
   uppercase, small, heavy, faint — so grid headers read consistently with the
   detail cards across every app that consumes the library. Applies to MudDataGrid
   header cells + sort labels and any plain/MudSimpleTable thead cells under a
   .rtr-web-grid table. */
.rtr-web-grid .mud-table-head .mud-table-cell,
.rtr-web-grid thead th,
.rtr-web-grid .mud-table-head .mud-table-sort-label-text {
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px !important;
    text-transform: uppercase !important;
    color: var(--rtr-web-text-faint) !important;
}

/* .rtr-web-grid__actions: the icon-button column. Put it on a grid's *leading*
   column (Class + HeaderClass) so edit/hide/delete stay reachable on a wide
   table that scrolls horizontally. width:1% + nowrap is the usual table trick
   for "shrink to content" — the data columns then absorb the leftover width
   instead of the buttons floating in a stretched cell. */
.rtr-web-grid__actions {
    width: 1%;
    white-space: nowrap;
    padding-right: 4px !important;
}

/* .rtr-web-grid--fill: grid fills its (definite-height) region with the sticky
   header, the horizontal scrollbar, and the pager all pinned — only the rows
   scroll. Requires FixedHeader on the grid and a height-bounded parent. */
.rtr-web-grid--fill {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.rtr-web-grid--fill .mud-table-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.rtr-web-grid--fill .mud-table-pagination {
    flex: 0 0 auto;
}

/* .rtr-web-grid--condensed: tight rows for config grids whose cells carry controls
   (switches, short values) rather than prose — many rows scanned at once matter
   more than breathing room. Pair with Dense on the grid. The switch is already
   a fixed 20px pill (see below), so cell padding is the only row-height lever. */
.rtr-web-grid--condensed .mud-table-cell {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    height: auto !important;
}

/* ── Switch: iOS-style pill toggle (all MudSwitch) ────────────────────────
   Mud v8 markup: .mud-switch-span > [.mud-switch-base(.mud-checked) >
   .mud-switch-button > input + .mud-switch-thumb-*] + .mud-switch-track.
   We take over the geometry: the track becomes a full-height pill, the base is
   stripped of its icon-button chrome and pinned, and we slide the thumb on the
   .mud-checked state. Off/on colors are split by :not(.mud-primary) /
   .mud-primary so they never fight. */
/* .mud-switch is the flex label wrapping the pill and its text. Mud ships them
   flush against each other; a gap gives the label room to breathe. Set on the
   flex container rather than as a margin on the label so it holds whichever
   side the label is placed. */
.mud-switch {
    gap: 10px;
}

/* 36×20 pill. Sized down from 40×22 (ADO 5742): at the old size the toggle was
   the heaviest thing in a dense config row, out of proportion to the 13-14px text
   beside it. The thumb and its travel below are tied to these numbers — change
   all three together. */
.mud-switch .mud-switch-span {
    position: relative;
    width: 36px;
    height: 20px;
    flex: none;
}

.mud-switch .mud-switch-track {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    border-radius: 999px;
    opacity: 1 !important;
    transition: background-color .2s ease;
}

.mud-switch .mud-switch-track:not(.mud-primary) {
    background: var(--rtr-web-switch-off) !important;   /* off */
}

.mud-switch .mud-switch-track.mud-primary {
    background: var(--rtr-web-accent) !important;        /* on */
}

/* Base holds the thumb: strip the icon-button chrome, pin it, and let us move
   the thumb (not Mud's base transform). */
.mud-switch .mud-switch-base {
    position: absolute !important;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    color: transparent !important;
    transform: none !important;
}

.mud-switch .mud-switch-base:hover {
    background-color: transparent !important;
}

.mud-switch .mud-switch-button {
    position: absolute;
    inset: 0;
}

/* Thumb: white disc, slides left → right. 14px inside the 20px track leaves the
   same 3px inset top, bottom and at rest. */
.mud-switch [class*="mud-switch-thumb"] {
    position: absolute !important;
    top: 50%;
    left: 3px;
    transform: translateY(-50%);
    width: 14px !important;
    height: 14px !important;
    min-width: 14px;
    border-radius: 50%;
    background: #fff !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .4);
    transition: left .2s cubic-bezier(.4, 0, .2, 1);
}

/* Thumb width + the 3px inset, so the travel lands it flush against the far end. */
.mud-switch .mud-switch-base.mud-checked [class*="mud-switch-thumb"] {
    left: calc(100% - 17px);
}

/* Keyboard focus ring on the thumb. */
.mud-switch .mud-switch-input:focus-visible + [class*="mud-switch-thumb"] {
    box-shadow: 0 0 0 3px var(--rtr-web-accent-tint), 0 1px 3px rgba(15, 23, 42, .4);
}

.mud-switch.mud-disabled {
    opacity: .45;
}
