/* ─────────────────────────────────────────────────────────────────────────
   LOGIN FORM — the one sign-in form, registration/_login_form.html.

   Two pages render it: the Gathering sign-in page (registration/login.html,
   on the public base, view/base_view.html) and the branded sign-in page every
   other site gets (sites/login_branded.html, on the shell). Each page owns its
   layout (common/css/login.css, the .site-login rules in sites.css); the
   form's rows, error and status boxes, buttons and "Forgot password?" link
   are styled here, once, so the two cannot drift apart (METIS-pub#759).
   Until then these rules were scoped to .site-login and the Gathering page
   had its own copies in its portal stylesheet. The sign-in link's page
   (registration/login_link_confirm.html, METIS-pub#703) uses them too.

   The button carries its whole shape, not just its width, because the public
   base does not load crm/css/base.css, which is where `.btn`'s shape lives
   (button.css says why it stays there). The values are base.css's own, so on
   the shell page nothing changes. `border-width` and `border-style` rather
   than the `border` shorthand: the shorthand would reset the border colour
   `.btn--primary` sets, and this rule outranks it.

   Tokens only; no literal colour, size, radius, shadow or duration.
   ───────────────────────────────────────────────────────────────────────── */

@layer components {
  .login-form .form-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-bottom: var(--space-4);
  }

  .login-form .form-row label {
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--color-text-muted);
  }

  .login-form .form-row input {
    width: 100%;
    padding: var(--space-3);
    font-family: inherit;
    font-size: var(--text-md);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
  }

  .login-form .form-row input::placeholder { color: var(--color-text-faint); }

  /* Solid accent edge plus the soft halo, matching the pattern in
     coherence/css/iris_config_form.css. The ring is never removed. */
  .login-form .form-row input:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-halo);
    outline-offset: 0;
    border-color: var(--focus-ring);
  }

  .login-form .login-errors {
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    font-size: var(--text-md);
    color: var(--color-danger-strong);
    background: var(--color-danger-bg);
    border: 1px solid var(--color-danger-border);
    border-radius: var(--radius-md);
  }

  /* What the page says after "Email me a sign-in link" (METIS-pub#703), in
     the place the error box takes. */
  .login-form .login-status {
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    font-size: var(--text-md);
    color: var(--color-info);
    background: var(--color-info-bg);
    border: 1px solid var(--color-info-border);
    border-radius: var(--radius-md);
  }

  /* "Sign in as …" on the sign-in link's page. */
  .login-form .login-form__who {
    margin: 0 0 var(--space-4);
    font-size: var(--text-md);
    color: var(--color-text);
    overflow-wrap: anywhere;
  }

  /* The card's actions, so full width, stacked. */
  .login-form .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border-width: 1px;
    border-style: solid;
    border-radius: var(--btn-radius);
    font-size: var(--text-base);
    transition: background var(--transition-fast), border-color var(--transition-fast);
  }

  /* Only while it can be pressed: `.btn:disabled` (button.css) says
     not-allowed, and an unconditional cursor here would outrank it. */
  .login-form .btn:not(:disabled) { cursor: pointer; }

  .login-form .btn + .btn { margin-top: var(--space-2); }

  .login-form .forgot-password {
    margin-top: var(--space-4);
    text-align: center;
    font-size: var(--text-sm);
  }

  .login-form .forgot-password a {
    color: var(--color-text-muted);
    text-decoration: none;
  }

  .login-form .forgot-password a:hover {
    color: var(--color-text);
    text-decoration: underline;
  }
}
