/* ═══════════════════════════════════════════════════════════════════════════
   CRM AUTH  —  the guest/auth shell, on the Geex design system
   Covers: page shell · brand head · titles · forms · primary button
           Google button · code box · alerts · footer · password toggle

   Loaded LAST, after crm-ui.css + crm-mobile.css, so it wins on the few
   auth-only components those files do not know about.

   Contract (GEEX-UI-DESIGN-GUIDE section 2.3):
     - No raw hex. Every colour resolves through a --crm-* / --s-* token
       declared in layouts/guest.blade.php :root (2.1) or crm-ui.css (2.2).
     - No font-family. Jost arrives from the layout's `*, body` rule.
   ═══════════════════════════════════════════════════════════════════════════ */


/* -- 1. PAGE SHELL -------------------------------------------------------- */
html, body { min-height: 100%; margin: 0; }

body {
  background: var(--crm-bg);
  color: var(--crm-body-text);
}

.login-wrap {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

/* The single centred card. flex-shrink:0 so a short viewport scrolls the card
   instead of clipping its content (section 13). */
.login-form-panel {
  width: 100%;
  max-width: 440px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--crm-card-bg);
  border: 1px solid var(--crm-border);
  border-radius: var(--crm-card-radius);
  box-shadow: var(--crm-card-shadow);
}

.login-form-inner { padding: 40px 40px 24px; }


/* -- 2. BRAND HEAD -------------------------------------------------------- */
.login-head { margin-bottom: 24px; }

.login-brand-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.login-brand-logo {
  height: 72px;
  width: auto;
  max-width: 240px;
  border-radius: var(--crm-r-md);
  object-fit: contain;
}

.login-badge {
  font-size: var(--crm-fs-xs);
  font-weight: 700;
  background: var(--crm-primary);
  color: var(--crm-on-primary);
  padding: 2px 8px;
  border-radius: var(--crm-r-xs);
  text-transform: uppercase;
  letter-spacing: .07em;
}

.login-tagline {
  font-size: var(--crm-fs-base);
  color: var(--crm-muted);
  margin-top: 6px;
}


/* -- 3. TITLES ------------------------------------------------------------ */
.auth-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--crm-heading);
  margin: 0 0 4px;
}

.auth-subtitle {
  font-size: var(--crm-fs-base);
  color: var(--crm-muted);
  margin: 0 0 20px;
}

/* The anti-phishing warning. It used to be a full sentence sitting above every
   form; it is now a shield glyph and a "?" (GEEX-UI-DESIGN-GUIDE §11), so the
   sentence appears on hover or on keyboard focus. Right-aligned, because a lone
   "?" on the left edge reads as an orphaned bullet. */
.login-notice {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  font-size: var(--crm-fs-sm);
  color: var(--crm-muted);
  margin-bottom: 1rem;
  min-height: 18px;
}

.login-notice i {
  font-size: 1rem;
  line-height: 1;
  color: var(--crm-muted);
}

/* The default bubble is centred on its badge. This badge sits hard against the
   card's right edge, so a centred 260px bubble hangs ~90px past it and runs off
   a 390px phone. Anchor this one to the right and cap it to the viewport. */
.login-notice .crm-help-tip::after {
  left: auto;
  right: -4px;
  transform: none;
  max-width: min(260px, calc(100vw - 48px));
}


/* -- 4. FORM FIELDS ------------------------------------------------------- */
/* Label + input TYPE (size/weight/colour) is owned by the form-typography
   block in crm-ui.css -- do not restate it here. Only the card shape is local. */
.login-form-panel .form-control {
  border-radius: var(--crm-r-md);
  padding: 12px 14px;
  border-color: var(--crm-border);
  transition: border-color var(--crm-tx), box-shadow var(--crm-tx);
}

.login-form-panel .form-control:focus {
  border-color: var(--crm-primary);
  box-shadow: 0 0 0 3px var(--crm-primary-soft);
}

.login-form-panel .form-check-label {
  font-size: var(--crm-fs-base);
  color: var(--crm-body-text);
}

.login-form-panel .form-check-input:checked {
  background-color: var(--crm-primary);
  border-color: var(--crm-primary);
}

.login-form-panel .form-check-input:focus {
  border-color: var(--crm-primary);
  box-shadow: 0 0 0 3px var(--crm-primary-soft);
}

.login-form-panel .form-text {
  font-size: var(--crm-fs-sm);
  color: var(--crm-muted);
}

.login-form-panel .form-text a { color: var(--crm-link); }

.login-forgot {
  font-size: var(--crm-fs-sm);
  color: var(--crm-link);
  text-decoration: none;
}
.login-forgot:hover { color: var(--crm-primary-dark); text-decoration: underline; }

/* Signup honeypot -- off-screen, never visible. */
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; }


