/**
 * @file
 * Visual styles for the Password widgets.
 */

@import "../base/variables.pcss.css";

:root {
  /* Weak */
  --password-strength-bar--weak-bg-color: var(--color-maximumred);
  --password-strength-bar--weak-border-color: var(--color-maximumred);
  /* Fair */
  --password-strength-bar--fair-bg-color: var(--color-sunglow);
  --password-strength-bar--fair-border-color: #977405;
  /* Good */
  --password-strength-bar--good-bg-color: var(--color-lightninggreen);
  --password-strength-bar--good-border-color: var(--color-lightninggreen);
  /* Strong */
  --password-strength-bar--strong-bg-color: var(--color-lightninggreen);
  --password-strength-bar--strong-border-color: var(--color-lightninggreen);
}

/**
 * Password confirm widget styles.
 */
.password-confirm {
  max-width: 25rem;
}

.password-confirm__password {
  margin-bottom: 0;
}

.password-confirm__confirm {
  margin-bottom: 0;
}

.js .password-confirm__confirm {
  overflow: hidden;
  max-height: 10rem;
  transition: max-height var(--speed-transition) ease-in-out, margin var(--speed-transition) ease-in-out;
}

@media screen and (prefers-reduced-motion: reduce) {
  .js .password-confirm__confirm {
    transition: none;
  }
}

/* Password confirm widget states. */
.js .is-initial:not(.form-item--error) .form-item__description {
  margin-top: 0;
}

.js .is-initial.is-password-empty.is-confirm-empty:not(.form-item--error) .password-confirm__confirm {
  display: none;
  max-height: 0;
  margin-top: 0;
}

/**
 * Password strength
 *
 * Description and strength indicator for the main input.
 */
.password-strength {
  margin-top: var(--progress-bar-spacing-size);
  margin-bottom: var(--progress-bar-spacing-size);
}

.password-strength__track {
  height: var(--progress-bar-small-size);
  margin-top: var(--progress-bar-spacing-size);
  margin-bottom: var(--progress-bar-spacing-size);
  border: var(--progress-bar-border-size) solid var(--progress-track-border-color);
  border-radius: var(--progress-bar-small-size-radius);
  background-color: var(--progress-track-bg-color);
}

.password-strength__track::after {
  display: table;
  clear: both;
  content: "";
}

.password-strength__bar {
  min-width: var(--progress-bar-small-size);
  height: var(--progress-bar-small-size);
  margin: calc(var(--progress-bar-border-size) * -1);
  transition: var(--progress-bar-transition);
  border: var(--progress-bar-border-size) solid transparent;
  border-radius: var(--progress-bar-small-size-radius);
  background-color: transparent;
}

@media screen and (prefers-reduced-motion: reduce) {
  .password-strength__bar {
    transition: none;
  }
}

@media screen and (-ms-high-contrast: active) {
  .password-strength__bar {
    background-color: windowText;
  }

  .is-initial .password-strength__bar {
    border-color: transparent;
    background-color: transparent;
  }
}

.password-strength__title {
  overflow: hidden;
  margin-top: var(--progress-bar-spacing-size);
  margin-bottom: var(--progress-bar-spacing-size);
  color: var(--progress-bar-description-color);
  font-size: var(--progress-bar-description-font-size);
  line-height: var(--space-m);
}

.password-strength__text {
  color: var(--progress-bar-label-color);
  font-weight: bold;
}

/* Password strength states */
.password-strength__bar.is-weak {
  border-color: var(--password-strength-bar--weak-border-color);
  background-color: var(--password-strength-bar--weak-bg-color);
}

.password-strength__bar.is-fair {
  border-color: var(--password-strength-bar--fair-border-color);
  background-color: var(--password-strength-bar--fair-bg-color);
}

.password-strength__bar.is-good {
  border-color: var(--password-strength-bar--good-border-color);
  background-color: var(--password-strength-bar--good-bg-color);
}

.password-strength__bar.is-strong {
  border-color: var(--password-strength-bar--strong-border-color);
  background-color: var(--password-strength-bar--strong-bg-color);
}

.is-initial.is-password-empty .password-strength__title {
  margin: 0;
  line-height: 0;
}

/**
 * Password match message.
 *
 * This is the description-like message on the bottom of the password confirm
 * input.
 */
.password-match-message {
  margin-top: var(--progress-bar-spacing-size);
  margin-bottom: var(--progress-bar-spacing-size);
  color: var(--progress-bar-description-color);
  font-size: var(--progress-bar-description-font-size);
}

.password-match-message__text {
  color: var(--progress-bar-label-color);
  font-weight: bold;
}

.is-confirm-empty .password-match-message {
  visibility: hidden;
}

/**
 * Password suggestions.
 *
 * Tips for improving the password.
 */
.password-suggestions {
  margin-top: var(--progress-bar-spacing-size);
  margin-bottom: var(--space-xs);
  padding: var(--space-m);
  color: var(--progress-bar-description-color);
  border: 1px solid var(--color-lightgray);
  border-radius: var(--base-border-radius);
  background-color: var(--color-white);
  box-shadow: var(--details-box-shadow);
  font-size: var(--progress-bar-description-font-size);
}

.password-suggestions__tips {
  margin: var(--space-xs) 0 0 var(--space-l); /* LTR */
}
[dir="rtl"] .password-suggestions__tips {
  margin-right: var(--space-l);
  margin-left: 0;
}
