// shared styles
// used in both login and
// create account modals
.d-modal.login-modal:not(.hidden),
.d-modal.create-account {
  .modal-body {
    padding: 0;
  }
  &.fixed-modal .modal-inner-container {
    max-width: 350px;
    max-height: 90vh;
    position: relative;
    overflow: hidden;
  }

  .close {
    padding: 0;
  }

  label {
    margin: 0;
  }

  .tip:not(:empty) {
    min-height: 1.4em; // prevents height jump when tips appear
  }

  .login-welcome-header {
    padding: 1.5em 1em;
    margin: 0 auto;
  }

  #login-buttons:not(.hidden) {
    display: flex;
    flex: 1 0 auto;
    flex-wrap: wrap;
    justify-content: center;
    padding: 1em;
    margin: 0;

    .btn {
      padding: 0.53em 0.53em 0.53em 0.43em;
      border: 1px solid var(--primary-low);
      flex: 1 1 47%;
      margin: 0 0.5em 0.5em 0;
      white-space: nowrap;
      &:last-child {
        margin-right: 0;
      }
    }
  }

  @media screen and (max-width: 750px) {
    #login-buttons:not(.hidden) {
      justify-content: center;
      .btn {
        &:nth-child(even) {
          margin: 0 0 0.5em 0;
        }
      }
    }
  }

  #login-form,
  .login-form {
    padding: 1em;

    form {
      display: flex;
      justify-content: center;
      flex-direction: column;
    }

    .input-group {
      input {
        height: 2.5em;
        margin-bottom: 0.25em;
      }
      margin-bottom: 1em;
      label.alt-placeholder {
        top: 8px;
      }
      input:focus + label,
      input.value-entered + label.alt-placeholder {
        top: -10px;
      }
      input.alt-placeholder:invalid {
        color: var(--primary);
      }
      label.more-info {
        color: var(--primary-medium);
      }
    }
  }

  .user-fields .input-group {
    .text.user-field {
      label.control-label {
        top: 8px;
      }
      &.value-entered label.control-label,
      label.control-label.value-entered {
        top: -10px;
        left: calc(1em - 0.25em);
        background-color: var(--secondary);
        padding: 0 0.25em 0 0.25em;
        font-size: 14px;
        color: var(--primary-medium);
      }
    }
    .controls .checkbox-label {
      align-items: center;
      input[type="checkbox"].ember-checkbox {
        height: 15px;
      }
    }
  }

  .modal-body input[type="text"],
  .modal-body input[type="email"],
  .modal-body input[type="password"],
  .modal-body input[type="tel"] {
    margin-top: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .modal-footer {
    box-sizing: border-box;
    margin: 0 auto;
    font-size: $font-down-1;
    padding: 1.25em;
  }

  .alert.alert-error {
    padding: 0.5em 1em;
    margin: 0;
  }

  #new-account-link {
    white-space: nowrap;
  }
}

// Styles for the
// login modal only
.d-modal.login-modal {
  #credentials {
    width: 100%;
  }

  #login-form {
    label {
      float: left;
      display: block;
    }
  }
}

.d-modal .login-modal {
  &.second-factor + .modal-footer {
    #new-account-link {
      display: none;
    }
  }
}

.login-modal:not(.hidden).has-alt-auth.no-local-login {
  #login-buttons:not(.hidden) {
    width: 100%;
  }
}

// styles for the
// create account
// modal only

#discourse-modal .create-account .modal-body {
  max-height: 60vh !important;
  overflow: hidden;
  @media screen and (max-height: 575px) {
    max-height: 50vh !important;
  }
}

.d-modal.create-account {
  .create-account-form {
    overflow-y: auto;
    .login-welcome-header {
      width: calc(100% - 2em);
      position: sticky;
      position: -webkit-sticky;
      top: 0;
      background-color: var(--secondary);
    }
  }
}

.create-account .modal-body {
  display: flex;
  flex-direction: column;
  #login-buttons {
    border-bottom: 1px solid var(--primary-low);
  }
  .login-form {
    margin-bottom: 0.75em;
  }
}

.create-account {
  .user-fields {
    display: flex;
    flex-direction: column;
  }

  .user-field {
    display: flex;
    flex-direction: column;
  }
}

.password-reset,
.email-login,
.invites-show {
  margin-top: 30px;
  .col-image {
    padding-top: 12px;
  }
  .password-reset-img {
    width: 50px;
    height: 50px;
  }
  .col-form {
    padding-left: 8px;
  }
  h2 {
    margin-bottom: 12px;
  }
  .tip {
    display: block;
    margin: 6px 0;
  }
}

.password-reset .tip {
  max-width: 180px;
}

.discourse-touch .password-reset {
  .instructions {
    margin-bottom: 16px;
  }
}

.invites-show {
  .col-image {
    display: none;
  }
}
