.dbqstsd-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    min-width: 0;

    .dbqstsd-output-button {
        outline: 0;
        background: none;
        border: none;
        padding: 0;
        margin: 0;
        width: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        opacity: 1;

        .dbqstsd-output-content-container {
            display: flex;
            flex-direction: column;
            justify-content: center;
            border: $field-border-width solid $modal-border-color;
            outline: 0;
            width: 100%;
            height: $field-height;
            -moz-appearance: none;
            -webkit-appearance: none;
            -ms-appearance: none;
            -o-appearance: none;
            appearance: none; 
            text-align: left;
            background: $modal-input-background;
            background-repeat: no-repeat;
            background-image: url("data:image/svg+xml;utf8,<svg fill='%23" + str-slice("#{color(text-color-default)}", 2) + "' height='20' viewBox='0 0 20 20' width='20' xmlns='http://www.w3.org/2000/svg'><g><path d='M10,16L0,6l2-2l8,8l8-8l2,2L10,16z'/></g></svg>");
            background-position-x: calc(100% - 10px);
            background-position-y: 50%;
            background-size: 10px 10px;
            border-radius: 0 0 $border-radius-default $border-radius-default;
            padding-left: 10px;
            color: $modal-input-color;
            padding: 0 30px 0 10px;
            font-weight: $field-font-weight;
            font-size: $field-font-size;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;

            &:focus {
                border-color: $color-primary !important;
                outline: 0;
                -webkit-box-shadow: none;
                -moz-box-shadow: none;
                box-shadow: none;
            }
            &:disabled,
            &.disabled {
                background: $modal-disabled-color;
                border: $field-border-width solid $modal-disabled-color;
                opacity: 1;
                color: $material-design-disabled-label-color;
                cursor: not-allowed;
                -webkit-text-fill-color: $material-design-disabled-label-color;
                -webkit-opacity: 1; /* Override iOS opacity change affecting text & background color */
            }

            &.dbqstsd-invalid {
                border-color: $select-type-popup-invalid-color;
            } 

            .dbqstsd-output-item {
                display: flex;
                align-items: center;
                margin-bottom: ($margin-default / 3);

                &:last-child {
                    margin-bottom: 0px;
                }

                .dbqstsd-attribute {
                    display: block;
                    width: 100%;

                    .dbqstsd-attribute-name {
                        float: left;
                        font-size: $font-size-small;
                        line-height: 14px;
                        color: #999;
                        margin-bottom: ($margin-default / 5);
                    }

                    .dbqstsd-attribute-value {
                        float: left;
                        width: 100%;
                        text-align: left;
                        overflow-wrap: break-word;
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        user-select: text;
                    }
                }
            }

            .dbqstsd-error {
                color: $select-type-popup-invalid-color;
            }
        }
    }

    &[data-has-paging="true"] {
        .dbqstsd-output-button {
            .dbqstsd-output-content-container {
                background: none !important;
                padding: 0 !important;
            }
        }
    }

    .dbqdb-static-dropdown.error + .dbqstsd-output-button {
        .dbqstsd-output-content-container {
            border-color: $modal-error-border;
        }
    }
}

