/*
|--------------------------------------------------------------------------
| FortuneSpace Theme V3 — Authentication
|--------------------------------------------------------------------------
|
| Phase 1D
|
| Pearl treatment for Login and Create Account.
| Midnight remains controlled by the existing V2 auth system.
|
*/


/* ================================================================
   PEARL AUTH CANVAS
   ================================================================ */

html[data-fs-theme="light"] body.auth-body {
  margin: 0;

  color:
    var(--fs-text) !important;

  background:
    var(--fs-canvas) !important;

  font-family:
    "Source Sans 3",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}


html[data-fs-theme="light"]
body.auth-body .auth-wrap {

  min-height:
    100svh;

  background:
    radial-gradient(
      780px 420px at 8% 0%,
      rgba(22,143,73,.075),
      transparent 64%
    ),
    radial-gradient(
      620px 360px at 96% 100%,
      rgba(245,197,66,.045),
      transparent 62%
    ),
    var(--fs-canvas) !important;
}


/* ================================================================
   AUTH CARD
   ================================================================ */

html[data-fs-theme="light"]
body.auth-body .auth-card {

  color:
    var(--fs-text) !important;

  background:
    rgba(255,255,255,.97) !important;

  border:
    1px solid var(--fs-border) !important;

  border-radius:
    20px !important;

  box-shadow:
    0 18px 52px rgba(23,33,26,.085) !important;

  -webkit-backdrop-filter:
    blur(12px);

  backdrop-filter:
    blur(12px);
}


/* ================================================================
   AUTH TYPOGRAPHY
   ================================================================ */

html[data-fs-theme="light"]
body.auth-body .auth-title {

  color:
    var(--fs-text) !important;

  font-family:
    "Plus Jakarta Sans",
    system-ui,
    sans-serif;

  font-weight:
    800;

  letter-spacing:
    -.025em;
}


html[data-fs-theme="light"]
body.auth-body .auth-sub {

  color:
    var(--fs-text-secondary) !important;

  line-height:
    1.5;
}


html[data-fs-theme="light"]
body.auth-body label {

  color:
    var(--fs-text-secondary) !important;
}


html[data-fs-theme="light"]
body.auth-body .muted {

  color:
    var(--fs-text-muted) !important;
}


/* ================================================================
   INPUTS
   ================================================================ */

html[data-fs-theme="light"]
body.auth-body .input {

  color:
    var(--fs-text) !important;

  background:
    var(--fs-surface-soft) !important;

  border:
    1px solid var(--fs-border-strong) !important;

  border-radius:
    12px !important;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.75);

  transition:
    background-color var(--fs-motion-normal) ease,
    border-color var(--fs-motion-normal) ease,
    box-shadow var(--fs-motion-normal) ease;
}


html[data-fs-theme="light"]
body.auth-body .input:hover {

  border-color:
    var(--fs-border-emphasis) !important;
}


html[data-fs-theme="light"]
body.auth-body .input:focus {

  color:
    var(--fs-text) !important;

  background:
    var(--fs-surface) !important;

  border-color:
    rgba(22,143,73,.52) !important;

  box-shadow:
    var(--fs-focus) !important;

  outline:
    0;
}


html[data-fs-theme="light"]
body.auth-body .input::placeholder {

  color:
    var(--fs-text-subtle) !important;

  opacity:
    1;
}


/* Select */

html[data-fs-theme="light"]
body.auth-body select.input {

  color:
    var(--fs-text) !important;

  background-color:
    var(--fs-surface-soft) !important;
}


html[data-fs-theme="light"]
body.auth-body select.input option {

  color:
    var(--fs-text);

  background:
    var(--fs-surface);
}


/* ================================================================
   PASSWORD SHOW / HIDE
   ================================================================ */

html[data-fs-theme="light"]
body.auth-body .toggle {

  color:
    var(--fs-brand-text) !important;

  background:
    var(--fs-brand-soft) !important;

  border:
    1px solid rgba(22,143,73,.13) !important;

  border-radius:
    9px !important;
}


html[data-fs-theme="light"]
body.auth-body .toggle:hover {

  color:
    #0c5e31 !important;

  background:
    #d9f2e1 !important;

  border-color:
    rgba(22,143,73,.22) !important;
}


html[data-fs-theme="light"]
body.auth-body .toggle:focus-visible {

  outline:
    3px solid rgba(22,143,73,.18);

  outline-offset:
    2px;
}


/* ================================================================
   PRIMARY AUTH ACTION
   ================================================================ */

html[data-fs-theme="light"]
body.auth-body .btn-primary {

  color:
    #ffffff !important;

  background:
    var(--fs-brand) !important;

  border:
    1px solid var(--fs-brand) !important;

  border-radius:
    13px !important;

  box-shadow:
    0 10px 24px rgba(22,143,73,.16) !important;
}


html[data-fs-theme="light"]
body.auth-body .btn-primary:hover {

  color:
    #ffffff !important;

  background:
    var(--fs-brand-hover) !important;

  border-color:
    var(--fs-brand-hover) !important;

  box-shadow:
    0 13px 30px rgba(22,143,73,.20) !important;

  transform:
    translateY(-1px);
}


