@use '@zywave/zui-base-styles/src/variables' as *;

:host {
  position: relative;
  display: flex;
  flex: 1 1 0;
  padding-bottom: 0;
  cursor: not-allowed;
  pointer-events: none;

  &::before,
  &::after {
    position: absolute;
    top: 7.5px;
    right: 50%;
    display: block;
    content: '';
    width: 50%;
    height: 1px;
    background-color: var(--zui-gray-200);

    @media (min-width: $bp-s) {
      top: 10px;
    }

    @media (min-width: $bp-m) {
      top: 12px;
    }
  }

  &::after {
    right: unset;
    right: auto;
    left: 50%;
  }

  .step {
    display: flex;
    flex-direction: column;
    flex: 1 0 0;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
  }

  .indicator {
    display: flex;
    width: 15px;
    height: 15px;
    z-index: z(default);
    justify-content: center;
    align-items: center;
    background-color: #f4f4f4;
    border: 2px solid var(--zui-gray-300);
    border-radius: 100%;
    transition: border-top-color 0.15s linear, border-right-color 0.15s linear 0.1s, border-bottom-color 0.15s linear 0.2s, border-left-color 0.15s linear 0.3s;

    @media (min-width: $bp-s) {
      width: 20px;
      height: 20px;
      margin-bottom: 10px;
    }

    .icon {
      display: none;

      zui-icon {
        width: 14px;
        height: 14px;
        fill: #fff;

        @media (min-width: $bp-m) {
          width: 16px;
          height: 16px;
        }
      }
    }
  }

  // IE11 sucks so we need this for flex-grow to work
  .label {
    width: 0;
    min-width: 100%;
  }
}

:host([complete]) {
  cursor: pointer;
  pointer-events: auto;

  .indicator {
    background-color: var(--zui-step-flow-indicator-item-complete-color, var(--zui-gray-800));
    border-color: var(--zui-step-flow-indicator-item-complete-color, var(--zui-gray-800));

    .icon {
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }
}

:host([active]) {
  font-weight: 600;

  .indicator {
    border-color: var(--zui-step-flow-indicator-item-active-color, var(--zui-gray-800));
  }
}

:host([disabled]) {
  cursor: not-allowed;
  color: var(--zui-gray-300);
  pointer-events: none;

  .indicator {
    border-color: var(--zui-gray-100);
  }
}

:host([orientation='vertical']) {
  $line: 8px;
  $line-bp-s: 3px;

  display: block;
  flex: 0 1 auto;
  padding-bottom: 30px;

  &::before,
  &::after {
    top: 0%;
    left: 9px;
    width: 2px;
    height: calc(50% - #{$line});

    @media (min-width: $bp-s) {
      left: 11.5px;
      height: calc(50% - #{$line-bp-s});
    }
  }

  &::after {
    top: calc(50% - #{$line});
    height: calc(50% + #{$line});

    @media (min-width: $bp-s) {
      top: calc(50% - #{$line-bp-s});
      height: calc(50% + #{$line-bp-s});
    }
  }

  .step {
    flex-direction: row;
    align-items: flex-start;
    text-align: left;
  }

  .indicator {
    flex-shrink: 0;
    margin-right: 10px;
    margin-bottom: 0;
  }

  .label {
    // IE11 sucks so this is undoing flex-grow for vertical indicator
    width: auto;
    min-width: 0;
    margin-right: 20px;
    line-height: rem(24);
  }
}
