/*===============================================*\
|| TerraLoc forms                                 ||
|| ---------------------------------------------- ||
|| Every form on the site is core markup: JScms    ||
|| renders sign in, register, reset, 2FA and the   ||
|| contact form, some with labels above the field, ||
|| some with Bootstrap floating labels. This file  ||
|| dresses that markup once, under .tl-form, so    ||
|| nothing has to fork it and two screens cannot   ||
|| drift apart.                                    ||
\*===============================================*/

/*
 * Add .tl-form to whatever wraps the form. The rules below assume the wrapper
 * sits on a light ground and supplies the palette; the auth card and the
 * contact card both pin it themselves, because they render on pages whose
 * theme may be dark.
 */

.tl-form .form-control {
  min-height: 52px;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--tl-hairline);
  border-radius: 8px;
  background: var(--tl-paper);
  color: var(--tl-ink);
  font-size: 0.9375rem;
}
.tl-form .form-control:focus {
  border-color: var(--tl-accent);
  background: var(--tl-white, #FFFFFF);
  box-shadow: 0 0 0 3px rgba(70, 96, 60, 0.14);
}

/* The label sits inside the field only when it floats, so only then does the
   text make room for it. A label above the field needs nothing, and this
   padding there pushes the text to the bottom of the box. :where keeps the
   weight of the rule above, so Bootstrap's filled and focused states still win. */
.tl-form :where(.form-floating) > .form-control { padding: 1.25rem 0.875rem 0.375rem; }

/* A textarea has no room for a floating label to sit above the first line, so
   it gets the padding a label needs and grows from there. */
.tl-form textarea.form-control { line-height: 1.6; }
.tl-form :where(.form-floating) > textarea.form-control { padding-top: 1.5rem; }

.tl-form .form-floating > label {
  padding: 0.9375rem 0.875rem;
  color: var(--tl-dim);
  font-size: 0.9375rem;
}
.tl-form .form-floating > .form-control:focus ~ label,
.tl-form .form-floating > .form-control:not(:placeholder-shown) ~ label {
  color: var(--tl-muted);
  transform: scale(0.8) translateY(-0.65rem) translateX(0.1rem);
}

.tl-form .form-check-input { border-color: var(--tl-hairline); }
.tl-form .form-check-input:checked {
  background-color: var(--tl-accent);
  border-color: var(--tl-accent);
}
.tl-form .form-check-label { font-size: 0.875rem; color: var(--tl-muted); }

.tl-form .fakepasswordicon { color: var(--tl-dim); }

/* Links inside a form are the secondary route out of it: forgot password,
   back to sign in, the terms link on the register form. */
.tl-form a,
.tl-form .link-underline-primary {
  color: var(--tl-accent);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}
.tl-form a:hover,
.tl-form .link-underline-primary:hover { color: var(--tl-accent-hover); text-decoration: underline; }

/*
 * The submit. The core emits .btn-dark on the auth forms and .btn-primary on
 * the contact and register forms; on a TerraLoc surface both are the CTA
 * orange, which is the colour this product uses to ask for something.
 */
.tl-form .btn-dark,
.tl-form .btn-primary {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--tl-cta);
  color: var(--tl-cta-ink);
  font-size: 1rem;
  font-weight: 600;
}
.tl-form .btn-dark:hover,
.tl-form .btn-primary:hover { background: var(--tl-cta-hover); color: var(--tl-cta-ink); }
.tl-form .btn-dark:focus-visible,
.tl-form .btn-primary:focus-visible { box-shadow: 0 0 0 3px rgba(var(--tl-cta-rgb), 0.35); }

/* 2FA: verify is the CTA, cancel is a way out and not a warning. */
.tl-form .btn-success { background: var(--tl-cta); color: var(--tl-cta-ink); }
.tl-form .btn-success:hover { background: var(--tl-cta-hover); color: var(--tl-cta-ink); }
.tl-form .btn-warning {
  background: transparent;
  border: 1px solid var(--tl-hairline);
  color: var(--tl-muted);
}
.tl-form .btn-warning:hover { background: var(--tl-paper-deep); color: var(--tl-ink); }
.tl-form .btn-success,
.tl-form .btn-warning { min-height: 52px; border-radius: 8px; font-weight: 600; }

/* The core wraps its own forms in .card-body with padding meant for the stock
   card they were written for; the surface here owns its padding. */
.tl-form .jscms-contact-form,
.tl-form .jscms-register-form { padding: 0 !important; }

.tl-form #pswmeter { margin-top: 0.75rem; }
