/*
 * Sign-in and Create Workspace (docs/engineering/sign-in-and-setup.md, migration 097): the Leadsensy brand panel on the
 * left, the form card on the right; one column below 992 px. Light / dark follows html[data-auth-theme] and is scoped to
 * .ls-auth, so the rest of the CRM is unchanged. Bootstrap 5 + crm-theme.css underneath; no build step.
 * The logo is the landing page's (wwwroot/images/home) and opens "/".
 */

/* Shared by every form: a required field's star, a field that checked out, and help under a field. */
.crm-required { color: #dc2626; font-weight: 600; }
.crm-field-success { margin-top: 0.25rem; font-size: 0.75rem; color: #08806d; }
.crm-input-group.is-valid { border-color: #1abfa6; }

.ls-auth {
  --ls-bg: #f6f8fb;
  --ls-card: #ffffff;
  --ls-ink: #001b40;
  --ls-text: #334155;
  --ls-muted: #5b6b82;
  --ls-border: #e3e8ec;
  --ls-field: #ffffff;
  --ls-brand-a: #eaf4ff;
  --ls-brand-b: #f3eefc;
  --ls-glow-a: rgba(26, 193, 254, 0.30);
  --ls-glow-b: rgba(124, 55, 204, 0.18);
  --ls-grid: rgba(3, 133, 230, 0.07);
  --ls-dots: rgba(3, 133, 230, 0.10);
  --ls-chip: rgba(255, 255, 255, 0.78);
  --ls-note: #f1f5f9;
  --ls-ease: cubic-bezier(0.22, 1, 0.36, 1);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--ls-bg);
  color: var(--ls-text);
}

html[data-auth-theme="dark"] .ls-auth {
  --ls-bg: #0a1120;
  --ls-card: #111b2e;
  --ls-ink: #e8eef8;
  --ls-text: #c7d2e3;
  --ls-muted: #9aabc4;
  --ls-border: #26344d;
  --ls-field: #0c1526;
  --ls-brand-a: #0e223d;
  --ls-brand-b: #1a1236;
  --ls-glow-a: rgba(26, 193, 254, 0.24);
  --ls-glow-b: rgba(124, 55, 204, 0.26);
  --ls-grid: rgba(148, 197, 255, 0.06);
  --ls-dots: rgba(148, 197, 255, 0.08);
  --ls-chip: rgba(255, 255, 255, 0.06);
  --ls-note: #17233a;
  color-scheme: dark;
}

/* ---- Logo (the landing page's); on dark it sits on a light plate so the navy wordmark stays readable ---- */
.ls-auth-home { display: inline-flex; align-items: center; text-decoration: none; transition: opacity .2s; }
.ls-auth-home:hover { opacity: 0.85; text-decoration: none; }
.ls-auth-home img { display: block; width: 172px; height: auto; }
html[data-auth-theme="dark"] .ls-auth-home { padding: 6px 12px; border-radius: 12px; background: #fff; box-shadow: 0 6px 20px -8px rgba(0, 0, 0, 0.5); }

/* ---- Brand panel ---- */
.ls-auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  overflow: hidden;
  padding: 2.25rem clamp(2rem, 4vw, 3.5rem);
  background: linear-gradient(145deg, var(--ls-brand-a) 0%, var(--ls-brand-b) 100%);
  border-right: 1px solid var(--ls-border);
  isolation: isolate;
}
/* the faint grid, fading out toward the edges */
.ls-auth-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(var(--ls-grid) 1px, transparent 1px), linear-gradient(90deg, var(--ls-grid) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 40% 45%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 70% at 40% 45%, #000 30%, transparent 75%);
}
/* two soft lights */
.ls-auth-brand::after {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: -1;
  background:
    radial-gradient(28% 30% at 85% 12%, var(--ls-glow-a), transparent 70%),
    radial-gradient(30% 32% at 8% 92%, var(--ls-glow-b), transparent 70%);
  animation: ls-drift 14s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes ls-drift { to { transform: translate3d(-3%, 2%, 0) scale(1.05); } }

.ls-auth-brand-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.ls-auth-tagline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--ls-border);
  border-radius: 999px;
  background: var(--ls-chip);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ls-ink);
  backdrop-filter: blur(6px);
}
.ls-auth-pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #12b886; }
.ls-auth-pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #12b886; animation: ls-pulse 2s ease-out infinite; }
@keyframes ls-pulse { from { transform: scale(1); opacity: 0.7; } to { transform: scale(3); opacity: 0; } }

