/* ---------------------------------------------------------------------------
   Password show / hide ("eye") toggle.

   Standalone because the site runs two independent design systems — Bootstrap
   .form-control on the app pages and the landing .sk-input inside the product
   modals — and this rule set is needed by both. Keeping it here avoids
   duplicating the same block in each stylesheet.

   The toggle button itself is injected by initPasswordReveal() in
   static/js/main.js; this sheet only lays it out.
   --------------------------------------------------------------------------- */

/* The wrapper is created by the JS. It has to be a real box (not
   display:contents) because the button is positioned against it. */
.pw-field {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

/* Edge's native reveal and clear buttons duplicate the toggle; each needs its own rule. */
input[type="password"]::-ms-reveal { display: none; }
input[type="password"]::-ms-clear { display: none; }
.pw-field input::-ms-reveal { display: none; }
.pw-field input::-ms-clear { display: none; }

/* [type] raises specificity above .form-control.is-invalid and .sk-modal-body .sk-input (both 0,2,0). */
.pw-field > input[type] {
  grid-area: 1 / 1;
  width: 100%;
  min-width: 0;
  padding-right: 2.75rem;
}

/* Bootstrap's error icon moves left of the toggle (toggle spans right .5rem to 2.25rem). */
.pw-field > input.is-invalid {
  padding-right: 4rem;
  background-position: right 2.5rem center;
}

.pw-toggle {
  position: absolute;
  /* Same grid area as the input, so it centres on the input row, not on the feedback below. */
  grid-area: 1 / 1;
  top: 50%;
  right: .5rem;
  transform: translateY(-50%);
  z-index: 3;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;

  border: 0;
  border-radius: .35rem;
  background: transparent;
  color: #6c757d;
  cursor: pointer;

  transition: color .15s ease, background .15s ease;
}

.pw-toggle:hover {
  color: #E81518;
  background: rgba(0, 0, 0, .05);
}

.pw-toggle:focus-visible {
  outline: 2px solid #E81518;
  outline-offset: 1px;
}

/* Bootstrap Icons are a font glyph on an <i>; without an explicit box the
   glyph stretches to the line box. Give it a square box and centre it. */
.pw-toggle i {
  display: block;
  width: 1rem;
  height: 1rem;
  font-size: 1rem;
  line-height: 1;
  /* The glyph must not swallow the click. */
  pointer-events: none;
}

/* The landing modals are dark, so the default grey glyph is too faint. */
.sk-modal .pw-toggle,
.sk-demo .pw-toggle {
  color: rgba(255, 255, 255, .55);
}

.sk-modal .pw-toggle:hover,
.sk-demo .pw-toggle:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

.sk-modal .pw-toggle:focus-visible,
.sk-demo .pw-toggle:focus-visible {
  outline-color: #fff;
}

/* Respect reduced-motion users. */
@media (prefers-reduced-motion: reduce) {
  .pw-toggle { transition: none; }
}