:root {
  --bg: #141c2a;
  --bg-2: #141c2a;
  --text: #edf4ff;
  --muted: #a9b8d4;
  --accent: #ffb454;
  --accent-2: #4dd5ff;
  --accent-3: #ff5d93;
  --card: rgba(30, 42, 62, 0.88);
  --border: rgba(170, 188, 220, 0.2);
  --mono: "IBM Plex Mono", "Courier New", monospace;
  --sans: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
}

html,
body,
.login-pf-page,
.login-pf {
  background: linear-gradient(180deg, #0d1520, #080d16) !important;
}

.login-pf-page::before,
.login-pf-page::after {
  background: transparent !important;
  background-image: none !important;
  animation: none !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
}

body {
  font-family: 'Inter', var(--sans);
  color: var(--text);
  min-height: 100vh;
}

#kc-content {
  margin: 0 auto;
}

.login-pf {
  min-height: 100%;
}

.login-pf-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
}

#kc-header,
#kc-header-wrapper {
  display: block !important;
}

#kc-header {
  margin: 0 0 12px;
  text-align: center;
}

#kc-header-wrapper {
  width: 140px;
  height: 52px;
  margin: 0 auto;
  text-indent: -9999px;
  overflow: hidden;
  white-space: nowrap;
  background: url('../img/aarp-logo.png') no-repeat center / contain;
}

/* Avoid first-paint flash of pre-enhanced single-card layout. */
body:not(.aarp-login-ready) #kc-header,
body:not(.aarp-login-ready) .card-pf {
  opacity: 0 !important;
  pointer-events: none !important;
}

body.aarp-login-ready #kc-header,
body.aarp-login-ready .card-pf {
  opacity: 1;
  transition: opacity 0.08s linear;
}

body.aarp-login-ready #kc-header,
body.aarp-login-ready #kc-header-wrapper,
#kc-logo,
.kc-logo-text,
.kc-brand,
.kc-branding,
.kc-logo,
.login-pf-brand,
.brand,
.login-pf-page-header,
.login-pf-page-header * {
  display: none !important;
}

.kc-container,
#kc-page-wrapper {
  background: transparent;
}

.login-pf-page {
  justify-content: center;
}

.card-pf,
#kc-content {
  position: relative;
  z-index: 1;
  max-width: 360px;
  margin: 0;
  background: rgba(14, 21, 32, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
  min-height: 255px;
  flex: 0 0 auto;
}

#kc-content {
  width: 360px;
  height: 260px;
  padding: 32px 24px 32px 40px;
  box-sizing: border-box;
}

.card-pf {
  max-width: none;
  width: 100%;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  box-sizing: border-box;
}

.aarp-card-shell {
  background: rgba(14, 21, 32, 0.55);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 32px 48px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.24);
  margin: 0;
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.aarp-login-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 360px;
  width: 100%;
  flex: 0 0 auto;
  align-self: stretch;
  position: relative;
  align-items: flex-start;
  margin-left: -20px;
}

.aarp-login-column > #kc-content {
  flex: 0 0 auto;
  width: 100%;
  height: auto;
}

#kc-form-login {
  padding: 0;
}

#kc-page-title {
  display: none;
}

.pf-c-form__label-text,
label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.form-group {
  margin-bottom: 8px;
}

#kc-form-buttons {
  margin-top: 0;
}

.pf-c-form-control,
input[type="text"],
input[type="password"],
input[type="email"] {
  background: rgba(11, 17, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px rgba(11, 17, 28, 0.9) inset;
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s ease-out;
}

.pf-c-form-control:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
  border-color: rgba(77, 213, 255, 0.6);
  box-shadow: 0 0 0 2px rgba(77, 213, 255, 0.2);
  outline: none;
}

.pf-c-form-control.pf-m-error,
.pf-c-form-control[aria-invalid="true"],
input[type="text"].pf-m-error,
input[type="password"].pf-m-error,
input[type="email"].pf-m-error,
input[type="text"][aria-invalid="true"],
input[type="password"][aria-invalid="true"],
input[type="email"][aria-invalid="true"] {
  background: rgba(11, 17, 28, 0.9);
  border-color: rgba(255, 93, 147, 0.55);
  box-shadow: 0 0 0 2px rgba(255, 93, 147, 0.15);
  color: var(--text);
}

#kc-login {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #0b0b0d;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 10px;
  padding: 10.5px 16px;
  text-transform: uppercase;
  font-size: 13px;
}

