/* ============ *
 * ## Button ##
 * ============ */

.ui-button {
    background: var(--ui-button-bg);
    border-radius: 11px;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    height: 22px;
    gap: 10px;
    padding: 0 10px;
    user-select: none;
    white-space: nowrap;

    transition: background 0.25s;
}
.ui-button:hover {
    background: var(--ui-button-hover-bg);
}

.ui-button[disabled] {
    background: var(--ui-button-disabled-bg);
    cursor: default;
    pointer-events: none;
}

.ui-button .icon,
.ui-button .label {
    pointer-events: none;
}

.ui-button .icon {
    float: left;
    height: 100%;
    position: relative;
    width: 12px;

    fill: #FFF;
}

.ui-button .icon svg {
    fill: var(--white);
    float: left;
    height: 100%;
    position: relative;
    stroke: var(--white);
    stroke-width: 5px;
    width: 100%;
}

.ui-button .label {
    color: var(--ui-button-text);
    float: left;
    font-size: 10px;
    font-weight: bold;
    line-height: 22px;
    position: relative;
    text-align: center;
    text-transform: uppercase;
}

.ui-button[disabled] .icon,
.ui-button[disabled] .label {
    opacity: .5;
}

.ui-button[disabled] .label {
    color: var(--ui-button-disabled-text);
}

/* ## rounded */
.ui-button.rounded {
    border-radius: 11px;
    padding: 5px;
    width: 22px;
}

.ui-button.rounded .icon { width: 100%; }


/* ============== *
 * ## Checkbox ##
 * ============== */

.ui-checkbox {
    display: flex;
    flex-direction: row;
    height: 22px;
    gap: 10px;
}

.ui-checkbox .button {
    float: left;
    height: 100%;
    order: 0;
    position: relative;
    width: 22px;
}

.ui-checkbox .button input {
    cursor: pointer;
    height: 100%;
    left: 0;
    opacity: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 2;
}

.ui-checkbox .button .background {
    border-style: solid;
    border-width: 1px;
    height: 100%;
    left: 0;
    opacity: 1;
    pointer-events: none;
    position: absolute;
    top: 0;
    width: 100%;

    background: var(--grey-light);
    border-color: var(--grey);
}
.ui-checkbox.checked .button .background {
    background: var(--primary);
    border-color: var(--primary);
}

.ui-checkbox .button .icon,
.ui-checkbox .button .icon svg {
    float: left;
    height: 100%;
    pointer-events: none;
    position: relative;
    width: 100%;
}

