/* ==========================================================================
   ФОРМА ВХОДА — motion inputs в стилистике beUI (v145)
   Плавающая подпись, иконки слева/справа, пружинное кольцо фокуса,
   тряска при ошибке и галочка, которая рисуется при успехе.
   ========================================================================== */

.mi-auth {
  --mi-spring: cubic-bezier(.34, 1.56, .64, 1);
  --mi-soft: cubic-bezier(.22, 1, .36, 1);
  --mi-line: rgba(255, 255, 255, .13);
  --mi-line-2: rgba(255, 255, 255, .26);
  --mi-tx3: rgba(255, 255, 255, .48);
  --mi-ok: #4ade80;
  --mi-err: #f87171;
}

.mi-auth .box {
  border-radius: 26px;
  border: 1px solid var(--mi-line);
  background: linear-gradient(180deg, rgba(24, 24, 28, .96), rgba(13, 13, 16, .96));
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .05);
  animation: miCardIn .6s var(--mi-soft) both;
}
@keyframes miCardIn { from { opacity: 0; transform: translateY(16px) scale(.985) } to { opacity: 1; transform: none } }
.mi-auth .box > * { animation: miRise .5s var(--mi-soft) both }
.mi-auth .box > *:nth-child(1) { animation-delay: .04s }
.mi-auth .box > *:nth-child(2) { animation-delay: .09s }
.mi-auth .box > *:nth-child(3) { animation-delay: .14s }
.mi-auth .box > *:nth-child(4) { animation-delay: .19s }
.mi-auth .box > *:nth-child(5) { animation-delay: .24s }
@keyframes miRise { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }

/* ---------- поле ---------- */
.mi-field {
  position: relative;
  display: block;
  border: 1px solid var(--mi-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .028);
  transition: border-color .25s var(--mi-soft), background .25s var(--mi-soft),
              box-shadow .35s var(--mi-spring), transform .35s var(--mi-spring);
  overflow: hidden;
}
.mi-field:hover { border-color: var(--mi-line-2); background: rgba(255, 255, 255, .045) }
.mi-field:focus-within {
  border-color: rgba(255, 255, 255, .5);
  background: rgba(255, 255, 255, .06);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .09);
  transform: translateY(-1px);
}

