@import "base";

.filter {
  @extend %block;
  position: relative;
  display: flex;
  align-items: stretch;
  flex-direction: column;

  @mixin show-dropdown {
    background-color: color(black, translucent);

    .filter__dropdown {
      visibility: visible;
    }
  }

  &.filter_filterable {
    .filter__label {
      padding-right: 0;
    }

    &:hover {
      @include show-dropdown;
    }

    &.filter_editing {
      @include show-dropdown;
    }
  }

  .filter__display {
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;

    &.filter__display_active {
      color: color(primary, light);
    }
  }

  .filter__label {
    max-width: 120px;
    @extend %ellipsis;
    font-size: 12px;
    padding: 8px;
    z-index: 1;
  }

  .filter__caret {
    padding: 8px;
  }

  .filter__dropdown {
    visibility: hidden;
    position: absolute;
    border: solid 1px color(black, bright);
    z-index: 1;
    top: 100%;
    left: 0;
    max-width: 500px;
    min-width: 200px;
    background-color: white;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  &.filter_sortable {
    .filter__label {
      @extend %link;
    }
  }
}
