@import "../../../../assets/scss/variables";

:root {
  --list-item-color: --title-color;
  --close-btn-filter: $svg-default;
  --pagination-bg: white;
  --theme-bg:white;
  --pagination-color: #040059;
}


:root[data-theme="dark"] {
  --list-item-color: #20262E;
  --close-btn-filter: var(--svg-white);
  --theme-bg:#40474F;
  --pagination-bg: #40474F;
  --pagination-color: #ccc;
}


.custom-select {
  width: 100%;
  //min-width: 226px;
  min-width: 100px;
  position: relative;

  .select-head {
    width: 100%;
    position: relative;

    .buttons {
      position: absolute;
      right: 0;
      top: 50%;
      transform: translateY(-50%);
      z-index: 0;
      cursor: pointer;
      display: flex;
      align-items: center;
      width: 50px;
      justify-content: flex-end;
      img{
        filter:$svg-default;
      }
      .close {
        margin: 0 15px 0 auto;
        cursor: pointer;
      }

      .open {
        margin: 0 15px 0 auto;
        cursor: pointer;
      }
    }


    &.disabled {
      cursor: initial;
      background-color: transparent;

      & .open {
        display: none;
      }
    }
    .selected-tags{
      display: inline-flex;
      flex-wrap: wrap;
      span{
        background-color: $main-color;
        color:$white!important;
        margin:2px;
        padding:8px 6px;
        padding-right: 18px;
        border-radius:5px;
        &.tag{
          position:relative;
          font-size: 14px;}
        img{
          filter: $svg-default;
          position: absolute;
          top:5px;
          width:7px;
          &:hover{
            cursor: pointer;
          }
        }
      }
    }
  }

  ul.options {
    width: 100%;
    padding: 0;
    position: absolute;
    max-height: 600px;
    overflow-y: auto;
    z-index: 200000000;
    top: 0;
    left: 0;
    background-color: $dropdown-color;
    box-shadow: 0 3px 6px #00000029;
    font-size: 1.8rem;
    letter-spacing: 0.4px;
    display: flex;
    flex-direction: column;

    input {
      margin: 5px;
    }

    & li {
      height: 45px;
      padding-left: 34px;
      color: $text-color;
      display: flex;
      align-items: center;
      font-size: 2rem;
      letter-spacing: 0.4px;
      order: 1;

      &.selected {

        order: 0;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        padding-right: 30px;

        & .close {
          margin: 0 15px 0 auto;
          cursor: pointer;
        }
      }

      &.disabled {
        cursor: not-allowed!important;
        pointer-events: none!important;
        color:#cccccc!important;
        background-color: #f8f8f8!important;
      }

      &:not(.selected) {

        cursor: pointer;
        font-size: 1.3rem;

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

      &.active {
        color: $white;
        background-color: $secondary-color;
      }
    }
  }

  &.user-form-select {
    z-index: unset;

    &.hasError {

      .select-head {
        border-color: $error-color;
      }
    }

    .select-head {
      padding-right: 25px;
      background-color: unset;
      border-top: unset;
      border-left: unset;
      border-right: unset;
      border-bottom: 1px solid #ccc;
      min-height: 3rem;

      & input {
        text-overflow: ellipsis;
        border: unset !important;
      }

      &.disabled {
        border: none;
      }

      &.hasSelected input::placeholder {
        font-size: $input-size !important;
      }

      span {
        &.select-selected {
          li {
            font-size: $input-size;
            list-style: none;
          }

        }

        &.select-placeholder {
          font-size: $index-size;
        }

        font-weight: $thin;
        color: $text-color;
      }


    }

    .options {
      padding: 12px;
      top: 31px;
      max-height: 20rem;
      scrollbar-width: auto;
      scroll-behavior: auto;

      & .options-inner {
        overflow-y: auto;

        &::-webkit-scrollbar {
          width: 5px;
          height: 50% !important;
          transform: scaleY(0.5) !important;
        }

        /* Track */
        &::-webkit-scrollbar-track {
          background: #CCCCCC;
          margin-top: 15px;
        }

        /* Handle */
        &::-webkit-scrollbar-thumb {
          background: $main-color;
        }

        /* Handle on hover */
        &::-webkit-scrollbar-thumb:hover {
        }

      }

      li {
        padding: .5rem 0 .5rem .5rem;
        font-size: $input-size;
        font-weight: $thin;
        color: $text-color;
        height: auto;

        &:not(.selected) {
          cursor: pointer;
          font-size: 1.6rem;
        }
      }
    }
  }

  &.search-listbox-blue {
    min-width: 215px;
    width: max-content;
    input{border-bottom: none;
      font-size: 1.4rem;
      height:37px;
      color:$white;
      &::placeholder {
        color: white;
      }
    }
    .select-head {
      border-radius: 5px;
      width: 100%;
      height: 37px;
      background-color: $blue-to-gray;
      color: $white;
      padding-left: 17px;
      border: none;
      .buttons{
        img{
          filter: brightness(0) invert(1);
        }
      }
      .selected-tags{display: none!important;}
      & li {
        font-size: 1.4rem;
        color: $white;
      }

      .select-placeholder {
        font-size: 1.4rem;
      }
    }

    ul.options {
      background-color: $blue-to-gray;
      min-width: max-content;
      border-radius: 5px;
      position: absolute;
      top:37px;
      li {
        min-height: unset;
        color:$white;
        background-color: $blue-to-gray;
        font-size: 1.4rem;
        width: inherit;
        height: 37px;
        padding-right: 10px;

        padding-left: 17px;
        &:hover{
          color: $white;
          background-color: var(--item-hover);
        }
      }
    }
  }

  .select-group {
    p {
      color: $title-color;
      font-size: 1.2rem;
      padding: 10px 0 10px 15px;
      font-weight: bold;
      background-color: $form-background;
    }

    li {
      padding-left: 50px !important;
    }
  }

  &.per-page {
    width: 44px;

    min-width: unset;

    .select-head {
      border: 1px solid $title-color;
      padding-left: 8px;
      height: 27px;

      .select-selected {
        font-size: 1.2rem;
        padding: 0;

        li {
          font-size: 1.2rem;
          font-weight: normal;

        }
      }
    }

    input {
      height: 23px;
      font-size: 1.2rem;
      color: $title-color;
      min-width: unset;

      &::placeholder {
        color: $title-color;
        font-weight: normal;
      }
    }

    .buttons {

      img {
        width: 8px;
        margin-right: 4px !important;
        filter: $svg-default;
      }
    }

    //
    ul.options {
      box-shadow: none;
      border: 1px solid $title-color;
      background-color: var(--theme-bg) !important;
      color: var(--pagination-color);
      margin: -1;
      margin: 0;
      bottom: 0;
      top: unset;



      li {
        min-height: 27px;
        height: 27px;
      }

      li {
        padding-left: 10px;
        color:  var(--pagination-color) !important;
        &:hover{
          color:white!important;
        }
      }
    }
  }


}

.error-message {
  color: $error-color;
  font-size: 1.2rem;
  padding-left: 4px;
  margin-top: 5px;
}

.clear {
  filter: var(--close-btn-filter) !important;
}

.options-inner {
  background-color: var(--pagination-bg) !important;
  color: var(--pagination-color) !important;
}
