/* src/MonolithAccessControl.Central.Admin.Client/wwwroot/css/select-standard.css */

/* Form, page, dialog, and drawer selects retain their layout-driven width and 42px default height.
   Only card-header toolbars and pagination footers opt into fixed dimensions below. */
/* The short monitoring-period labels use the requested 104px toolbar control. */
html body:has(.mac-shell) #app .central-card-title-search-toolbar .central-searchbar-monitoring-window .central-searchbar-select {
    --central-standard-select-width: 104px;
    flex: 0 0 104px !important;
    width: 104px !important;
    min-width: 104px !important;
    max-width: 104px !important;
}
html body:has(.mac-shell) #app {
    --mac-standard-select-height: 42px;
    --mac-standard-select-border: var(--central-control-border);
}

html body:has(.mac-shell) #app .mud-select,
html body:has(.mac-shell) #app .mud-select .mud-input-control,
html body:has(.mac-shell) #app .mud-select .mud-input-control-input-container,
html body:has(.mac-shell) #app .mud-select .mud-input,
html body:has(.mac-shell) #app .mud-select .mud-input-root {
    height: var(--mac-standard-select-height, 42px) !important;
    min-height: var(--mac-standard-select-height, 42px) !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

html body:has(.mac-shell) #app .mud-select,
html body:has(.mac-shell) #app .mud-select .mud-input-control,
html body:has(.mac-shell) #app .mud-select .mud-input-control-input-container,
html body:has(.mac-shell) #app .mud-select .mud-input-root {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: 0 !important;
}

html body:has(.mac-shell) #app .mud-input.mud-select,
html body:has(.mac-shell) #app .mud-select .mud-input {
    padding: 0 !important;
    border-radius: 8px !important;
    background: var(--central-control-surface) !important;
    color: var(--central-control-text) !important;
}

html body:has(.mac-shell) #app .mud-select .mud-input-root::before,
html body:has(.mac-shell) #app .mud-select .mud-input-root::after,
html body:has(.mac-shell) #app .mud-select .mud-input-slot::before,
html body:has(.mac-shell) #app .mud-select .mud-input-slot::after {
    display: none !important;
}

/* MudSelect renders a closed value either in an input or a display div.  Style both
   without assigning display so MudBlazor remains the single owner of slot visibility. */
html body:has(.mac-shell) #app .mud-select :is(
    input.mud-input-slot.mud-select-input:not([type="hidden"]),
    div.mud-input-slot.mud-select-input) {
    align-items: center !important;
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: var(--mac-standard-select-height, 42px) !important;
    min-height: var(--mac-standard-select-height, 42px) !important;
    margin: 0 !important;
    padding: 0 8px 0 10px !important;
    box-sizing: border-box !important;
    line-height: var(--mac-standard-select-height, 42px) !important;
    overflow: hidden !important;
    text-align: left !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Searchable form selects reserve a 32px button with a stable 4px inset on each side. */
html body:has(.mac-shell) #app .mud-autocomplete .central-standard-form-select {
    --mac-standard-select-adornment-width: 40px;
}

html body:has(.mac-shell) #app .mud-autocomplete .central-standard-form-select .mud-input-adornment-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    margin: 0;
    padding: 7px;
    border-radius: 8px;
    box-sizing: border-box;
    color: var(--central-control-muted);
}

html body:has(.mac-shell) #app .mud-autocomplete .central-standard-form-select .mud-input-adornment-icon-button:hover {
    color: var(--central-control-primary);
    background: var(--central-control-primary-soft);
}

/* Compact selects reuse the toolbar's 32px outer boundary without changing their form typography. */
html body:has(.mac-shell) #app .central-compact-select {
    --mac-standard-select-height: 32px;
}

html body:has(.mac-shell) #app .central-compact-select :is(
    input.mud-input-slot.mud-select-input:not([type="hidden"]),
    div.mud-input-slot.mud-select-input) {
    height: 28px !important;
    min-height: 28px !important;
    line-height: 28px !important;
}

/* Card toolbars are the sole standard token-based × 32px select context. */
html body:has(.mac-shell) #app .central-card-title-search-toolbar .central-searchbar-select {
    --mac-standard-select-height: 32px;
    --central-standard-select-width: var(--central-search-select-width, 124px);
    flex: 0 0 var(--central-standard-select-width) !important;
    width: var(--central-standard-select-width) !important;
    min-width: var(--central-standard-select-width) !important;
    max-width: var(--central-standard-select-width) !important;
    height: 32px !important;
    min-height: 32px !important;
    margin: 0 !important;
}

