/**
 * Fusion 3.0 login — extends RFG auth markup classes with design-system tokens
 * and firm-driven --fe-primary (set by 3.0-firm-theme.js after firm.js loads).
 */

:root {
  /* Default until firm theme runs */
  --fe-primary: var(--brand-orange);
  --fe-primary-hover: var(--brand-orange-dark);
  --fe-link: var(--brand-orange);
  --fe-focus-ring: var(--shadow-focus-orange);
}

html.fe30-auth-html {
  -webkit-text-size-adjust: 100%;
}

/* So tokens-base body rules do not fight the centered auth shell */
body.fe30-auth-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--bg-gray-50);
  color: var(--ink-primary);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

.fe30-login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-8) var(--space-5);
}

/* Border-box under login shell so `width:100%` inputs include padding/border and stay centered in the card. */
.fe30-login-wrap,
.fe30-login-wrap *,
.fe30-login-wrap *::before,
.fe30-login-wrap *::after {
  box-sizing: border-box;
}

.fe30-login-card {
  width: 100%;
  max-width: 26rem;
  background: var(--bg-white);
  border: 1px solid var(--bg-gray-100);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  /* Generous horizontal inset (tokens); symmetric so stacked fields stay visually centered. */
  padding: var(--space-8) var(--space-10) var(--space-6) var(--space-10);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.fe30-login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: var(--space-6);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--bg-gray-100);
}

.fe30-login-logo {
  display: block;
  height: 2.875rem;
  width: auto;
  max-width: 14rem;
  object-fit: contain;
}

/* RFG panel / form classes — required by `/3.0/js/fe30-login.js` (same DOM contract as RFG login). */
.rfg-panel form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.375rem;
  width: 100%;
  min-width: 0;
}

.fe30-login-card .rfg-panel form > .rfg-field {
  width: 100%;
  min-width: 0;
}

.rfg-field-row-end {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.rfg-msg {
  font-size: var(--text-sm);
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-md);
  margin: -0.25rem 0 1.25rem;
  display: none;
  line-height: 1.4;
}

.rfg-msg.is-error {
  display: block;
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.rfg-msg.is-info {
  display: block;
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.rfg-msg.is-success {
  display: block;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.rfg-panel {
  display: none;
  width: 100%;
  min-width: 0;
}

.rfg-panel.is-active {
  display: block;
}

.rfg-auth-heading {
  margin: 0 0 1rem;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.rfg-panel-lead {
  margin: 0 0 1rem;
  font-size: var(--text-sm);
  color: var(--gray-600);
  line-height: 1.45;
}

.rfg-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: var(--space-2);
}

.rfg-field input {
  width: 100%;
  min-width: 0;
  padding: 0.6875rem 0.875rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: var(--text-md);
  font-family: inherit;
  color: var(--ink-primary);
  background: var(--bg-white);
  transition: border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

.rfg-field input:focus {
  outline: none;
  border-color: var(--fe-primary);
  box-shadow: var(--fe-focus-ring);
}

.rfg-link {
  color: var(--fe-link);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
}

.rfg-link:hover {
  text-decoration: underline;
}

.rfg-back {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
}

.rfg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-md);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--gradient-main);
  color: #fff;
  margin-top: 0;
  box-shadow: var(--shadow-glow);
  transition: transform var(--duration-base) var(--ease-standard),
    box-shadow var(--duration-base) var(--ease-standard),
    filter var(--duration-base) var(--ease-standard);
}

.rfg-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.rfg-btn:focus-visible {
  outline: none;
  box-shadow: var(--fe-focus-ring), var(--shadow-glow);
}

.rfg-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.rfg-panel-actions {
  text-align: center;
  margin-top: 1.25rem;
}

.rfg-mfa-row {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}

.rfg-mfa-digit {
  width: 2.875rem;
  height: 3rem;
  text-align: center;
  font-size: 1.125rem;
  font-weight: 600;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  color: var(--ink-primary);
  transition: border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

.rfg-mfa-digit:focus {
  outline: none;
  border-color: var(--fe-primary);
  box-shadow: var(--fe-focus-ring);
}

/* Submit-button async states (login/MFA/forgot/SMS) — parallel to 3.0-shell.css fe30-btn */

@keyframes rfg-submit-spin {
  to { transform: rotate(360deg); }
}

.rfg-btn.fe30-btn--submit-loading,
.rfg-btn.fe30-btn--submit-success {
  cursor: default;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.rfg-btn .fe30-btn-submit-spinner {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: rfg-submit-spin 0.65s linear infinite;
}

.rfg-btn.fe30-btn--submit-success {
  background: #10b981;
  border-color: #10b981;
}

@media (max-width: 480px) {
  .fe30-login-card {
    padding: var(--space-6) var(--space-8) var(--space-6) var(--space-8);
  }

  .rfg-mfa-digit {
    width: 2.5rem;
    height: 2.75rem;
    font-size: 1rem;
  }
}
