/* Password visibility toggle.
   Its own file rather than auth-page.css because the reset-password page uses a
   different layout and never loads auth-page.css - this way one stylesheet
   serves every password field in the app. */

/* A wrapping flex row rather than a plain block with an absolutely-positioned
   button. jQuery Validate inserts its <label class="error"> immediately after
   the input, which lands inside this wrapper. Because the row wraps, the input
   and the button share line 1 and the error message drops to line 2, so
   align-items centers the button against the INPUT only. An absolutely
   positioned button at top:50% would instead center against input + error and
   slide down whenever a validation message appeared. */
.password-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

/* width:auto overrides .auth-input's width:100%, which would otherwise make the
   flex-basis 100% and push the button onto its own line. min-width:0 lets the
   input actually shrink - flex items refuse to shrink below their intrinsic
   width without it. */
.password-field > input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

/* Reserve room so a long password doesn't run underneath the button.
   Both selectors are needed: the auth pages use .auth-input, the reset-password
   page uses Bootstrap's .form-control. */
.password-field > .auth-input,
.password-field > .form-control {
  padding-right: 2.75rem;
}

/* The validation message is a full-width item on its own line. */
.password-field > label.error {
  flex: 0 0 100%;
}

.password-toggle {
  /* Pulled back over the padding reserved above so it sits inside the field. */
  flex: 0 0 auto;
  margin-left: -2.75rem;
  width: 2.75rem;
  position: relative;
  z-index: 2;
  background: none;
  border: 0;
  padding: 0;
  line-height: 1;
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: color 0.15s ease;
}

.password-toggle:hover {
  color: #27B253;
}

/* Visible keyboard focus - the button is reachable by Tab between the password
   field and the submit button, so it needs a focus state of its own. */
.password-toggle:focus-visible {
  color: #27B253;
  outline: 2px solid #27B253;
  outline-offset: -2px;
  border-radius: 4px;
}