// The popup container will be moved to the end of the <body> tag upon opening. That's also why .dbqstsd-popup-container is outside of .dbqstsd-container in the CSS file.
.dbqstsd-popup-container {
    // width: 100%;
    padding: 0 0 ($padding-default / 3) 0;
    background: $modal-label-background;
    overflow: hidden;
    z-index: 1060;

    .dbqstsd-items {
        .dbqstsd-no-result {
            color: $modal-label-color;
        }
    }
    
    .dbqstsd-title-container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: ($padding-default / 3);// ($padding-default / 2);
        color: $modal-label-color;
        font-size: $font-size-small;
        font-weight: 600;
        
        .dbqstsd-close {
            width: 12px;
            height: 12px;
            margin-left: 5px;
            display: inline-flex;
            cursor: pointer;
            align-items: center;
            justify-content: center;
            svg {
                fill: $modal-label-color;
            }
        }
    }

    .dbqstsd-search-input {
        width: calc(100% - 16px);
        //margin: 0px ($margin-default / 2) ($margin-default / 3) ($margin-default / 2);
        padding: 1px ($padding-default / 3);
        min-height: 30px;
        max-height: 30px;
        height: 30px;
        border-radius: 6px !important;
        font-size: $font-size-small;
        @include search-field;
    }

    ul {
        list-style: none;
        padding: ($padding-default / 2) 0;
        margin: 0;
        max-height: 250px;
        overflow-y: auto;
        background-color: $modal-input-background;
        @include scrollbar($sidebar-background, 0, $sidebar-scrollbar-thumb-color, $sidebar-scrollbar-thumb-color-hover, $sidebar-scrollbar-width, true);

        span {
            font-size: $font-size-small;
            font-weight: 400;

            svg {
                fill: $text-color-default !important;
            }
        }

        .dbqstsd-no-result {
            display: block;
            margin: 0 ($margin-default / 2);
        }

        .dbqstsd-error {
            color: $select-type-popup-invalid-color;
        }

        li.dbqstsd-list-item {
            color: $text-color-default;
            cursor: pointer;
            display: block;
            outline: 0;
            position: relative;
            font-weight: 600;
            padding: 0px ($padding-default / 2) !important;
            margin: 0px;
            width: 100%;
        
            user-select: none; /* CSS3 (little to no support) */
            -ms-user-select: none; /* IE 10+ */
            -moz-user-select: none; /* Gecko (Firefox) */
            -webkit-user-select: none; /* Webkit (Safari, Chrome) */

            .dbqstsd-list-item-content {
                flex-wrap: nowrap;
                padding: 0px;
                position: relative;
                display: flex;
                -webkit-box-pack: start;
                justify-content: flex-start;
                -webkit-box-align: center;
                align-items: center;
                border-radius: 6px;

                .dbqstsd-attribute {
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    width: 100%;

                    .dbqstsd-attribute-name {
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                    }

                    .dbqstsd-attribute-checkmark {
                        height: 16px;
                        margin-left: 5px;
                        margin-bottom: 4px;
                        display: none;
                        fill: $text-color-default;
                        flex-shrink: 0;
                    }
                }
            }

            &:hover,
            &.dbqstsd-selected-list-item {
                background: transparent !important;
                color: transparent !important;

                .dbqstsd-list-item-content {
                    color: $color-primary !important;
                }
            }

            &.dbqstsd-selected-list-item {
                .dbqstsd-list-item-content {
                    color: $color-gray-base !important;
                }

                .dbqstsd-attribute-checkmark {
                    display: none !important;
                }
            }
        }
    }

    ul.dbqstsd-selected-items {
        border-bottom: $field-border-width solid $modal-label-background;

        .dbqstsd-list-item.dbqstsd-selected-list-item {
            .dbqstsd-list-item-content {
                padding: ($padding-default / 3) ($padding-default / 2) !important;
                background: $background-item-color-default !important;
                color: $text-color-default !important;

                .dbqstsd-attribute-checkmark {
                    display: block !important;
                }
            }

            .dbqstsd-selected-list-item {
                background: transparent !important;
                color: transparent !important;
            }
        }
    }

    .dbqstsd-loading {
        margin: ($margin-default / 3) $margin-default;
    }

    .dbqstsd-buttons {
        display: flex;
        margin: ($margin-default / 3) ($margin-default / 3) 0 ($margin-default / 3);

        .dbqstsd-button {
            background: $color-primary;
            color: $color-white;
            border: none;
            margin-right: 5px;
            padding: 0;
            outline: 0;
            width: 24px;
            height: 24px;
            border-radius: 50%;

            svg {
                fill: $color-white;
            }
        }
    }
}

.dbqstsd-loading {
    @include loading-indicator-inline;
}

.dbq-select-view-button,
.dbq-select-add-button {
    color: #000000;
    border-color: $modal-border-color;
    margin-left: 5px;
    transition: none !important;
    outline: 0;
    &:hover {
        color: color(text-color-default);
        border-color: $modal-border-color;
        background: $modal-input-background;
        svg {
            fill: color(text-color-default);
        }
    }
    &:active {
        background: $modal-input-background;
        border-color: $modal-border-color;
        &:hover {
            background: $modal-input-background;
            border-color: $modal-border-color;
        }
    }
    svg {
        fill: $color-primary;
    }
}

/* No label styling */
.dbq-property-no-label {
    .dbqdb-select-single,
    .dbqdb-select-single-tree {
        .dbqstsd-output-content-container {
            border-radius: $border-radius-default !important;
        }

        /* The border radius must change depending on which buttons are visible */
        &[data-inspect-folder-document-id][data-has-value="true"]:not([data-inspect-folder-document-id=""]) {
            .dbqstsd-output-content-container {
                border-top-right-radius: 0 !important;
                border-bottom-right-radius: 0 !important;
            }

            .dbq-select-view-button {   //Commented out because it's causing trouble with the material design styling
                //border-top-right-radius: $border-radius-default !important;
                //border-bottom-right-radius: $border-radius-default !important;
            }
        }
        &[data-inspect-add-rule-code]:not([data-inspect-add-rule-code=""]) {
            .dbqstsd-output-content-container {
                border-top-right-radius: 0 !important;
                border-bottom-right-radius: 0 !important;
            }
        }
        &[data-inspect-folder-document-id][data-inspect-add-rule-code][data-has-value="true"]:not([data-inspect-folder-document-id=""]):not([data-inspect-add-rule-code=""]) {
            .dbq-select-view-button {
                border-top-right-radius: 0 !important;
                border-bottom-right-radius: 0 !important;
            }
        }
    }
}