/* Micro-interactions: ripple, hover lift, toggle, icon morph, form success */

/* Button base polish */
.btn {
  transition: transform .12s cubic-bezier(.2,.8,.2,1), box-shadow .12s ease, background-color .12s ease;
  will-change: transform;
  position: relative; /* for ripple */
  overflow: hidden;   /* for ripple */
}

/* Subtle lift on hover/focus */
.btn:hover,
.btn:focus {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(20,40,80,0.08), 0 2px 6px rgba(20,40,80,0.06);
  outline: none;
}

/* Pressed state */
.btn:active {
  transform: translateY(0);
  box-shadow: 0 3px 8px rgba(20,40,80,0.06);
}

/* Ripple element */
.mi-ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  opacity: 0.6;
  pointer-events: none;
  background: rgba(255,255,255,0.35); /* works on colored buttons */
  mix-blend-mode: screen;
  animation: mi-ripple 650ms cubic-bezier(.2,.8,.2,1);
}

@keyframes mi-ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Icon morph target */
.icon-morph {
  display: inline-block;
  transition: transform .22s cubic-bezier(.2,.9,.2,1), opacity .18s ease;
  transform-origin: center;
}
.icon-morph.active {
  transform: rotate(90deg) scale(1.08);
  opacity: 0.98;
}

/* Toggle (switch) style */
.mi-switch {
  --mi-switch-width: 46px;
  --mi-switch-height: 26px;
  position: relative;
  display: inline-block;
  width: var(--mi-switch-width);
  height: var(--mi-switch-height);
}
.mi-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.mi-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0;
  right: 0; bottom: 0;
  background-color: #d6dbe6;
  border-radius: 999px;
  transition: background-color .18s ease, box-shadow .18s ease;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.04);
}
.mi-switch .slider::before {
  content: "";
  position: absolute;
  height: calc(var(--mi-switch-height) - 6px);
  width: calc(var(--mi-switch-height) - 6px);
  left: 4px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform .18s cubic-bezier(.2,.9,.2,1), box-shadow .12s ease;
  box-shadow: 0 1px 3px rgba(10,20,40,0.08);
}
.mi-switch input:checked + .slider {
  background-color: var(--secondary-colour, #1e90ff);
}
.mi-switch input:checked + .slider::before {
  transform: translateX(calc(var(--mi-switch-width) - var(--mi-switch-height)));
}

/* Form submit success pulse */
.form-success {
  animation: mi-form-success 900ms cubic-bezier(.2,.9,.2,1);
}
@keyframes mi-form-success {
  0% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
  40% { box-shadow: 0 6px 20px rgba(0,160,90,0.12); }
  100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}

/* Small accessibility helpers */
.mi-focus-ring:focus {
  box-shadow: 0 0 0 0.2rem rgba(37,140,251,0.22);
  outline: none;
}