/* auth_modal.css — eva-themed restyle for #modal-login and #modal-signup.
 *
 * Loaded from base.mak and base_v2.mak (after base*.css), so all rules here
 * win against the Bootstrap-3 / base.css defaults. Token values are inlined
 * (matches the pattern used in function_introduction.css) so the file is
 * self-contained.
 *
 * To revert: remove the two <link> tags from base.mak and base_v2.mak.
 */

/* ---------- eva-* token values (inlined, auth-scoped) ----------
   Scoped to the three modals that opt into this stylesheet. The
   .auth-valueprops list (shared between signup and the upsell modal)
   reads these vars, so #modal-upgrade-ac must be in this selector list
   or the tint/border/gradient/check colors fall back to initial. */
#modal-login, #modal-signup, #modal-upgrade-ac {
  --auth-bg:           #ffffff;
  --auth-surface-tint: #f3f6fb;
  --auth-border:       #d6dfeb;
  --auth-border-strong:#aebcce;
  --auth-text:         #06203d;
  --auth-text-muted:   #344662;
  --auth-text-subtle:  #5b6b85;
  --auth-primary:      #0a84ff;
  --auth-primary-strong:#0066d4;
  --auth-primary-soft: rgba(10, 132, 255, 0.08);
  --auth-primary-glow: rgba(10, 132, 255, 0.20);
  --auth-success:      #1a7f37;
  --auth-success-soft: #ddf4e4;
  --auth-cyan:         #22d3ee;
  --auth-body-tint:    #f6f9fd;
  --auth-card-tint:    #f0f6ff;
  --auth-card-border:  #d8e6f8;
  --auth-danger:       #ef4444;
  --auth-radius:       10px;
  --auth-radius-sm:    6px;
  --auth-shadow:       0 24px 60px rgba(6, 32, 61, 0.22),
                       0 8px 18px rgba(6, 32, 61, 0.12);
  --auth-font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                       'Helvetica Neue', 'Noto Sans TC', 'PingFang TC',
                       'Microsoft JhengHei', sans-serif;
  --auth-ease:         cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============================================================
   Modal shell — centered, capped width, rounded card
   ============================================================ */
#modal-login .modal-dialog,
#modal-signup .modal-dialog {
  width: auto;
  max-width: 540px;
  margin: 6vh auto;
  font-family: var(--auth-font);
}
#modal-login .modal-content,
#modal-signup .modal-content {
  border: none;
  border-radius: var(--auth-radius);
  box-shadow: var(--auth-shadow);
  overflow: hidden;
  background: var(--auth-bg);
}

/* ============================================================
   Header — white card with green eyebrow pill (mirrors the upsell
   modal + welcome modal). Replaces the blue gradient banner so the
   green pill + blue accents read as a single palette family.
   ============================================================ */
#modal-login .modal-header,
#modal-signup .modal-header {
  position: relative;
  background: #fff;
  padding: 24px 28px 18px;
  border: none;
  text-align: left;
}
/* Single title — welcome text + brand inline, mirroring the upsell modal's
   .upsell-modal__title pattern. Drops the separate small "brand" line so
   there's one visual anchor in the header instead of two. */
#modal-login .auth-headline,
#modal-signup .auth-headline {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--auth-text);
  font-family: var(--auth-font);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.012em;
  line-height: 1.3;
}
/* Brand inside the headline — Disclosure navy + Tracker blue (matches
   the email template and the upsell modal title). Inherits the headline
   font/size/weight so the wordmark sits cleanly inline. Overrides the
   global red `.disclosure` defined in base.css. */
#modal-login .auth-headline .disclosure,
#modal-signup .auth-headline .disclosure { color: var(--auth-text); font-weight: 700; }
#modal-login .auth-headline .tracker,
#modal-signup .auth-headline .tracker    { color: var(--auth-primary); font-weight: 700; }
#modal-login .auth-subhead,
#modal-signup .auth-subhead {
  position: relative;
  z-index: 1;
  margin: 6px 0 0;
  color: var(--auth-text-muted);
  font-family: var(--auth-font);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
}
#modal-login .modal-header .close,
#modal-signup .modal-header .close {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 2;
  color: var(--auth-text-subtle);
  opacity: 0.7;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  text-shadow: none;
  padding: 4px 8px;
  background: none;
  border: none;
}
#modal-login .modal-header .close:hover,
#modal-signup .modal-header .close:hover {
  opacity: 1;
  color: var(--auth-text);
}

