@use 'libs/components/theme/src/lib/styles/mixins' as mixins;
@use 'libs/components/theme/src/lib/styles/variables' as *;
@use '../scss/progress-indicator-variables' as *;

// 80% brightness of our standard highlight green #71bf43
// and exceeds 3:1 contrast against both white and our modern page background #FCFCFC.
$sky-progress-indicator-success-color: #5a9936;

.sky-progress-indicator-status-marker {
  --sky-progress-indicator-marker-line-icon-color: var(
    --sky-border-color-neutral-medium
  );
  display: flex;
  height: 100%;

  &.sky-progress-indicator-status-marker-mode-vertical {
    flex-basis: $status-marker-width;
    flex-grow: 0;
    flex-direction: column;
    margin-right: $status-marker-width;

    .sky-progress-indicator-status-marker-icon {
      margin-top: $icon-offset;
      width: $status-marker-width;

      > ::ng-deep sky-icon {
        margin-left: -1px;
      }
    }

    .sky-progress-indicator-status-marker-line {
      margin: 0 auto;
      width: 1px;
    }
  }

  &.sky-progress-indicator-status-marker-mode-horizontal {
    flex-direction: row;
    width: 100%;
    padding-left: 5px;

    .sky-progress-indicator-status-marker-icon {
      height: $status-marker-width;
    }

    .sky-progress-indicator-status-marker-line {
      margin: auto 0;
      height: 1px;
    }

    &.sky-progress-indicator-status-marker-status-complete {
      .sky-progress-indicator-status-marker-icon {
        border: 0;
        margin-right: 5px;
      }
    }

    &.sky-progress-indicator-status-marker-status-active {
      .sky-progress-indicator-status-marker-icon {
        position: relative;

        &:before {
          content: '';
          display: block;
          width: 5px;
          height: 1px;
          background-color: $sky-progress-indicator-success-color;
          position: absolute;
          left: -7px;
          top: 5px;
        }
      }
    }

    &.sky-progress-indicator-status-marker-status-incomplete {
      .sky-progress-indicator-status-marker-icon {
        position: relative;

        &:before {
          content: '';
          display: block;
          width: 5px;
          height: 1px;
          background-color: $sky-border-color-neutral-medium;
          position: absolute;
          left: -7px;
          top: 5px;
        }
      }
    }
  }
}

.sky-progress-indicator-status-marker-icon {
  border-radius: $status-marker-width;
  border: 2px solid var(--sky-progress-indicator-marker-line-icon-color);
  flex: 0 0 $status-marker-width;
}

.sky-progress-indicator-status-marker-line {
  background-color: var(--sky-progress-indicator-marker-line-icon-color);
  flex: 1 0 auto;
}

.sky-progress-indicator-status-marker-status-active {
  .sky-progress-indicator-status-marker-icon {
    background-color: $sky-progress-indicator-success-color;
    border-color: transparent;
  }
}

.sky-progress-indicator-status-marker-status-pending {
  .sky-progress-indicator-status-marker-icon {
    border-color: $sky-progress-indicator-success-color;
  }
}

.sky-progress-indicator-status-marker-status-complete {
  .sky-progress-indicator-status-marker-icon {
    border-color: transparent;
    color: $sky-progress-indicator-success-color;
    margin-top: 0;

    > ::ng-deep sky-icon {
      display: inline-flex;
      vertical-align: top;
    }
  }

  .sky-progress-indicator-status-marker-line {
    background-color: $sky-progress-indicator-success-color;
  }
}

@include mixins.sky-theme-modern {
  .sky-progress-indicator-status-marker {
    --sky-progress-indicator-marker-line-icon-color: var(
      --sky-border-color-neutral-medium-dark
    );
    &.sky-progress-indicator-status-marker-mode-vertical {
      position: relative;
      top: 3px;
      margin-right: $sky-theme-modern-margin-inline-lg;

      .sky-progress-indicator-status-marker-icon {
        width: 17px;
      }
    }
    &.sky-progress-indicator-status-marker-mode-horizontal {
      .sky-progress-indicator-status-marker-icon {
        height: 17px;
        top: 1px;
      }
    }
  }

  .sky-progress-indicator-status-marker-icon {
    border-radius: 17px;
    flex: 0 0 17px;
  }
}
