@import '../helpers/helpers';
@import '../components/snack-bar';

.page_wismo-orders {
  .page-header {
    width: 100%;
    text-align: center;
  }

  .wismo-order {
    width: 100%;
    padding: 30px 20px;
    position: relative;

    &-wrap {
      border: 1px solid $warm-grey;
      margin-bottom: 60px;
    }

    &__heading {
      position: absolute;
      top: -15px;
      left: calc(50% - 120px);
      background-color: $white;
      color: $gray-dark;
      width: 240px;
      text-align: center;
      margin: 0;
      font-weight: 500;
      font-size: 1.5rem;
      line-height: 2rem;

      & + .wismo-order__store-link,
      & + .wismo-order__delivery-notification {
        padding-top: 20px;
      }

      & + .wismo-order__delivery-notification {
        .icon {
          top: 23px;
          position: absolute;
        }
      }
    }

    &__message {
      font-size: 1.25em;
      line-height: 1.5;
      padding-top: 5px;
      margin: 0;
      columns: $gray-dark;
    }

    &__store-link {
      padding-bottom: 5px;
      font-weight: 500;
      font-size: 1rem;
      color: $gray-dark;

      .icon {
        svg {
          position: relative;
          right: 5px;
          bottom: 1px;
        }
      }
    }

    &__delivery-notification {
      font-weight: bold;
      padding-left: 26px;
      position: relative;
      color: $gray-dark;
      font-size: 1.125rem;
      line-height: 1.5rem;

      .icon {
        position: absolute;
        left: 0;
        top: 0;

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

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

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

    &__track {
      margin: 15px 0 .5rem;

      & .btn {
        width: 230px;
      }
    }

    &__product {
      display: flex;
      align-items: flex-start;
      padding: 15px 0;

      &-wrap {
        padding-bottom: 15px;
        border-bottom: 1px solid $gray;
      }

      &:last-child {
        padding-bottom: 0;
        border-bottom: 0;
      }
    }

    &__img {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100px;
      margin-right: 15px;
      padding-top: 5px;

      img {
        max-height: 100px;
        max-width: 100px;
      }
    }

    &__name {
      a {
        font-size: .875rem;
      }
    }

    &__name,
    &__quantity,
    &__total {
      line-height: 1.5rem;

      .value {
        font-weight: bold;
        font-size: 1.125rem;
      }

      .price-per-uom {
        font-weight: bold;
        font-size: .75rem;
      }
    }

    a:not(.energy-efficiency__link) {
      text-decoration: none;

      &:hover {
        text-decoration: underline;
      }
    }

    &__click-collect,
    &__wickes-delivery,
    &__supplier-delivery {
      .wismo-order {
        &:not(:last-child) {
          border-bottom: 1px solid $warm-grey;
        }
      }
    }
  }
}

.wismo {
  &__header {
    margin-bottom: 20px;
  }

  .logo__print {
    display: none;
  }

  &__order-heading {
    display: flex;
    padding: 15px 20px;
    width: 100%;
    margin-bottom: 45px;
    background: $gray-bg;
    flex-wrap: wrap;

    & .order-heading {
      &__info {
        @include make-col(4);

        &:nth-child(2) {
          display: flex;
          justify-content: center;
        }
      }

      &__title {
        font-size: 1rem;
        line-height: 1.5rem;
        padding-bottom: 3px;
      }

      &__value {
        font-size: 1.125rem;
        line-height: 1.5rem;
        font-weight: 500;
      }

      &__print {
        color: $blue;
        font-weight: 500;
        font-size: .875rem;
        cursor: pointer;
        text-align: right;
      }
    }
  }

  &__ref {
    padding: 30px 20px;
    border: 1px solid $green;
    width: 100%;
    color: $green;
    margin: 0 15px;

    .heading-3 {
      padding-left: 36px;
      position: relative;
      font-size: 1.125rem;
      line-height: 1.5rem;

      .icon {
        position: absolute;
        left: 0;
        top: 0;
      }

      .ref-msg {
        font-weight: 500;
      }
    }

    &-wrap {
      margin-top: -30px;
      margin-bottom: 60px;
    }
  }

  .wismo-order-wrap {
    &:last-child {
      margin-bottom: 0;
    }
  }

  .btn {
    font-weight: $font-weight-bold;
  }
}

@include media-breakpoint-down(md) {
  .wismo {
    .wismo-row {
      margin: 0 -15px;

      .content {
        padding: 0;
      }
    }
  }
}

@include media-breakpoint-down(sm) {
  .page_wismo-orders {
    .wismo-order {
      padding: 15px;

      &__heading {
        left: calc(50% - 130px);
        width: 260px;
      }

      &-wrap {
        margin-left: 15px;
        margin-right: 15px;
      }

      &__store-link {
        font-size: .875rem;

        a {
          display: block;
          margin-bottom: 10px;
        }
      }

      &__delivery-notification {
        padding-left: 26px;
        font-weight: 500;
        font-size: 1rem;
      }

      &__track {
        & .btn {
          width: 100%;
        }
      }
    }
  }

  .wismo {
    &__header {
      margin-bottom: 15px;
    }

    &__order-heading {
      flex-wrap: wrap;
      margin: 0 15px 40px;
      padding: 10px 15px;

      & .order-heading {
        &__info {
          @include make-col(6);

          &:nth-child(2) {
            justify-content: flex-end;
          }
        }

        &__print {
          text-align: left;
          padding-top: 10px;
          display: none;
        }
      }
    }
  }
}

@include media-breakpoint-up(lg) {
  .wismo {
    &__ref {
      &-wrap {
        padding: 0;
      }
    }
  }

  .page_wismo-orders {
    .wismo-order {
      &__product {
        &-wrap {
          display: flex;
          justify-content: space-between;
        }
      }

      &__action {
        padding-top: 15px;

        .btn {
          min-width: 106px;
        }
      }
    }
  }
}

@include media-breakpoint-up(lg) {
  .wismo {
    &__order-heading {
      display: flex;
    }
  }
}

@include media-breakpoint-only(md) {
  .wismo {
    .wismo-row {
      margin-right: -30px;
    }
  }
}

@include media-breakpoint-only(sm) {
  .wismo {
    &-order {
      &__product {
        &-wrap {
          display: flex;
          justify-content: space-between;
        }
      }
    }
  }
}

@media print {
  .page_wismo-orders {
    .container,
    .header {
      // sass-lint:disable no-important
      max-width: inherit !important;
      width: 100%;
      padding: 0;
    }

    main {
      padding-bottom: 0;

      &.container {
        padding-top: 20px;
      }
    }

    // sass-lint:disable no-ids
    footer,
    .main-nav,
    .main-nav__overlay,
    .breadcrumbs,
    .sticky-wrapper,
    .sticky-wrapper.waypoint,
    .header-inner,
    .back-to-top,
    .cookies-policy,
    #cookie-bar,
    .new-usp-container {
      // sass-lint:disable no-important
      display: none !important;
    }

    .wismo {
      display: block;
      margin-right: 0;
      margin-left: 0;

      .logo__print {
        display: block;
        float: left;
        width: 150px;
      }

      .page-header {
        padding-right: 150px;

        &::after {
          clear: both;
          display: block;
          content: '';
        }
      }

      .row {
        margin-right: 0;
        margin-left: 0;
      }

      &__ref {
        margin: 20px -30px -30px 0;
      }
    }

    .wismo-order,
    .wismo-order__product {
      display: block;
      width: 100%;
    }

    .wismo-order {
      padding: 15px;
      border: 1px solid $warm-grey;
      margin-bottom: -2px;

      &__heading {
        position: relative;
        margin: 0;
        left: 0;
        text-align: center;
        top: 0;
        width: 100%;
      }
    }

    .wismo-order__product {
      page-break-inside: avoid;
    }

    .wismo-order-wrap {
      //page-break-after: always;
      margin: 0 0 40px;
      border: 0;
      position: relative;

      * {
        display: block;
      }

      .icon,
      .wismo-order__store-link a {
        display: inline-block;
      }

      .wismo-order__img,
      .wismo-order__info {
        display: inline-block;
        vertical-align: top;
        page-break-inside: avoid;
      }

      .wismo-order__img {
        width: 115px;
        margin-right: -4px;

        img {
          display: block;
          page-break-inside: avoid;
        }
      }

      .wismo-order__info {
        width: calc(100% - 115px);
      }

      .wismo-order__quantity,
      .wismo-order__total {
        display: block;

        .title,
        .value {
          display: inline-block;
          vertical-align: top;
        }
      }
    }

    .wismo-info {
      margin: 0;
      page-break-inside: avoid;
      text-align: center;
    }

    .wismo-info-banner {
      display: inline-block;
      vertical-align: top;
      width: 32%;
      margin: 0 0 0 1%;
      page-break-inside: avoid;
      text-align: left;

      &:first-child {
        margin-left: 0;
      }
    }
  }
}