/* ============================================================
   Body — form
   ============================================================ */
#modal-login .modal-body,
#modal-signup .modal-body {
  padding: 19px 28px 18px;
  background:
    linear-gradient(180deg, var(--auth-body-tint) 0%, var(--auth-bg) 110px);
  font-family: var(--auth-font);
}
/* Thin gradient accent line under the header — stripe-style hinge between
   the brand band and the form. */
#modal-login .modal-header::before,
#modal-signup .modal-header::before {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: linear-gradient(90deg,
    var(--auth-primary) 0%,
    var(--auth-cyan) 50%,
    var(--auth-primary) 100%);
  z-index: 2;
}

/* Value-prop bullets — tinted "stripe-style" card with a left-edge
   gradient bar (cf. .isa-card__title::before on /insiders_search_agentic).
   Shared between #modal-signup and #modal-upgrade-ac. */
#modal-signup .auth-valueprops,
#modal-upgrade-ac .auth-valueprops {
  position: relative;
  margin: 0 0 16px;
  padding: 12px 14px 12px 22px;
  list-style: none;
  font-size: 13px;
  line-height: 1.5;
  color: var(--auth-text-muted);
  background: var(--auth-card-tint);
  border: 1px solid var(--auth-card-border);
  border-radius: var(--auth-radius-sm);
}
#modal-signup .auth-valueprops::before,
#modal-upgrade-ac .auth-valueprops::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg,
    var(--auth-primary) 0%,
    var(--auth-cyan) 100%);
}
#modal-signup .auth-valueprops li,
#modal-upgrade-ac .auth-valueprops li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 2px;
}
#modal-signup .auth-valueprops li:last-child,
#modal-upgrade-ac .auth-valueprops li:last-child { margin-bottom: 0; }
/* Green check (made from two borders rotated -45deg). */
#modal-signup .auth-valueprops li::before,
#modal-upgrade-ac .auth-valueprops li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 5px;
  width: 12px;
  height: 7px;
  border-left: 2px solid var(--auth-success);
  border-bottom: 2px solid var(--auth-success);
  transform: rotate(-45deg);
}

/* Form inputs */
#modal-login .modal-body .form-control,
#modal-signup .modal-body .form-control {
  height: 44px;
  padding: 0 14px;
  margin-bottom: 12px;
  font-size: 14.5px;
  font-family: var(--auth-font);
  color: var(--auth-text);
  background: #fff;
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-sm);
  box-shadow: none;
  transition: border-color 140ms var(--auth-ease),
              box-shadow 140ms var(--auth-ease);
}
#modal-login .modal-body .form-control::placeholder,
#modal-signup .modal-body .form-control::placeholder {
  color: var(--auth-text-subtle);
  opacity: 0.7;
}
#modal-login .modal-body .form-control:focus,
#modal-signup .modal-body .form-control:focus {
  border-color: var(--auth-primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--auth-primary-glow);
}

/* Password-input wrapper — hosts the show/hide eye toggle button. */
#modal-login .auth-pw-wrap,
#modal-signup .auth-pw-wrap {
  position: relative;
}
/* The wrapped input keeps room on the right for the icon. */
#modal-login .auth-pw-input,
#modal-signup .auth-pw-input {
  padding-right: 44px;
}
/* Eye-toggle button — absolute right inside the wrapper. */
#modal-login .auth-pw-toggle,
#modal-signup .auth-pw-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 42px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--auth-text-subtle);
  cursor: pointer;
  transition: color 140ms var(--auth-ease);
}
#modal-login .auth-pw-toggle:hover,
#modal-signup .auth-pw-toggle:hover {
  color: var(--auth-text-muted);
}
#modal-login .auth-pw-toggle:focus,
#modal-signup .auth-pw-toggle:focus {
  outline: none;
  color: var(--auth-primary);
}
/* The "slash" line is hidden by default and shown when the password
   is visible. JS toggles the .is-visible class on the button. */
#modal-login .auth-pw-icon-slash,
#modal-signup .auth-pw-icon-slash {
  stroke: currentColor;
  opacity: 0;
  transition: opacity 140ms var(--auth-ease);
}
#modal-login .auth-pw-toggle.is-visible .auth-pw-icon-slash,
#modal-signup .auth-pw-toggle.is-visible .auth-pw-icon-slash {
  opacity: 1;
}

