/* Portal login — matches portal-nav / portal-forms brand + neutral dark mode */

/* Theme toggle */
.login-theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1080;
}

.login-theme-toggle .portal-login-theme-toggle,
.login-theme-toggle .style-switcher-toggle {
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--portal-border-subtle, var(--bs-border-color));
  background: var(--portal-surface-card, var(--bs-body-bg));
  color: var(--portal-text-primary, var(--bs-body-color));
  box-shadow: 0 0.125rem 0.375rem rgba(15, 20, 34, 0.12);
}

.login-theme-toggle .portal-login-theme-toggle:hover,
.login-theme-toggle .style-switcher-toggle:hover {
  background: var(--portal-surface-inset, var(--bs-gray-100));
  color: var(--portal-brand-blue, var(--bs-primary));
}

html.dark-style.portal-login .login-theme-toggle .portal-login-theme-toggle:hover,
html.dark-style.portal-login .login-theme-toggle .style-switcher-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Auth layout */
html.portal-login .authentication-wrapper,
html.portal-login .portal-login__wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

html.portal-login .authentication-wrapper .authentication-inner,
html.portal-login .portal-login__wrap .portal-login__inner,
html.portal-login .portal-login__wrap .authentication-inner {
  width: 100%;
}

html.portal-login .portal-login__inner.row,
html.portal-login .portal-login__inner {
  flex: 1 1 auto;
  align-items: stretch;
  margin-left: 0 !important;
  margin-right: 0 !important;
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
  min-height: 100%;
}

