/* Auth pages UI/UX + motion standard (login, register, future auth screens).
   Theme-driven (--bs-primary / --bs-secondary), no JS libs, GPU-friendly
   (transform/opacity only), and fully disabled under prefers-reduced-motion.
   Standard documented in docs/DESIGN.md "Motion & auth UX standard". */

:root {
  --am-ease: cubic-bezier(.22, 1, .36, 1);   /* easeOutExpo-ish: all entrances */
  --am-dur: .6s;
}

/* ---------- Animated backdrop ---------- */
.auth-main {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), .10), rgba(var(--bs-secondary-rgb), .12) 55%, #fff);
  background-size: 200% 200%;
  animation: am-bg 18s ease-in-out infinite alternate;
}
.auth-main .auth-wrapper { position: relative; z-index: 1; }

/* Blobs drift across the whole screen on their own looping paths (vw/vh), breathe in size,
   and lean away from the pointer (--am-px / --am-py set by the login page; `translate` is separate from
   the animated `transform`, so the two never fight). transform/opacity only = GPU-friendly. */
.am-blob {
  position: absolute; border-radius: 50%; filter: blur(55px); opacity: .55;
  pointer-events: none; will-change: transform;
  translate: calc(var(--am-px, 0) * var(--am-depth, 30px)) calc(var(--am-py, 0) * var(--am-depth, 30px));
  transition: translate 1.2s var(--am-ease);
}
.am-blob.b1 { --am-depth: 46px; width: 420px; height: 420px; top: -120px; left: -100px;  background: rgba(var(--bs-primary-rgb), .6);   animation: am-orbit-1 22s ease-in-out infinite; }
.am-blob.b2 { --am-depth: -34px; width: 360px; height: 360px; bottom: -100px; right: -80px; background: rgba(var(--bs-secondary-rgb), .55); animation: am-orbit-2 26s ease-in-out -6s infinite; }
.am-blob.b3 { --am-depth: 22px; width: 240px; height: 240px; top: 45%; left: 58%;         background: rgba(var(--bs-primary-rgb), .38);   animation: am-orbit-3 30s ease-in-out -12s infinite; }

@keyframes am-bg    { to { background-position: 100% 100%; } }
@keyframes am-orbit-1 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1) }
  25%      { transform: translate3d(32vw, 14vh, 0) scale(1.25) }
  50%      { transform: translate3d(18vw, 48vh, 0) scale(.9) }
  75%      { transform: translate3d(-4vw, 26vh, 0) scale(1.15) }
}
@keyframes am-orbit-2 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1) }
  30%      { transform: translate3d(-34vw, -18vh, 0) scale(1.2) }
  60%      { transform: translate3d(-14vw, -46vh, 0) scale(.88) }
  85%      { transform: translate3d(6vw, -20vh, 0) scale(1.1) }
}
@keyframes am-orbit-3 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1) }
  33%      { transform: translate3d(-40vw, 12vh, 0) scale(1.35) }
  66%      { transform: translate3d(-22vw, -34vh, 0) scale(.85) }
}

