/* Auth module — aligned with FP Markets marketing visual tokens. */

@font-face {
  font-family: InterVariable;
  src: url(/fonts/InterVariable.woff2) format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: InterStatic;
  src: url(/fonts/static/Inter-Regular.woff2) format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: InterStatic;
  src: url(/fonts/static/Inter-SemiBold.woff2) format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --auth-blue: #00bdff;
  --auth-blue-dark: #00a8e6;
  --auth-ink: #0a121c;
  --auth-muted: #474d55;
  --auth-line: #b7c4cc;
  --auth-bg: #f4f4f4;
  --auth-surface: #ffffff;
  --auth-danger: #e04442;
  --auth-danger-bg: #e04442;
  --auth-success-bg: #26cc68;
  --auth-warn-toast: #dc6803;
  --auth-radius: 0.5rem;
  --auth-btn-radius: 2rem;
  --auth-max: 440px;
  --auth-page: 1120px;
  --auth-toast-max: 480px;
  --auth-font: InterVariable, InterStatic, Inter, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.auth-page {
  margin: 0;
  min-height: 100vh;
  font-family: var(--auth-font);
  color: var(--auth-ink);
  background: var(--auth-bg);
  -webkit-font-smoothing: antialiased;
}

.auth-container {
  width: 100%;
  max-width: var(--auth-page);
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 768px) {
  .auth-container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.auth-session-bar {
  background: #c3e9f6;
  border-bottom: 1px solid #9ad4ea;
  padding: 0.65rem 0;
}

.auth-session-bar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.auth-session-bar__text {
  margin: 0;
  font-size: 0.875rem;
}

.auth-session-bar__flag {
  color: var(--auth-muted);
  font-size: 0.75rem;
}

.auth-topbar {
  background: #fff;
  border-bottom: 1px solid var(--auth-line);
}

.auth-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 1rem;
}

.auth-topbar__tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.auth-topbar__logo img,
.auth-topbar__logo-img {
  display: block;
  height: 28px;
  width: auto;
  max-width: min(180px, 45vw);
}

.auth-topbar__logo-img[hidden] {
  visibility: hidden;
}

.auth-topbar__link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--auth-blue);
  text-decoration: none;
}

.auth-topbar__link:hover {
  text-decoration: underline;
}

/* Language switcher — matches site header lang-select (light navbar treatment) */
.auth-topbar .language {
  position: relative;
}

.auth-topbar .lang-select {
  position: relative;
  width: auto;
  min-width: 4.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.auth-topbar .lang-select__selected {
  height: 2.125rem;
  padding: 0 1rem;
  border-radius: 2rem;
  background: transparent;
  border: 1px solid var(--auth-line);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  color: var(--auth-ink);
  text-transform: uppercase;
}

.auth-topbar .lang-select__selected p {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.auth-topbar .lang-select__dropdown {
  display: none;
  min-width: 10rem;
  margin-top: 0.5rem;
  padding: 0.25rem;
  position: absolute;
  inset-inline-end: 0;
  z-index: 1200;
  background: #e7e9f0eb;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  border-radius: 0.75rem;
}

.auth-topbar .lang-select.open .lang-select__dropdown {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.auth-topbar .lang-select__option {
  appearance: none;
  width: 100%;
  height: 2.125rem;
  padding: 0.16rem 1rem 0;
  border-radius: 2rem;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  text-transform: uppercase;
  color: var(--auth-ink);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  text-align: start;
}

.auth-topbar .lang-select__option:hover:not(.active) {
  border-color: var(--auth-ink);
}

.auth-topbar .lang-select__option.active {
  border-color: var(--auth-blue);
  background: var(--auth-blue);
  color: #fff;
}

.auth-main {
  padding: 1.5rem 0 3rem;
}

@media (min-width: 768px) {
  .auth-main {
    padding: 2.5rem 0 4rem;
  }
}

.auth-main__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-card {
  width: 100%;
  max-width: var(--auth-max);
  background: var(--auth-surface);
  border: 1px solid var(--auth-line);
  border-radius: 1rem;
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: 0 1px 2px rgba(10, 18, 28, 0.04);
}

@media (min-width: 480px) {
  .auth-card {
    padding: 1.75rem 1.75rem 2rem;
  }
}

.auth-card__header {
  margin-bottom: 1.25rem;
}

.auth-card__title {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 700;
}

@media (min-width: 768px) {
  .auth-card__title {
    font-size: 1.75rem;
  }
}

.auth-card__lead {
  margin: 0;
  color: var(--auth-muted);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--auth-line);
}

.auth-tabs__btn {
  flex: 1;
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 0.8rem 0.5rem;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--auth-muted);
  cursor: pointer;
}

.auth-tabs__btn.is-active {
  color: var(--auth-ink);
  border-bottom-color: var(--auth-blue);
}

.auth-tabs__btn:focus-visible {
  outline: 2px solid var(--auth-blue);
  outline-offset: 2px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.auth-field {
  position: relative;
}

.auth-field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.auth-optional {
  font-weight: 400;
  font-size: 0.875em;
  color: var(--auth-muted);
}

.auth-field input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius);
  background: #fff;
  color: var(--auth-ink);
  min-height: 44px;
}

