.filter-group {
  position: relative;
  margin-bottom: 15px;

  .filter-group-title,
  .filter-group-item {
    i,
    svg {
      position: absolute;
      top: 13px;
      right: 15px;
      transition: all 0.5s ease;
    }
  }

  .filter-group-search {
    border: 1px solid $input-border;
    border-top: none;
    border-bottom: none;
  }

  .filter-group-title {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-width: 200px;
    height: 43px;
    padding-right: 40px;
    padding-left: 12px;
    font-weight: bold;
    background: rgba($input-bg, 0.9);
    border: 1px solid $input-border;
    border-radius: $border-radius-base;
    cursor: pointer;

    .filter-group-title-prompt {
      display: inline-block;
      max-width: 100%;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    &:hover {
      color: white;
      background: $input-bg;
    }

    &.active {
      border-bottom-right-radius: 0;
      border-bottom-left-radius: 0;

      i,
      svg {
        transform: rotate(90deg);
      }
    }

    &.disabled {
      cursor: not-allowed;
      opacity: 0.5;
    }

    &.hasLabel {
      color: $input-placerholder;
      font-weight: normal;
    }

    &.selected {
      color: white;
      font-weight: bold;
      border-bottom-right-radius: 0;
      border-bottom-left-radius: 0;
    }
  }

  .filter-group-items {
    max-height: 300px;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: rgba($gray-darker, 0.95);
    border: 1px solid $input-border;
    border-top: none;
    border-bottom-right-radius: $border-radius-base;
    border-bottom-left-radius: $border-radius-base;
  }

  .filter-group-items-wrapper {
    position: absolute;
    right: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(black, 0.9);
  }

  .filter-group-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 10px 36px 10px 6px;
    color: $input-color;
    border-right: 4px solid transparent;
    border-bottom: 1px solid $input-border;
    border-left: 4px solid transparent;
    cursor: pointer;

    .filter-group-item-icon {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 30px;
      height: 21px;
      margin-right: 10px;

      img {
        max-width: 100%;
        max-height: 100%;
        border-radius: 2px;
      }
    }

    &::before,
    &::after {
      position: absolute;
      top: 50%;
      width: 3px;
      height: 26px;
      margin-top: -13px;
      opacity: 0;
      transition: all ease 0.3s;
      content: "";
    }

    &::before {
      left: -4px;
    }

    &::after {
      right: -4px;
    }

    &:hover {
      &::before,
      &::after {
        background: $primary;
        opacity: 1;
      }

      &::before {
        border-top-right-radius: 2px;
        border-bottom-right-radius: 2px;
        box-shadow:
          3px 0 10px rgba(darken($primary, 20%), 0.9),
          0 3px 10px rgba(darken($primary, 20%), 0.9),
          0 -3px 10px rgba(darken($primary, 20%), 0.9);
      }

      &::after {
        border-top-left-radius: 2px;
        border-bottom-left-radius: 2px;
        box-shadow:
          -3px 0 10px rgba(darken($primary, 20%), 0.9),
          0 3px 10px rgba(darken($primary, 20%), 0.9),
          0 -3px 10px rgba(darken($primary, 20%), 0.9);
      }
    }

    &.active {
      color: $primary;
      animation-name: flash;
      animation-duration: 0.5s;

      i,
      svg {
        transform: rotate(45deg);
      }
    }

    &:last-child {
      border-bottom: none;
    }

    &.bigIcon {
      .filter-group-item-icon {
        width: 60px;
      }
    }
  }
}

.has-error .filter-group-title {
  border-color: darken($danger, 15%);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}

@keyframes flash {
  from,
  50%,
  to {
    opacity: 1;
  }

  25%,
  75% {
    opacity: 0.5;
  }
}