html[data-fs-theme="light"]
body.auth-body .btn-primary:focus-visible {

  outline:
    3px solid rgba(22,143,73,.20);

  outline-offset:
    3px;
}


/* ================================================================
   SECONDARY / BACK HOME
   ================================================================ */

html[data-fs-theme="light"]
body.auth-body .btn-ghost {

  color:
    var(--fs-text-secondary) !important;

  background:
    var(--fs-surface) !important;

  border:
    1px solid var(--fs-border-strong) !important;

  border-radius:
    13px !important;

  box-shadow:
    var(--fs-shadow-sm) !important;
}


html[data-fs-theme="light"]
body.auth-body .btn-ghost:hover {

  color:
    var(--fs-text) !important;

  background:
    var(--fs-surface-raised) !important;

  border-color:
    var(--fs-border-emphasis) !important;
}


html[data-fs-theme="light"]
body.auth-body .btn-ghost:focus-visible {

  outline:
    3px solid rgba(22,143,73,.17);

  outline-offset:
    3px;
}


/* ================================================================
   LINKS
   ================================================================ */

html[data-fs-theme="light"]
body.auth-body a.link {

  color:
    var(--fs-link) !important;

  text-decoration:
    none;
}


html[data-fs-theme="light"]
body.auth-body a.link:hover {

  color:
    var(--fs-link-hover) !important;

  text-decoration:
    underline;
}


html[data-fs-theme="light"]
body.auth-body a.link:focus-visible {

  outline:
    2px solid rgba(22,143,73,.20);

  outline-offset:
    3px;

  border-radius:
    4px;
}


/* ================================================================
   DIVIDER
   ================================================================ */

html[data-fs-theme="light"]
body.auth-body .divider {

  color:
    var(--fs-text-subtle) !important;
}


html[data-fs-theme="light"]
body.auth-body .divider::before,
html[data-fs-theme="light"]
body.auth-body .divider::after {

  background:
    var(--fs-border) !important;
}


/* ================================================================
   MESSAGES
   ================================================================ */

html[data-fs-theme="light"]
body.auth-body .msg.error {

  color:
    #922c2c !important;

  background:
    var(--fs-danger-soft) !important;

  border:
    1px solid rgba(201,54,54,.15) !important;
}


html[data-fs-theme="light"]
body.auth-body .msg.success {

  color:
    #0f6937 !important;

  background:
    var(--fs-success-soft) !important;

  border:
    1px solid rgba(22,143,73,.16) !important;
}


/* ================================================================
   CHECKBOX
   ================================================================ */

html[data-fs-theme="light"]
body.auth-body input[type="checkbox"] {

  accent-color:
    var(--fs-brand);

  width:
    18px !important;

  height:
    18px;
}


/* ================================================================
   MOBILE AUTH
   ================================================================ */

@media (max-width: 600px) {

  html[data-fs-theme="light"]
  body.auth-body .auth-wrap {

    padding:
      18px;
  }


  html[data-fs-theme="light"]
  body.auth-body .auth-card {

    padding:
      24px 20px !important;

    border-radius:
      18px !important;

    box-shadow:
      0 12px 36px rgba(23,33,26,.075) !important;
  }
}


/* ================================================================
   REDUCED MOTION
   ================================================================ */

@media (prefers-reduced-motion: reduce) {

  html[data-fs-theme="light"]
  body.auth-body
  :is(
    .input,
    .toggle,
    .btn-primary,
    .btn-ghost
  ) {

    transition:
      none !important;

    transform:
      none !important;
  }
}


/* ================================================================
   THEME V3 FINAL QA — BROWSER AUTOFILL
   ================================================================ */

/*
 * Chrome/Samsung/Edge may paint saved credentials with their own
 * blue/yellow surface. Force autofilled fields back into the active
 * FortuneSpace appearance.
 */

body.auth-body
.input:-webkit-autofill,
body.auth-body
.input:-webkit-autofill:hover,
body.auth-body
.input:-webkit-autofill:focus,
body.auth-body
.input:-webkit-autofill:active {

  -webkit-text-fill-color:
    var(--fs-text) !important;

  caret-color:
    var(--fs-text);

  -webkit-box-shadow:
    0 0 0 1000px
    var(--fs-surface-soft)
    inset !important;

  box-shadow:
    0 0 0 1000px
    var(--fs-surface-soft)
    inset !important;

  border-color:
    var(--fs-border-strong) !important;

  transition:
    background-color 9999s ease-out 0s;
}


html[data-fs-theme="light"]
body.auth-body
.input:-webkit-autofill:focus {

  -webkit-box-shadow:
    0 0 0 1000px
    var(--fs-surface)
    inset,
    var(--fs-focus) !important;

  box-shadow:
    0 0 0 1000px
    var(--fs-surface)
    inset,
    var(--fs-focus) !important;
}


html[data-fs-theme="dark"]
body.auth-body
.input:-webkit-autofill:focus {

  -webkit-box-shadow:
    0 0 0 1000px
    var(--fs-surface)
    inset,
    var(--fs-focus) !important;

  box-shadow:
    0 0 0 1000px
    var(--fs-surface)
    inset,
    var(--fs-focus) !important;
}
