@import "variables";
@import "mixins";
@import "grid.scss";

$checkout-form-bg: $gray100 !default;

// toto sa enqueuje v inc/enqueue.php
.tabs-column {
  @include bp("md") {
    padding: 0;
  }
}
.tabs {
  background: $gray800;
  color: $gray200;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-start;
  align-content: center;
  margin-bottom: (2rem * 1.6);
  padding: (2rem * 1.6) 0 (1rem * 1.6);
  .tab {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    align-content: center;
    width: 12rem;
    &.active {
      .number {
        border: 1px solid $white;
        color: $white;
      }
      .label {
        color: $white;
      }
    }
    .number {
      font-size: 3rem;
      height: 5.4rem;
      width: 5.4rem;
      border: 1px solid $gray200;
      line-height: 5.4rem;
      text-align: center;
      position: relative;
      border-radius: 3px;
      margin-bottom: 0.6rem;
      &::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 100%;
        width: 3rem;
        height: 1px;
        transform: translate(60%, -50%);
        background: $gray200;
        @include bp("md") {
          content: none;
        }
      }
    }
    .label {
      font-size: 1.4rem;
    }
    &:last-child {
      .number {
        &:after {
          content: none;
        }
      }
    }
  }
}

//checkout step 1
.checkout-step-1 {
  .checkout-form-wrp {
  }
}

