@import '../../helpers/helpers';

.active-orders {
  margin-top: 24px;

  &__title {
    font-weight: 500;
    font-size: 1.25rem;
    line-height: 1rem;
    color: $blue-dark;
    margin-bottom: 0;
  }

  &__item {
    margin-top: 16px;
    padding: 16px;
    background: $white;
    border-radius: 4px;
  }

  .view-more {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 12px;
    border-top: 1px solid $gray;

    .link {
      font-weight: 500;
      font-size: .875rem;
      line-height: 1.375rem;
      text-align: center;
      color: $blue;
      text-decoration: none;
      display: flex;
      justify-content: center;
      align-items: center;

      span:hover {
        text-decoration: underline;
      }

      .icon {
        margin-left: 8px;
        font-size: 1rem;
      }
    }
  }

  .btn--all-orders {
    margin-top: 16px;
  }
}

.order {
  &-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;

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

  &-status {
    background: rgba(2, 119, 189, .1);
    padding: 2px 8px;
    border-radius: 50px;
    font-weight: 500;
    display: flex;
    align-items: center;

    .icon {
      font-size: 1rem;
      height: auto;
      color: $blue;
      margin-right: 8px;
    }

    &.completed {
      background: rgba(103, 165, 9, .1);

      .icon {
        color: $green;
      }
    }

    &.cancelled {
      background: rgba(207, 0, 15, .1);

      .icon {
        color: $red;
      }
    }
  }

  &-details {
    margin-top: 8px;

    &__summary {
      display: flex;
      align-items: baseline;
    }

    &__price {
      margin-bottom: 0;
      font-weight: 700;
      font-size: 1.125rem;
      line-height: 1.5rem;
      color: $blue-dark;
    }

    &__vat {
      margin-left: 5px;
      line-height: 1rem;
    }

    &__count {
      position: relative;
      padding-left: 8px;
      margin-left: 8px;
      font-weight: 400;
      font-size: .875rem;
      line-height: 1.375rem;
      color: $gray-dark;

      &::before {
        content: '';
        height: 100%;
        position: absolute;
        max-height: 16px;
        left: 0;
        top: 50%;
        width: 1px;
        background: $gray;
        transform: translateY(-50%);
      }
    }

    &__date {
      display: block;
      margin-top: 4px;
      font-weight: 400;
      font-size: .875rem;
      line-height: 1.375rem;
      color: $gray-dark;
    }
  }
}

@include media-breakpoint-up(sm) {
  .active-orders {
    &__header {
      display: flex;
      justify-content: space-between;
      align-items: center;

      .btn--all-orders {
        margin-top: 0;
        max-width: 125px;
      }
    }

    &__item {
      display: grid;
      grid-template-areas:
      'header viewMore'
      'orderDetails orderDetails'
      'consignmentInfo consignmentInfo'
      'paymentStatus paymentStatus'
      'shipment shipment';

      .order-header {
        flex-direction: row-reverse;
        justify-content: flex-end;
        grid-area: header;

        &__title {
          margin-left: 16px;
          font-weight: 700;
        }
      }

      .view-more {
        grid-area: viewMore;
        justify-content: flex-end;
        border-top: 0;
        padding: 0;

        .link .icon {
          margin-left: 13px;
        }
      }
    }
  }

  .order-details {
    grid-area: orderDetails;
    display: flex;
    align-items: baseline;

    &__date {
      margin-left: 8px;
      padding-left: 8px;
      margin-top: 0;
      position: relative;

      &::before {
        content: '';
        height: 100%;
        position: absolute;
        max-height: 16px;
        left: 0;
        top: 50%;
        width: 1px;
        background: $gray;
        transform: translateY(-50%);
      }
    }
  }
}

@include media-breakpoint-up(md) {
  .active-orders__title {
    font-size: 1.5rem;
  }
}

@include media-breakpoint-up(lg) {
  .active-orders {
    &__item {
      padding: 24px;
      grid-template-areas:
      'header consignmentInfo viewMore'
      'orderDetails orderDetails orderDetails'
      'paymentStatus paymentStatus paymentStatus'
      'shipment shipment shipment';
      grid-template-columns: auto auto 1fr;
      align-items: center;
    }
  }
}
