@use "../../assets/scss/mixins/_font-size.scss";

.bimdata-select {
  position: relative;
  font-family: var(--primary-font);
  font-size: font-size.calculateEm(15px);
  user-select: none;

  &__content {
    height: 32px;

    &__value {
      width: 100%;
      height: 32px;
      position: absolute;
      z-index: 1;
      top: 0;

      display: flex;
      justify-content: space-between;
      align-items: center;
      cursor: pointer;

      span {
        width: 100%;
        height: auto;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }

    &__label {
      position: absolute;
      top: 6px;
      left: 0;
      font-size: font-size.calculateEm(12px);
      transition: 0.2s ease all;
      color: var(--color-granite-light);
      transition: 0.2s ease all;
    }

    &__underline {
      width: 100%;
      height: 1px;
      position: absolute;
      bottom: 0;
      display: block;
      background: var(--color-silver);
    }
  }

  &.disabled {
    opacity: 0.6;
  }

  &.active,
  &.not-empty {
    .bimdata-select__content {
      .bimdata-select__content__label {
        top: -18px;
        font-size: font-size.calculateEm(10px);
        color: var(--color-primary);
      }
    }
  }

  &__option-list {
    position: absolute;
    z-index: 2;
    top: -3px;
    width: 100%;
    max-height: 220px;
    overflow: auto;
    box-shadow: var(--box-shadow);
    background-color: var(--color-white);

    &__entry {
      height: 29px;
      padding: 0 var(--spacing-unit);
      display: flex;
      align-items: center;
      font-size: font-size.calculateEm(12px);
      cursor: pointer;

      &:hover {
        background-color: var(--color-silver-light);
        transition: all 0.2s ease;
      }

      &.selected {
        background-color: var(--color-silver-light);
        &:hover {
          background-color: var(--color-silver);
        }
      }

      &.disabled {
        color: var(--color-silver-dark);
        cursor: default;
      }

      &.option-group {
        color: var(--color-granite);
        font-weight: 700;
        &:hover {
          background-color: transparent;
          cursor: default;
        }
      }

      &.option-group ~ &:not(.option-group) {
        padding-left: calc(var(--spacing-unit) * 2);
      }
    }
  }
}
