.widget{
  position: absolute;
  pointer-events: all;
  &:not(.active) {
    .connection-icon-container {
      display: none;
    }
  }
  &.highlight {
    .processor-view {
      border-color: rgb(61, 103, 255) !important;
    }
  }
  &.service {
    .processor-view {
      border-color: rgb(145, 61, 255) !important;
    }
  }
  &.input-port {
    .ripple-1, .ripple-2, .ripple-3 {
      animation: in 2s linear infinite;
    }
  }

  &.output-port {
    .ripple-1, .ripple-2, .ripple-3 {
      animation: out 2s linear infinite;
    }
  }
  
  @keyframes out {
    0% { width: 4px; height: 4px; opacity: 0.5; }
    100% { width: 50px; height: 50px; opacity: 0; }
  }

  @keyframes in {
    0% { width: 50px; height: 50px; opacity: 0; }
    100% { width: 4px; height: 4px; opacity: 0.5; }
  }
  .processor-view{
    &:not(.extended) {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 50px;
      height: 50px;
      border: 5px solid var(--text-color);
      border-radius: 50%;
      background-color: var(--bg-color);
      color: var(--text-color);
      .merge-icon {
        fill: var(--text-color);
        path {
          stroke-width: 4px;
        }
      }
      .arrow-left-icon, .arrow-right-icon, .arrow-full-right-icon, .arrow-full-left-icon, .arrow-full-up-icon, .arrow-full-down-icon {
        fill: var(--text-color);
      }
      .ripple-1, .ripple-2, .ripple-3 {
        position: absolute;
        border-radius: 50%;
        border: 2px solid rgb(40, 40, 40);
      }

      .ripple-2 {
        animation-delay: 666ms;
      }

      .ripple-3 {
        animation-delay: 1333ms;
      }
    }
    &.extended {
      border: 2px solid transparent;
      border-radius: 10px;
    }
    box-sizing: border-box;
    position: relative;

    .processor-errors {
      position: absolute;
      right: -5px;
      bottom: -5px;
    }

    .processor-state {
      display: inline-block;
      cursor: pointer;
      position: absolute;
      right: -12px;
      top: -12px;
      border-radius: 50%;
      background-color: var(--bg-color);
      width: 28px;
      height: 28px;
      padding: 4px;

      .pause-icon {
        fill:  var(--text-inactive-color);
      }

      .play-icon {
        fill: var(--highlight-green);
      }

      &::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border: 4px solid;
        border-radius: 50%;
      }

      &.STARTED::after {
        border-color: var(--highlight-green);
      }

      &.STOPPED::after {
        border-color: var(--text-inactive-color);
      }

      &.STARTING::after, &.STOPPING::after, &.UNKNOWN::after {
        border-color: var(--light-bg-color);
        animation: spin 2s linear infinite;
      }

      &.UNKNOWN::after {
        border-top-color: var(--highlight-blue);
      }

      &.STARTING::after {
        border-top-color: var(--highlight-green);
      }

      &.STOPPING::after {
        border-top-color: var(--text-inactive-color);
      }
        
      @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
      }
    }

    .name {
      color: var(--text-color);
      position: absolute;
      top: 100%;
      left: 50%;
      margin-top: 10px;
      transform: translate(-50%, 0);
      white-space: pre;
    }

    .connection-icon-container {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      transform-origin: 50% 50%;
      .connection-icon {
        position: absolute;
        top: 100%;
        margin-top: 2px;
        left: 50%;
        transform: translate(-50%, 0);
      }
    }
  }
}

.widget-container {
  position: absolute;
  pointer-events: none;
  &.active {
    overflow: hidden;
  }
}

.widget-container.selected {
  .processor-view {
    border-color: var(--highlight-blue) !important;
  }
}