.select2-container {
  &--classic {

    /* SINGLE */
    .select2-selection--single {
      outline: 0;

      .select2-selection__rendered {
        line-height: 28px;
      }

      .select2-selection__clear {
        cursor: pointer;
        float: right;
        margin-right: 10px;
      }

      .select2-selection__arrow {
        height: 26px;
        position: absolute;
        top: 1px;
        right: 1px;
        width: 20px;

        b {
          height: 0;
          left: 50%;
          margin-left: -4px;
          margin-top: -2px;
          position: absolute;
          top: 50%;
          width: 0;
        }
      }
    }

    /* MULTIPLE */
    .select2-selection--multiple {
      cursor: text;
      outline: 0;

      .select2-selection__rendered {
        list-style: none;
        margin: 0;
        padding: 0 5px;
      }

      .select2-selection__clear {
        display: none;
      }

      .select2-selection__choice {
        cursor: default;
        float: left;
        margin-right: 5px;
        margin-top: 5px;
        padding: 0 5px;
      }

      .select2-selection__choice__remove {
        cursor: pointer;
        display: inline-block;
        font-weight: bold;
        margin-right: 2px;
      }
    }

    .select2-search--dropdown {
      .select2-search__field {
        outline: 0;
      }
    }

    .select2-search--inline {
      .select2-search__field {
        outline: 0;
      }
    }

    .select2-results {
      >.select2-results__options {
        max-height: 200px;
        overflow-y: auto;
      }
    }

    .select2-results__option[role="group"] {
      padding: 0;
    }

    .select2-results__group {
      cursor: default;
      display: block;
      padding: 6px;
    }

    /* RTL */
    &[dir="rtl"] {
      .select2-selection--single {
        .select2-selection__clear {
          float: left;
        }

        .select2-selection__arrow {
          left: 1px;
          right: auto;
        }
      }

      .select2-selection--multiple {
        .select2-selection__choice {
          float: right;
          margin-left: 5px;
          margin-right: auto;
        }

        .select2-selection__choice__remove {
          margin-left: 2px;
          margin-right: auto;
        }
      }
    }
  }

  &--default {

    /* SELECT SINGLE */
    .select2-selection--single {
      outline: 0;

      .select2-selection__rendered {
        line-height: 28px;
        line-height: 40px;
        padding-left: 0;
      }

      /* CROSS */
      .select2-selection__clear {
        cursor: pointer;
        float: right;
        height: 100%;
        display: flex;
        align-items: center;
        margin: 0 25px 0 0;

        &:hover {
          background-color: transparent !important;
        }

        .ui-btn__inner {
          box-shadow: none !important;

          .ui-btn__icon {
            padding: 0;

            .ui-icon {
              font-size: 12px;
            }
          }
        }
      }

      /* ARROW */
      .select2-selection__arrow {
        height: 26px;
        position: absolute;
        top: 1px;
        right: 1px;
        width: 20px;
        height: 2rem;

        b {
          height: 0;
          left: 50%;
          margin-left: -4px;
          margin-top: -2px;
          position: absolute;
          top: 50%;
        }
      }
    }

    /* SELECT MULTIPLE */
    .select2-selection--multiple {
      cursor: text;
      outline: 0;

      .select2-selection__placeholder {
        margin-top: 5px;
        float: left;
      }

      /* TAG LIST */
      .select2-selection__rendered {
        box-sizing: border-box;
        list-style: none;
        margin: 0;
        padding: 0 5px;

        .select2-selection__choice {
          cursor: default;
          float: left;
          margin-right: 5px;
          margin-top: 5px;
          padding: 0 5px;
          margin-top: 8px;
          padding: 3px 10px;

          &__display {
            @include ellipsis();
          }

          .select2-selection__choice__remove {
            cursor: pointer;
            display: inline-block;
            margin-right: 2px;
          }
        }
      }

      &.select2-selection--clearable {

        /* CROSS*/
        .select2-selection__clear {
          cursor: pointer;
          float: right;
          margin-top: 5px;
          margin-right: 10px;

          .ui-btn__inner {
            box-shadow: none !important;

            .ui-btn__icon {
              padding: 0;

              .ui-icon {
                font-size: 10px;
              }
            }
          }
        }
      }

      input {
        margin: 0;
      }

      .select2-search--inline {
        .select2-search__field {
          display: none;
        }
      }
    }

    /* SEARCH DROPDOWN */
    .select2-search--dropdown {
      .select2-search__field {
        border-top: none;
        border-right: none;
        border-left: none;
      }
    }

    .select2-search--inline {
      .select2-search__field {
        height: 15px;
        margin-top: 0;
        margin-bottom: 0;
        outline: 0;
        -webkit-appearance: textfield;
      }
    }

    /* CONTENT DROPDOWN SELECT */
    .select2-results {
      >.select2-results__options {
        max-height: 200px;
        overflow-y: auto;

        .select2-results__option {
          .select2-results__option {
            padding-left: 1em;

            .select2-results__group {
              padding-left: 0;
            }

            .select2-results__option {
              margin-left: -1em;
              padding-left: 2em;

              .select2-results__option {
                margin-left: -2em;
                padding-left: 3em;

                .select2-results__option {
                  margin-left: -3em;
                  padding-left: 4em;

                  .select2-results__option {
                    margin-left: -4em;
                    padding-left: 5em;

                    .select2-results__option {
                      margin-left: -5em;
                      padding-left: 6em;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }

    .select2-results__option[role="group"] {
      padding: 0;
    }

    .select2-results__group {
      cursor: default;
      display: block;
      padding: 6px;
    }

    /* SELECT FOCUS */
    &.select2-container--focus {
      .select2-selection--multiple {
        outline: 0;
      }
    }

    &[dir="rtl"] {
      .select2-selection--single {
        .select2-selection__clear {
          float: left;
        }

        .select2-selection__arrow {
          left: 1px;
          right: auto;
        }
      }

      .select2-selection--multiple {
        .select2-selection__choice {
          float: right;
          margin-left: 5px;
          margin-right: auto;
        }

        .select2-selection__placeholder {
          float: right;
        }

        .select2-search--inline {
          float: right;
        }

        .select2-selection__choice__remove {
          margin-left: 2px;
          margin-right: auto;
        }
      }
    }
  }

  &[dir="rtl"] .select2-selection--single .select2-selection__rendered {
    padding-right: 8px;
    padding-left: 20px;
  }

  .select2-search--inline {
    float: left;

    .select2-search__field {
      box-sizing: border-box;
      border: none;
      padding: 0;

      &::-webkit-search-cancel-button {
        -webkit-appearance: none;
      }
    }
  }

  .select2-dropdown {
    box-sizing: border-box;
    display: block;
    position: absolute;
    left: -100000px;
    width: 100%;
    z-index: 2100;
    min-width: 200px;

    .select2-results {
      display: block;

      .select2-results__options {
        list-style: none;
        margin: 0;
        padding: 0;

        .select2-results__option {
          padding: 6px;
          user-select: none;
          -webkit-user-select: none;
          padding: 10px;

          &[aria-selected] {
            cursor: pointer;

            .ui-tag {
              margin-top: 0;
              margin-bottom: 0;
            }
          }
        }
      }
    }
  }

  .select2-search.select2-search--dropdown {
    padding: 0;
    position: relative;

    &::after {
      font-family: "DigiWall-Icons";
      font-weight: normal;
      font-style: normal;
      content: "\e936";
      position: absolute;
      left: 5px;
      font-size: 1.5rem;
      line-height: $ui-select-search-field-height;
    }

    input.select2-search__field {
      height: $ui-select-search-field-height;
      padding-left: $ui-select-search-field-height;
      padding-right: 0.5rem;
      box-sizing: border-box;
      margin-bottom: 0;
      border: none;

      &:focus-visible {
        border: none;
      }
    }
  }

  /* DISABLED */
  .ui-input--disabled {
    >.select2-container.select2-container--disabled {
      .select2-selection--single.select2-selection--clearable {
        cursor: default;

        >ui-button.select2-selection__clear {
          display: none;
        }
      }

      .select2-selection--multiple {
        cursor: default;
      }

      .select2-selection__choice__remove {
        display: none;
      }
    }
  }

  /* READONLY */
  .ui-input--readonly {
    padding: 3px 10px;

    & {

      & .select2-container--default span.select2-selection--single,
      & .select2-container--default span.select2-selection--multiple {
        cursor: default;

        & .select2-selection__arrow {
          display: none;
        }

        .select2-selection__rendered {
          cursor: default;
        }

        .select2-selection__rendered>.select2-selection__clear,
        .select2-selection__clear {
          display: none !important;
        }

        .select2-selection__choice {
          grid-template-columns: 1fr;

          .select2-selection__choice__remove {
            display: none;
          }
        }
      }
    }
  }
}

.select2-close-mask {
  margin: 0;
  padding: 0;
  display: block;
  position: fixed;
  left: 0;
  top: 0;
  min-height: 100%;
  min-width: 100%;
  height: auto;
  width: auto;
  z-index: 99;
}

.select2-hidden-accessible {
  clip: rect(0 0 0 0) !important;
  height: 1px !important;
  margin: -1px !important;
  overflow: hidden !important;
  padding: 0 !important;
  position: absolute !important;
  width: 1px !important;
}

.ui-select {
  .select2-container {
    box-sizing: border-box;
    display: inline-block;
    margin: 0;
    position: relative;
    vertical-align: middle;
    width: auto !important;

    &.select2-container--default {
      border: none;
      margin-bottom: 0;
      grid-area: input;
      min-height: $ui-select-search-field-height;
    }

    span.select2-selection {

      &--single,
      &--multiple {
        padding: 0;
        margin: 0;
        box-sizing: border-box;
        cursor: pointer;
        display: block;
        user-select: auto;
        -webkit-user-select: auto;
        min-height: unset;
      }

      &--single {
        .select2-selection {
          &__rendered {
            height: 100%;
            display: block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            line-height: 2rem;
            padding-right: 10px;
            letter-spacing: 0.01em;
          }

          &__clear {
            font-size: 1.4rem;
            font-weight: normal;
            opacity: 0.5;
            display: grid;
            place-content: center;
            border: none;
            background: none;
          }

          &__arrow {
            width: 10px;
            display: grid;
            place-content: center;

            [role="presentation"] {
              position: relative;
              margin: auto;
              left: auto;
              right: auto;
              top: auto;
              bottom: auto;
            }
          }
        }
      }

      &--multiple {
        height: 100%;
        display: flex;
        align-items: center;

        .select2-selection__rendered {
          padding: 2px 0;
          display: inline-flex;
          flex-wrap: wrap;
          gap: 3px;
        }

        .select2-selection__clear {
          font-size: 1.4rem;
          font-weight: normal;
          opacity: 0.5;
          display: grid;
          margin-right: 0;
        }
      }

      .select2-selection__choice {
        display: grid;
        grid-template-columns: 1fr 15px;
        grid-template-areas: "label remove";
        padding-left: 5px;
        padding-right: 5px;
        align-items: center;
        margin: 0;
        line-height: 1.3;
        border-radius: 1rem;

        .select2-selection__choice__remove {
          margin: 0;
          border-radius: 30px;
          line-height: 14px;
          width: 14px;
          text-align: center;
          font-size: 16px;
          grid-area: remove;
          position: relative;
          display: flex;
          align-items: center;
          padding: 0;
          height: 14px;
          box-shadow: none;
          border: none;
          justify-content: center;

          span {
            margin-top: -3px;
          }

          >div>a>div.ui-btn__icon {
            padding: 0;
          }
        }

        .select2-selection__choice__display {
          grid-area: label;
        }
      }

      >ui-button+ul+.select2-search--inline {
        display: none;
      }
    }

    &--disabled {
      span.select2-selection {

        &--single,
        &--multiple {
          cursor: not-allowed;
        }
      }
    }
  }
}

.select2-container--open {
  .select2-dropdown {
    left: -1px;
  }
}

.select2-search--dropdown {
  display: block;
  padding: 4px;

  .select2-search__field {
    padding: 4px;
    width: 100%;
    box-sizing: border-box;

    &::-webkit-search-cancel-button {
      -webkit-appearance: none;
    }
  }
}

.select2-search--dropdown.select2-search--hide {
  display: none;
}