/* Sign-in pages (login, two-factor code, two-factor setup): navy brand
   panel on the left, form on the right. Layout: templates/auth_base.html */

html, body { height: 100%; }
body { margin: 0; background: var(--color-surface); color: var(--color-text); }

.lp { display: flex; min-height: 100vh; min-height: 100dvh; }

/* ── Brand panel (left) ── */
.lp-brand {
  position: relative;
  flex: 0 0 36%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 3.25rem;
  overflow: hidden;
  background: linear-gradient(160deg, var(--color-side-bg) 0%, var(--color-nav-bg) 60%, var(--color-nav-bg) 100%);
  color: var(--color-on-accent);
}
.lp-brand::before {
  /* soft light in the top corner */
  content: '';
  position: absolute;
  top: -30%;
  left: -20%;
  width: 80%;
  height: 70%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.08), transparent);
  pointer-events: none;
}
.lp-brand-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; }
.lp-logo { display: block; width: 100%; max-width: 340px; height: auto; margin: 0 auto; }
.lp-tagline { margin-top: 1.25rem; font-size: 1.05rem; color: var(--color-on-accent-muted); }

.lp-version {
  position: absolute;
  left: 3.25rem;
  bottom: 1.25rem;
  font-size: 0.78rem;
  color: var(--color-on-accent-muted);
  opacity: 0.8;
}

/* ── Form side ── */
.lp-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lp-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Placed a little right of the browser window's centre: padding on
     the right worth half the brand panel (shrinking on windows too
     narrow for that, so the form keeps its room) */
  padding: 2.5rem max(1.5rem, min(calc(min(18vw, 240px) + 1.5rem), calc(100vw - min(36vw, 480px) - 360px - 1.5rem))) 2.5rem 1.5rem;
}
.lp-form { width: 100%; max-width: 360px; }
.lp-mobile-logo { display: none; width: 200px; max-width: 70%; height: auto; margin: 0 auto 1.75rem; }
.login-logo-dark { display: none; }
[data-theme="dark"] .login-logo-light { display: none; }
[data-theme="dark"] .login-logo-dark { display: block; }
.lp-site {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-brand-text);
  white-space: nowrap;
}
.lp-site span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lp-site .bi { flex-shrink: 0; font-size: 1rem; }

/* Page heading and one line under it (two-factor pages) */
.lp-title { margin: 0 0 0.35rem; font-size: 1.25rem; font-weight: 600; color: var(--color-text); }
.lp-lead { margin: 0 0 1.25rem; font-size: 0.9rem; color: var(--color-text-muted); }

/* Message box (errors and notices), shown only when there's something to say */
.login-error {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-danger-border, var(--color-danger));
  border-radius: var(--bs-border-radius, 0.375rem);
  background: var(--color-danger-subtle);
  color: var(--color-danger-text);
  font-size: 0.875rem;
  line-height: 1.4;
}
.login-error .bi { flex-shrink: 0; margin-top: 0.05rem; }
.login-error.is-warning { border-color: var(--color-warning-border, var(--color-warning)); background: var(--color-warning-subtle); color: var(--color-warning-text); }
.login-error.is-info    { border-color: var(--color-info-border, var(--color-border)); background: var(--color-info-subtle, var(--color-brand-subtle)); color: var(--color-info-text, var(--color-brand-text)); }
.login-error.is-success { border-color: var(--color-success-border, var(--color-success)); background: var(--color-success-subtle); color: var(--color-success-text); }

.lp-form .form-label { margin-bottom: 0.35rem; font-size: 0.875rem; font-weight: 600; color: var(--color-text); }
.lp-form .form-control.is-missing { border-color: var(--color-danger); }

/* Full-width buttons (standard Bootstrap sizes) */
.lp-submit, .lp-secondary { display: flex; align-items: center; justify-content: center; gap: 0.5rem; width: 100%; padding: 0.375rem 0.75rem; border-radius: var(--bs-border-radius, 0.375rem); font-weight: 500; }
.lp-secondary {
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
}
.lp-secondary:hover, .lp-secondary:focus-visible { border-color: var(--color-brand); color: var(--color-brand-text); background: var(--color-surface-2); }

/* Small text link under a form ("Use a backup code", "Back to sign in") */
.lp-link {
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.85rem;
  color: var(--color-brand-text);
  text-decoration: none;
  cursor: pointer;
}
.lp-link:hover { text-decoration: underline; }
.lp-links { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1rem; }

/* 6-digit code field */
.lp-code {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.45rem;
  font-variant-numeric: tabular-nums;
}
.lp-code::placeholder { letter-spacing: 0.45rem; font-weight: 400; color: var(--color-text-faint, var(--color-text-muted)); }

.site-footer { margin-top: 1.5rem; text-align: center; font-size: 0.8rem; color: var(--color-text-muted); }
.site-footer a { color: var(--color-brand-text); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* Narrow windows and phones: no brand panel, small logo above the form */
@media (max-width: 860px) {
  .lp-brand { display: none; }
  .lp-center { align-items: flex-start; justify-content: center; padding: calc(2.5rem + env(safe-area-inset-top)) 1.25rem 2rem; }
  .lp-mobile-logo.login-logo-light { display: block; }
  [data-theme="dark"] .lp-mobile-logo.login-logo-light { display: none; }
  [data-theme="dark"] .lp-mobile-logo.login-logo-dark { display: block; }
}
@media (max-width: 520px) {
  .lp-form .form-control { font-size: 16px; }   /* iOS zooms into smaller inputs */
  .lp-code { font-size: 1.5rem; }
}
