/* BrightInsight Partner Portal — Join
 * Public sign-up page. Match the partner-portal look:
 *   - Dark navy header (#142645), white text
 *   - Green primary button (#34a853)
 *   - Centered card on a light neutral background
 */

:root {
  --bi-navy: #142645;
  --bi-green: #34a853;
  --bi-green-dark: #2c8f46;
  --bi-red: #c1282d;
  --bi-text: #1a1a2e;
  --bi-muted: #5a6a7a;
  --bi-border: #d0dde8;
  --bi-bg: #f4f7fb;
  --bi-white: #ffffff;
  --bi-shadow: 0 4px 16px rgba(20, 38, 69, 0.08);
  --bi-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
             "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bi-bg);
  color: var(--bi-text);
  font-family: var(--bi-font);
  font-size: 16px;
  line-height: 1.5;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────── */
.app-header {
  background: var(--bi-navy);
  color: var(--bi-white);
  padding: 18px 24px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

.app-header__inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.app-header__brand {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.2px;
}

.app-header__tag {
  font-size: 13px;
  opacity: 0.75;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  padding-left: 12px;
}

/* ── Page + entry two-column layout ─────────────────── */
.page {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px;
}

.entry {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
  max-width: 920px;
  align-items: stretch;
}

.card {
  width: 100%;
  max-width: 440px;
  background: var(--bi-white);
  border: 1px solid var(--bi-border);
  border-radius: 12px;
  box-shadow: var(--bi-shadow);
  padding: 32px;
}

.entry .card {
  max-width: none;
  margin: 0;
  display: flex;
  flex-direction: column;
}

/* Register column: slightly softer visual weight so returning users
 * naturally look left first. Register is still a first-class action,
 * just not the primary CTA. */
.card--register {
  background: #fbfcfe;
}

#card-success {
  max-width: 480px;
  margin: 0 auto;
}

.card h1 {
  margin: 0 0 8px 0;
  font-size: 22px;
  color: var(--bi-navy);
}

.card .lede {
  margin: 0 0 20px 0;
  color: var(--bi-muted);
  font-size: 14px;
  line-height: 1.45;
  /* Reserve space for two lines so the form fields + CTA button align
   * across the Sign In and Register cards. The Register card's lede
   * wraps to two lines; the Sign In card's fits on one — without this
   * min-height the right card sits ~21px lower than the left. */
  min-height: calc(2 * 1.45em);
}

/* ── Form ───────────────────────────────────────────── */
form label {
  display: block;
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--bi-text);
}

form input[type="email"],
form input[type="password"],
form input[type="text"] {
  width: 100%;
  border: 1px solid var(--bi-border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  background: var(--bi-white);
  color: var(--bi-text);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

form input:focus {
  border-color: #6ba6d9;
  box-shadow: 0 0 0 3px rgba(107, 166, 217, 0.25);
}

.password-wrap {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 6px 8px;
  font-size: 17px;
  color: var(--bi-muted);
  border-radius: 6px;
}

.password-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* ── Submit ─────────────────────────────────────────── */
.submit-btn {
  width: 100%;
  margin-top: 20px;
  padding: 12px 16px;
  background: var(--bi-green);
  color: var(--bi-white);
  border: 0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 120ms ease, transform 60ms ease;
}

.submit-btn:hover:not(:disabled) { background: var(--bi-green-dark); }
.submit-btn:active:not(:disabled) { transform: translateY(1px); }
.submit-btn:disabled { opacity: 0.7; cursor: not-allowed; }

.submit-btn__arrow { font-size: 17px; }

.submit-btn.loading .submit-btn__label,
.submit-btn.loading .submit-btn__arrow { visibility: hidden; }

.spinner {
  display: none;
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--bi-white);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.submit-btn { position: relative; }
.submit-btn.loading .spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error inline ────────────────────────────────────── */
.error {
  margin-top: 14px;
  padding: 10px 12px;
  background: #fdecec;
  border: 1px solid #f5b3b5;
  border-radius: 8px;
  color: var(--bi-red);
  font-size: 13px;
}

/* ── Fine print ─────────────────────────────────────── */
.fine-print {
  margin-top: 18px;
  color: var(--bi-muted);
  font-size: 12px;
  text-align: center;
}

.fine-print a { color: var(--bi-navy); }

/* Optional-field label suffix. Compact + muted so it clearly reads
 * as a hint rather than an instruction. */
.label-optional {
  color: var(--bi-muted);
  font-weight: 400;
  font-size: 12px;
  margin-left: 4px;
}

/* ── Inline success (trouble panel) ─────────────────── */
.success {
  margin-top: 14px;
  padding: 10px 12px;
  background: #eaf6ed;
  border: 1px solid #b8dcc2;
  border-radius: 8px;
  color: #1a6b35;
  font-size: 13px;
}

/* ── Link-style button (for Trouble toggle, Back) ─── */
.link-btn {
  background: transparent;
  border: 0;
  color: var(--bi-navy);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 12px 4px 0 4px;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  align-self: flex-start;
}

.link-btn:hover { color: #0c1a33; }

.trouble-panel {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px dashed var(--bi-border);
}

.trouble-panel .submit-btn--secondary {
  background: var(--bi-navy);
}
.trouble-panel .submit-btn--secondary:hover:not(:disabled) {
  background: #0c1a33;
}

/* Trouble panel spinner is inline (not overlay).
 * v0.3.8 — base rule MUST inherit `display: none` from the generic
 * .spinner rule above; overriding it to inline-block here made the
 * spinner visible on page load before any submit had ever fired.
 * Only `.submit-btn.loading .spinner` should be visible, matching the
 * behaviour of the main buttons. */
.trouble-panel .spinner {
  position: static;
  margin-left: 8px;
  vertical-align: middle;
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: var(--bi-white);
}
.trouble-panel .submit-btn.loading .spinner { display: inline-block; }
.trouble-panel .submit-btn.loading .submit-btn__label { visibility: visible; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.success-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  margin-top: 20px;
}

.success-actions .link-btn { align-self: center; }

/* ── Success card ───────────────────────────────────── */
.card--success {
  text-align: center;
}

.card--success .check {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}

.card--success h1 {
  color: var(--bi-navy);
  margin-top: 8px;
}

.card--success p {
  color: var(--bi-muted);
}

/* ── Footer ─────────────────────────────────────────── */
.app-footer {
  padding: 20px;
  text-align: center;
  color: var(--bi-muted);
  font-size: 12px;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 780px) {
  .entry {
    grid-template-columns: 1fr;
    max-width: 480px;
  }
}

@media (max-width: 480px) {
  .app-header { padding: 14px 16px; }
  .card { padding: 24px; border-radius: 10px; }
  .card h1 { font-size: 20px; }
  .page { padding: 24px 12px; }
}
