@import '../helpers/helpers';
@import '../components/my-account/order-status';
@import '../components/my-account/order-process';
@import '../pages/page_wismo-details';
@import '../libs/font-awesome-icons';

.my-order {
  padding: 0;

  &__header {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    .order-status {
      margin-top: 12px;
    }

    .btn--resend-confirmation {
      min-width: 162px;
    }
  }

  &__body {
    .notification {
      margin-top: 20px;
      margin-bottom: 0;
    }
  }

  &__title {
    font-size: 1.625rem;
    font-weight: 500;
    line-height: 2.25rem;
    margin-bottom: 0;
    text-align: left;
  }

  .linked-order {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    &__title {
      font-size: .875rem;
      font-weight: 500;
      line-height: 1.375rem;
      margin-bottom: 0;
      white-space: nowrap;
      margin-right: 8px;
    }

    &__list {
      margin-bottom: 0;
      padding-left: 0;
      list-style-type: none;
      display: flex;
      align-items: center;

      .comma {
        color: $gray-dark;
      }
    }

    &__item {
      display: flex;
      align-items: center;

      .link {
        font-weight: 500;
      }

      & + .linked-order__item {
        margin-left: 8px;
      }
    }
  }

  &__placed {
    margin-top: 12px;
    margin-bottom: 0;
    font-size: .875rem;
    font-weight: 400;
    line-height: 1.375rem;

    .date {
      display: inline-block;
    }
  }

  .order {
    margin-top: 24px;
    border: 1px solid $gray;
    border-radius: 4px;
    padding: 16px 16px 0;

    &__title {
      font-size: 1.25rem;
      font-weight: 500;
      line-height: 2rem;
      margin-bottom: 8px;
    }

    &__subtotal-wrap {
      display: flex;

      .icon-info {
        margin-left: 4px;
      }
    }

    &__subtotal {
      font-size: .875rem;
      font-weight: 400;
      line-height: 1.375rem;
      margin-bottom: 0;
    }

    &__expectation {
      font-size: .875rem;
      font-weight: 500;
      line-height: 1.375rem;
      display: flex;
      margin-top: 8px;

      &--cc {
        margin-top: 16px;
      }

      .icon-wrap-info {
        color: $blue;
        margin-right: 4px;
        text-align: center;
        width: 100%;
        max-width: 24px;

        & .fa-check-circle {
          color: $gray-dark;
        }

        & .fa-info-circle {
          color: $green;
        }

        & .fa-times-circle {
          color: $red;
        }
      }

      &--supplier {
        margin-top: 0;
        margin-bottom: 16px;
      }
    }

    &__collection {
      margin-top: 16px;
      font-size: .875rem;
      font-weight: 500;
      line-height: 1.375rem;

      .icon {
        margin-left: 6px;
        height: auto;
        font-size: 1rem;
      }

      .link {
        text-decoration: none;
        display: inline-block;
      }
    }

    &__delivery {
      margin-top: 16px;
      font-size: .875rem;
      font-weight: 500;
      line-height: 1.375rem;
    }

    &-products {
      list-style-type: none;
      padding-left: 0;
      margin: 0;

      &__item {
        padding-top: 16px;
        padding-bottom: 16px;

        & + .order-products__item {
          border-top: 1px solid $gray;
        }

        &.consignment {
          .order-products__image {
            opacity: .5;
          }
        }

        &--supplier {
          .order-products__item-wrap {
            & + .order-products__item-wrap {
              padding-top: 16px;
              margin-top: 16px;
              border-top: 1px solid $gray;
            }
          }
        }
      }

      &__item-wrap {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        grid-gap: 8px;
      }

      &__details {
        width: 100%;

        .title {
          font-size: .75rem;
          font-weight: 400;
          line-height: 1rem;
          text-decoration: none;
        }

        .item {
          margin-top: 4px;
          margin-bottom: 0;
          font-size: .75rem;
          font-weight: 400;
          line-height: 1rem;

          &__wrap {
            display: inline-flex;
            flex-direction: column;
            margin-left: 4px;
          }

          &__per {
            font-weight: 500;
          }

          &__vat {
            font-size: .75rem;
            margin-left: 4px;
            font-weight: 500;
            color: $gray-dark;
          }
        }

        .energy-efficiency {
          margin-top: 4px;
          margin-bottom: 0;

          &__link {
            margin-top: 8px;
            font-size: .75rem;
            line-height: 1rem;
          }
        }
      }

      &__image {
        width: 100%;
        height: auto;
        max-width: 72px;
      }

      &__btn {
        max-width: 86px;
        padding: 5px 10px;
        width: 100%;
      }

      .information {
        display: flex;
        align-items: center;
        margin-bottom: 16px;

        &__icon {
          display: flex;
          align-items: center;
          justify-content: center;
          width: 100%;
          max-width: 24px;
          height: 24px;
          font-size: 1rem;
          margin-right: 4px;

          &.cancel {
            color: $red;
          }
        }

        &__text {
          font-size: .875rem;
          font-weight: 500;
          line-height: 1.375rem;
        }
      }
    }

    .track-link {
      display: flex;
      align-items: center;
      margin-top: 8px;
      font-weight: 500;
      text-decoration: none;

      &:hover {
        text-decoration: underline;
      }

      .icon-wrap {
        margin-right: 8px;

        .icon {
          font-size: 1rem;
        }
      }
    }

    & + .order {
      margin-top: 16px;
    }
  }

  .wismo {
    margin-top: 24px;

    .wismo__order-right {
      margin-bottom: 0;
      margin-top: 16px;
    }
  }

  .icon-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: auto;
    max-width: 24px;

    .icon {
      height: auto;
      font-size: 1rem;
    }
  }
}