/* Card toolbars have a 32px boundary and a 28px inner value slot. The value uses
   one shared 10px left inset regardless of which MudSelect closed-value path is active. */
html body:has(.mac-shell) #app .central-card-title-search-toolbar .central-searchbar-select :is(
    input.mud-input-slot.mud-select-input:not([type="hidden"]),
    div.mud-input-slot.mud-select-input) {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: 28px !important;
    min-height: 28px !important;
    margin: 0 !important;
    padding: 0 8px 0 10px !important;
    box-sizing: border-box !important;
    color: var(--status-text-strong, var(--central-control-text)) !important;
    font-size: .72rem !important;
    font-weight: 400 !important;
    line-height: 28px !important;
    overflow: hidden !important;
    text-align: left !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

html body:has(.mac-shell) #app .mud-select .mud-input-adornment-end {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 var(--mac-standard-select-adornment-width, 24px) !important;
    width: var(--mac-standard-select-adornment-width, 24px) !important;
    min-width: var(--mac-standard-select-adornment-width, 24px) !important;
    max-width: var(--mac-standard-select-adornment-width, 24px) !important;
    height: var(--mac-standard-select-height, 42px) !important;
    margin: 0 !important;
    padding: 0 !important;
    color: var(--central-control-muted) !important;
}

/* Pagination is the only select context with a fixed 70px × 32px control.
   MudBlazor applies Class to its inner input control, so size its outer wrapper too. */
html body:has(.mac-shell) #app .central-status-pagination .central-status-page-size > .mud-select:has(.central-status-page-select),
html body:has(.mac-shell) #app .central-status-pagination .central-status-page-size .central-status-page-select {
    --mac-standard-select-height: 32px;
    --central-standard-select-width: 70px;
    flex: 0 0 70px !important;
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    height: 32px !important;
    min-height: 32px !important;
    margin: 0 !important;
}

html body:has(.mac-shell) #app .central-status-pagination .central-status-page-select :is(
    input.mud-input-slot.mud-select-input:not([type="hidden"]),
    div.mud-input-slot.mud-select-input) {
    height: 28px !important;
    min-height: 28px !important;
    line-height: 28px !important;
}

html body:has(.mac-shell) #app .mud-select .mud-input:not(.mud-input-error) .mud-input-outlined-border,
html body:has(.mac-shell) #app .mud-select .mud-input:not(.mud-input-error) fieldset.mud-input-outlined-border,
html body:has(.mac-shell) #app .mud-input.mud-select:not(.mud-input-error) .mud-input-outlined-border,
html body:has(.mac-shell) #app .mud-input.mud-select:not(.mud-input-error) fieldset.mud-input-outlined-border {
    border: 1px solid var(--mac-standard-select-border) !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}

html body:has(.mac-shell) #app .mud-select .mud-input:not(.mud-input-error):focus-within .mud-input-outlined-border,
html body:has(.mac-shell) #app .mud-select .mud-input:not(.mud-input-error):focus-within fieldset.mud-input-outlined-border,
html body:has(.mac-shell) #app .mud-input.mud-select:not(.mud-input-error):focus-within .mud-input-outlined-border,
html body:has(.mac-shell) #app .mud-input.mud-select:not(.mud-input-error):focus-within fieldset.mud-input-outlined-border {
    border-color: var(--central-control-primary) !important;
    outline: 0 !important;
}

html body:has(.mac-shell) #app .mud-input.mud-input-error .mud-input-outlined-border {
    border-color: var(--mud-palette-error) !important;
}

html body:has(.mac-shell) #app .mud-select .mud-input:focus-within .mud-input-adornment-end,
html body:has(.mac-shell) #app .mud-input.mud-select:focus-within .mud-input-adornment-end {
    color: var(--central-control-primary) !important;
}

html body:has(.mac-shell) #app select {
    height: var(--mac-standard-select-height, 42px) !important;
    min-height: var(--mac-standard-select-height, 42px) !important;
    border: 1px solid var(--mac-standard-select-border) !important;
    border-radius: 8px !important;
    background-color: var(--central-control-surface) !important;
    color: var(--central-control-text) !important;
    box-shadow: none !important;
}

html body:has(.mac-shell) #app select:focus,
html body:has(.mac-shell) #app select:focus-visible {
    border-color: var(--central-control-primary) !important;
    outline: 0 !important;
}

