/*
 * Portal ui-select final alignment.
 * This file is loaded after angular-ui-select/select2/selectize CSS by the
 * ui.select lazy module, so populated list text stays left-aligned from paint.
 */
html body.ff-app.ff-app.ff-app ui-select,
html body.ff-app.ff-app.ff-app ui-select-match,
html body.ff-app.ff-app.ff-app ui-select-choices,
html body.ff-app.ff-app.ff-app .dx-field-value ui-select,
html body.ff-app.ff-app.ff-app .dx-field-value ui-select-match,
html body.ff-app.ff-app.ff-app .dx-field-value ui-select-choices {
    direction: ltr !important;
    text-align: left !important;
    text-align-last: left !important;
}

html body.ff-app.ff-app.ff-app ui-select,
html body.ff-app.ff-app.ff-app ui-select-match {
    display: block !important;
    float: none !important;
    max-width: 100% !important;
    width: 100% !important;
}

html body.ff-app.ff-app.ff-app ui-select *,
html body.ff-app.ff-app.ff-app ui-select-match *,
html body.ff-app.ff-app.ff-app ui-select-choices * {
    direction: ltr !important;
    text-align: left !important;
    text-align-last: left !important;
}

html body.ff-app.ff-app.ff-app .ui-select-container,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap > .ui-select-match,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap > .ui-select-match > .btn,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap > .ui-select-match > .ui-select-toggle,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-search,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-placeholder,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-match-text,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-match-text *,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-choices-row-inner,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-choices-row-inner *,
html body.ff-app.ff-app.ff-app .select2-container .select2-choice,
html body.ff-app.ff-app.ff-app .select2-container .select2-chosen,
html body.ff-app.ff-app.ff-app .selectize-input,
html body.ff-app.ff-app.ff-app .selectize-input input {
    direction: ltr !important;
    text-align: left !important;
    text-align-last: left !important;
}

html body.ff-app.ff-app.ff-app .ui-select-bootstrap > .ui-select-match > .btn,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap > .ui-select-match > .ui-select-toggle {
    align-items: center !important;
    display: flex !important;
    justify-content: flex-start !important;
}