.account-actions {
  background: $gray-bg;
  padding: 40px 0;
  margin-top: 40px;

  .contacts {
    margin-top: 0;

    &__link {
      white-space: nowrap;
    }

    .icon-wrap {
      margin-left: 8px;
    }
  }

  &__link {
    text-decoration: none;
    font-weight: 500;
    color: $blue;
    display: flex;
    align-items: center;
    transition: all .3s;

    &:hover {
      opacity: .7;
      text-decoration: underline;
    }

    .icon {
      width: 24px;
      height: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-right: 8px;
      font-size: 1rem;
    }
  }

  .link-to-orders {
    display: flex;
    align-items: center;
    margin-top: 24px;
    font-weight: 500;
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }

    .icon-wrap {
      margin-right: 8px;
    }
  }
}

@media (min-width: 320px) and (max-width: 360px) {
  .my-order {
    .order-products__item-wrap {
      flex-direction: column;
    }
  }
}

@include media-breakpoint-only(xs) {
  .my-order {
    .btn--resend-confirmation {
      margin-top: 16px;
    }
  }
}

@include media-breakpoint-up(sm) {
  .my-order {
    &__header {
      display: grid;
      grid-template-columns: auto 1fr;
      align-items: center;
    }

    .btn--resend-confirmation,
    .btn--print {
      grid-row: 1;
      grid-column: 2;
      max-width: 162px;
      margin-left: auto;
    }

    .linked-order {
      grid-column: span 2;
      margin-bottom: 16px;
    }

    .order-status {
      margin-top: 0;
      grid-column: 1;
      max-width: 112px;
    }

    &__placed {
      margin-top: 0;
      text-align: right;
    }

    .order {
      padding: 24px 24px 8px;

      &__date {
        margin-top: 0;
        grid-column: 2;
        text-align: right;
      }

      &__header {
        display: flex;
        justify-content: space-between;
        align-items: center;
      }

      &__title {
        margin-bottom: 0;
        font-size: 1.5rem;
        line-height: 2rem;
      }

      &__expectation:not(.order__expectation--supplier) {
        margin-top: 8px;
      }

      &__delivery {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
      }

      .track-link {
        margin-top: 0;
      }

      &-products {
        &__item-wrap {
          grid-gap: 15px;
        }

        &__image {
          max-width: 100px;
        }

        &__btn {
          max-width: 94px;
          height: 40px;
        }

        &__details {
          .title {
            font-size: .875rem;
            line-height: 1.5rem;
          }

          .item b {
            font-size: 1rem;
          }
        }
      }
    }
  }
}

@include media-breakpoint-up(md) {
  .my-order {
    &__header {
      margin-top: 40px;
    }

    &__title {
      font-size: 2.125rem;
      line-height: 2.875rem;
    }
  }

  .account-actions {
    margin-top: 72px;
    padding-bottom: 72px;
  }
}

@include media-breakpoint-up(lg) {
  .my-order {
    &__header {
      margin-bottom: 24px;
      grid-template-columns: 1fr repeat(3, auto);
      align-items: center;
      grid-gap: 0 24px;
    }

    &__body {
      .notification {
        margin-top: 0;
        margin-bottom: 24px;
      }
    }

    .linked-order {
      grid-column: span 4;
      margin-bottom: 0;
    }

    &__title {
      text-align: left;
    }

    &__placed {
      margin-top: 0;
      grid-column: 3;
      grid-row: 1;
      text-align: right;
    }

    .btn--resend-confirmation,
    .btn--print {
      grid-column: 4;
    }

    .order {
      &:first-child {
        margin-top: 0;
      }

      &-status {
        grid-row: 1;
        grid-column: 2;
        margin-left: auto;
      }

      & + .order {
        margin-top: 24px;
      }
    }

    .wismo {
      margin-top: 0;
      margin-left: -6px;

      &__order-summary,
      &__order-pay {
        border-radius: 4px;
      }
    }
  }
}
