@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;
    .stepper-header-wrapper {
      background-color: #FFF;
      display: flex;
      position: sticky;
      top: $tp-checkout-wrapper-header-top;
      z-index: 2;
      font-size: 12px;
      margin-bottom: $tp-checkout-wrapper-header-margin;
      box-shadow: $tp-checkout-wrapper-header-box-shadow;
      height: $tp-checkout-wrapper-header-height;
    }
    .co-stepper-content {
      display: flex;
      flex-direction: row;
      max-width: $tp-checkout-wrapper-max-width;
      margin: 0 auto;
      position: absolute;
      width: 100%;
      left: 50%;
      transform: translateX(-50%);
      top: 15px;
    }
    .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: 5px;
        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;
      position: sticky;
      bottom: 0;
      background: #FFF;
      padding: 15px 25px;
      z-index: 2;
      box-shadow: 0px 2px 0px 0px rgba(234, 234, 234, 0.7);
      border-top: 10px solid #f8f8fa;
      co-button.co-button {
        background: #212437;
        color: #FFF;
        border: 1px solid #1A73E8;
        height: 32px;

        .co-icon {
          width: $tp-co-stepper-step-button-icon-size;
          height: $tp-co-stepper-step-button-icon-size;
          svg {
            fill: #FFF;
          }
          svg [fill] {
            fill: #FFF;
          }
        }
      }
    }
  }
}
