@import url('../../tokens.css');

.forgot-password-page {
  --popup-control-border: var(--popup-border-strong);
  --popup-focus: var(--color-forest);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-page-bg);
}

.forgot-password-page--preview {
  min-height: 100vh;
}

.forgot-password-page__main {
  flex: 1 0 auto;
  width: 100%;
  padding: clamp(16px, 2vw, 24px) clamp(16px, 3vw, 20px) 36px;
  box-sizing: border-box;
  background: var(--color-page-bg);
}

.forgot-password-page__logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  width: max-content;
  margin: 0 auto 28px;
  line-height: 0;
}

.forgot-password-page__logo {
  display: block;
  height: 40px;
  width: auto;
}

.forgot-password {
  width: 100%;
}

.forgot-password__shell {
  width: min(100%, 457px);
  margin: 0 auto;
  box-sizing: border-box;
}

.forgot-password__card {
  --forgot-password-label-bg: var(--color-page-bg);
  --forgot-password-field-bg: var(--forgot-password-label-bg);
  background: var(--color-page-bg);
  border-radius: 30px;
  box-shadow: none;
  box-sizing: border-box;
  padding: 30px;
}

.forgot-password__head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.forgot-password__head[hidden] {
  display: none !important;
}

.forgot-password__title {
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 26px;
}

.forgot-password__text {
  max-width: 409px;
  margin: 0;
  color: #232030;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
}

.forgot-password__form,
.forgot-password__success {
  margin-top: 26px;
}

.forgot-password__form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.forgot-password__field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-top: 8px;
}

.forgot-password__label {
  position: absolute;
  top: 2px;
  left: 22px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  max-width: calc(100% - 36px);
  padding: 0 6px;
  border-radius: 999px;
  background: var(--forgot-password-label-bg, var(--color-page-bg));
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
  white-space: nowrap;
  pointer-events: none;
}

.forgot-password__required {
  color: var(--color-alert-red);
}

.forgot-password__field.is-error .forgot-password__label,
.forgot-password__field.is-error .forgot-password__required {
  color: var(--color-alert-red);
}

.forgot-password__input-wrap {
  position: relative;
  display: block;
  width: 100%;
  height: 46px;
  border-radius: 999px;
  background: var(--forgot-password-field-bg, var(--forgot-password-label-bg, var(--color-page-bg)));
  border: 1.5px solid var(--control-border-resting, var(--popup-control-border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-ink) 4%, transparent);
  outline: 2px solid transparent;
  outline-offset: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, outline-color 0.2s ease;
}

.forgot-password__input-wrap:focus-within {
  border-color: var(--color-forest);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-forest) 14%, transparent);
}

.forgot-password__input-wrap.is-filled {
  border-color: var(--control-border-resting, var(--popup-control-border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-ink) 4%, transparent);
  outline-color: transparent;
}

.forgot-password__input-wrap.is-error {
  border-color: var(--color-alert-red);
  background: var(--forgot-password-field-bg, var(--forgot-password-label-bg, var(--color-page-bg)));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-alert-red) 11%, transparent);
  outline-color: transparent;
}

.forgot-password__input-wrap.is-error:focus-within {
  border-color: var(--color-alert-red);
  background: var(--forgot-password-field-bg, var(--forgot-password-label-bg, var(--color-page-bg)));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-alert-red) 11%, transparent);
  outline-color: transparent;
}

.forgot-password__field.is-error .forgot-password__input-wrap,
.forgot-password__field.is-error .forgot-password__input-wrap:focus-within,
.forgot-password__field.is-error .forgot-password__input-wrap.is-filled {
  border-color: var(--color-alert-red);
  background: var(--forgot-password-field-bg, var(--forgot-password-label-bg, var(--color-page-bg)));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-alert-red) 11%, transparent);
  outline-color: transparent;
}

.forgot-password__input {
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
  z-index: 1;
  border: 0 !important;
  background: transparent !important;
  padding: 0 18px;
  color: var(--color-ink);
  -webkit-text-fill-color: var(--color-ink);
  opacity: 1;
  caret-color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  line-height: 46px;
  outline: 0 !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  box-shadow: none !important;
  -webkit-box-shadow: none !important;
  border-radius: 0 !important;
}

.forgot-password__input:focus,
.forgot-password__input:focus-visible {
  outline: 0 !important;
  box-shadow: none !important;
  -webkit-box-shadow: none !important;
  color: var(--color-ink) !important;
  -webkit-text-fill-color: var(--color-ink) !important;
}

