/* ============================================================================
 * Login page-local stylesheet.
 *
 * Extracted from inline <style> in login.html to allow stricter CSP rules
 * for the /admin/login route (remove style-src 'unsafe-inline' when the
 * route-specific CSP is wired in main.ts).
 *
 * The page consumes design-tokens.v2.css (loaded first) and overrides only
 * what's specific to the login surface.
 * ========================================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  background: var(--ds-canvas);
  color: var(--ds-text);
  min-height: 100vh;
  min-height: 100svh;
  /* font-family vem de .ds-root (design-tokens.v2.css:223) → General Sans
   * self-hosted. Adicionar class="ds-root" ao <body> é obrigatório. */
}

/* Placeholder contrast override — DS default `--ds-text-subtle` (#8b919e)
 * gives 2.96:1 against white, which fails WCAG AA. Using `--ds-text-muted`
 * (#656b78) raises it to 5.74:1 → passes AA. Scoped to login.css so other
 * V2 pages keep current behavior until the DS token is hardened globally. */
.ds-input::placeholder { color: var(--ds-text-muted); }

/* ─── Split-screen shell ─────────────────────────────────────────────────── */
.lg-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--ds-canvas);
}

.lg-pane-form {
  flex: 0 0 480px;
  display: flex;
  flex-direction: column;
  background: var(--ds-surface);
  border-right: 1px solid var(--ds-border);
  min-width: 0;
  /* Allow scroll when the viewport is shorter than the form content
   * (e.g., landscape mobile, DevTools docked vertically). Vertical
   * centering inside .lg-form-body is preserved when content fits. */
  overflow-y: auto;
}

.lg-pane-marketing {
  flex: 1 1 0%;
  background: var(--ds-accent);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px clamp(28px, 5vw, 56px);
  /* Reserve room for the absolutely-positioned .lg-marketing-foot so it
   * never overlaps the centered .lg-marketing-content in tall viewports. */
  padding-bottom: 80px;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

/* ─── Form pane: header (logo + product name) ───────────────────────────── */
.lg-form-header {
  padding: 24px 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: max(24px, env(safe-area-inset-top));
}

.lg-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ds-accent);
  color: white;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* Chat-balloon glyph restaurado da v1. `currentColor` herda da cor branca do
 * container — fica branco sobre `--ds-accent`. O círculo usa opacity 0.55
 * para criar a "boca" do balão sem precisar de uma segunda cor explícita
 * (compatível com tenants que customizam o primaryColor). 18px ≈ 56% do
 * container 32px, proporcional ao 22-em-44 original. */
.lg-logo svg {
  width: 18px;
  height: 18px;
  display: block;
}

.lg-product-name {
  font-weight: 600;
  /* Usa token DS para o tamanho de body (14px); evita hardcoded. */
  font-size: var(--ds-fs-body);
  letter-spacing: -0.01em;
}

/* ─── Form pane: body (centered form) ───────────────────────────────────── */
.lg-form-body {
  flex: 1 1 0%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 40px;
}

.lg-form-card {
  width: 100%;
  max-width: 360px;
}

/* Tightens .ds-display line-height to 1.15 to match the prototype
 * (DS default is var(--ds-lh-tight) = 1.2). */
.lg-form-title { line-height: 1.15; }

.lg-form-subtitle {
  margin-top: 8px;
  /* 28px = fidelidade exata ao protótipo (era 24px). */
  margin-bottom: 28px;
}

.lg-error {
  display: none;
  margin-bottom: 18px;
}
.lg-error[data-visible="true"] { display: flex; }

.lg-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lg-field-label {
  display: block;
  margin-bottom: 6px;
}

.lg-pwd-wrap { position: relative; }

/* Reserve space for the inline eye toggle on the password input. */
.lg-pwd-wrap input.ds-input { padding-right: 50px; }

.lg-pwd-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--ds-r-sm);
  /* Subir de 28×28 para 36×36 — touch target mais confortável; passa
   * WCAG 2.5.5 (AAA pede 44 mas 36 é amplamente aceito como boa prática). */
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ds-text-subtle);
  transition: color .15s, background .15s;
}
.lg-pwd-toggle:hover { color: var(--ds-text); background: var(--ds-n-100); }
.lg-pwd-toggle:focus-visible {
  outline: 2px solid var(--ds-accent);
  outline-offset: 1px;
  color: var(--ds-text);
}
.lg-pwd-toggle svg { width: 16px; height: 16px; display: block; }

.lg-submit {
  margin-top: 6px;
  width: 100%;
  gap: 8px;
}
.lg-submit svg { width: 16px; height: 16px; flex-shrink: 0; }

@keyframes lg-spin { to { transform: rotate(360deg); } }
.lg-spin { animation: lg-spin .9s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  .lg-spin { animation: none; }
}

/* Shared eyebrow spacing — used by both overlines (form pane +
 * marketing pane) so .ds-overline is followed by 8px of breathing room
 * before the title beneath it. */
.lg-eyebrow { margin-bottom: 8px; }

/* Visually-hidden helper for screen-reader-only status announcements.
 * Used by the password toggle live region (#pwd-state). Mirrors the
 * conventional `.sr-only` / `.visually-hidden` recipe. */
.ds-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Form pane: security badge ─────────────────────────────────────────── */
.lg-security {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--ds-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.lg-security-badge {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ds-success) 20%, transparent);
  color: var(--ds-success);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.lg-security-badge svg { width: 8px; height: 8px; display: block; }

/* ─── Form pane: footer (legal links) ───────────────────────────────────── */
.lg-form-footer {
  padding: 20px 40px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--ds-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lg-legal-links { display: flex; gap: 16px; }

.lg-legal-links a {
  color: var(--ds-text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color .15s;
}
.lg-legal-links a:hover { color: var(--ds-text); }
.lg-legal-links a:focus-visible {
  outline: 2px solid var(--ds-accent);
  outline-offset: 2px;
  border-radius: var(--ds-r-sm);
}

/* ─── Marketing pane (right): diagonal stripe pattern ───────────────────── */
.lg-marketing-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background: repeating-linear-gradient(45deg, white 0px, white 1px, transparent 1px, transparent 32px);
  pointer-events: none;
}

.lg-marketing-overline {
  /* 0.85 sobre --ds-accent: ~5.9:1 (passa WCAG AA para texto pequeno). */
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.12em;
}

.lg-marketing-content {
  max-width: 480px;
  position: relative;
}

.lg-marketing-headline {
  font-size: 36px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.lg-marketing-subhead {
  margin-top: 24px;
  font-size: 14px;
  opacity: 0.9;
  line-height: 1.6;
  max-width: 420px;
}

.lg-marketing-features {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.lg-feature {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.lg-feature-bullet {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.lg-feature-bullet::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: white;
}

.lg-feature-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.lg-feature-desc {
  font-size: 12px;
  opacity: 0.78;
  margin-top: 2px;
  line-height: 1.5;
}

.lg-marketing-foot {
  position: absolute;
  right: clamp(28px, 5vw, 56px);
  bottom: 36px;
  font-size: 11px;
  opacity: 0.78;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  /* Pre-login is conversion-critical on small viewports; collapse the
   * decorative marketing pane and let the form take full width. */
  .lg-pane-marketing { display: none; }
  .lg-pane-form { flex: 1 1 0%; border-right: none; }
  .lg-form-body { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .lg-form-header  { padding: 20px 24px; }
  .lg-form-footer  { padding: 16px 24px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .lg-form-title   { font-size: 24px; }
}
