/* Shared input interaction: floating labels, shake, inline errors */
.float-field {
  --float-left: 16px;
  --float-size: 13.5px;
  --float-rise: 17px;
  --float-height: 58px;
  --float-color: #9d8bb5;
  --float-focus: #6b4f96;
  position: relative;
}

.float-label {
  position: absolute;
  left: var(--float-left);
  top: calc(var(--float-height) / 2);
  z-index: 3;
  max-width: calc(100% - var(--float-left) - 46px);
  overflow: hidden;
  color: var(--float-color);
  font-size: var(--float-size);
  font-weight: 400;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
  transform: translateY(-50%) scale(1);
  transform-origin: left center;
  transition:
    transform 200ms cubic-bezier(0.2, 0.8, 0.25, 1),
    color 180ms ease;
}

.float-field:focus-within .float-label,
.float-field input:not(:placeholder-shown) ~ .float-label,
.float-field textarea:not(:placeholder-shown) ~ .float-label {
  transform: translateY(calc(-50% - var(--float-rise))) scale(0.72);
  color: var(--float-focus);
}

.float-field.is-invalid .float-label {
  color: var(--field-error-color);
}

#login-form .float-field {
  --float-left: 52px;
  --float-height: 58px;
  --float-size: 15.5px;
  --float-rise: 17px;
  --float-color: #b5a6ce;
  --float-focus: #d0a8e0;
}

.bm-search.float-field {
  --float-left: 40px;
  --float-height: 44px;
  --float-size: 13.5px;
  --float-rise: 11px;
  --float-color: #a695b9;
  --float-focus: #6b4f96;
}

.search-box.float-field {
  --float-left: 39px;
  --float-height: 45px;
  --float-size: 13.5px;
  --float-rise: 11px;
  --float-color: #a695b9;
  --float-focus: #6b4f96;
}

/* Inline validation state */
.form-field {
  --field-error-color: #a84b68;
  --field-error-border: #c15a78;
  --field-error-ring: rgba(193, 90, 120, 0.14);
}

#login-form .form-field {
  --field-error-color: #ffb3c5;
  --field-error-border: #ff7f9e;
  --field-error-ring: rgba(255, 96, 128, 0.19);
}

.form-field .field-error {
  display: block;
  max-height: 0;
  margin: 0 4px;
  overflow: hidden;
  color: var(--field-error-color);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0.005em;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 180ms ease,
    transform 220ms cubic-bezier(0.2, 0.8, 0.25, 1),
    max-height 220ms ease,
    margin-top 220ms ease;
}

.form-field.is-invalid .field-error {
  max-height: 44px;
  margin-top: 6px;
  opacity: 1;
  transform: translateY(0);
}

.form-field.is-invalid input,
.form-field.is-invalid textarea {
  border-color: var(--field-error-border) !important;
  box-shadow: 0 0 0 3px var(--field-error-ring) !important;
}

.form-field.is-invalid .field-icon {
  color: var(--field-error-color);
}

.form-field.is-invalid > span:first-child {
  color: var(--field-error-color);
}

@keyframes colemofield-shake {
  0%, 100% {
    transform: translateX(0);
  }
  12% {
    transform: translateX(-6px);
  }
  24% {
    transform: translateX(5px);
  }
  36% {
    transform: translateX(-4px);
  }
  48% {
    transform: translateX(3px);
  }
  60% {
    transform: translateX(-2px);
  }
  72% {
    transform: translateX(1px);
  }
  84% {
    transform: translateX(0);
  }
}

.form-field.is-shaking input,
.form-field.is-shaking textarea {
  animation: colemofield-shake 400ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@media (max-width: 560px) {
  #login-form .float-field {
    --float-height: 55px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .float-label,
  .form-field .field-error {
    transition-duration: 0.01ms;
  }

  .form-field.is-shaking input,
  .form-field.is-shaking textarea {
    animation: none;
  }
}
