﻿:root {
    --ms-border-color: #aaa;
    --ms-border-radius: 4px;
    --ms-bg-color: #fff;
    --ms-text-color: #444;
    --ms-hover-bg: #f8f9fa;
    --ms-selected-bg: #b0d4f3;
    --ms-selected-color: #000;
    --ms-disabled-bg: #f4f4f4;
    --ms-height: 26px;
}

.ms-offscreen {
    clip: rect(0 0 0 0) !important;
    width: 1px !important;
    height: 1px !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    outline: 0 !important;
    left: auto !important;
    top: auto !important;
}

.ms-parent {
    display: inline-block;
    position: relative;
    vertical-align: middle;
    box-sizing: border-box;
}

.ms-choice {
    display: block;
    width: 100%;
    height: var(--ms-height);
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--ms-border-color);
    text-align: left;
    white-space: nowrap;
    line-height: var(--ms-height);
    color: var(--ms-text-color);
    text-decoration: none;
    border-radius: var(--ms-border-radius);
    background-color: var(--ms-bg-color);
    position: relative;
    user-select: none;
}

    .ms-choice.disabled {
        background-color: var(--ms-disabled-bg);
        border-color: #ddd;
        cursor: default;
    }

    .ms-choice > span {
        position: absolute;
        top: 0;
        left: 0;
        right: 20px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        padding-left: 8px;
    }

        .ms-choice > span.placeholder {
            color: #999;
        }

    .ms-choice > .icon-close {
        position: absolute;
        top: 0;
        right: 16px;
        height: 100%;
        width: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        color: #888;
    }

        .ms-choice > .icon-close:hover {
            color: #333;
        }

        .ms-choice > .icon-close::before {
            content: '×';
        }

    .ms-choice > .icon-caret {
        position: absolute;
        width: 0;
        height: 0;
        top: 50%;
        right: 8px;
        margin-top: -2px;
        border-color: #888 transparent transparent transparent;
        border-style: solid;
        border-width: 5px 4px 0 4px;
    }

.ms-drop {
    width: auto;
    height: fit-content;
    overflow: hidden;
    display: none;
    margin-top: -1px;
    padding: 0;
    position: absolute;
    z-index: 1000;
    background: #fff;
    color: #000;
    border: 1px solid var(--ms-border-color);
    border-radius: var(--ms-border-radius);
    box-sizing: border-box;
}

    .ms-drop.bottom {
        top: 100%;
        box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
    }

    .ms-drop.top {
        bottom: 100%;
        box-shadow: 0 -4px 5px rgba(0, 0, 0, 0.15);
    }

.ms-search {
    display: inline-block;
    margin: 0;
    min-height: 26px;
    padding: 4px;
    position: relative;
    white-space: nowrap;
    width: 100%;
    z-index: 10000;
    box-sizing: border-box;
}

    .ms-search input {
        width: 100%;
        height: auto !important;
        min-height: 24px;
        padding: 0 5px;
        margin: 0;
        outline: 0;
        font-family: sans-serif;
        border: 1px solid #aaa;
        border-radius: 5px;
        box-shadow: none;
        box-sizing: border-box;
    }

.ms-drop ul {
    overflow: auto;
    margin: 0;
    padding: 0;
    list-style: none;
}

    .ms-drop ul > li {
        list-style: none;
        display: block;
        position: static;
        padding: .25rem 8px;
        cursor: pointer;
    }

        .ms-drop ul > li.active {
            background-color: var(--ms-selected-bg) !important;
            color: var(--ms-selected-color);
            outline: 0;
        }

        .ms-drop ul > li.selected {
            /* Opzionale: stile per elementi checkati, se diverso da active */
        }

        .ms-drop ul > li .disabled {
            font-weight: normal !important;
            opacity: .35;
            cursor: default;
        }

        .ms-drop ul > li.group {
            clear: both;
        }

        .ms-drop ul > li label {
            position: relative;
            padding-left: 1.5rem;
            margin-bottom: 0;
            font-weight: normal;
            display: block;
            white-space: nowrap;
            cursor: pointer;
            user-select: none;
        }

            .ms-drop ul > li label.optgroup {
                font-weight: bold;
                padding-left: 0;
            }

        .ms-drop ul > li.hide-radio {
            padding: 0;
        }

            .ms-drop ul > li.hide-radio:focus,
            .ms-drop ul > li.hide-radio:hover {
                background-color: var(--ms-hover-bg);
            }

            .ms-drop ul > li.hide-radio.selected {
                color: #fff;
                background-color: #007bff;
            }

            .ms-drop ul > li.hide-radio label {
                margin-bottom: 0;
                padding: 5px 8px;
            }

            .ms-drop ul > li.hide-radio input {
                display: none;
            }

        .ms-drop ul > li.option-level-1 label {
            padding-left: 28px;
        }

.ms-drop input[type="radio"],
.ms-drop input[type="checkbox"] {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
}

.ms-drop .ms-no-results {
    display: none;
    padding: 8px;
    color: #888;
    text-align: center;
}