/* Per-field validation errors (jquery.validate injects <label class="error">
   right after the input). Pulled up into the input's bottom margin so the
   message sits visually tied to its field instead of floating mid-gap. */
#modal-login .modal-body label.error,
#modal-signup .modal-body label.error {
  display: block;
  margin: -9px 2px 14px;
  padding: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--auth-danger);
}
/* Red border on the input when it has the .error class */
#modal-login .modal-body .form-control.error,
#modal-signup .modal-body .form-control.error {
  border-color: var(--auth-danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Error / message banners */
#modal-login .login-error,
#modal-signup .signup-error,
#modal-signup .signup-msg {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #b3261e;
  border-radius: var(--auth-radius-sm);
  font-size: 13px;
  padding: 8px 12px;
  margin-bottom: 9px;
  display: none;
}
#modal-login .login-error:not(:empty),
#modal-signup .signup-error:not(:empty),
#modal-signup .signup-msg:not(:empty) {
  display: block;
}

/* Pending-activation banner inside .login-error — replaces the plain
   "user not found" error when the user enters correct credentials for a
   hide=1 (unverified) account. Renders an inline resend button. */
#modal-login .login-error .auth-pending-banner {
  /* Defeat the parent .login-error red-tinted styling so the banner
     reads as informational, not error. */
  margin: -8px -12px;  /* cancel parent padding so the banner spans the full row */
  padding: 12px 14px;
  background: var(--auth-primary-soft);
  border: 1px solid var(--auth-primary-glow);
  border-radius: var(--auth-radius-sm);
  color: var(--auth-text);
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}
#modal-login .login-error .auth-pending-msg {
  margin-bottom: 8px;
  color: var(--auth-text-muted);
  font-size: 13px;
}
#modal-login .login-error .auth-login-resend {
  display: inline-block;
  padding: 6px 14px;
  font-family: var(--auth-font);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-strong) 100%);
  border: none;
  border-radius: var(--auth-radius-sm);
  cursor: pointer;
  transition: filter 140ms var(--auth-ease);
}
#modal-login .login-error .auth-login-resend:hover {
  filter: brightness(1.04);
}
#modal-login .login-error .auth-login-resend:disabled {
  filter: grayscale(0.4) brightness(0.95);
  cursor: default;
}
#modal-login .login-error .auth-login-resend-feedback {
  display: inline-block;
  margin-left: 10px;
  font-size: 12px;
  color: var(--auth-success);
}
#modal-login .login-error .auth-login-resend-feedback.is-error {
  color: var(--auth-danger);
}

/* Forget-password row (login) */
#modal-login .auth-utility-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -4px 0 14px;
  font-size: 13px;
  color: var(--auth-text-muted);
}
#modal-login .auth-utility-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 400;
  cursor: pointer;
  user-select: none;
}
#modal-login .auth-utility-row input[type="checkbox"] {
  margin: 0;
}
#modal-login .auth-utility-row a.forget-password-link {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 500;
}
#modal-login .auth-utility-row a.forget-password-link:hover {
  color: var(--auth-primary-strong);
  text-decoration: underline;
}

/* Primary submit button (login + signup) */
#modal-login .auth-submit,
#modal-signup .auth-submit {
  display: block;
  width: 100%;
  height: 46px;
  margin: 6px 0 0;
  padding: 0 14px;
  font-family: var(--auth-font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-strong) 100%);
  border: none;
  border-radius: var(--auth-radius-sm);
  box-shadow: 0 4px 12px rgba(10, 132, 255, 0.22);
  cursor: pointer;
  transition: transform 140ms var(--auth-ease),
              box-shadow 140ms var(--auth-ease),
              filter 140ms var(--auth-ease);
}
#modal-login .auth-submit:hover,
#modal-signup .auth-submit:hover {
  filter: brightness(1.04);
  box-shadow: 0 6px 18px rgba(10, 132, 255, 0.30);
  transform: translateY(-1px);
}
#modal-login .auth-submit:active,
#modal-signup .auth-submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(10, 132, 255, 0.18);
}
/* Busy state — set by JS while the form is in-flight. */
#modal-login .auth-submit.is-busy,
#modal-signup .auth-submit.is-busy {
  cursor: wait;
  filter: brightness(0.92);
  transform: none;
  pointer-events: none;
}
#modal-login .auth-submit.is-busy:hover,
#modal-signup .auth-submit.is-busy:hover {
  transform: none;
  box-shadow: 0 4px 12px rgba(10, 132, 255, 0.22);
}
#modal-login .auth-spinner,
#modal-signup .auth-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: -3px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 700ms linear infinite;
}
@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* TOS caption (signup) — small, below CTA */
#modal-signup .auth-tos-caption {
  margin: 12px 2px 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--auth-text-subtle);
  text-align: center;
}
#modal-signup .auth-tos-caption a {
  color: var(--auth-text-muted);
  text-decoration: underline;
  text-decoration-color: var(--auth-border-strong);
}
#modal-signup .auth-tos-caption a:hover {
  color: var(--auth-primary);
  text-decoration-color: var(--auth-primary);
}

