/*
 * Shared form field — one look for every form.
 *
 *   <div class="gf-field" :class="{ 'is-invalid': errors.email }">
 *     <label for="email">Email</label>
 *     <input id="email" class="gf-field__control" aria-describedby="email-error" …>
 *     <p class="gf-field__error" id="email-error" x-show="errors.email" x-text="errors.email"></p>
 *   </div>
 *
 * .gf-field__control marks the element that draws the field's box (an input, a textarea, a
 * dropdown button, or the wrapper around an input with an icon). While the field is invalid it
 * gets a thin red border, and the message sits directly under it.
 */
:root {
  --gf-field-error: #d92d20;
  --gf-field-error-ring: rgba(240, 68, 56, 0.14);
}

/* Zero specificity: a page's own field layout (spacing, columns) always wins over this default. */
:where(.gf-field) {
  display: grid;
  gap: 6px;
  min-width: 0;
  /* Side-by-side fields stay aligned when one shows a longer (wrapping) message. */
  align-self: start;
}

/* Drawn as an inset outline so a field never changes size when it turns invalid. */
.gf-field.is-invalid .gf-field__control {
  border-color: var(--gf-field-error) !important;
  outline: 1px solid var(--gf-field-error);
  outline-offset: -1px;
}

.gf-field.is-invalid .gf-field__control:focus,
.gf-field.is-invalid .gf-field__control:focus-within {
  box-shadow: 0 0 0 4px var(--gf-field-error-ring) !important;
}

.gf-field__error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  color: var(--gf-field-error);
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-medium);
  line-height: var(--gf-leading-caption);
}

.gf-field__error::before {
  content: "";
  flex: 0 0 14px;
  height: 14px;
  margin-top: 2px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm0 5a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0V8a1 1 0 0 1 1-1Zm0 8.5a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm0 5a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0V8a1 1 0 0 1 1-1Zm0 8.5a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Filled field shell — the box around a plain input/textarea, the same control look the
   account setup uses. Use it wherever a field is not a component of its own:

     <div class="gf-field__shell">
       <input class="gf-field__input" …>
     </div> */
.gf-field__shell {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  background: #f2f4f7;
  box-sizing: border-box;
  transition: background 160ms cubic-bezier(0.2, 0, 0, 1), box-shadow 160ms cubic-bezier(0.2, 0, 0, 1);
}

.gf-field__shell:hover {
  background: #eaecf0;
}

.gf-field__shell:focus-within {
  background: #f2f4f7;
  box-shadow: 0 0 0 3px rgba(41, 102, 244, 0.16);
}

.gf-field__input {
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: #101828;
  font-family: var(--gf-font);
  font-size: var(--gf-text-body);
  line-height: var(--gf-leading-body);
  font-weight: var(--gf-weight-medium);
}

.gf-field__input::placeholder {
  color: #667085;
  font-weight: var(--gf-weight-normal);
}

/* Helper line under a field (the field's own message is .gf-field__error). */
.gf-field__hint {
  margin: 0;
  color: #98a2b3;
  font-family: var(--gf-font);
  font-size: var(--gf-text-caption);
  line-height: var(--gf-leading-caption);
  font-weight: var(--gf-weight-medium);
}

/* Show / hide password (added by assets/js/forms/password-toggle.js). */
.gf-password-toggle {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #667085;
  cursor: pointer;
  transform: translateY(-50%);
}

.gf-password-toggle:hover {
  color: #344054;
  background: rgba(16, 24, 40, 0.05);
}

.gf-password-toggle:focus-visible {
  outline: 2px solid #2966F4;
  outline-offset: 1px;
}

.gf-password-toggle svg {
  width: 20px;
  height: 20px;
}

input.gf-password-input {
  padding-right: 44px !important;
}