.ls-auth-brand-body { max-width: 600px; }
.ls-auth-headline { margin: 0 0 1rem; font-size: clamp(2rem, 3.3vw, 3rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.035em; color: var(--ls-ink); }
.ls-auth-gradient { background: linear-gradient(90deg, #0385e6 0%, #1ac1fe 45%, #7c37cc 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ls-auth-copy { max-width: 32rem; margin: 0 0 1.4rem; font-size: 1rem; line-height: 1.65; color: var(--ls-text); }
.ls-auth-chips { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.ls-auth-chips li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--ls-border);
  border-radius: 999px;
  background: var(--ls-chip);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ls-ink);
  box-shadow: 0 4px 14px -8px rgba(3, 61, 120, 0.25);
  backdrop-filter: blur(6px);
}
.ls-auth-chips li i { color: #0385e6; }
.ls-auth-chips li:nth-child(2) i { color: #1abfa6; }
.ls-auth-chips li:nth-child(3) i { color: #7c37cc; }

.ls-auth-brand-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: 0.75rem; color: var(--ls-muted); }
.ls-auth-version { padding: 0.15rem 0.6rem; border: 1px solid var(--ls-border); border-radius: 999px; background: var(--ls-chip); font-weight: 600; }

/* ---- Form side ---- */
.ls-auth-main {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  padding: 4.5rem 1.5rem 2.5rem;
  isolation: isolate;
}
/* dotted backdrop with a soft light behind the card */
.ls-auth-main::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(var(--ls-dots) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 20%, transparent 75%);
}
.ls-auth-main::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 520px;
  height: 520px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26, 193, 254, 0.16), transparent 65%);
  pointer-events: none;
}
.ls-auth-main-top {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
}
.ls-auth-mobile-logo { display: none; }
.ls-auth-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--ls-border);
  border-radius: 999px;
  background: var(--ls-card);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ls-ink);
  text-decoration: none;
  box-shadow: 0 4px 12px -8px rgba(15, 23, 42, 0.3);
  transition: color .2s, border-color .2s, transform .25s var(--ls-ease);
}
.ls-auth-back:hover { color: #0385e6; border-color: rgba(3, 133, 230, 0.4); text-decoration: none; }
.ls-auth-back i { font-size: 0.75rem; transition: transform .25s var(--ls-ease); }
.ls-auth-back:hover i { transform: translateX(-3px); }
.ls-auth-back-short { display: none; }

.ls-auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 2.4rem 2.25rem 1.85rem;
  border: 1px solid var(--ls-border);
  border-radius: 1.25rem;
  background: var(--ls-card);
  box-shadow: 0 40px 80px -40px rgba(3, 61, 120, 0.45), 0 12px 28px -18px rgba(15, 23, 42, 0.18), 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}