.auth-field input:focus {
  outline: 2px solid rgba(0, 189, 255, 0.28);
  border-color: var(--auth-blue);
}

.auth-field input.is-invalid {
  border-color: var(--auth-danger);
}

.auth-field__hint {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--auth-muted);
  line-height: 1.4;
}

/* Overlay — does not push following fields when shown/hidden */
.auth-field__error {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.15rem);
  z-index: 2;
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.3;
  color: var(--auth-danger);
  pointer-events: none;
}

.auth-field__error[hidden] {
  display: none !important;
}

.auth-password {
  position: relative;
  display: flex;
  align-items: stretch;
}

.auth-password input {
  flex: 1;
  min-width: 0;
  padding-right: 2.75rem;
}

.auth-password__toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: var(--auth-radius);
  background: transparent;
  color: var(--auth-muted);
  cursor: pointer;
}

.auth-password__toggle:hover {
  color: var(--auth-ink);
  background: rgba(10, 18, 28, 0.05);
}

.auth-password__toggle:focus-visible {
  outline: 2px solid var(--auth-blue);
  outline-offset: 1px;
}

.auth-password__icon {
  display: block;
  flex-shrink: 0;
}

.auth-password__icon--hide {
  display: none;
}

.auth-password__toggle.is-revealed .auth-password__icon--show {
  display: none;
}

.auth-password__toggle.is-revealed .auth-password__icon--hide {
  display: block;
}

.auth-field--password-rules {
  padding-bottom: 0.15rem;
}

/* High-specificity resets: beat browser / residual UA list styles after deploy cache. */
ul.auth-password-rules,
.auth-password-rules {
  list-style: none !important;
  list-style-type: none !important;
  margin: 0.55rem 0 0;
  padding: 0 !important;
  padding-inline-start: 0 !important;
  -webkit-padding-start: 0 !important;
  display: grid;
  gap: 0.35rem;
}

ul.auth-password-rules > li,
.auth-password-rules > li {
  list-style: none !important;
  list-style-type: none !important;
  position: relative;
  margin: 0;
  padding: 0 0 0 1.25rem !important;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--auth-muted);
  transition: color 0.15s ease;
}

ul.auth-password-rules > li::marker,
.auth-password-rules > li::marker {
  content: "" !important;
  font-size: 0;
}

ul.auth-password-rules > li::before,
.auth-password-rules > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.3rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: transparent;
  box-sizing: border-box;
}

.auth-password-rules > li.is-idle {
  color: var(--auth-muted);
}

.auth-password-rules > li.is-met {
  color: #1a9a4a;
}