html.portal-login .portal-login__inner > [class*="col-"] {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Auth layout surfaces */
html.portal-login .authentication-wrapper.authentication-bg,
html.portal-login .portal-login__wrap {
  background-color: var(--portal-surface-page) !important;
}

html.portal-login.light-style .auth-cover-bg-color,
html.portal-login.light-style .portal-login__cover {
  background-color: #f0eef8 !important;
  background-image:
    radial-gradient(ellipse 85% 65% at 18% 22%, rgba(120, 168, 255, 0.22) 0%, transparent 58%),
    radial-gradient(ellipse 75% 55% at 82% 78%, rgba(168, 130, 230, 0.16) 0%, transparent 52%),
    radial-gradient(ellipse 55% 45% at 52% 48%, rgba(255, 255, 255, 0.85) 0%, transparent 62%),
    linear-gradient(145deg, #eef3fc 0%, #f2eef9 42%, #e8f1fd 72%, #f3eef8 100%) !important;
}

html.dark-style.portal-login .authentication-wrapper.authentication-bg,
html.dark-style.portal-login .portal-login__wrap {
  background-color: #111318 !important;
  background-image:
    radial-gradient(ellipse 100% 80% at 18% 50%, rgba(59, 148, 235, 0.07) 0%, transparent 55%),
    linear-gradient(90deg, #111318 0%, #111318 52%, #0f1116 100%) !important;
}

html.dark-style.portal-login .auth-cover-bg-color,
html.dark-style.portal-login .portal-login__cover {
  background-color: #0e1524 !important;
  background-image:
    radial-gradient(ellipse 90% 70% at 16% 24%, rgba(59, 148, 235, 0.28) 0%, transparent 58%),
    radial-gradient(ellipse 80% 60% at 84% 76%, rgba(120, 90, 210, 0.2) 0%, transparent 54%),
    radial-gradient(ellipse 55% 45% at 48% 42%, rgba(30, 100, 200, 0.14) 0%, transparent 60%),
    radial-gradient(ellipse 40% 35% at 72% 22%, rgba(80, 130, 255, 0.1) 0%, transparent 50%),
    linear-gradient(155deg, #0a1018 0%, #0e1628 32%, #101c30 58%, #0d1424 82%, #110e1c 100%) !important;
  border: 1px solid rgba(59, 148, 235, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 32px rgba(0, 0, 0, 0.35);
}

html.portal-login body {
  color: var(--portal-text-primary);
}

html.portal-login .authentication-wrapper.authentication-cover .authentication-inner .auth-cover-bg,
html.portal-login .portal-login__wrap .portal-login__cover {
  align-self: stretch;
  flex: 1 1 auto;
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  min-height: calc(100% - 2.5rem);
  margin: 1.25rem 0.75rem 1.25rem 1.5rem !important;
  padding: 1.5rem;
  overflow: hidden;
  border-radius: 1.125rem;
}

html.portal-login .authentication-wrapper.authentication-cover .authentication-inner .auth-cover-bg .auth-illustration,
html.portal-login .portal-login__cover .auth-illustration {
  display: block;
  width: auto !important;
  max-width: min(44rem, 100%) !important;
  height: auto !important;
  max-height: min(68vh, 34rem) !important;
  margin: 0 !important;
  object-fit: contain;
  object-position: center;
}

html.portal-login .authentication-inner > .d-flex.align-items-center,
html.portal-login .portal-login__inner > .d-flex.align-items-center {
  padding: 1.5rem !important;
}

html.portal-login .w-px-400,
html.portal-login .portal-login__form {
  max-width: 400px;
  width: 100%;
  height: auto;
  flex: 0 0 auto;
  align-self: center;
}

html.portal-login .app-brand,
html.portal-login .portal-login__brand {
  overflow: visible;
  max-width: 100%;
}

html.portal-login .app-brand img,
html.portal-login .portal-login__brand img,
html.portal-login #imgLoginLogo {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
}

html.portal-login .w-px-400 > br,
html.portal-login .w-px-400 form > br,
html.portal-login .portal-login__form > br,
html.portal-login .portal-login__form form > br {
  display: none;
}

html.portal-login .authentication-wrapper h4,
html.portal-login .portal-login__wrap h4 {
  color: var(--portal-text-primary);
}

html.portal-login .authentication-wrapper h4 b,
html.portal-login .portal-login__wrap h4 b {
  color: var(--portal-text-primary);
}

/* Form fields — same as portal-forms */
html.portal-login .form-label {
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--portal-text-primary);
}

html.portal-login .form-control {
  min-height: 2.625rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background-color: var(--portal-surface-input);
  border-color: var(--portal-border-subtle);
  color: var(--portal-text-primary);
}

html.portal-login .form-control::placeholder {
  color: var(--portal-text-placeholder);
}

html.portal-login .form-control:focus {
  background-color: var(--portal-surface-input);
  color: var(--portal-text-primary);
}

html.portal-login .input-group-text {
  background-color: var(--portal-surface-input);
  border-color: var(--portal-border-subtle);
  color: var(--portal-text-muted);
  border-radius: 0 0.5rem 0.5rem 0;
}

html.portal-login .input-group .form-control {
  border-radius: 0.5rem 0 0 0.5rem;
}

html.portal-login .input-group .form-control:focus + .input-group-text,
html.portal-login .input-group:focus-within .input-group-text {
  border-color: rgba(var(--portal-brand-blue-rgb), 0.65);
}

/* Primary button */
html.portal-login #btnSignIn,
html.portal-login #btnSignIn_1,
html.portal-login #btnGoHome {
  min-height: 2.625rem;
  font-weight: 500;
  border-radius: 0.5rem;
}

html.portal-login #btnSignIn:disabled,
html.portal-login #btnSignIn_1:disabled {
  opacity: 0.55;
}

/* Links & meta */
html.portal-login a:not(.btn) {
  color: var(--portal-brand-blue);
  text-decoration: none;
}

html.portal-login a:not(.btn):hover {
  color: var(--portal-brand-blue-hover);
}

html.portal-login .portal-login__meta {
  margin-top: 1.25rem;
}

html.portal-login .portal-login__meta .form-label {
  margin-bottom: 0;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--portal-text-muted);
}

html.portal-login .alert-danger {
  border-radius: 0.625rem;
}