/* ============================================================
   Footer — cross-link to the other modal
   ============================================================ */
#modal-login .modal-footer,
#modal-signup .modal-footer {
  padding: 14px 28px 22px;
  background: var(--auth-surface-tint);
  border-top: 1px solid var(--auth-border);
  text-align: center;
  font-family: var(--auth-font);
  font-size: 13.5px;
  color: var(--auth-text-muted);
}
#modal-login .modal-footer .auth-switch-link,
#modal-signup .modal-footer .auth-switch-link {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 600;
  margin-left: 4px;
}
#modal-login .modal-footer .auth-switch-link:hover,
#modal-signup .modal-footer .auth-switch-link:hover {
  color: var(--auth-primary-strong);
  text-decoration: underline;
}

/* ============================================================
   Signup success state — replaces the form when /signup_submission
   returns success. The signup form sets .signup-msg with text; the
   inline JS in base*.mak swaps states.
   ============================================================ */
#modal-signup .auth-signup-success-state {
  text-align: center;
  padding: 4px 4px 0;
  font-family: var(--auth-font);
}
#modal-signup .auth-success-icon {
  margin: 6px auto 14px;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--auth-success-soft);
  color: var(--auth-success);
  border-radius: 50%;
}
#modal-signup .auth-success-title {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 600;
  color: var(--auth-text);
  letter-spacing: -0.01em;
}
#modal-signup .auth-success-copy {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--auth-text-muted);
}
#modal-signup .auth-success-copy .auth-success-email {
  display: inline-block;
  margin: 4px 0;
  padding: 3px 10px;
  background: var(--auth-card-tint);
  border: 1px solid var(--auth-card-border);
  border-radius: var(--auth-radius-sm);
  font-weight: 600;
  color: var(--auth-text);
  font-size: 14.5px;
}
#modal-signup .auth-success-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 8px 0 14px;
  font-size: 13px;
}
#modal-signup .auth-success-resend {
  background: none;
  border: none;
  padding: 4px 8px;
  font-family: var(--auth-font);
  color: var(--auth-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
#modal-signup .auth-success-resend:hover {
  color: var(--auth-primary-strong);
  text-decoration: underline;
}
#modal-signup .auth-success-resend:disabled {
  color: var(--auth-text-subtle);
  cursor: default;
  text-decoration: none;
}
#modal-signup .auth-success-resend-feedback {
  font-size: 12px;
  color: var(--auth-success);
  min-height: 16px;
}
#modal-signup .auth-success-resend-feedback.is-error {
  color: var(--auth-danger);
}
#modal-signup .auth-success-tip {
  margin: 6px 4px 0;
  padding-top: 12px;
  border-top: 1px dashed var(--auth-border);
  font-size: 12px;
  line-height: 1.55;
  color: var(--auth-text-subtle);
}

/* Hide legacy markup that we are replacing in the new template
   (defensive — covers any cached page render).                  */
#modal-login .acc-action .forget-password,
#modal-login .acc-action #rmbpw-checkbox,
#modal-signup .tos-container {
  /* old layout — superseded by .auth-utility-row / .auth-tos-caption */
}

/* ============================================================
   Mobile responsive
   ============================================================ */
@media (max-width: 480px) {
  #modal-login .modal-dialog,
  #modal-signup .modal-dialog {
    margin: 0 12px;
    max-width: calc(100vw - 24px);
  }
  #modal-login .modal-header,
  #modal-signup .modal-header,
  #modal-login .modal-body,
  #modal-signup .modal-body,
  #modal-login .modal-footer,
  #modal-signup .modal-footer {
    padding-left: 20px;
    padding-right: 20px;
  }
  #modal-login .auth-headline,
  #modal-signup .auth-headline {
    font-size: 19px;
  }
}
