@use "sass:math";
@use "sass:meta";


//theme
.p-stepper {
  .p-stepper-nav {
    display: flex;
    gap: $inlineSpacing;
    justify-content: space-between;
    margin: 0;
    padding: 0;
    list-style-type: none;
  }

  .p-stepper-header {
    padding: $inlineSpacing 0;

    &.p-disabled {
      opacity: 1; // Костыль на прозрачность

      .p-stepper-action {
        opacity: $disabledOpacity;
      }
    }

    .p-stepper-action {
      flex-grow: 0;
      transition: $listItemTransition;
      border-radius: $borderRadius;
      background: $stepsItemBg;
      outline-color: transparent;
      padding: 0;

      .p-stepper-number {
        font-weight: $stepsItemFontWeight;
        color: $stepsItemNumberColor;
        border: $stepsItemBorder;
        background: $stepsItemBg;
        min-width: $stepsItemNumberWidth;
        height: $stepsItemNumberHeight;
        line-height: $stepsItemNumberHeight;
        font-size: $stepsItemNumberFontSize;
        border-radius: $stepsItemNumberBorderRadius;
        transition: $actionIconTransition;
      }

      .p-stepper-title {
        margin-left: $inlineSpacing;
        color: $stepsItemTextColor;
        font-weight: $stepsItemFontWeight;
        transition: $actionIconTransition;
      }

      &:not(.p-disabled):focus-visible {
        @include focused();
      }
    }

    &.p-highlight {
      .p-stepper-number {
        background: $highlightBg;
        color: $highlightTextColor;
        border-color: transparent;
      }

      .p-stepper-title {
        color: $textColor;
      }
    }

    &:not(.p-disabled):focus-visible {
      @include focused();
    }

    &:has(~ .p-highlight) {
      @if meta.variable-exists(primaryColor) {
        .p-stepper-separator {
          background-color: $primaryColor;
        }
      }
    }
  }

  .p-stepper-panels {
    background: $tabviewContentBg;
    padding: $tabviewContentPadding;
    color: $tabviewContentTextColor;
  }

  .p-stepper-separator {
    background-color: $timelineEventColor;
    width: 100%;
    height: 1px;
    margin-inline-start: $inlineSpacing;
    transition: $listItemTransition;
  }

  &.p-stepper-vertical {
    display: flex;
    flex-direction: column;

    .p-stepper-toggleable-content {
      display: flex;
      flex: 1 1 auto;
      background: $tabviewContentBg;
      color: $tabviewContentTextColor;
    }

    .p-stepper-panel {
      display: flex;
      flex-direction: column;
      flex: initial;

      &.p-stepper-panel-active {
        flex: 1 1 auto;
      }

      .p-stepper-header {
        flex: initial;
      }

      .p-stepper-content {
        width: 100%;
        padding-left: calc($inlineSpacing * 2);
      }

      .p-stepper-separator {
        flex: 0 0 auto;
        width: 2px;
        height: auto;
        margin-inline-start: calc($inlineSpacing * 7 / 2 + 2px);
      }

      &:has(~ .p-stepper-panel-active) {
        @if meta.variable-exists(primaryColor) {
          .p-stepper-separator {
            background-color: $primaryColor;
          }
        }
      }

      &:last-of-type {
        .p-stepper-content {
          padding-left: calc($inlineSpacing * 6);
        }
      }
    }
  }
}
