@use '../../../../shared/styles/variables' as *;

.organisation-select {
  position: relative;
}

.organisation-select__trigger {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid $color-border-strong;
  border-radius: 12px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  background: $color-surface;
  color: $color-text;

  font-size: $font-size-15;
  font-weight: 500;
  text-align: left;

  cursor: pointer;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;

  span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .is-placeholder {
    color: $gray50;
  }

  svg {
    flex: 0 0 auto;
    color: $gray50;
    transition: transform 0.2s ease;
  }

  &:hover {
    border-color: rgba($color-primary-rgb, 0.45);
  }

  &:disabled {
    opacity: 0.65;
    cursor: not-allowed;
  }
}

.organisation-select.is-open {
  .organisation-select__trigger {
    border-color: rgba($color-primary-rgb, 0.7);
    box-shadow: 0 0 0 3px rgba($color-primary-rgb, 0.12);

    svg {
      transform: rotate(180deg);
    }
  }
}

.organisation-select__dropdown {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  right: 0;

  padding: 10px;
  border: 1px solid $color-border-strong;
  border-radius: 16px;
  background: $color-surface;

  box-shadow:
    0 18px 45px rgba($color-shadow-rgb, 0.12),
    0 4px 12px rgba($color-shadow-rgb, 0.08);
}

.organisation-select__search {
  height: 40px;
  padding: 0 10px;
  border-radius: 11px;
  background: $color-surface-muted;

  display: flex;
  align-items: center;
  gap: 8px;

  color: $gray50;

  input {
    width: 100% !important;
    border: none !important;
    outline: none !important;
    background: $transparent !important;

    color: $color-text;
    font-size: $font-size-15;
    height: 100% !important;

    &:focus{
      background-color: $transparent;
      box-shadow: none !important;
    }

    &::placeholder {
      color: $gray50;
    }
  }
}

.organisation-select__list {
  max-height: 250px;
  margin-top: 8px;
  overflow: auto;

  display: flex;
  flex-direction: column;
  gap: 4px;

  scrollbar-width: thin;
  scrollbar-color: $gray50 $transparent;
}

.organisation-select__option {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  background: $transparent;
  color: $color-text;

  cursor: pointer;
  text-align: left;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;

  span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: $font-size-15;
    font-weight: 500;
  }

  small {
    flex: 0 0 auto;
    color: $gray50;
    font-size: $font-size-12;
    font-weight: 500;
  }

  &:hover {
    background: $gray20;
    color: $blue;
  }

  &.is-selected {
    background: $blue20;
    span{
        color: $blue;
    }

    small {
      //color: rgba($white, 0.75);
    }
  }
}

.organisation-select__state {
  padding: 14px 10px;
  color: $gray50;
  font-size: $font-size-14;
  font-weight: 500;
  text-align: center;

  &.is-error {
    color: $red;
  }
}

.organisation-select__hint {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: $color-surface-muted;

  color: $gray50;
  font-size: $font-size-12;
  font-weight: 500;
  line-height: 1.35;
}