.auth-password-rules > li.is-met::before {
  border-color: #1a9a4a;
  background: #1a9a4a;
  box-shadow: inset 0 0 0 1.5px #fff;
}

.auth-password-rules > li.is-unmet {
  color: var(--auth-danger);
}

.auth-password-rules > li.is-unmet::before {
  border-color: var(--auth-danger);
  background: transparent;
}

.auth-form__status {
  display: none;
}

.auth-toast {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  display: flex;
  justify-content: center;
  pointer-events: none;
  padding: 0;
}

.auth-toast[hidden] {
  display: none !important;
}

.auth-toast__banner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.85rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  color: #fff;
  background: var(--auth-danger-bg);
  box-shadow: 0 4px 16px rgba(10, 18, 28, 0.18);
  transform: translateY(calc(-100% - 1.5rem));
  transition: transform 0.32s ease;
  pointer-events: auto;
  will-change: transform;
}

.auth-toast.is-visible .auth-toast__banner {
  transform: translateY(0);
}

.auth-toast.is-error .auth-toast__banner {
  background: var(--auth-danger-bg);
}

.auth-toast.is-warn .auth-toast__banner {
  background: var(--auth-warn-toast);
}

.auth-toast.is-success .auth-toast__banner {
  background: var(--auth-success-bg);
}

.auth-toast.is-info .auth-toast__banner {
  background: var(--auth-ink);
}

@media (min-width: 640px) {
  .auth-toast {
    padding: 0 1rem;
  }

  .auth-toast__banner {
    max-width: var(--auth-toast-max);
    border-radius: var(--auth-radius);
  }

  .auth-toast.is-visible .auth-toast__banner {
    transform: translateY(0.75rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-toast__banner {
    transition: none;
  }
}

.auth-code-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.auth-code-row input {
  flex: 1;
  min-width: 0;
}

.auth-code-row .auth-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.auth-btn {
  font: inherit;
  font-weight: 400;
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.75rem 1.25rem;
  border-radius: var(--auth-btn-radius);
  border: 0;
  cursor: pointer;
  min-height: 2.625rem;
  transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
}

.auth-btn--block {
  width: 100%;
}

.auth-btn--primary {
  background: var(--auth-blue);
  color: #fff;
}

.auth-btn--primary:hover {
  background: var(--auth-blue-dark);
}

.auth-btn--primary:disabled,
.auth-btn.is-loading {
  cursor: wait;
  opacity: 0.85;
  pointer-events: none;
}

.auth-btn.is-loading {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.625rem;
}

.auth-btn.is-loading::before {
  content: "";
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-btn-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes auth-btn-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-btn.is-loading::before {
    animation: none;
    border-color: rgba(255, 255, 255, 0.55);
    border-top-color: #fff;
    opacity: 0.9;
  }
}

.auth-btn--primary:focus-visible,
.auth-btn--ghost:focus-visible {
  outline: 2px solid var(--auth-blue);
  outline-offset: 2px;
}

.auth-btn--ghost {
  background: #fff;
  color: var(--auth-ink);
  border: 1px solid var(--auth-blue);
  padding: 0.45rem 0.95rem;
  font-size: 0.75rem;
  min-height: 2.125rem;
  min-width: 6.5rem;
}

.auth-btn--ghost:hover {
  background: #c3e9f6;
}

.auth-btn--ghost:disabled,
.auth-btn--ghost.is-loading {
  cursor: not-allowed;
  opacity: 0.85;
  pointer-events: none;
}

.auth-btn--ghost.is-loading::before {
  border-color: rgba(0, 189, 255, 0.25);
  border-top-color: var(--auth-blue);
}

.auth-footer-note {
  margin: 1.25rem 0 0;
  max-width: var(--auth-max);
  width: 100%;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--auth-muted);
  line-height: 1.45;
}

.auth-footer-note a {
  color: var(--auth-blue);
  font-weight: 600;
  text-decoration: none;
}

.auth-footer-note a:hover {
  text-decoration: underline;
}