/* brand accent across the top of the card */
.ls-auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #1ac1fe 0%, #0385e6 50%, #7c37cc 100%);
}
.ls-auth-card.ls-auth-card-wide { max-width: 640px; }
.ls-auth-theme {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--ls-border);
  border-radius: 50%;
  background: transparent;
  color: var(--ls-muted);
  transition: color .2s, background-color .2s, transform .3s var(--ls-ease);
}
.ls-auth-theme:hover { color: var(--ls-ink); background: var(--ls-note); transform: rotate(-15deg); }
.ls-auth-title { margin: 0 2.75rem 0.35rem 0; font-size: 1.85rem; font-weight: 800; letter-spacing: -0.03em; color: var(--ls-ink); }
.ls-auth-subtitle { margin: 0 0 1.6rem; font-size: 0.9375rem; color: var(--ls-muted); }
.ls-auth-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1rem; }
.ls-auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 0.7rem;
  border: 1px solid rgba(26, 193, 254, 0.55);
  background: linear-gradient(180deg, #1a93ec 0%, #0385e6 100%);
  box-shadow: 0 10px 22px -10px rgba(3, 133, 230, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform .25s var(--ls-ease), box-shadow .25s var(--ls-ease), filter .2s;
}
.ls-auth-submit:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 16px 28px -12px rgba(3, 133, 230, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.ls-auth-submit:active:not(:disabled) { transform: translateY(0); }
.ls-auth-switch { margin: 1.35rem 0 0; text-align: center; font-size: 0.875rem; color: var(--ls-muted); }
.ls-auth-link { font-weight: 600; color: #026bba; text-decoration: none; }
.ls-auth-link:hover { text-decoration: underline; }
.ls-auth-terms { margin: 0.75rem 0 0; text-align: center; font-size: 0.75rem; color: var(--ls-muted); }
.ls-auth-terms a { color: inherit; text-decoration: underline; }
.ls-auth-note { margin: 0 0 1rem; padding: 0.75rem 0.9rem; border-radius: 0.6rem; background: var(--ls-note); font-size: 0.8125rem; color: var(--ls-text); }
.ls-auth-note-ok { background: #e6f8f5; color: #065e50; }
.ls-auth-note-warn { background: #fef3c7; color: #78350f; }

/* Password rules under the field */
.ls-pw-rules { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0.4rem 0 0; padding: 0; list-style: none; font-size: 0.75rem; color: var(--ls-muted); }
.ls-pw-rules i { margin-right: 0.35rem; font-size: 0.5rem; vertical-align: middle; }
.ls-pw-rules li.ok { color: #08806d; }
.ls-pw-rules li.ok i { font-size: 0.7rem; }

/* Google */
.ls-auth-google { margin-bottom: 0.25rem; }
.ls-google-slot { display: flex; justify-content: center; min-height: 44px; }
.ls-google-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem; height: 44px; border: 1px solid var(--ls-border); background: var(--ls-card); color: var(--ls-ink); font-weight: 600; }
.ls-google-btn:hover { background: var(--ls-note); }
.ls-google-g { font-weight: 800; font-size: 1.05rem; background: conic-gradient(from -45deg, #ea4335 0 25%, #4285f4 0 50%, #34a853 0 75%, #fbbc05 0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ls-auth-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0; font-size: 0.75rem; color: var(--ls-muted); }
.ls-auth-divider::before, .ls-auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--ls-border); }

/* Fields inside the card follow the theme */
.ls-auth .crm-label, .ls-auth .form-check-label { color: var(--ls-ink); }
.ls-auth .crm-input-group { height: 46px; border-radius: 0.7rem; background: var(--ls-field); border-color: var(--ls-border); transition: border-color .2s, box-shadow .2s, background-color .2s; }
.ls-auth .crm-input-group:hover { border-color: #b9d6f5; }
.ls-auth .crm-input-group:focus-within { border-color: #0385e6; box-shadow: 0 0 0 4px rgba(3, 133, 230, 0.12); }
.ls-auth .crm-input-group.is-invalid { border-color: #ef4444; }
.ls-auth .crm-input-group.is-valid { border-color: #1abfa6; }
.ls-auth .crm-input-group input, .ls-auth .crm-input-group select { padding: 0 0.9rem; font-size: 0.875rem; color: var(--ls-ink); }
.ls-auth .crm-input-group .crm-input-action { color: var(--ls-muted); }
.ls-auth .phone-input .form-select { flex: 0 0 8.75rem; width: 8.75rem; max-width: 8.75rem !important; color: var(--ls-ink); background-color: transparent; }
.ls-auth .phone-input .form-control { min-width: 0; }
.ls-auth .form-control { background-color: var(--ls-field); border-color: var(--ls-border); color: var(--ls-ink); }
.ls-auth .form-check-input:checked { background-color: #0385e6; border-color: #0385e6; }
html[data-auth-theme="dark"] .ls-auth .crm-input-group:hover { border-color: #3a4d6e; }
html[data-auth-theme="dark"] .ls-auth .crm-field-error { color: #f87171; }
html[data-auth-theme="dark"] .ls-auth .crm-field-success, html[data-auth-theme="dark"] .ls-auth .ls-pw-rules li.ok { color: #5eead4; }
html[data-auth-theme="dark"] .ls-auth .ls-auth-link { color: #1ac1fe; }
html[data-auth-theme="dark"] .ls-auth .ls-auth-note-ok { background: #0b2e2a; color: #a6e8dd; }
html[data-auth-theme="dark"] .ls-auth .ls-auth-note-warn { background: #3a2a0c; color: #fde68a; }
html[data-auth-theme="dark"] .ls-auth .phone-input option { background: #111b2e; color: #e8eef8; }
html[data-auth-theme="dark"] .ls-auth .btn-link { color: #9aabc4; }
html[data-auth-theme="dark"] .ls-auth-main::after { background: radial-gradient(circle, rgba(26, 193, 254, 0.10), transparent 65%); }

/* Keyboard focus is always visible */
.ls-auth a:focus-visible,
.ls-auth button:focus-visible,
.ls-auth .form-check-input:focus-visible {
  outline: 3px solid rgba(3, 133, 230, 0.55);
  outline-offset: 2px;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .ls-auth *, .ls-auth *::before, .ls-auth *::after { animation: none !important; transition: none !important; }
}

/* ---- Laptops: a little tighter ---- */
@media (max-width: 1199.98px) {
  .ls-auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* ---- Phones and small tablets: no brand panel, the logo above the form ---- */
@media (max-width: 991.98px) {
  .ls-auth { grid-template-columns: minmax(0, 1fr); background: linear-gradient(180deg, var(--ls-brand-a) 0%, var(--ls-bg) 45%); }
  .ls-auth-brand { display: none; }
  .ls-auth-main { justify-content: flex-start; padding: 1.25rem 1rem 2rem; }
  .ls-auth-main-top { position: static; width: 100%; max-width: 560px; justify-content: space-between; margin-bottom: 0.75rem; }
  .ls-auth-mobile-logo { display: inline-flex; }
  .ls-auth-mobile-logo img { width: 150px; }
  .ls-auth-card, .ls-auth-card.ls-auth-card-wide { max-width: 560px; padding: 2rem 1.25rem 1.5rem; }
  .ls-auth-main::after { top: 40%; }
}

@media (max-width: 575.98px) {
  .ls-auth-grid { grid-template-columns: minmax(0, 1fr); }
  .ls-auth-title { font-size: 1.5rem; }
  .ls-auth-mobile-logo img { width: 132px; }
  .ls-auth-back { padding: 0.45rem 0.75rem; }
  .ls-auth-back-long { display: none; }
  .ls-auth-back-short { display: inline; }
}

/* ---- The dashboard's Setup checklist (migration 097) ---- */
.ls-setup-steps { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.ls-setup-steps li { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.75rem; border: 1px solid var(--crm-border); border-radius: 0.6rem; }
.ls-setup-steps li.done { background: var(--crm-surface); }
.ls-setup-mark { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 1.75rem; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--crm-border-soft); color: var(--crm-subtle); font-size: 0.5rem; }
.ls-setup-steps li.done .ls-setup-mark { background: #e6f8f5; color: #08806d; font-size: 0.75rem; }
