/* Request a blood test - Contact Form 7 (ID 2139) inside a Beaver Builder button lightbox */
.fl-button-lightbox-content:has(.wpcf7[data-wpcf7-id="2139"]) {
  --bt-primary: #66c3d3;
  --bt-accent: #d84e00;

  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
  background-color: #eff1f3;
  border-radius: 12px;
  color: #000000;
  font-family: "Comfortaa", sans-serif;

  /* The lightbox has no heading element, so the title is generated here. */
  &::before {
    content: "Request a blood test";
    display: block;
    margin: 0 0 20px;
    padding-right: 32px;
    font-size: 18px;
    font-weight: 500;
    line-height: normal;
  }

  /* BB forces `background: transparent !important` on .mfp-close, so the icon is drawn on a pseudo-element. */
  .mfp-close {
    top: 16px !important;
    right: 16px;
    width: 16px;
    height: 16px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
    line-height: 0;
    color: transparent;
    opacity: 1;
    cursor: pointer;

    &::before {
      content: "";
      position: absolute;
      inset: 0;
      background: url("../images/blood-test-form/icon-x.svg") center / 16px 16px
        no-repeat;
    }

    &:hover,
    &:focus-visible {
      opacity: 0.7;
    }
  }

  .wpcf7 {
    margin: 0;
  }

  .wpcf7-form {
    margin: 0;
  }

  .form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .form-grid > .field,
  .form-grid > .button {
    grid-column: 1 / -1;
    min-width: 0;
    margin: 0;

    p {
      margin: 0;
    }
  }

  /* Label, line break and control wrapper stack with an 8px gap. */
  .field label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: normal;
    color: #000000;

    br {
      display: none;
    }
  }

  .wpcf7-form-control-wrap {
    display: block;
    width: 100%;
  }

  .wpcf7-form-control.wpcf7-text,
  .wpcf7-form-control.wpcf7-email,
  .wpcf7-form-control.wpcf7-tel,
  .wpcf7-form-control.wpcf7-date,
  .wpcf7-form-control.wpcf7-textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 14px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.2;
    color: #000000;
    background-color: #ffffff;
    border: 1px solid var(--bt-primary);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    appearance: none;

    &:focus {
      outline: 0;
      border-color: var(--bt-accent);
    }
  }

  .wpcf7-form-control.wpcf7-text,
  .wpcf7-form-control.wpcf7-email,
  .wpcf7-form-control.wpcf7-tel,
  .wpcf7-form-control.wpcf7-date {
    height: 43px;
  }

  .field-address .wpcf7-textarea {
    height: 80px;
    min-height: 60px;
    resize: vertical;
  }

  .field-message .wpcf7-textarea {
    height: 120px;
    min-height: 120px;
    line-height: 20px;
    resize: vertical;
  }

  .wpcf7-textarea::placeholder {
    color: #595959;
    opacity: 1;
  }

  .wpcf7-date {
    position: relative;
    padding-right: 44px;

    &::-webkit-calendar-picker-indicator {
      position: absolute;
      top: 50%;
      right: 14px;
      width: 20px;
      height: 20px;
      margin: 0;
      padding: 0;
      transform: translateY(-50%);
      background: url("../images/blood-test-form/icon-calendar.svg") center /
        20px 20px no-repeat;
      opacity: 1;
      cursor: pointer;
    }

    &::-webkit-calendar-picker-indicator:hover {
      opacity: 0.7;
    }

    &::-webkit-date-and-time-value {
      min-height: 1.2em;
      text-align: left;
    }
  }

  .form-grid > .button {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    p {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 12px;
    }
  }

  .wpcf7-submit {
    min-width: 200px;
    margin: 0;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    line-height: normal;
    text-align: center;
    color: #ffffff;
    background-color: var(--bt-accent);
    border: 0;
    border-radius: 999px;
    box-shadow: none;
    cursor: pointer;
    transition: background-color 0.2s ease;

    &:hover,
    &:focus-visible {
      background-color: #b84200;
    }
  }

  .wpcf7-spinner {
    margin: 0;
  }

  .wpcf7-not-valid-tip {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.3;
  }

  .wpcf7-response-output {
    margin: 16px 0 0;
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 8px;
  }

  @media (min-width: 800px) {
    padding: 32px;
    border-radius: 16px;

    &::before {
      margin-bottom: 24px;
      font-size: 24px;
    }

    .mfp-close {
      top: 20px !important;
      right: 20px;
    }

    .form-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 20px;
    }

    .form-grid > .field-child,
    .form-grid > .field-dob,
    .form-grid > .field-phone,
    .form-grid > .field-email {
      grid-column: auto;
    }

    .field label {
      font-size: 16px;
    }

    .wpcf7-form-control.wpcf7-text,
    .wpcf7-form-control.wpcf7-email,
    .wpcf7-form-control.wpcf7-tel,
    .wpcf7-form-control.wpcf7-date,
    .wpcf7-form-control.wpcf7-textarea {
      padding: 14px 16px;
      font-size: 14px;
    }

    .wpcf7-form-control.wpcf7-text,
    .wpcf7-form-control.wpcf7-email,
    .wpcf7-form-control.wpcf7-tel,
    .wpcf7-form-control.wpcf7-date {
      height: 46px;
    }

    .field-address .wpcf7-textarea {
      min-height: 80px;
    }

    .field-message .wpcf7-textarea {
      height: 160px;
      min-height: 160px;
    }

    .wpcf7-date {
      padding-right: 48px;

      &::-webkit-calendar-picker-indicator {
        right: 16px;
      }
    }
  }
}

/* Lightbox container spacing around the modal (12px / 20px on mobile, 40px / 80px on desktop). */
.mfp-container:has(.wpcf7[data-wpcf7-id="2139"]) {
  padding: 20px 12px;

  @media (min-width: 640px) {
    padding: 40px 80px;
  }
}