.forgot-password__input[aria-invalid="true"],
.forgot-password__input[aria-invalid="true"]:focus,
.forgot-password__input[aria-invalid="true"]:focus-visible {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-box-shadow: none !important;
}

.forgot-password__input::-webkit-textfield-decoration-container {
  padding: 0;
}

.forgot-password__input:-webkit-autofill,
.forgot-password__input:-webkit-autofill:hover,
.forgot-password__input:-webkit-autofill:focus,
.forgot-password__input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--color-ink) !important;
  box-shadow: 0 0 0 1000px transparent inset !important;
  -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
  transition: background-color 9999s ease-out 0s;
}

.forgot-password__error {
  margin: 8px 0 0 10px;
  color: var(--color-alert-red);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 17px;
}

.forgot-password__captcha {
  width: min(100%, 306px);
  min-height: 77px;
}

.forgot-password__captcha-trigger {
  width: 100%;
  min-height: 77px;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1.5px solid var(--control-border-resting, var(--popup-control-border));
  border-radius: 20px;
  background: var(--popup-bg-muted);
  box-shadow: none;
  padding: 14px 16px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.forgot-password__captcha-trigger:hover,
.forgot-password__captcha-trigger:focus-visible {
  border-color: var(--color-forest);
  box-shadow: none;
}

.forgot-password__captcha-trigger:focus-visible {
  outline: 2px solid var(--color-forest);
  outline-offset: 3px;
}

.forgot-password__captcha[data-state="checking"] .forgot-password__captcha-trigger {
  cursor: progress;
}

.forgot-password__captcha[data-state="verified"] .forgot-password__captcha-trigger {
  border-color: var(--color-forest);
  background: var(--popup-hover);
}

.forgot-password__captcha-box {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1.5px solid var(--control-border-resting, var(--popup-control-border));
  background: var(--popup-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.forgot-password__captcha[data-state="verified"] .forgot-password__captcha-box {
  border-color: var(--color-forest);
  background: var(--color-forest);
}

.forgot-password__captcha-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.forgot-password__captcha-icon--idle {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  opacity: 1;
}

.forgot-password__captcha-icon--spinner {
  --jp-spinner-size: 18px;
  --jp-spinner-stroke: 5px;
  width: 18px;
  height: 18px;
}

.forgot-password__captcha-icon--check {
  width: 18px;
  height: 14px;
  transform: scale(0.92);
}

.forgot-password__captcha[data-state="checking"] .forgot-password__captcha-icon--idle,
.forgot-password__captcha[data-state="verified"] .forgot-password__captcha-icon--idle {
  opacity: 0;
}

.forgot-password__captcha[data-state="checking"] .forgot-password__captcha-icon--spinner {
  opacity: 1;
}

.forgot-password__captcha[data-state="verified"] .forgot-password__captcha-icon--check {
  opacity: 1;
  transform: scale(1);
}

.forgot-password__captcha-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
  text-align: left;
}

.forgot-password__captcha-title {
  color: #232030;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.forgot-password__captcha-note {
  color: var(--color-ink-muted);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.forgot-password__captcha[data-state="verified"] .forgot-password__captcha-note {
  color: var(--color-forest);
}

.forgot-password__captcha-badge {
  align-self: start;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--popup-hover);
  color: #232030;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.forgot-password__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.forgot-password__submit,
.forgot-password__back {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-body);
  line-height: 1;
  white-space: nowrap;
  width: 100%;
  transition: box-shadow 0.2s ease, transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.forgot-password__submit {
  width: 100%;
  padding: 6px 27px;
  background: transparent;
  color: var(--auth-disabled-text);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  cursor: not-allowed;
  position: relative;
  isolation: isolate;
  overflow: visible;
}

.forgot-password__submit::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--control-disabled-bg);
  transform: scale(1);
  transform-origin: center;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: -1;
  pointer-events: none;
}

.forgot-password__submit.is-enabled,
.forgot-password__submit:not(:disabled):not([aria-disabled="true"]) {
  color: var(--color-cream);
  cursor: pointer;
}

.forgot-password__submit.is-enabled::before,
.forgot-password__submit:not(:disabled):not([aria-disabled="true"])::before {
  background: var(--color-forest);
}

.forgot-password__submit.is-enabled:hover::before,
.forgot-password__submit.is-enabled:focus-visible::before,
.forgot-password__submit:not(:disabled):not([aria-disabled="true"]):hover::before,
.forgot-password__submit:not(:disabled):not([aria-disabled="true"]):focus-visible::before {
  transform: scale(1.018);
}

.forgot-password__submit:focus-visible,
.forgot-password__back:focus-visible {
  outline: 2px solid var(--color-forest);
  outline-offset: 3px;
}

.forgot-password__back {
  width: 100%;
  min-height: 54px;
  padding: 6px 20px;
  margin-left: 0;
  background: transparent;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  isolation: isolate;
  overflow: visible;
}

.forgot-password__back::before {
  content: none;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  transform: scale(1);
  transform-origin: center;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s ease;
  z-index: -1;
  pointer-events: none;
}

.forgot-password__back:hover,
.forgot-password__back:focus-visible {
  background: transparent;
  box-shadow: var(--homepage-card-hover-shadow, var(--shadow-card-hover));
}

.forgot-password__back:hover::before,
.forgot-password__back:focus-visible::before {
  content: none;
}

.forgot-password__success {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.forgot-password__success-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.forgot-password__success-icon {
  width: min(260px, 76vw);
  height: auto;
  flex: 0 0 auto;
  display: block;
  margin: 0 auto 2px;
}

.forgot-password__form[hidden],
.forgot-password__success[hidden] {
  display: none !important;
}

.forgot-password__success-title {
  margin: 0;
  color: #232030;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 26px;
}

.forgot-password__success-text {
  margin: 0;
  color: #232030;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
}

.forgot-password__actions--success .forgot-password__submit {
  cursor: pointer;
}

.forgot-password__actions--success {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  min-height: 0;
}

.forgot-password__actions--success .forgot-password__submit {
  flex: 0 0 auto;
}

.forgot-password__actions--success .forgot-password__back {
  position: relative;
  align-self: stretch;
  justify-self: auto;
  margin: 0;
}

.forgot-password-page .site-footer {
  background: var(--color-page-bg);
  border-top-color: var(--color-line);
  margin-top: 0;
}

.forgot-password-page .site-footer__minimal-row--bottom {
  border-top-color: var(--color-line);
}

@media (max-width: 900px) {
  .forgot-password-page__main {
    padding: 18px 20px 36px;
  }

  .forgot-password__card {
    padding: 24px;
  }
}

@media (max-width: 640px) {
  .forgot-password-page__main {
    padding: 16px 16px 34px;
  }

  .forgot-password__shell {
    width: 100%;
  }

  .forgot-password__card {
    border-radius: 26px;
    padding: 22px 20px 20px;
  }

  .forgot-password__title,
  .forgot-password__success-title {
    font-size: 22px;
    line-height: 26px;
  }

  .forgot-password__success-head {
    gap: 12px;
  }

  .forgot-password__success-icon {
    width: min(220px, 72vw);
    height: auto;
  }

  .forgot-password__text,
  .forgot-password__success-text {
    font-size: 14px;
  }

  .forgot-password__captcha {
    width: min(100%, 440px);
  }

  .forgot-password__captcha-trigger {
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 14px 16px;
  }
}

@media (max-width: 560px) {
  .forgot-password__captcha {
    width: 100%;
  }

  .forgot-password__captcha-trigger {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 14px;
  }

  .forgot-password__captcha-badge {
    grid-column: 2;
    justify-self: start;
    margin-top: 2px;
  }

  .forgot-password__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .forgot-password__actions--success {
    display: flex;
    min-height: 0;
  }

  .forgot-password__submit {
    width: 100%;
    justify-content: center;
  }

  .forgot-password__back {
    width: 100%;
    margin-left: 0;
  }

  .forgot-password__actions--success .forgot-password__back {
    position: relative;
    align-self: stretch;
    transform: none;
    margin-right: 0;
  }
}

@media (max-width: 420px) {
  .forgot-password-page__main {
    padding: 12px 12px 30px;
  }

  .forgot-password__card {
    border-radius: 24px;
    padding: 18px 14px 16px;
  }

  .forgot-password__title,
  .forgot-password__success-title {
    font-size: 22px;
    line-height: 26px;
  }

  .forgot-password__captcha-trigger {
    min-height: 82px;
  }

  .forgot-password__captcha-title {
    font-size: 14px;
  }
}
