@import "../../../style/mixin";

$index-origin: calc((#{$tp-co-stepper-step-index-size} / 2) + (#{$tp-co-stepper-step-index-border-width} / 2));

@include export-module('co-stepper-layout') {
  .co-stepper {
    font-family: $tp-co-stepper-font-family;
    font-size: $tp-co-stepper-font-size;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: initial;
    .co-stepper-content {
      display: flex;
      flex-direction: row;
      position: relative;
    }
    .stepper-step {
      position: relative;
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      &:not(.last):after {
        content: "";
        position: absolute;
        top: calc(100% - (#{$index-origin} + 2px));
        width: calc(100% - #{$tp-co-stepper-step-index-size} - #{$tp-co-stepper-step-index-border-width});
        left: calc(50% + #{$index-origin});
        height: 2px;
        order: -1;
      }
      &:not(.last):before {
        content: "";
        position: absolute;
        top: calc(100% - (#{$index-origin} + 2px));
        width: 0;
        max-width: calc(100% - #{$tp-co-stepper-step-index-size} - #{$tp-co-stepper-step-index-border-width});
        left: calc(50% + #{$index-origin});
        height: 2px;
        order: -1;
        z-index: 1;
        transition: all .2s;
      }
      .index {
        cursor: pointer;
        display: flex;
        font-size: $tp-co-stepper-step-index-font-size;
        height: $tp-co-stepper-step-index-size;
        width: $tp-co-stepper-step-index-size;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        border-style: solid;
        border-width: $tp-co-stepper-step-index-border-width;
        box-sizing: initial;
      }
      .description {
        margin-bottom: 15px;
        font-weight: $tp-co-stepper-step-incomplete-description-font-weight;
      }
      &.active {
        &:not(.last):before {
          width: 50%;
        }
        .description {
          font-weight: $tp-co-stepper-step-description-font-weight;
        }
        .delivery-truck {
          opacity: 1;
          left: calc(100% - #{$tp-co-stepper-step-delivery-truck-size / 2});
        }
      }
      &.complete {
        &:not(.last):before {
          width: 100%;
        }
        .description {
          font-weight: $tp-co-stepper-step-description-font-weight;
        }
      }
    }
    .delivery-truck {
      position: absolute;
      width: $tp-co-stepper-step-delivery-truck-size;
      height: $tp-co-stepper-step-delivery-truck-size;
      top: calc(100% - (#{$index-origin} + 2px + #{$tp-co-stepper-step-delivery-truck-size / 2}));
      //opacity: 0;
      //left: 50%;
      transform: translateX(-#{$tp-co-stepper-step-delivery-truck-size / 2});
      transition: all .2s;
      z-index: 2;
    }
    .co-stepper-step {
      display: none;
      &.show {
        display: flex;
      }
    }
    .stepper-title {
      display: flex;
      justify-content: space-between;
      padding: $tp-co-stepper-step-title-padding;
      .stepper-title-wrapper {
        display: flex;
        align-items: center;
        column-gap: $tp-co-stepper-step-title-column-gap;
      }
      .title {
        font-family: $tp-co-stepper-step-title-font-family;
        font-size: $tp-co-stepper-step-title-font-size;
        font-weight: $tp-co-stepper-step-title-font-weight;
      }
      .title-icon {
        height: $tp-co-stepper-step-title-icon-size;
        width: $tp-co-stepper-step-title-icon-size;
      }
    }
    .stepper-button-wrapper {
      display: flex;
      column-gap: 5px;
      justify-content: flex-end;
      margin: 15px 0;
      .co-button {
        .co-icon {
          width: $tp-co-stepper-step-button-icon-size;
          height: $tp-co-stepper-step-button-icon-size;
        }
      }
    }
  }
}