.ui-checkbox .button .icon {
    padding: 5px;
    z-index: 1;
}
.ui-checkbox .button .icon svg {
    opacity: 0;
    transition: opacity .25s;

    fill: #636363;
}
.ui-checkbox.checked .button .icon svg { fill: #FFF; }

.ui-checkbox.checked .button input + .icon svg { opacity: 1; }

.ui-checkbox:not(.disabled) label:hover + .button .icon svg,
.ui-checkbox:not(.disabled) .button:hover .icon svg {
    opacity: .5;
}

.ui-checkbox.disabled .button .background,
.ui-checkbox.disabled .button .icon {
    opacity: .5;
}

.ui-checkbox.disabled .button input { pointer-events: none; }

.ui-checkbox label {
    cursor: pointer;
    line-height: 20px;
    opacity: 1;
    order: 1;
    white-space: nowrap;
}

.ui-checkbox label.disabled {
    pointer-events: none;
    opacity: .5;
}


/* ================== *
 * ## Dynamic List ##
 * ================== */

.ui-dynamic-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ui-dynamic-list .header {
    display: flex;
    flex-direction: row;
    gap: 12px;
}

.ui-dynamic-list .header .title {
    color: var(--ui-dynamic-list-title-text);
    flex: 1;
    font-weight: bold;
    height: 22px;
    line-height: 22px;
    text-transform: uppercase;
}

.ui-dynamic-list .header .ui-button {
    flex: 0;
}

.ui-dynamic-list .list-container {
    display: flex;
    flex-direction: column;
}

.ui-dynamic-list .list-header {
    border-color: var(--ui-dynamic-list-list-header-bc);
    border-style: solid;
    border-width: 0 1px;
    background: var(--ui-dynamic-list-list-header-bg);
    display: flex;
    flex-direction: row;
    gap: 10px;
    padding: 0 21px 0 11px;
}

.ui-dynamic-list .list-header .button,
.ui-dynamic-list .list-header .label {
    color: var(--white);
    font-size: 10px;
    line-height: 20px;
    text-transform: uppercase;
    white-space: nowrap;
}
.ui-dynamic-list .label + .button { margin-left: auto; }

.ui-dynamic-list .list-wrapper {
    border-color: var(--ui-dynamic-list-list-wrapper-bc);
    border-style: solid;
    border-width: 1px;
    float: left;
    height: 100%;
    overflow: hidden;
    padding: 5px;
    position: relative;
    width: 100%;
}

.ui-dynamic-list .list {
    float: left;
    height: 100%;
    overflow: auto;
    position: relative;
    width: 100%;
}

.ui-dynamic-list .list .list-row {
    cursor: pointer;
    display: flex;
    flex-direction: row;
    gap: 0 10px;
    line-height: 22px;
    padding: 5px;
    position: relative;
    user-select: none;
    width: calc(100% - 5px);
}

.ui-dynamic-list .list .list-row .list-cell {
    white-space: nowrap;
}

.ui-dynamic-list .list .list-row .list-cell .label {
    float: left;
    position: relative;
}

.ui-dynamic-list .list .list-row:nth-child(odd) {
    background: var(--grey-light);
}

.ui-dynamic-list .list .list-row:hover {
    background: var(--grey);
}

.ui-dynamic-list .list .list-row .label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ui-dynamic-list .list .list-row .label.color-indicator {
    border-color: var(--grey);
    border-radius: 4px;
    border-style: solid;
    border-width: 1px;
    margin: 3px 0;
}

.ui-dynamic-list .list .list-row .button {
    display: flex;
    justify-content: end;
    margin-left: auto;
}


/* =========== *
 * ## Input ##
 * =========== */

.ui-input {
    border-radius:4px;
    display: flex;
    flex-direction: row;
    gap: 10px;
    height: 22px;
}

.ui-input .input-container {
    background: var(--white);
    border-color: #B0B0B0;
    border-radius: 4px;
    border-style: solid;
    border-width: 1px;
    display: flex;
    flex-direction: row;
    width: 150px;
}

.ui-input .search-tools-container {
    display: none;
    flex: 20px;
}
.ui-input .input-container.has-tools .search-tools-container { display: block; }

.ui-input .search-tools-container .tool-clear,
.ui-input .search-tools-container .tool-search {
    cursor: pointer;
    display: none;
    height: 100%;
    padding: 5px;
    width: 100%;
}

.ui-input .tool-clear svg,
.ui-input .tool-search svg {
    fill: var(--grey);
    float: left;
    height: 100%;
    position: relative;
    stroke: var(--grey);
    stroke-width: 4px;
    width: 100%;
}

.ui-input .tool-clear:hover svg,
.ui-input .tool-search:hover svg {
    fill: var(--primary);
    stroke: var(--primary);
}

.ui-input .input-container input {
    border-width: 0;
    color: var(--grey-dark);
    font-size: 12px;
    height: 20px;
    line-height: 20px;
    outline: none;
    padding: 0 0 0 10px;
    width: 100%;

    background: transparent;
}
.ui-input .input-container.has-tools input { width: calc(100% - 20px); }

.ui-input .input-container input::placeholder {
    color: var(--grey);
    font-style: italic;
}


/* =========== *
 * ## Popup ##
 * =========== */

.ui-popup-overlay {
    height: 100vh;
    left: 0;
    pointer-events: none;
    position: fixed;
    top: 0;
    width: 100vw;
    z-index: 9999;
}
.ui-popup-overlay .mouse-blocker {
    background: rgba(0,0,0,.33);
    float: left;
    height: 100%;
    opacity: 0;
    position: relative;
    width: 100%;
    z-index: 0;

    transition: opacity .25s;
}

.ui-popup-overlay.active { pointer-events: all; }
.ui-popup-overlay.active .mouse-blocker { opacity: 1; }

.ui-popup {
    background: var(--ui-popup-bg);
    border-radius: 6px;
    box-shadow: 0 1px 5px 1px rgb(0 0 0 / 25%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    left: 50%;
    max-width: 40vw;
    position: absolute;
    top: 50%;
}

.ui-popup[type="alert"] { max-width: min(40vw, 250px); }

.ui-popup .role-header,
.ui-popup .role-content,
.ui-popup .role-buttons {
    padding: 0 10px;
}

.ui-popup .role-header {
    background: var(--ui-popup-header-bg);
    border-radius: 6px 6px 0 0;
    border-style: solid;
    border-width: 0 0 1px 0;
    color: var(--ui-popup-header-text);
    cursor: move;
    font-weight: bold;
    height: 27px;
    line-height: 27px;
    text-transform: uppercase;
    user-select: none;
    z-index: 2;

    border-color: #E0E0E0;
}

.ui-popup .role-content {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    gap: 10px;
    line-height: 16px;
    max-height: 50vh;
    overflow: visible auto;
    padding-top: 10px;
    z-index: 1;
}

.ui-popup .role-content p {
    margin-block-end: 0;
    margin-block-start: 0;
}

.ui-popup .role-content ul {
    margin-block-end: 0;
    margin-block-start: 0;
    padding-inline-start: 20px;
}

.ui-popup .role-content .ui-row > .value { flex: 1; }

.ui-popup .role-content .form-constant {
    line-height: 22px;
}

.ui-popup .role-header + .role-content { padding-top: 0; }

.ui-popup .role-buttons {
    border-style: solid;
    border-width: 1px 0 0 0;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding-bottom: 10px;
    padding-top: 10px;
    z-index: 0;

    border-color: #E0E0E0;
}
.ui-popup .role-buttons[num="1"] { justify-content: space-around }


/* ========= *
 * ## Row ##
 * ========= */

.ui-row,
.ui-row .ui-sub-row {
    display: flex;
    flex-direction: row;
    font-size: 11px;
    gap: 10px;
    line-height: 22px;
    user-select: none;
}

.ui-row > .description,
.ui-row .ui-sub-row > .description,
.ui-row > .label,
.ui-row .ui-sub-row > .label {
    height: 22px;
    line-height: 22px;
    user-select: none;
    white-space: nowrap;
}

.ui-row > .label,
.ui-row .ui-sub-row > .label {
    font-weight: bold;
    text-transform: capitalize;
}

.ui-row > .value,
.ui-row .ui-sub-row > .value {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
}


/* ============ *
 * ## Select ##
 * ============ */

.ui-select {
    display: flex;
    flex-direction: column;
    float: left;
    max-width: 100%;
    min-width: 100px;
    position: relative;
}

.ui-select .button {
    border-style: solid;
    border-width: 1px;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    height: 22px;

    border-color: var(--grey);
}

.ui-select .button > .icon {
    border-color: var(--grey);
    border-style: solid;
    border-width: 0 0 0 1px;
    height: 100%;
    order: 999;
    padding: 3px;
    pointer-events: none;
    width: 20px;

    background: var(--grey-light);
}

.ui-select .button .icon svg {
    fill: var(--grey-dark);
    float: left;
    height: 100%;
    position: relative;
    width: 100%;
}

.ui-select .button > .icon svg {
    transform: rotate(0deg);
    transition: transform .25s;
}

.ui-select.open .button > .icon svg {
    transform: rotate(180deg);
}

.ui-select[disabled] {
    cursor: default;
    opacity: .5;
    pointer-events: none;
}

.ui-select .button .values-container {
    flex: 1;
    overflow: hidden;
    padding: 0 10px;
}

.ui-select .values-container .values {
    display: flex;
    flex-direction: row;
    gap: 6px;
    overflow: hidden;
    position: relative;
    width: 100%;
    z-index: 0;
}
.ui-select .values-container .values.overflow:after {
    background-color: var(--white);
    content: "...";
    line-height: 20px;
    padding-left: 2px;
    position:absolute;
    right: 0;
    z-index: 1;
}

.ui-select .button .value {
    display: flex;
    flex-direction: row;
    gap: 5px;
    height: 20px;
    order: 0;
    position: relative;
}

.ui-select .button .value + .value:after {
    content: ",";
    left: -5px;
    line-height: 20px;
    pointer-events: none;
    position: absolute;
}

.ui-select .button .value .icon {
    order: 0;
}

.ui-select .button .value .label {
    flex: 1;
    line-height: 20px;
    order: 1;
    overflow: hidden;
    pointer-events: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ui-select .button .value.placeholder .label {
    color: var(--grey);
    font-style: italic;
}

.ui-select[customvalue] .button input,
.ui-select[filter] .button input {
    border-style: solid;
    border-width: 0;
    box-sizing: border-box;
    display: none;
    flex: 1;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    height: 20px;
    line-height: 20px;
    order: 0;
    padding: 0;
    text-shadow: inherit;
    width: 100%;
}

.ui-select[customvalue].open .button input,
.ui-select[filter].open .button input {
    display: block;
}

.ui-select[customvalue].open .button .values .value,
.ui-select[filter].open .button .values .value {
    display: none;
}

.ui-select .list-wrapper {
    height: 0;
    position: fixed;
    overflow: hidden;

    transition: height .25s;
}

.ui-select.reverse .list-wrapper {
    top: unset;
}

.ui-select .list-scroller {
    border-style: solid;
    border-width: 1px;
    float: left;
    max-height: 200px;
    min-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;

    background: #FFFFFF;
    border-color: #B0B0B0;
}

.ui-select .list,
.ui-select .list .ui-option-wrapper {
    display: flex;
    flex-direction: column;
}

.ui-select .ui-option {
    display: flex;
    flex-direction: row;
    gap: 5px;
}

.ui-select .button .value .icon,
.ui-select .ui-option .icon {
    float: left;
    order: 1;
    padding: 5px 0;
    position: relative;
}

.ui-select .ui-option .icon svg {
    fill: var(--grey-dark);
    float: left;
    height: 100%;
    position: relative;
    width: 100%;
}

.ui-select .ui-option .label { order: 2; }

.ui-select .ui-option-group .group-label,
.ui-select .ui-option,
.ui-select .no-filter-result {
    padding: 0 10px;
    white-space: nowrap;
}

.ui-select .ui-option-group .group-label {
    text-transform: uppercase;
}

.ui-select .ui-option .match.highlight {
    font-weight: bold;
    text-decoration: underline;
}

.ui-select .ui-option:not([disabled]) { cursor: pointer; }

.ui-select .ui-option:not([disabled]).filtered.target,
.ui-select .ui-option:not([disabled]):hover {
    background: #DBDBDB;
}

.ui-select .ui-option:not([disabled])[selected].filtered.target,
.ui-select .ui-option:not([disabled])[selected]:hover {
    background: var(--primary-dark);
}

.ui-select .ui-option[selected] {
    font-weight: bold;

    background: var(--primary);
    color: var(--white);
}

.ui-select .ui-option[selected] .icon svg { fill: var(--white); }
.ui-select .ui-option[disabled] {
    opacity: .5;
    pointer-events: none;
}

.ui-select .ui-option-group .group-label {
    cursor: default;
    font-weight: bold;
    user-select: none;
}

.ui-select .ui-option-group:not(:last-child) .group-list {
    border-bottom: 1px solid var(--grey-light);
}

.ui-select:not([grid]) .ui-option-group .ui-option {
    padding-left: 20px;
}

/* ## no-grid-base-layout ## */
.ui-select .ui-option-group .group-label,
.ui-select:not([grid]) .no-filter-result,
.ui-select:not([grid]) .ui-option {
    height: 24px;
    line-height: 24px;
    width: 100%;
}


/* ## grid-based-layout ## */
.ui-select[grid] .list .ui-option-wrapper {
    display: grid;
    gap: 5px;
    padding: 5px;
}

.ui-select[grid] .no-filter-result,
.ui-select[grid] .ui-option {
    background: var(--grey-light);
    border-color: var(--grey);
    border-radius: 4px;
    border-style: solid;
    border-width: 1px;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    height: 22px;
}

.ui-select[grid] .no-filter-result .icon,
.ui-select[grid] .ui-option .icon {
    height: 100%;
    padding: 4px 0;
    width: 12px;
}

.ui-select[grid] .no-filter-result .label,
.ui-select[grid] .ui-option .label {
    color: var(--grey-dark);
    height: 100%;
    line-height: 20px;
    white-space: nowrap;
}

.ui-select[grid] .ui-option:hover {
    background-color: var(--grey);
    border-color: var(--grey-dark);
}

.ui-select[grid] .ui-option:hover .label {
    color: var(--white);
}
.ui-select[grid] .ui-option:hover .icon svg {
    fill: var(--white);
}

.ui-select[grid] .ui-option[selected] {
    background: var(--primary);
    border-color: var(--primary-dark);
}

.ui-select[grid] .ui-option[selected] .icon {
}

.ui-select[grid] .ui-option[selected] .label {
    color: var(--white);
    font-weight: bold;
}

.ui-select .no-filter-result {
    cursor: default;
    order: 9999;
    user-select: none;
}

.ui-select .list-scroller.scrollable .ui-option { width: calc(100% - 5px); }