//
// _select2.scss
//

@use "../variables" as *;
@use "../utils/mixins" as *;

.select2-container {
    width: 100% !important;

    .select2-selection--multiple{
       box-shadow: $box-shadow; 
    }

    .select2-selection--single {
        border: 1px solid $border-color;
        background-color: $white;
        outline: none;
        box-shadow: $box-shadow;
        border-radius: $border-radius;

        .select2-selection__rendered {
            line-height: 38px;
            padding-left: 12px;
            padding-right: 28px;
            color: $gray-900;
        }

        .select2-selection__arrow {
            height: 34px;
            width: 38px;
            position: absolute;
            top: 1px;
            /*rtl:ignore*/
            right: 3px;

            b {
                border-color: $gray-500 transparent transparent transparent;
                border-width: 5px 5px 0 5px;
                height: 0;
                left: 50%;
                margin-left: -4px;
                margin-top: -2px;
                position: absolute;
                top: 50%;
                width: 0;
                border-style: solid;
            }
        }
    }
}

.select2-container--open {
    .select2-selection--single {
        .select2-selection__arrow {
            b {
                border-color: transparent transparent $gray-500 transparent !important;
                border-width: 0 5px 5px 5px !important;
            }
        }
    }
}

.select2-results__option {
    padding: 6px 12px;


}

.select2-dropdown {
    border: 1px solid $border-color;
    box-shadow: $box-shadow;
    background-color: $white;
    z-index: 1056;
}


.select2-results__options {
    scrollbar-width: thin;
}


.select2-container--default {
    .select2-results__option--selected {
        background-color: $light;
    }

    .select2-search--dropdown {
        padding: 10px;
        background-color: $white;

        .select2-search__field {
            outline: none;
            border: 1px solid $border-color;
            background-color: $white;
            color: $body-color;
            border-radius: $border-radius;
        }
    }

    .select2-results__option--highlighted[aria-selected] {
        background-color: $primary;
    }

    .select2-results__option[aria-selected="true"] {
        background-color: $white;
        color: $body-color;

        &:hover {
            background-color: $primary;
            color: $white;
        }
    }

    .select2-selection--multiple {
        .select2-selection__choice__display {
            padding-left: 36px;
            padding-right: 5px;
        }
    }

    .select2-selection--single {
        .select2-selection__arrow {
            border-radius: 4px;
            cursor: text;
            /*rtl:ignore*/
            right: 1px;
            /*rtl:ignore*/
            left: auto;
        }
    }
}

.select2-container {
    .select2-selection--multiple {
        min-height: 39px;
        border: 1px solid $border-color !important;
        background-color: $white;

        .select2-selection__rendered {
            padding: 1px 12px;
        }

        .select2-search__field {
            border: 0;
            color: $body-color;
        }

        .select2-selection__choice {
            background-color: $light;
            border: none;
            color: $gray-500;
            border-radius: 3px;
            padding: 2px 7px 2px 0;
            margin-top: 6px;
            .img-flag{
                border-radius: 50%;
            }
        }

        .select2-selection__choice__remove {
                   color: $gray-500;
            margin-right: 0;
            padding: 0 8px;
        }
    }

    .select2-search--inline {
        .select2-search__field {
            margin-top: 7px;
            font-family: $font-family-base;
        }
    }

    .select2-search {
        textarea {
            &::placeholder {
                color: $gray-400;
            }
        }
    }
}

[dir="rtl"] {
    .select2-container {
        .select2-selection--multiple {
            .select2-selection__choice {
                padding: 0 0 0 7px;
            }
        }
    }
}