.mi-field .mi-ic {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  display: flex; color: var(--mi-tx3); pointer-events: none;
  transition: color .25s var(--mi-soft), transform .4s var(--mi-spring);
}
.mi-field .mi-ic .material-symbols-outlined { font-size: 20px }
.mi-field:focus-within .mi-ic { color: #fff; transform: translateY(-50%) scale(1.06) }

.mi-auth .mi-field .mi-input {
  width: 100%; box-sizing: border-box;
  height: 62px; padding: 24px 44px 8px 44px;
  border: 0 !important; background: transparent !important; box-shadow: none !important;
  color: #fff; font-size: 15px; line-height: 1.2; outline: none;
  border-radius: 16px;
}
.mi-auth .mi-field .mi-input:focus { border: 0 !important; box-shadow: none !important }

.mi-field .mi-label {
  position: absolute; left: 44px; top: 50%; transform: translateY(-50%);
  transform-origin: left center; pointer-events: none;
  color: var(--mi-tx3); font-size: 15px; letter-spacing: -.01em;
  transition: transform .34s var(--mi-spring), color .25s var(--mi-soft), font-size .25s var(--mi-soft);
}
.mi-field .mi-input:focus ~ .mi-label,
.mi-field .mi-input:not(:placeholder-shown) ~ .mi-label {
  transform: translateY(-22px) scale(.78);
  color: rgba(255, 255, 255, .62);
}
.mi-field:focus-within .mi-label { color: #fff }

/* линия, которая разъезжается от центра при фокусе */
.mi-field .mi-line {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  transform: scaleX(0); transition: transform .45s var(--mi-spring);
}
.mi-field:focus-within .mi-line { transform: scaleX(1) }

/* галочка, которая рисуется */
.mi-field .mi-check {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%) scale(.9);
  width: 20px; height: 20px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .4s var(--mi-spring);
}
.mi-field .mi-check path {
  fill: none; stroke: var(--mi-ok); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 30; stroke-dashoffset: 30;
}
.mi-field.ok .mi-check { opacity: 1; transform: translateY(-50%) scale(1) }
.mi-field.ok .mi-check path { animation: miDraw .5s var(--mi-soft) forwards }
@keyframes miDraw { to { stroke-dashoffset: 0 } }
.mi-field.ok:not(:focus-within) { border-color: rgba(74, 222, 128, .35) }

/* глаз для пароля */
.mi-field .mi-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--mi-tx3); cursor: pointer; border-radius: 12px;
  transition: color .2s, background .2s, transform .35s var(--mi-spring);
}
.mi-field .mi-eye:hover { color: #fff; background: rgba(255, 255, 255, .08) }
.mi-field .mi-eye:active { transform: translateY(-50%) scale(.9) }
.mi-field .mi-eye .material-symbols-outlined { font-size: 19px }
.mi-field:has(.mi-eye) .mi-check { right: 48px }
.mi-field:has(.mi-eye) .mi-input { padding-right: 82px }

/* ошибка — тряска и красное кольцо */
.mi-field.bad {
  border-color: rgba(248, 113, 113, .75) !important;
  box-shadow: 0 0 0 4px rgba(248, 113, 113, .13);
  animation: miShake .45s cubic-bezier(.36, .07, .19, .97) both;
}
.mi-field.bad .mi-ic { color: var(--mi-err) }
@keyframes miShake {
  10%, 90% { transform: translateX(-1px) }
  20%, 80% { transform: translateX(2px) }
  30%, 50%, 70% { transform: translateX(-5px) }
  40%, 60% { transform: translateX(5px) }
}

.mi-auth .err {
  color: var(--mi-err); font-size: 12.5px; line-height: 1.35;
  max-height: 0; opacity: 0; overflow: hidden; margin: 0;
  transition: max-height .3s var(--mi-soft), opacity .25s, margin .3s var(--mi-soft);
}
.mi-auth .err.show { max-height: 60px; opacity: 1; margin: 2px 2px 0 }

/* ---------- кнопка ---------- */
.mi-auth .mi-submit {
  position: relative; overflow: hidden;
  width: 100%; height: 50px; margin-top: 4px;
  border-radius: 16px; font-size: 15px; font-weight: 650;
  transition: transform .32s var(--mi-spring), box-shadow .3s var(--mi-soft), opacity .2s;
}
.mi-auth .mi-submit:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(255, 255, 255, .16) }
.mi-auth .mi-submit:active { transform: translateY(0) scale(.975) }
.mi-auth .mi-submit::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
}
.mi-auth .mi-submit:hover::after { animation: miShine .9s var(--mi-soft) }
@keyframes miShine { to { transform: translateX(120%) } }

.mi-auth .google-btn {
  border-radius: 16px; height: 50px;
  transition: transform .32s var(--mi-spring), border-color .25s, background .25s;
}
.mi-auth .google-btn:hover { transform: translateY(-2px) }
.mi-auth .google-btn:active { transform: scale(.975) }

.mi-auth form { gap: 12px }
.mi-auth .mi-pass.in { animation: miUnfold .45s var(--mi-soft) both }
@keyframes miUnfold { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }
.mi-auth .switch b {
  cursor: pointer; border-bottom: 1px solid transparent;
  transition: border-color .25s, color .25s, letter-spacing .3s var(--mi-soft);
}
.mi-auth .switch b:hover { border-color: currentColor }

/* автозаполнение не ломает тёмную тему */
.mi-auth .mi-input:-webkit-autofill,
.mi-auth .mi-input:-webkit-autofill:hover,
.mi-auth .mi-input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff;
  -webkit-box-shadow: 0 0 0 1000px #17171b inset;
  transition: background-color 9999s ease-in-out 0s;
}

/* ---------- телефон ---------- */
@media (max-width: 560px) {
  .mi-auth { padding: 18px 14px calc(18px + env(safe-area-inset-bottom)) }
  .mi-auth .box { padding: 26px 18px; border-radius: 24px }
  .mi-auth .mi-field .mi-input { font-size: 16px; height: 60px }
  .mi-auth .mi-field .mi-label { font-size: 15px }
  .mi-auth .mi-submit, .mi-auth .google-btn { height: 52px }
}

@media (prefers-reduced-motion: reduce) {
  .mi-auth .box, .mi-auth .box > *, .mi-field.bad, .mi-field.ok .mi-check path, .mi-auth .mi-pass.in {
    animation: none !important;
  }
  .mi-field, .mi-field .mi-label, .mi-auth .mi-submit { transition-duration: .01ms !important }
  .mi-field.ok .mi-check path { stroke-dashoffset: 0 }
}
body.ui-reduce-motion .mi-auth .box,
body.ui-reduce-motion .mi-auth .box > *,
body.ui-reduce-motion .mi-field.bad { animation: none !important }