/* ---------- Card: entrance + glass ---------- */
.auth-main .auth-form .card {
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 20px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px -15px rgba(var(--bs-secondary-rgb), .35), 0 2px 8px rgba(0, 0, 0, .05);
  animation: am-card-in .8s var(--am-ease) both;
}
@keyframes am-card-in {
  from { opacity: 0; transform: translateY(32px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* Staggered reveal: add .am-rise and --i (0,1,2...) to any child */
.am-rise { animation: am-rise var(--am-dur) var(--am-ease) both; animation-delay: calc(.25s + var(--i, 0) * .08s); }
@keyframes am-rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

/* Logo: pop in, then gentle idle float */
.auth-main .brand-logo { animation: am-pop .9s var(--am-ease) .1s both, am-bob 5s ease-in-out 1.2s infinite; }
@keyframes am-pop { from { opacity: 0; transform: scale(.5) rotate(-8deg); } to { opacity: 1; transform: none; } }
@keyframes am-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ---------- Inputs ---------- */
.auth-main .form-control { border-radius: 12px; transition: box-shadow .25s, border-color .25s, transform .25s var(--am-ease); }
.auth-main .form-control:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .18);
  transform: translateY(-1px);
}
.auth-main .form-floating > label { transition: all .2s var(--am-ease), color .2s; }
.auth-main .form-floating > .form-control:focus ~ label { color: var(--bs-primary); }
#togglePassword { transition: color .2s, transform .2s var(--am-ease); }
#togglePassword:hover { color: var(--bs-primary) !important; transform: scale(1.15); }
.am-caps { display: none; font-size: .8rem; color: #e58a00; margin: -.5rem 0 .5rem .25rem; }
.am-caps.show { display: block; animation: am-rise .3s var(--am-ease) both; }

/* ---------- Buttons: lift, shimmer, press ---------- */
.auth-main .btn { border-radius: 12px; position: relative; overflow: hidden; transition: transform .2s var(--am-ease), box-shadow .25s; }
.auth-main .btn:hover:not(:disabled):not(.disabled) { transform: translateY(-2px); box-shadow: 0 10px 22px -8px rgba(var(--bs-secondary-rgb), .6); }
.auth-main .btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.auth-main .btn-secondary::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
}
.auth-main .btn-secondary:hover::after { transform: translateX(120%); transition: transform .8s var(--am-ease); }

/* Button state: success (check pop) */
.am-check { display: none; margin-right: .4rem; }
.btn.is-success { background: #2ca87f !important; border-color: #2ca87f !important; }
.btn.is-success .am-check { display: inline-block; animation: am-pop .5s var(--am-ease) both; }

/* ---------- Feedback: error shake / success exit ---------- */
.auth-main .card.am-shake { animation: am-shake .5s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes am-shake {
  10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); }
}
.auth-main .card.am-leave { animation: am-leave .55s var(--am-ease) forwards; }
@keyframes am-leave { to { opacity: 0; transform: translateY(-24px) scale(.97); } }


/* ---------- Compact + high-visibility (fits a laptop at 100% zoom) ---------- */
.auth-main .auth-wrapper { display: flex; align-items: center; justify-content: center; padding: 12px 0; }
.auth-main .auth-form { width: 100%; max-width: 420px; padding: 0 12px; }
.auth-main .auth-form .card-body { padding: 1.25rem 1.5rem; }
/* Floating label: the theme paints a white ::after box behind the floated label which covers the typed text - remove it,
   and give the text its own band under the label (label scales up/left, text sits below). */
.auth-main .form-floating > label::after { display: none !important; }
.auth-main .form-floating > .form-control { height: calc(3.1rem + 2px); min-height: 0; padding: 1.5rem .75rem .4rem; line-height: 1.2; }
.auth-main .form-floating > label { padding: .85rem .75rem; transform-origin: 0 0; }
.auth-main .form-floating > .form-control:focus ~ label,
.auth-main .form-floating > .form-control:not(:placeholder-shown) ~ label { transform: scale(.78) translateY(-.62rem) translateX(.1rem); opacity: 1; font-weight: 600; }
.auth-main .form-floating > .form-control:not(:focus):not(:placeholder-shown) ~ label { color: #6b7280; }
.auth-main .auth-header h2 { font-size: 1.45rem; letter-spacing: -.01em; }
.auth-main .auth-header p  { font-size: .95rem !important; color: #5b6472; }
/* OR divider: slim line + small pill, no big boxed label */
.auth-main .auth-wrapper .saprator { height: 22px; align-items: center; }
.auth-main .auth-wrapper .saprator span { padding: 0 .75rem; background: #fff; outline: 0; border-radius: 20px; font-size: .75rem; color: #8a93a0; letter-spacing: .08em; line-height: 22px; }
.auth-main hr { margin: .75rem 0 !important; opacity: .15; }
.auth-main .btn { padding-top: .6rem; padding-bottom: .6rem; }
/* Sign In: the main call to action - bigger, gradient, glow, nudging arrow */
.auth-main #btnLogin {
  font-size: 1rem; font-weight: 700; letter-spacing: .02em;
  background: linear-gradient(135deg, var(--bs-secondary), color-mix(in srgb, var(--bs-secondary) 55%, var(--bs-primary)));
  border: 0; box-shadow: 0 8px 20px -8px rgba(var(--bs-secondary-rgb), .75);
  animation: am-pulse 2.8s ease-in-out 1.6s infinite;
}
.auth-main #btnLogin:disabled { animation: none; }
.am-arrow { display: inline-block; transition: transform .25s var(--am-ease); }
#btnLogin:hover .am-arrow { transform: translateX(5px); }
@keyframes am-pulse { 0%, 100% { box-shadow: 0 8px 20px -8px rgba(var(--bs-secondary-rgb), .75); } 50% { box-shadow: 0 8px 26px -4px rgba(var(--bs-secondary-rgb), .95); } }
.auth-main .card { background: rgba(255, 255, 255, .94); }
@media (max-height: 760px) {                     /* short laptop screens at 100-110% zoom */
  .auth-main .auth-form .card-body { padding: 1rem 1.25rem; }
  .auth-main .brand-logo { max-width: 56px !important; }
  .auth-main .auth-header h2 { font-size: 1.25rem; }
  .auth-main .form-floating > .form-control { height: calc(2.85rem + 2px); padding-top: 1.3rem; }
  .auth-main .form-floating > label { padding: .7rem .75rem; }
}

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  .auth-main, .auth-main *, .am-blob { animation: none !important; transition: none !important; }
  .am-rise, .auth-main .auth-form .card, .auth-main .brand-logo { opacity: 1 !important; transform: none !important; }
  .am-blob { translate: none !important; }
}
@media (max-width: 575.98px) {
  .am-blob.b3 { display: none; }               /* cheaper on phones */
  .auth-main .auth-form .card { backdrop-filter: none; background: #fff; }
}

/* Theme's v3 layout paints a solid #d4e7f9 column behind the card - drop it so
   the animated page background is the only background. */
.auth-main .auth-wrapper.v3 .auth-form { background: transparent; min-height: 0; padding: 12px; }
.auth-main .auth-wrapper .auth-form img { padding-right: 0; }
.auth-main .auth-wrapper { min-height: 100vh; }