html.portal-login .portal-login__dev-mfa {
  padding: 0.65rem 0.85rem;
  border: 1px dashed var(--portal-border-subtle, var(--bs-border-color));
  border-radius: 0.5rem;
  background: var(--portal-surface-inset, rgba(15, 20, 34, 0.03));
}

html.portal-login .portal-login__dev-mfa .form-check-label {
  font-size: 0.875rem;
  color: var(--portal-text-secondary, var(--bs-secondary-color));
}

html.dark-style.portal-login .portal-login__dev-mfa {
  background: rgba(255, 255, 255, 0.04);
}

/* Sign-in loading spinner */
html.portal-login .btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
}

html.portal-login .btn-loading::after {
  content: "";
  position: absolute;
  left: 1rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  margin-top: -0.5rem;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: portal-login-spin 0.6s linear infinite;
}

@keyframes portal-login-spin {
  to {
    transform: rotate(360deg);
  }
}

/* MFA / Enable MFA one-time code boxes */
html.portal-login .otp-field {
  display: flex;
  flex-direction: row;
  column-gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

html.portal-login .otp-field input {
  height: 3rem;
  width: 2.75rem;
  border-radius: 0.5rem;
  outline: none;
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  border: 1px solid var(--portal-border-subtle, #ddd);
  background: var(--portal-surface-card, #fff);
  color: var(--portal-text-primary, inherit);
  caret-color: var(--portal-brand-blue, #3b94eb);
}

html.portal-login .otp-field input:focus {
  border-color: var(--portal-brand-blue, #3b94eb);
  box-shadow: 0 0 0 3px rgba(59, 148, 235, 0.18);
}

html.portal-login .otp-field input::-webkit-inner-spin-button,
html.portal-login .otp-field input::-webkit-outer-spin-button {
  display: none;
}

html.dark-style.portal-login .otp-field input {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.14);
}

html.portal-login .portal-login__qr {
  display: block;
  margin: 0 auto 1rem;
  max-width: 180px;
  width: 100%;
  height: auto;
  padding: 0.5rem;
  border-radius: 0.75rem;
  background: #fff;
}

html.portal-login .portal-login__mfa-key {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  text-align: left;
  word-break: break-word;
}

html.portal-login .portal-login__mfa-key code {
  flex: 1;
  font-size: 0.8125rem;
  line-height: 1.4;
  white-space: normal;
}

html.portal-login .portal-login__hub {
  width: 26.5rem;
  max-width: calc(100% - 2rem);
  margin: 1rem auto 0;
  text-align: center;
}

html.portal-login .portal-login__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--portal-brand-blue);
  text-decoration: none;
}

html.portal-login .portal-login__hub .portal-login__back {
  font-size: 0.875rem;
  font-weight: 500;
}

html.portal-login .portal-login__hub .portal-login__back:hover {
  color: var(--portal-brand-blue-hover, #1868c7);
  text-decoration: underline;
}

/* Unhandled-error page — centered glass card on the login mesh, not a login form */
html.portal-login .portal-error {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

html.portal-login .portal-error__card {
  width: min(28rem, 100%);
  text-align: center;
  padding: 2rem 1.75rem 1.75rem;
  border-radius: 1.25rem;
}

html.portal-login .portal-error__logo {
  display: block;
  max-height: 2.25rem;
  width: auto;
  max-width: 12rem;
  margin: 0 auto 1.25rem;
}

html.portal-login .portal-error__icon {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1.25rem;
  display: grid;
  place-items: center;
  border-radius: 1rem;
  background: rgba(var(--portal-brand-blue-rgb, 30, 122, 230), 0.12);
  color: var(--portal-brand-blue, #1e7ae6);
  font-size: 1.5rem;
}

html.portal-login .portal-error__title {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.5rem;
  color: var(--portal-text-primary);
}

html.portal-login .portal-error__text {
  margin: 0 0 1.5rem;
  color: var(--portal-text-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

html.portal-login .portal-error__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

html.portal-login .portal-error__actions .btn {
  min-width: 8rem;
  min-height: 2.625rem;
  font-weight: 500;
  border-radius: 0.5rem;
}