/* -- 5. PRIMARY BUTTON ---------------------------------------------------- */
.btn-login {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, var(--crm-primary), var(--crm-primary-light));
  border: none;
  color: var(--crm-on-primary);
  border-radius: var(--crm-r-md);
  padding: 13px;
  font-size: var(--crm-fs-md);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(var(--crm-primary-rgb), .30);
  transition: filter var(--crm-tx), transform var(--crm-tx), box-shadow var(--crm-tx);
  cursor: pointer;
}

.btn-login:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  color: var(--crm-on-primary);
  box-shadow: 0 6px 18px rgba(var(--crm-primary-rgb), .34);
}

.btn-login:focus-visible {
  outline: 2px solid var(--crm-primary);
  outline-offset: 2px;
}

.btn-login:active { transform: translateY(0); }


/* -- 6. GOOGLE BUTTON ----------------------------------------------------- */
/* Geex surface, Geex border, Geex ink. The only brand-specific thing left is
   the Google "G" artwork itself (an <img>), which is correct -- recolouring a
   third-party mark is not ours to do. */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: var(--crm-card-bg);
  color: var(--crm-body-text);
  border: 1px solid var(--crm-border);
  border-radius: var(--crm-r-md);
  padding: 12px;
  font-size: var(--crm-fs-md);
  font-weight: 600;
  text-decoration: none;
  transition: border-color var(--crm-tx), background var(--crm-tx), box-shadow var(--crm-tx);
}

.btn-google:hover {
  background: var(--crm-hover);
  border-color: var(--crm-primary);
  color: var(--crm-primary);
  box-shadow: var(--crm-sh-xs);
}

.btn-google:focus-visible {
  outline: 2px solid var(--crm-primary);
  outline-offset: 2px;
}

.btn-google img { flex-shrink: 0; }

/* "or sign in with your password" -- a rule with the text sitting in it. */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  font-size: var(--crm-fs-sm);
  color: var(--crm-muted);
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--crm-border);
}


/* -- 7. ONE-TIME CODE BOX ------------------------------------------------- */
/* Beats the global .form-control font-size !important in crm-ui.css -- a
   6-digit code is read as a group, not as body copy. */
.login-form-panel .form-control.tf-code {
  letter-spacing: 8px;
  text-align: center;
  font-size: 1.3rem !important;
  font-weight: 600;
  padding: 12px;
}


/* -- 8. SECONDARY LINKS --------------------------------------------------- */
.login-alt-text {
  text-align: center;
  margin-top: 18px;
  font-size: var(--crm-fs-base);
  color: var(--crm-muted);
}

.login-alt-text a,
.login-alt-text .btn-link {
  color: var(--crm-link);
  text-decoration: none;
  font-weight: 600;
}
.login-alt-text a:hover,
.login-alt-text .btn-link:hover { color: var(--crm-primary-dark); text-decoration: underline; }

/* The "Send a new code" resend control is a <button> inside its own <form>. */
.login-alt-text .btn-link {
  font-size: var(--crm-fs-base);
  vertical-align: baseline;
}

.login-alt-back { margin-top: 8px; }


/* -- 9. ALERTS ------------------------------------------------------------ */
.login-form-panel .alert {
  font-size: var(--crm-fs-base);
  border-radius: var(--crm-r-md);
}

.login-form-panel .invalid-feedback { font-size: var(--crm-fs-sm); }


/* -- 10. FOOTER ----------------------------------------------------------- */
.login-footer {
  padding: 16px 40px 20px;
  border-top: 1px solid var(--crm-border);
}

.login-footer-text {
  font-size: var(--crm-fs-xs);
  color: var(--crm-muted);
  text-align: center;
}

.login-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 6px;
}

.login-footer-links a {
  font-size: var(--crm-fs-xs);
  color: var(--crm-muted);
  text-decoration: none;
}
.login-footer-links a:hover { color: var(--crm-primary); }


/* -- 11. PASSWORD SHOW/HIDE ----------------------------------------------- */
/* .pw-wrap / .pw-toggle are injected by the layout script; the styling lives
   here so that script carries no colours of its own. */
.pw-wrap { position: relative; }

.pw-wrap .form-control { padding-right: 2.4rem; }

.pw-toggle {
  position: absolute;
  right: .55rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  color: var(--crm-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 1.05rem;
  transition: color var(--crm-tx);
}
.pw-toggle:hover { color: var(--crm-primary); }


/* -- 12. RESPONSIVE (section 13) ------------------------------------------ */
@media (max-width: 768px) {
  .login-wrap { padding: 24px 16px; }
  .login-form-inner { padding: 32px 28px 20px; }
  .login-footer { padding: 14px 28px 18px; }
  .login-brand-logo { height: 60px; }
}

@media (max-width: 480px) {
  .login-wrap { padding: 16px; align-items: flex-start; }
  .login-form-inner { padding: 28px 20px 18px; }
  .login-footer { padding: 14px 20px 16px; }
  .login-brand-logo { height: 52px; max-width: 190px; }
  .auth-title { font-size: 1.05rem; }
  .login-footer-links { gap: 12px; }
  .login-form-panel .form-control.tf-code { letter-spacing: 6px; font-size: 1.15rem !important; }
}