.checkout-form-wrp {
  .woocommerce-cart-form {
    table.shop_table {
      border-radius: 0;
      border: none;
      th,
      td {
        position: relative;
        border: none;
        &.product-remove {
          position: absolute;
          right: 0;
          z-index: 1;
          top: 50%;
          transform: translate(0%, -50%);
          @include bp("md") {
            top: 0;
            right: 0;
            transform: none;
          }
          a.remove {
            border-radius: 0 !important;
          }
        }
      }
      thead {
        th {
          padding: 1px 1.2rem 0.9rem;
        }
      }
      tbody {
        display: flex;
        flex-direction: column;
        row-gap: 2rem;
        > tr.cart_item {
          background: $gray100;
          position: relative;
          margin-bottom: 0;
          display: grid;
          grid-template-columns: 9rem auto 10rem 15rem;
          column-gap: 1rem;
          row-gap: 2rem;
          align-items: center;
          @include bp("lg") {
            padding-top: (2.5rem * 1.6);
          }
          @include bp("md") {
            grid-template-columns: auto 10rem 12rem;
          }
          @include bp("sm") {
            grid-template-columns: 1fr 1fr;
            grid-template-rows: auto;
          }
          td {
            border: none;
            font-size: $fs-1;
          }
          .product-thumbnail {
            padding: 0;
            img {
              aspect-ratio: 1;
              object-fit: cover;
              width: 9rem;
            }
          }
          .product-name {
            font-weight: $fw-light;
            @include bp("sm") {
              grid-column: 1 / span 2;
            }
          }
          .product-subtotal {
            text-align: right;
          }
          .product-quantity {
            @include product-quantity;
          }
        }
      }
    }
  }
  .checkout-left-column {
    margin-bottom: $space-lg;
    @include bp("lg") {
      margin-bottom: 0;
    }
    .customer-info-step {
      h3 {
        font-size: $fs-1;
        font-weight: $fw-bold;
        text-transform: uppercase;
        margin-bottom: (1rem * 1.6);
      }
      > div {
        background: $checkout-form-bg;
        padding: 0 (1rem * 1.6);
        &.woocommerce-billing-fields {
          padding: (1rem * 1.6) (1rem * 1.6) 0;
        }
        &.checkbox {
          padding: 0 (1rem * 1.6) (1rem * 1.6);
        }
      }
      > p {
        background: $col-bg;
        margin: 0;
        padding: 4rem (1rem * 1.6);
        border: 2px solid $gray100;
        display: flex;
        justify-content: space-between;
        @include bp("md") {
          flex-direction: column;
          padding: (1rem * 1.6);
        }
        span {
          color: $gray800;
          font-weight: $fw-bold;
        }
      }
      .woocommerce-billing-fields {
        .half-first,
        .half-last {
          width: calc(50% - (0.5rem * 1.6));
          display: inline-block;
          @include bp("md") {
            width: 100%;
          }
        }
        .half-first {
          float: left;
          &::after {
            content: "" !important;
            display: block;
            clear: both;
          }
        }
        .half-last {
          float: right;
        }
        .half-alone {
          width: calc(50% - (0.5rem * 1.6));
          display: block;
          @include bp("md") {
            width: 100%;
          }
        }
        .checkbox {
          clear: both;
        }
        .form-row-wide {
          clear: none;
        }
        .billing-company-fields {
          display: flex;
          display: flex;
          flex-direction: row;
          flex-wrap: wrap;
          justify-content: space-between;
          .form-row {
            flex: 1 0 calc(50% - (0.5rem * 1.6));
            max-width: calc(50% - (0.5rem * 1.6));
            @include bp("md") {
              width: 100%;
            }
          }
        }
      }
    }
    .shipping-payment-step {
      .woocommerce-checkout-payment {
        h3 {
          font-size: $fs-1;
          font-weight: $fw-bold;
          text-transform: uppercase;
          margin-bottom: (1rem * 1.6);
        }
        ul {
          padding: 0;
          border: 2px solid $gray100;
          .wc_payment_method {
            list-style: none;
            border-bottom: 2px solid $gray100;
            padding: (1rem * 1.6) (2rem * 1.6);
            &:last-child {
              border-bottom: none;
            }
            &.is-checked {
              background: $gray100;
            }
            label {
              margin: 0;
              font-weight: $fw-bold;
            }
            .payment_box {
              margin-top: (1rem * 1.6);
            }
            input {
              margin-right: 2.5rem;
            }
          }
        }
      }
    }
    .checkout-summary-step {
      .pay {
        width: 100%;
        margin-bottom: (2rem * 1.6);
        h3 {
          font-size: $fs-1;
          font-weight: $fw-bold;
          text-transform: uppercase;
          margin-bottom: (1rem * 1.6);
        }
        .wrp {
          padding: (1rem * 1.6);
          background: $gray100;
          label {
            margin: 0;
            font-weight: $fw-bold;
          }
          .payment_box {
            margin-top: (1rem * 1.6);
          }
        }
      }
      .shipping,
      .bill {
        width: 100%;
        margin-bottom: (2rem * 1.6);
        h3 {
          font-size: $fs-1;
          font-weight: $fw-bold;
          text-transform: uppercase;
          margin-bottom: (1rem * 1.6);
        }
        address {
          padding: (1rem * 1.6);
          background: $gray100;
        }
      }
      .company-additional-info {
        strong {
          font-size: $fs-1;
          font-weight: $fw-bold;
          text-transform: uppercase;
          margin-bottom: (1rem * 1.6);
        }
        > div {
          padding: (1rem * 1.6);
          background: $gray100;
        }
      }
      .note-wrp {
        width: 100%;
        margin-bottom: (2rem * 1.6);
        h3 {
          font-size: $fs-1;
          font-weight: $fw-bold;
          text-transform: uppercase;
          margin-bottom: (1rem * 1.6);
        }
        .note {
          padding: (1rem * 1.6);
          background: $gray100;
        }
      }
    }
    .customer-info-step,
    .shipping-payment-step,
    .checkout-summary-step {
      .checkout-buttons-wrap {
        display: flex;
        justify-content: space-between;
        margin-top: (2rem * 1.6);
        @include bp("lg") {
          position: fixed;
          bottom: 0;
          left: 0;
          width: 100%;
          background-color: $white;
          z-index: 999;
        }
        button {
          &.prev {
            @include button-outline;
            background-color: $white;
            width: calc(50% - (1rem * 1.6));
            @include bp("lg") {
              position: fixed;
              bottom: 0;
              left: 0;
              width: 50%;
              border-radius: 0;
              padding: (1rem * 1.6);
              z-index: 10;
            }
            @include bp("md") {
              position: fixed;
              bottom: 0;
              left: 0;
              width: 100%;
              border-radius: 0;
              padding: (1rem * 1.6);
              z-index: 10;
            }
          }
          &.shipping-payment-btn,
          &.checkout-summary-btn,
          &#place_order {
            width: calc(50% - (1rem * 1.6));
            @include bp("lg") {
              position: fixed;
              bottom: 0;
              right: 0;
              width: 50%;
              border-radius: 0;
              padding: (1rem * 1.6);
              z-index: 10;
            }
            @include bp("md") {
              position: fixed;
              bottom: 5.3rem;
              left: 0;
              width: 100%;
              border-radius: 0;
              padding: (1rem * 1.6);
              z-index: 10;
            }
          }
        }
      }
    }
    form .form-row {
      margin: 0 0 (1rem * 1.6);
      input.input-text,
      textarea,
      select {
        @include input;
        -webkit-appearance: none;
        background-color: $checkout-form-bg;
      }
      &.woocommerce-validated {
        input.input-text,
        textarea,
        select {
          -webkit-appearance: none;
          @include input-valid;
        }
      }
      &.woocommerce-invalid {
        input.input-text,
        textarea,
        select {
          @include input-error;
          -webkit-appearance: none;
        }
      }
      label.inplace-label {
        background-color: $checkout-form-bg;
        line-height: 1em;
      }
      .woocommerce-input-wrapper {
        position: relative;
        label.error {
          position: absolute;
          left: 0;
          bottom: -2rem;
          color: red;
          transform: translate((1rem * 1.6), 50%);
          margin: 0;
          background: $gray100;
          line-height: 1;
        }
      }
    }
    #order_comments {
      margin-bottom: (2rem * 1.6);
    }
  }
  .checkout-right-column {
    margin-top: 3.4rem;
    margin-bottom: $space-md;
    display: flex;
    flex-direction: column;
    row-gap: 2rem;
    @include bp("md") {
      margin-top: (1rem * 1.6);
    }
    > div {
      background: $gray100;
      padding: (1rem * 1.6);
      p {
        margin: 0;
      }
      .label {
        font-weight: $fw-bold;
      }
      button {
        width: 100%;
      }
    }
    .cart-totals {
      display: flex;
      flex-direction: column;
      > div {
        margin: 0 0 (1rem * 1.6);
        display: flex;
        flex-flow: row;
        justify-content: space-between;
        align-items: flex-end;
        &:last-child {
          margin: 0;
        }
      }
    }
    .cart-coupon-wrp {
      // order: 1;
      .form-wrp {
        form {
          display: grid;
          grid-template-columns: 3fr 2fr;
          @include bp("sm") {
            grid-template-columns: 1fr;
            margin: (1rem * 1.6) 0;
            row-gap: 1rem;
            .input-text {
              min-width: 1px;
            }
          }
          .input-text {
            width: 100%;
          }
          button.apply-coupon-btn {
            display: flex;
            justify-content: center;
            align-items: center;
          }
        }
        .woocommerce-error {
          background-color: transparent;
          border: 0;
          color: $col-danger;
          font-size: 1.6rem;
          margin-bottom: 1rem;
          padding: 1rem 2rem 1rem 0.5rem;
          &:before {
            content: none;
          }
        }
      }
    }
    .other-steps {
      order: 2;
      .cart-summary-wrp {
        .item {
          display: grid;
          grid-template-columns: 1fr 10rem;
          padding-bottom: (1rem * 1.6);
          margin-bottom: (1rem * 1.6);
          border-bottom: 1px solid $gray200;
          .thumb {
            display: none;
          }
          .name {
          }
          .price {
            text-align: right;
          }
          .subtotal {
            display: none;
          }
        }
      }
    }
    .customer-info-btn {
      @include bp("lg") {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        border-radius: 0;
        padding: (1rem * 1.6);
        z-index: 10;
      }
    }
    .reservation-info-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      align-content: center;
      flex-wrap: wrap;
      flex-direction: row;
      margin: (1rem * 1.6) 0;
    }
  }
  button {
    @include button;
  }
  input[type="checkbox"] + label {
    font-size: 1.05em;
  }
}

.thank-you-section {
  margin-bottom: $space-lg;
  .thank-you-wrapper {
    margin: $space-lg 0;
    text-align: center;
    h2,
    p {
      margin-bottom: $space-md;
    }
    .button {
      @include button;
      cursor: pointer;
      &:hover {
        transition: $trans-h;
        color: $white;
      }
    }
  }
}

.cart-empty {
  margin: $space-lg 0;
  @include bp("md") {
    margin: $space-md 0;
  }
}