#kc-login:hover {
  filter: brightness(1.05);
}

#kc-form-buttons {
  margin-top: 0;
}

.login-pf-header {
  display: none;
}

.aarp-login-logo-block {
  width: 100%;
  margin: 0 0 12px;
  padding: 0 4px;
  box-sizing: border-box;
  position: static;
  display: flex;
  justify-content: flex-start;
}

.aarp-login-logo {
  display: block;
  width: 140px;
  height: 52px;
  aspect-ratio: 273 / 102;
  object-fit: contain;
}

#kc-content-wrapper {
  padding: 0;
}

#kc-info-wrapper,
#kc-form-options,
#kc-form-options-wrapper {
  border: none;
  color: var(--muted);
}

#kc-form-options a,
#kc-info-wrapper a {
  color: var(--accent-2);
}

#kc-locale {
  color: var(--muted);
}

.alert {
  border-radius: 10px;
  background: rgba(255, 93, 147, 0.15);
  color: var(--text);
  border: 1px solid rgba(255, 93, 147, 0.4);
}

#kc-content,
.login-pf-main {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#kc-content {
  width: 360px !important;
  height: 280px !important;
  padding: 32px 24px 32px 40px;
  box-sizing: border-box;
  align-items: stretch;
}

/* 2FA setup screens can be taller; let cards/tiles fit their content. */
body.aarp-two-factor #kc-content,
body.aarp-two-factor .card-pf {
  height: auto !important;
  min-height: 0 !important;
}

body.aarp-two-factor #kc-content {
  width: min(560px, 96vw) !important;
}

#kc-footer,
.pf-c-login__footer,
.pf-c-login__main-footer {
  color: var(--muted) !important;
  text-align: center !important;
  width: 100% !important;
  display: block !important;
  justify-content: center !important;
  margin: 16px 0 0 !important;
  font-size: 12px;
}

/* Hide Keycloak "Restart login" backlink in auth flows. */
#reset-login {
  display: none !important;
}

/* Hide attempted username label on re-auth screens. */
#kc-attempted-username {
  display: none !important;
}

.aarp-waitlist {
  max-width: 360px;
  width: 360px;
  height: 280px;
  margin: 77px 0 0;
  padding: 32px 40px 32px 24px;
  background: rgba(14, 21, 32, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
  box-sizing: border-box;
  min-height: 280px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  justify-content: space-between;
}


.aarp-waitlist-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
  text-align: left;
}

.aarp-login-heading {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.2;
  text-align: left;
  letter-spacing: 0;
}

.aarp-waitlist-sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 2px;
}

.aarp-waitlist-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.aarp-waitlist-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aarp-waitlist-input {
  background: rgba(11, 17, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  height: 44px;
  box-sizing: border-box;
}

.aarp-waitlist-btn {
  background: rgba(16, 22, 34, 0.95);
  border: 1px solid var(--border);
  color: var(--accent);
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  min-width: 160px;
  width: 100%;
  margin-top: 2px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.aarp-waitlist-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.aarp-waitlist-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.aarp-waitlist-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.aarp-waitlist-status {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  min-height: 0;
}

.aarp-waitlist-status[data-state="ok"] {
  color: #7de3b7;
}

.aarp-waitlist-status[data-state="error"] {
  color: #ff8aa7;
}

.aarp-legal {
  margin: 16px auto 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  max-width: 900px;
  width: 100%;
}

@media (max-width: 900px) {
  .card-pf {
    flex-direction: column;
    align-items: stretch;
  }

  .card-pf,
  #kc-content,
  .aarp-waitlist,
  .aarp-login-column {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .login-pf-page {
    padding: 16px 12px 24px;
  }

  .aarp-card-shell {
    padding: 20px 18px 28px;
    border-radius: 10px;
  }

  .card-pf {
    gap: 16px;
    padding: 0;
  }

  .aarp-login-column {
    margin-left: 0;
    align-items: stretch;
  }

  #kc-content {
    width: 100% !important;
    height: auto !important;
    min-height: 0;
    padding: 24px 18px;
  }

  #kc-header-wrapper {
    width: 120px;
    height: 44px;
  }

  .aarp-waitlist {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 0;
    margin: 16px 0 0;
    padding: 24px 18px;
  }

  .aarp-login-logo-block {
    justify-content: center;
    margin: 0 0 8px;
  }

  .aarp-login-logo {
    width: 120px;
    height: auto;
  }
}

/* Hide "* Required fields" on verify-profile page */
.subtitle {
  display: none !important;
}

/* Let card grow on verify-profile page (3 fields + errors need more than 280px) */
.aarp-verify-profile #kc-content {
  height: auto !important;
  min-height: 280px;
}

