$suction-shadow: 0 0 0 rgba($color-error, 0);
$exhale-shadow: 0 0 20px rgba($color-error, 0.9);

@keyframes service-node-animation {
  0% {
    box-shadow: $suction-shadow;
  }
  50% {
    box-shadow: $exhale-shadow;
  }
  100% {
    box-shadow: $suction-shadow;
  }
}

@keyframes addon-node-animation {
  0% {
    filter: drop-shadow($suction-shadow);
  }
  50% {
    filter: drop-shadow($exhale-shadow);
  }
  100% {
    filter: drop-shadow($suction-shadow);
  }
}

.service-node {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 6px solid rgba(121, 140, 241, 0.2);
  position: relative;

  .unit {
    transform: scale(0.9);
    transform-origin: center;
  }

  .service-name {
    left: -27px;
    bottom: -40px;
  }

  .service-node-tips {
    position: absolute;
    height: 96px;
    width: 96px;
    left: -16px;
    bottom: -16px;

    .info-icon {
      float: right;
      cursor: pointer;
      display: none;
    }
  }

  &:hover {
    .service-name {
      background-color: #5c6bcc;
    }

    .info-icon {
      display: block;
    }
  }

  &.error {
    &:hover {
      &:before {
        content: '';
        display: block;
        position: absolute;
        top: -9px;
        left: -9px;
        width: 82px;
        height: 82px;
        border-radius: 50%;
        border: 1px dotted #d84b65;
      }
    }
  }

  &.has-error {
    border-color: transparent;

    &:after {
      content: '';
      display: block;
      position: absolute;
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      border-radius: 50%;
      animation: service-node-animation 2s infinite ease-in-out;
    }
  }
}

.api-gateway-node {
  .count {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-image: linear-gradient(180deg, rgba($white, 0.8) 0%, rgba($white, 0.6) 100%);
  }
}

.external-service-node {
  width: 69px;
  height: 60px;

  .unit {
    transform: scale(0.9);
    transform-origin: center;
  }
}

.addon-node {
  &.has-error {
    .shadow-wrapper {
      animation: addon-node-animation 2s infinite ease-in-out;
    }
  }
}
