/* section colors */
$section-colors: (
        'green': #4acfae,
        'blue': #44aaee,
        'purple': #9899cd,
        'red': #ffb2a6,
        'pink': #cc6699
);

$animation-time: 0.15s;
$animation-delay: 0s;

$activeItemBgColor: white;
$activeItemBorderRadius: 5px;

.container:not(.isMinimal) {
  &:hover {
    background-color: $activeItemBgColor;
    border-radius: $activeItemBorderRadius;
  }

  .icon {
    svg {
      width: 20px;
      height: 20px;
    }

    width: 40px;
    height: 40px;
  }
}

.container {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  .icon {
    svg {
      fill: white;
    }

    position: relative;
    border-radius: 24px;
    background-color: gray;
    border-color: gray;
    border-width: 1px;
    border-style: solid;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  @each $name, $color in $section-colors {
    &.#{$name} {
      .icon {
        background-color: $color;
        border-color: $color;
      }
    }
  }

  .title {
    text-align: center;
    transition: color 0.3s;
    font-family: 'Open Sans', arial;
    width: 90%;
    font-size: 12px;
    line-height: 14px;
    color: #333333;
    height: 33px;
    display: block;
    align-items: center;
    justify-content: space-around;
    overflow: hidden;

    span {
      display: inline-block;
      max-width: 100%;
      text-overflow: ellipsis;
      overflow: hidden;
      line-height: 15px;
      transition: max-width 0.2s;
      background-color: white;
      padding: 2px;
    }
  }

  &:hover:not(.isDisabled) {
    .title {
      color: #00b0ff;
      overflow: visible;
    }
  }

  &:hover {
    .title {
      z-index: 1;

      span {
        background-color: $activeItemBgColor;
        border-radius: $activeItemBorderRadius;
        overflow-wrap: break-word;
        white-space: normal;
        word-wrap: break-word;
        overflow: visible;
      }
    }
  }

  &.isActive:not(.isMinimal) {
    .icon:after {
      content: ' ';
      position: absolute;
      left: -1px;
      top: -1px;
      right: -1px;
      bottom: -1px;
      border-radius: 24px;
      border: solid 2px #00b0ff;
      transform: scale(1.15);
      z-index: 2;
    }

    &.isSmall .icon {
      background-color: #44aaee;
      border-color: #44aaee;
    }

    .title {
      color: #00b0ff;
    }
  }

  &.isDisabled {
    opacity: 0.5;
    cursor: default;
  }
}

.container.isMinimal {
  .icon {
    transition: border-radius $animation-time,
      background-color 0.2s,
      border-color 0.2s;
    animation-delay: $animation-delay;
    animation-duration: $animation-time;
    animation-name: showIconContainer;
    width: 34px;
    height: 34px;
    background-color: #454545;
    border-color: #252525;

    svg {
      animation-delay: $animation-delay;
      animation-duration: $animation-time;
      animation-name: showIconSvg;
      width: 17px;
      height: 17px;
    }
  }

  &.isActive {
    .icon {
      background-color: gray;
      border-color: gray;
    }
  }
  @each $name, $color in $section-colors {
    &.isActive.#{$name} {
      .icon {
        background-color: $color;
        border-color: $color;
      }
    }
  }

  &:hover:not(.isDisabled) {
    .icon {
      background-color: gray;
      border-color: gray;
    }

    @each $name, $color in $section-colors {
      &.#{$name} {
        .icon {
          background-color: $color;
          border-color: $color;
        }
      }
    }
  }
}

.container.isMinimal.initHide {
  .icon {
    animation-delay: $animation-delay;
    animation-duration: $animation-time;
    animation-name: hideIconContainer;
    width: 0;
    height: 0;
    opacity: 0;

    svg {
      animation-delay: $animation-delay;
      animation-duration: $animation-time;
      animation-name: hideIconSvg;

      width: 0;
      height: 0;
      opacity: 0;
    }
  }
}

@keyframes showIconContainer {
  from {
    opacity: 0;
    width: 0;
    height: 0;
  }

  to {
    opacity: 1.0;
    width: 34px;
    height: 34px;
  }
}
@keyframes showIconSvg {
  from {
    opacity: 0;
    width: 0;
    height: 0;
  }

  to {
    opacity: 1.0;
    width: 17px;
    height: 17px;
  }
}

@keyframes hideIconContainer {
  from {
    opacity: 1.0;
    width: 34px;
    height: 34px;
  }

  to {
    opacity: 0;
    width: 0;
    height: 0;
  }
}
@keyframes hideIconSvg {
  from {
    opacity: 1.0;
    width: 17px;
    height: 17px;
  }

  to {
    opacity: 0;
    width: 0;
    height: 0;
  }
}