.aarp-galaxy {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse at center, #0f1a2e 0%, #0a1220 48%, #060d16 100%);
}

/* Keep the animated dots layer enabled with the canvas layer. */

.aarp-galaxy .space {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background-repeat: repeat;
  transform-origin: center center;
}

.aarp-galaxy .stars1 {
  background-image:
    linear-gradient(125deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(305deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 34px 34px, 48px 48px;
  animation: galaxy-rotate-1 120s linear infinite;
  opacity: 0.7;
}

.aarp-galaxy .stars2 {
  background-image:
    linear-gradient(145deg, rgba(136, 184, 255, 0.2) 1px, transparent 1px),
    linear-gradient(325deg, rgba(136, 184, 255, 0.12) 1px, transparent 1px);
  background-size: 74px 74px, 90px 90px;
  animation: galaxy-rotate-2 190s linear infinite reverse;
  opacity: 0.55;
}

.aarp-galaxy .stars3 {
  background-image:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.25) 0 1px, transparent 2px),
    linear-gradient(120deg, rgba(113, 146, 255, 0.12) 1px, transparent 1px);
  background-size: 116px 116px, 160px 160px;
  animation: galaxy-rotate-3 260s linear infinite;
  opacity: 0.4;
}

@keyframes galaxy-rotate-1 {
  from { transform: rotate(0deg) scale(1); }
  to { transform: rotate(360deg) scale(1.06); }
}

@keyframes galaxy-rotate-2 {
  from { transform: rotate(0deg) scale(1.04); }
  to { transform: rotate(360deg) scale(1); }
}

@keyframes galaxy-rotate-3 {
  from { transform: rotate(0deg) scale(1); }
  to { transform: rotate(360deg) scale(1.08); }
}

/* Gradient animated background layer (login only) */
.login-pf-page {
  position: relative;
  overflow: hidden;
}

.aarp-login-fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: #060d16;
}

.gradient-background {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 1;
}

.aarp-card-shell,
.aarp-legal,
.card-pf,
#kc-content {
  position: relative;
  z-index: 2;
}

.gradient-sphere {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
}

.sphere-1 {
  width: 40vw;
  height: 40vw;
  background: linear-gradient(40deg, rgba(20, 80, 180, 0.6), rgba(77, 213, 255, 0.3));
  top: -10%;
  left: -10%;
  animation: float-1 15s ease-in-out infinite alternate;
}

.sphere-2 {
  width: 45vw;
  height: 45vw;
  background: linear-gradient(240deg, rgba(10, 50, 140, 0.6), rgba(0, 150, 220, 0.3));
  bottom: -20%;
  right: -10%;
  animation: float-2 18s ease-in-out infinite alternate;
}

.sphere-3 {
  width: 30vw;
  height: 30vw;
  background: linear-gradient(120deg, rgba(30, 70, 160, 0.4), rgba(77, 213, 255, 0.2));
  top: 60%;
  left: 20%;
  animation: float-3 20s ease-in-out infinite alternate;
}

.noise-overlay {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  z-index: 5;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.grid-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-size: 40px 40px;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
}

.glow {
  position: absolute;
  width: 40vw;
  height: 40vh;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  filter: blur(30px);
  background: radial-gradient(circle, rgba(20, 80, 180, 0.15), transparent 70%);
  animation: pulse 8s infinite alternate;
}

.particles-container {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  animation-name: float-particle;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

@keyframes float-1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(10%, 10%) scale(1.1); }
}

@keyframes float-2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-10%, -5%) scale(1.15); }
}

@keyframes float-3 {
  0% { transform: translate(0, 0) scale(1); opacity: 0.3; }
  100% { transform: translate(-5%, 10%) scale(1.05); opacity: 0.6; }
}

@keyframes pulse {
  0% { opacity: 0.3; transform: translate(-50%, -50%) scale(0.9); }
  100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes float-particle {
  0% { opacity: 0; transform: translateY(0); }
  15% { opacity: 0.35; }
  85% { opacity: 0.35; }
  100% { opacity: 0; transform: translateY(-18px); }
}

@media (max-width: 640px) {
  .sphere-1,
  .sphere-2 {
    width: 70vw;
    height: 70vw;
  }

  .sphere-3 {
    width: 56vw;
    height: 56vw;
  }
}
