/**
 * Pingdom Signup Form Block — Styles
 *
 * Combines sw19s-corp-form.css, sw19s-corp-field.css,
 * sw19s-confirmation-modal.css and page-level layout from pingdom-2018.
 */

/* ── Page-level layout (from pingdom-2018 page-sign-up) ──────────────── */

.sw-pingdom-signup {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  max-width: 1200px;
  margin: 0 auto;

  @media (max-width: 768px) {
    flex-direction: column;
    padding: 30px 20px;
  }

  .form-wrap {
    flex: 1 1 auto;
    min-width: 0;

    .form-wrap-two {
      max-width: 540px;
      margin: 0 auto;
      position: relative;

      .svg-decor {
        position: absolute;
        bottom: 100%;
        left: 0;
        display: grid;
      }
    }
  }

  .email-in-use-note {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 14px;

    a {
      color: #006482;
    }
  }
}

/* ── Form container (from sw19s-corp-form.css) ───────────────────────── */

.sw19s-corp-form {
  box-shadow: 10px 10px 0 0 var(--Brand-Color-Primary-Silver-300, #a0b9b9);
  border: 1px solid var(--Brand-Color-Primary-Silver-300, #a0b9b9);
  padding: 32px;
  background-color: #fff;

  .promotions,
  .terms {
    padding-left: 22px;
    text-indent: -22px;
    margin-top: 32px;
    display: flex;
    align-items: flex-start;
    gap: 16px;

    p {
      display: inline;
    }

    input[type="checkbox"] {
      appearance: checkbox;
      -webkit-appearance: checkbox;
      width: auto;
      height: auto;
    }

    input[type="checkbox"]:checked:after {
      display: none;
    }

    label {
      font-size: 14px;
      display: inline;
    }
  }

  .sw19-corp-combo-fields {
    display: flex;
    gap: 16px;
  }

  .terms-text {
    margin-top: 32px;
    display: flex;
    align-items: flex-start;
    gap: 16px;

    input {
      width: 16px;
      height: 16px;
      margin: 0;
    }

    p,
    a {
      display: inline;
      font-family: "Roboto", sans-serif;
      font-size: 12px;
      line-height: 16px;
      font-weight: 500;
      color: #444;
    }

    a {
      color: #006482;

      &:hover,
      &:active {
        text-decoration: none;
      }
    }
  }

  input[type="submit"] {
    display: block;
    margin: 30px auto 0 auto;
    width: 100%;

    &:disabled {
      background-color: #cccccc;
      cursor: not-allowed;
    }
  }

  .promotions {
    display: none;
  }

  &.show-optin .promotions {
    display: block;
  }

  ul.errors {
    list-style: none;
    padding: 0;
    margin-top: 12px;
    color: #e20a38;
    font-size: 14px;

    li {
      margin-bottom: 4px;
    }
  }

  .validation-spinner {
    position: absolute;
    top: -5px;
    right: 0;
    width: 45px;
  }

  .sw19s-corp-field:not(.loading) .validation-spinner {
    display: none;
  }

  @media (max-width: 425px) {
    .promotions,
    .terms {
      margin-top: 25px;
    }

    input[type="submit"] {
      font-size: 12px;
      line-height: normal;
    }
  }
}

/* ── Field component (from sw19s-corp-field.css) ────────────────────── */

.sw19s-corp-field {
  margin: 8px 0;
  min-height: 26px;
  width: 100%;
  position: relative;

  input[type],
  input[type]:focus,
  input,
  input:focus,
  .country-picker,
  .sw-selector,
  textarea,
  textarea:focus {
    width: 100%;
    border: 0;
    border-bottom: 2px solid #a0b9b9;
    border-radius: 0;
    padding: 0 0 2px 0;
    font-size: 16px;
    line-height: 24px;
    outline: none;
    margin-top: 1px;
  }

  &.invalid input[type] {
    border-bottom-color: #e20a38;
  }

  label:first-child {
    display: block;
    color: #ccc;
    font-size: 12px;
    line-height: 12px;
    font-weight: 700;
    margin-bottom: 0;
    visibility: hidden;
    position: absolute;
    left: 0;
    bottom: 100%;
  }

  label.selected:first-child {
    visibility: visible;
  }

  label:last-child,
  label.validation {
    color: #e20a38;
    font-size: 12px;
    line-height: 12px;
    font-weight: 700;
    text-align: right;
    display: block;
    visibility: hidden;
    margin: 1px 0 0 0;

    a {
      color: #006482;
      text-decoration: none;

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

  &.invalid label:last-child,
  &.invalid label.validation {
    visibility: visible;
  }

  input::placeholder,
  textarea::placeholder {
    color: #666;
  }

  input:focus::placeholder,
  textarea:focus::placeholder {
    color: transparent;
  }

  .country-picker,
  .sw-selector {
    height: 26px;
    background: transparent;
  }

  textarea {
    height: 80px;
    resize: vertical;
  }
}

form.submitted .sw19s-corp-field label:first-child {
  visibility: visible;
}

/* ── Submit button (sw19s-btn) ───────────────────────────────────────── */

.sw19s-btn {
  display: inline-block;
  background-color: #111;
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 16px 24px;
  font-size: 18px;
  line-height: 24px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease;

  &:hover {
    background-color: #ff6200;
    color: #111;
  }

  &:active {
    background-color: #ff9b66;
    color: #111;
  }

  &.disabled,
  &:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
  }
}

/* ── Confirmation modal (from sw19s-confirmation-modal.css) ──────────── */

.sw19s-confirmation-modal-background {
  width: 100vw;
  height: 100vh;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.25);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;

  @media (max-width: 768px) {
    background-color: rgba(0, 0, 0, 0.75);
  }

  &.modal-display-initial {
    display: none;
  }

  .modal-confirmation {
    width: 550px;
    padding: 2rem;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);

    @media (max-width: 425px) {
      width: 80vw;
    }

    .close-btn {
      border: none;
      background-color: transparent;
      align-self: flex-end;
      cursor: pointer;

      svg {
        width: 15px;
      }
    }

    .modal-title {
      font-weight: 700;
      font-size: 26px;
      margin-top: 15px;
      color: #111;
      text-align: center;
      line-height: 120%;
    }

    .modal-text {
      padding: 0 2rem;
      text-align: center;
      font-size: 16px;
      color: #666;

      @media (max-width: 425px) {
        padding: 0;
      }
    }

    .modal-btn-wrapper {
      margin-top: 15px;
    }

    .btn-dismiss {
      background: none;
      border: none;
      color: #006482;
      cursor: pointer;
      font-size: 14px;
      text-decoration: underline;
    }
  }
}
