/**
 * Shrisha Forms - Animations
 */

/* Base entrance */
@keyframes sf-fade    { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }
@keyframes sf-zoom    { from { opacity:0; transform:scale(.94); } to { opacity:1; transform:scale(1); } }
@keyframes sf-slide   { from { opacity:0; transform:translateY(24px); } to { opacity:1; transform:none; } }
@keyframes sf-flip    { from { opacity:0; rotateX(20deg); } to { opacity:1; rotateX(0); } }
@keyframes sf-glow    { 0%,100%{ box-shadow:0 0 0 0 rgba(102,126,234,0); } 50%{ box-shadow:0 0 18px 4px rgba(102,126,234,.35); } }
@keyframes sf-ripple  { from{ transform:scale(0); opacity:.6; } to{ transform:scale(2.5); opacity:0; } }
@keyframes sf-pulse   { 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.03); } }
@keyframes sf-shake   { 0%,100%{ transform:translateX(0); } 20%,60%{ transform:translateX(-6px); } 40%,80%{ transform:translateX(6px); } }
@keyframes sf-bounce  { 0%,100%{ transform:translateY(0); } 50%{ transform:translateY(-8px); } }

/* Entrance variants */
.sf-anim-fade   .sf-form { animation: sf-fade  .4s ease both; }
.sf-anim-zoom   .sf-form { animation: sf-zoom  .35s cubic-bezier(.34,1.56,.64,1) both; }
.sf-anim-slide  .sf-form { animation: sf-slide .4s ease both; }
.sf-anim-flip   .sf-form { animation: sf-flip  .4s ease both; perspective:800px; }

/* Field-level entrance (stagger via JS) */
.sf-field { opacity:0; animation: sf-fade .3s ease forwards; }
.sf-field:nth-child(1)  { animation-delay:.04s; }
.sf-field:nth-child(2)  { animation-delay:.08s; }
.sf-field:nth-child(3)  { animation-delay:.12s; }
.sf-field:nth-child(4)  { animation-delay:.16s; }
.sf-field:nth-child(5)  { animation-delay:.20s; }
.sf-field:nth-child(6)  { animation-delay:.24s; }
.sf-field:nth-child(7)  { animation-delay:.28s; }
.sf-field:nth-child(8)  { animation-delay:.32s; }
.sf-field:nth-child(n+9){ animation-delay:.36s; }

/* Hover effects */
.sf-field__input:hover:not(:focus) { border-color: #b2bfd4; }

/* Focus glow */
.sf-field__input:focus,
.sf-field__textarea:focus,
.sf-field__select:focus {
  animation: sf-glow .6s ease;
}

/* Submit ripple */
.sf-submit-btn .sf-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.35);
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  animation: sf-ripple .5s ease-out forwards;
  pointer-events: none;
}

/* Error shake */
.sf-field--error .sf-field__input,
.sf-field--error .sf-field__textarea,
.sf-field--error .sf-field__select {
  animation: sf-shake .4s ease;
}

/* Step transitions */
.sf-step { transition: opacity .25s ease, transform .25s ease; }
.sf-step--leaving  { opacity:0; transform:translateX(-20px); }
.sf-step--entering { animation: sf-slide .3s ease both; }

/* Progress bar smooth */
.sf-progress__bar { transition: width .45s cubic-bezier(.4,0,.2,1); }

/* Rating hover */
.sf-rating__item { transition: color .15s ease, transform .15s ease; }

/* Checkbox / radio */
.sf-field__checkbox,
.sf-field__radio { transition: background .15s, border-color .15s, box-shadow .15s; }
.sf-field__checkbox:checked,
.sf-field__radio:checked { animation: sf-pulse .2s ease; }

/* Loading dots */
@keyframes sf-dot { 0%,80%,100%{ transform:scale(0); } 40%{ transform:scale(1); } }

.sf-loading-dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sf-primary);
  animation: sf-dot 1.4s ease infinite both;
}
.sf-loading-dots span:nth-child(2) { animation-delay:.16s; }
.sf-loading-dots span:nth-child(3) { animation-delay:.32s; }

/* Success checkmark */
@keyframes sf-check-draw {
  from { stroke-dashoffset: 50; }
  to   { stroke-dashoffset: 0;  }
}

.sf-success-icon path {
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  animation: sf-check-draw .4s .2s ease forwards;
}

/* Conditional show/hide */
.sf-field--hidden { display:none !important; }
.sf-field--visible { animation: sf-fade .25s ease; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