html body:has(.mac-shell) #app select[aria-invalid="true"] {
    border-color: var(--mud-palette-error) !important;
}

/* MudBlazor Adaptive owns the measured trigger minimum; content may widen every select popover. */
html body .mud-popover.mud-popover-adaptive-width:has(.mud-list > .mud-list-item),
html body .mud-popover.central-status-page-select-popover,
html body .mud-popover.central-card-title-search-popover {
    width: max-content !important;
    max-width: calc(100vw - 24px) !important;
}

html body .mud-popover.mud-popover-adaptive-width:has(.mud-list > .mud-list-item),
html body .mud-popover.central-status-page-select-popover,
html body .mud-popover.central-card-title-search-popover {
    border: 1px solid var(--central-control-border) !important;
    border-radius: 14px !important;
    background: var(--central-control-surface) !important;
    color: var(--central-control-text) !important;
    box-shadow: 0 12px 28px rgba(27, 28, 28, .16) !important;
    box-sizing: border-box !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    backdrop-filter: none !important;
}

html body .mud-popover.mud-popover-adaptive-width:has(.mud-list > .mud-list-item) .mud-paper,
html body .mud-popover.mud-popover-adaptive-width:has(.mud-list > .mud-list-item) .mud-list,
html body .mud-popover.central-status-page-select-popover :is(.mud-paper, .mud-popover-paper, .mud-list),
html body .mud-popover.central-card-title-search-popover :is(.mud-paper, .mud-popover-paper, .mud-list) {
    width: max-content !important;
    min-width: 100% !important;
    max-width: none !important;
    border: 0 !important;
    background: var(--central-control-surface) !important;
    color: var(--central-control-text) !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
}

html body .mud-popover.mud-popover-adaptive-width:has(.mud-list > .mud-list-item) .mud-list,
html body .mud-popover.central-status-page-select-popover .mud-list,
html body .mud-popover.central-card-title-search-popover .mud-list {
    padding: 5px !important;
}

html body .mud-popover.mud-popover-adaptive-width:has(.mud-list > .mud-list-item) .mud-list-item,
html body .mud-popover.central-status-page-select-popover .mud-list-item,
html body .mud-popover.central-card-title-search-popover .mud-list-item {
    width: max-content !important;
    min-width: 100% !important;
    max-width: none !important;
    min-height: 34px !important;
    padding: 5px 10px !important;
    border-radius: 10px !important;
    background: transparent !important;
    color: var(--central-control-soft) !important;
    font-size: .8rem !important;
    font-weight: 400 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
}

html body .mud-popover.mud-popover-adaptive-width:has(.mud-list > .mud-list-item) .mud-list-item:hover,
html body .mud-popover.mud-popover-adaptive-width:has(.mud-list > .mud-list-item) .mud-list-item:focus-visible,
html body .mud-popover.mud-popover-adaptive-width:has(.mud-list > .mud-list-item) .mud-list-item.mud-selected-item,
html body .mud-popover.central-status-page-select-popover .mud-list-item:hover,
html body .mud-popover.central-status-page-select-popover .mud-list-item:focus-visible,
html body .mud-popover.central-status-page-select-popover .mud-list-item.mud-selected-item,
html body .mud-popover.central-card-title-search-popover .mud-list-item:hover,
html body .mud-popover.central-card-title-search-popover .mud-list-item:focus-visible,
html body .mud-popover.central-card-title-search-popover .mud-list-item.mud-selected-item {
    background: var(--central-control-primary-soft) !important;
    color: var(--central-control-primary-strong) !important;
}

html body .mud-popover.mud-popover-adaptive-width:has(.mud-list > .mud-list-item) :is(.mud-list-item-text, .mud-typography),
html body .mud-popover.central-status-page-select-popover :is(.mud-list-item-text, .mud-typography),
html body .mud-popover.central-card-title-search-popover :is(.mud-list-item-text, .mud-typography) {
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
}

:is(body.theme-dark, body[data-theme="dark"]) .mud-popover.mud-popover-adaptive-width:has(.mud-list > .mud-list-item) {
    box-shadow: 0 16px 34px rgba(0, 0, 0, .34) !important;
}

/* Selection values are regular text; field labels keep their own hierarchy. */
html body:has(.mac-shell) #app .mud-select .mud-select-input,
html body:has(.mac-shell) #app .mud-select .mud-select-input *,
html body:has(.mac-shell) #app .mud-autocomplete input[role="combobox"],
html body:has(.mac-shell) #app select {
    font-weight: 400 !important;
}