html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-placeholder,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-match-text {
    display: block !important;
    flex: 1 1 auto !important;
    float: none !important;
    justify-content: flex-start !important;
    margin-left: 0 !important;
    margin-right: auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-placeholder.ng-hide,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-match-text.ng-hide,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-match-text.ng-hide *,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-search.ng-hide,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-match.ng-hide,
html body.ff-app.ff-app.ff-app ui-select-match.ng-hide {
    display: none !important;
}

html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-match-text.pull-left,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-match-text.pull-right,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-placeholder.pull-left,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-placeholder.pull-right {
    float: none !important;
}

html body.ff-app.ff-app.ff-app .ui-select-bootstrap > input.ui-select-search,
html body.ff-app.ff-app.ff-app .ui-select-bootstrap .ui-select-search {
    direction: ltr !important;
    text-align: left !important;
}

/* Capture pages and explicitly opted-in master lists use one persistent text
   input per ui-select. Ordinary portal lists retain ui-select's native
   open/close lifecycle. */
html body.ff-app.ff-app.ff-app .ui-select-container.ff-capture-ui-select-stable {
    position: relative !important;
}

html body.ff-app.ff-app.ff-app .ui-select-container.ff-capture-ui-select-stable > .ui-select-match,
html body.ff-app.ff-app.ff-app .ui-select-container.ff-capture-ui-select-stable > .ui-select-match.ng-hide {
    animation: none !important;
    display: block !important;
    inset: 0 !important;
    opacity: 1 !important;
    pointer-events: none !important;
    position: absolute !important;
    transition: none !important;
    visibility: visible !important;
    z-index: 3 !important;
}

html body.ff-app.ff-app.ff-app .ui-select-container.ff-capture-ui-select-stable > .ui-select-match > .ui-select-toggle {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    pointer-events: none !important;
}

html body.ff-app.ff-app.ff-app .ui-select-container.ff-capture-ui-select-stable > .ui-select-match :is(.ui-select-match-text, .ui-select-placeholder) {
    visibility: hidden !important;
}

html body.ff-app.ff-app.ff-app .ui-select-container.ff-capture-ui-select-stable > .ui-select-match :is(.caret, a.btn-link, .ui-select-match-close) {
    pointer-events: auto !important;
    visibility: visible !important;
}

html body.ff-app.ff-app.ff-app .ui-select-container.ff-capture-ui-select-stable > .ui-select-match a.btn-link {
    color: var(--primary-seed, #337ab7) !important;
    opacity: 1 !important;
    text-decoration: none !important;
}

html body.ff-app.ff-app.ff-app .ui-select-container.ff-capture-ui-select-stable > .ui-select-match a.btn-link:hover,
html body.ff-app.ff-app.ff-app .ui-select-container.ff-capture-ui-select-stable > .ui-select-match a.btn-link:focus {
    color: var(--primary-seed, #23527c) !important;
}

html body.ff-app.ff-app.ff-app .ui-select-container.ff-capture-ui-select-stable > input.ui-select-search,
html body.ff-app.ff-app.ff-app .ui-select-container.ff-capture-ui-select-stable > input.ui-select-search.ng-hide {
    animation: none !important;
    cursor: text !important;
    display: block !important;
    max-width: 100% !important;
    min-width: 0 !important;
    opacity: 1 !important;
    padding-right: 48px !important;
    position: relative !important;
    transition: none !important;
    visibility: visible !important;
    width: 100% !important;
    z-index: 2 !important;
}

html body.ff-app.ff-app.ff-app .ui-select-container.ff-capture-ui-select-stable > :is(.ui-select-choices, .ui-select-no-choice) {
    z-index: 1001 !important;
}

/* Users/Webusers: keep the open User lookup above the Branch row below it. */
html body.ff-app.ff-app.ff-app .ff-page.ff-users fieldset,
html body.ff-app.ff-app.ff-app .ff-page.ff-users .ff-users-main-col,
html body.ff-app.ff-app.ff-app .ff-page.ff-users .ff-users-main-col > .row,
html body.ff-app.ff-app.ff-app .ff-page.ff-users .ff-users-select-field,
html body.ff-app.ff-app.ff-app .ff-page.ff-users .ff-users-select-field .form-group {
    overflow: visible !important;
}

html body.ff-app.ff-app.ff-app .ff-page.ff-users .ff-users-identity-row {
    position: relative !important;
    z-index: 20 !important;
}

html body.ff-app.ff-app.ff-app .ff-page.ff-users .ff-users-select-field {
    position: relative !important;
    z-index: 25 !important;
}

html body.ff-app.ff-app.ff-app .ff-page.ff-users .ff-users-select-field ui-select,
html body.ff-app.ff-app.ff-app .ff-page.ff-users .ff-users-select-field .ui-select-container {
    position: relative !important;
    z-index: 26 !important;
}

html body.ff-app.ff-app.ff-app .ff-page.ff-users .ff-users-select-field .ui-select-container.open,
html body.ff-app.ff-app.ff-app .ff-page.ff-users .ff-users-select-field .ui-select-container.ui-select-open {
    z-index: 1100 !important;
}

html body.ff-app.ff-app.ff-app .ff-page.ff-users .ff-users-select-field .ui-select-choices,
html body.ff-app.ff-app.ff-app .ff-page.ff-users .ff-users-select-field .ui-select-dropdown,
html body.ff-app.ff-app.ff-app .ff-page.ff-users .ff-users-select-field .dropdown-menu {
    z-index: 1101 !important;
}

/* Stable shared overlays. Only the control and its popup change stacking
   while open; opening a list must not relayout every ancestor row, panel,
   grid and scroll container. */
html body.ff-app.ff-app.ff-app :is(.ui-select-container.open, .ui-select-container.ui-select-open, .ui-select-bootstrap.open, ui-select.open) {
    background-color: var(--ff-ctrl-bg, var(--surface, #fff)) !important;
    box-sizing: border-box !important;
    min-height: var(--ff-control-h, 30px) !important;
    overflow: visible !important;
    position: relative !important;
    z-index: 30020 !important;
}

/* ui-select swaps the selected match for its search input when opening.
   Keep that real input painted throughout Angular's open transition so the
   field cannot disappear for a frame before its choices are shown. */
html body.ff-app.ff-app.ff-app
    :is(.ui-select-container.open, .ui-select-container.ui-select-open, .ui-select-bootstrap.open, ui-select.open)
    > input.ui-select-search:not(.ui-select-search-hidden) {
    animation: none !important;
    background-color: var(--ff-ctrl-bg, var(--surface, #fff)) !important;
    box-sizing: border-box !important;
    display: block !important;
    min-height: var(--ff-control-h, 30px) !important;
    opacity: 1 !important;
    transition: none !important;
    visibility: visible !important;
    width: 100% !important;
}

html body.ff-app.ff-app.ff-app :is(.btn-group.open, [uib-dropdown].open, .input-group-btn.open, .multiselect-parent.open, .dropdown-multiselect.open, .dropdown.open:not(.ui-select-container):not(.ui-select-bootstrap)) {
    overflow: visible !important;
    position: relative !important;
    z-index: 30020 !important;
}

html body.ff-app.ff-app.ff-app :is(.btn-group.open, [uib-dropdown].open, .input-group-btn.open, .multiselect-parent.open, .dropdown-multiselect.open, .dropdown.open:not(.ui-select-container):not(.ui-select-bootstrap)) > :is(.dropdown-menu, .generate-menu, [uib-dropdown-menu]) {
    z-index: 30030 !important;
}

/* Angular UI Select owns the choices/no-choice visibility through ng-show.
   Never let a generic Bootstrap overlay rule reveal a hidden empty-state
   panel over valid options. */
html body.ff-app.ff-app.ff-app .ui-select-container > .ui-select-no-choice.ng-hide {
    display: none !important;
    pointer-events: none !important;
}

html body.ff-app.ff-app.ff-app :is(.dropdown-menu, .generate-menu, [uib-dropdown-menu], .ui-select-choices, .ui-select-dropdown, .ui-select-no-choice, .select2-drop, .select2-dropdown, .selectize-dropdown, .uib-datepicker-popup.dropdown-menu) {
    z-index: 30030 !important;
}

html body.ff-app.ff-app.ff-app :is(.ui-select-container.open, .ui-select-container.ui-select-open, .ui-select-bootstrap.open, ui-select.open) > :is(.ui-select-choices, .ui-select-dropdown, .ui-select-no-choice),
html body.ff-app.ff-app.ff-app :is(.dropdown.open, .btn-group.open, [uib-dropdown].open, .input-group-btn.open, .multiselect-parent.open, .dropdown-multiselect.open) > :is(.dropdown-menu, .generate-menu, [uib-dropdown-menu]) {
    max-height: 360px;
    max-height: min(360px, calc(100dvh - 24px));
    overflow-x: hidden;
    overflow-y: auto;
}

html body.ff-app.ff-app.ff-app :is(.dx-overlay-wrapper, .dx-popup-wrapper, .dx-dropdowneditor-overlay, .dx-dropdownlist-popup-wrapper, .dx-selectbox-popup-wrapper, .dx-datebox-wrapper, .dx-calendar-navigator, .dx-loadpanel-wrapper) {
    z-index: 30040 !important;
}
