/* ==========================================================================
   Inovit Fun System — centralized playful micro-interactions (LIGHT theme)
   Included on every page via templates/partials/inovit_fun.html
   Vanilla CSS, no libraries. Respects prefers-reduced-motion.
   ========================================================================== */

/* ---------- Button: hover lift + shine sweep (primary buttons) ---------- */
.btn-fun,
button.bg-emerald-600, a.bg-emerald-600,
button.bg-slate-800, a.bg-slate-800,
button.bg-teal-600, a.bg-teal-600 {
  position: relative;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .25s ease, filter .2s ease;
}
.btn-fun:hover,
button.bg-emerald-600:hover, a.bg-emerald-600:hover,
button.bg-slate-800:hover, a.bg-slate-800:hover,
button.bg-teal-600:hover, a.bg-teal-600:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -8px rgba(16, 185, 129, .45);
  filter: brightness(1.04);
}
.btn-fun::after,
button.bg-emerald-600::after, a.bg-emerald-600::after,
button.bg-slate-800::after, a.bg-slate-800::after,
button.bg-teal-600::after, a.bg-teal-600::after {
  content: '';
  position: absolute;
  top: 0; left: -80%;
  width: 45%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.55), transparent);
  transform: skewX(-20deg);
  transition: left .55s ease;
  pointer-events: none;
}
.btn-fun:hover::after,
button.bg-emerald-600:hover::after, a.bg-emerald-600:hover::after,
button.bg-slate-800:hover::after, a.bg-slate-800:hover::after,
button.bg-teal-600:hover::after, a.bg-teal-600:hover::after {
  left: 135%;
}
button:active, .btn-fun:active { transform: scale(.96); }

/* ---------- Card hover float (opt-in) ---------- */
.lift { transition: transform .28s cubic-bezier(.34,1.4,.64,1), box-shadow .28s ease; }
.lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 34px -14px rgba(16, 185, 129, .28), 0 4px 10px -4px rgba(15, 23, 42, .08);
}

/* ---------- Input focus glow ---------- */
input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus, select:focus {
  outline: none;
  border-color: #34d399 !important;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .22);
  transition: box-shadow .2s ease, border-color .2s ease;
}

/* ---------- Entrance animation (opt-in) ---------- */
.pop-in { animation: popIn .5s cubic-bezier(.34,1.4,.64,1) both; }
.pop-in-1 { animation-delay: .06s; } .pop-in-2 { animation-delay: .12s; }
.pop-in-3 { animation-delay: .18s; } .pop-in-4 { animation-delay: .24s; }
@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Toasts ---------- */
#inov-toasts {
  position: fixed; top: 1.25rem; right: 1.25rem; z-index: 9999;
  display: flex; flex-direction: column; gap: .6rem; align-items: flex-end;
  pointer-events: none;
}
.inov-toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: .6rem;
  background: #fff; color: #0f172a;
  border: 1px solid #e2e8f0; border-left: 4px solid #10b981;
  border-radius: 1rem; padding: .8rem 1.1rem;
  font-size: .875rem; font-weight: 600;
  box-shadow: 0 18px 40px -12px rgba(15, 23, 42, .25);
  animation: toastIn .45s cubic-bezier(.34,1.56,.64,1);
  max-width: 22rem;
}
.inov-toast.info  { border-left-color: #38bdf8; }
.inov-toast.error { border-left-color: #f43f5e; }
.inov-toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(70px) scale(.92); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(70px) scale(.92); }
}

/* ---------- Achievement badge ---------- */
.inov-achieve {
  display: flex; align-items: center; gap: .75rem;
  background: linear-gradient(135deg, #ecfdf5, #fefce8);
  border: 2px solid #6ee7b7;
  border-radius: 1.25rem; padding: .9rem 1.2rem;
  box-shadow: 0 18px 40px -12px rgba(16, 185, 129, .4);
  animation: toastIn .45s cubic-bezier(.34,1.56,.64,1);
  max-width: 24rem; pointer-events: auto;
}
.inov-achieve .badge {
  width: 2.75rem; height: 2.75rem; border-radius: 9999px;
  background: linear-gradient(135deg, #10b981, #14b8a6);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: #fff; flex-shrink: 0;
  animation: badgePop .6s cubic-bezier(.34,1.8,.64,1);
  box-shadow: 0 8px 18px -6px rgba(16, 185, 129, .6);
}
@keyframes badgePop {
  0%   { transform: scale(0) rotate(-14deg); }
  60%  { transform: scale(1.18) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ---------- Confetti pieces (animated via JS) ---------- */
.inov-confetti {
  position: fixed; z-index: 10000; pointer-events: none;
  width: 9px; height: 13px; border-radius: 2px;
}

/* ---------- Floating blobs background (login / public pages) ---------- */
.inov-blobs { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.inov-blob {
  position: absolute; border-radius: 9999px;
  filter: blur(70px); opacity: .5;
  animation: blobDrift 18s ease-in-out infinite alternate;
}
@keyframes blobDrift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(50px, -36px) scale(1.18); }
}

/* ---------- Progress shimmer (opt-in) ---------- */
.shimmer { position: relative; overflow: hidden; }
.shimmer::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.65) 50%, transparent 80%);
  animation: shimmerMove 1.9s infinite;
}
@keyframes shimmerMove {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* ---------- Wiggle for playful icons (opt-in) ---------- */
.wiggle-hover:hover { animation: wiggle .5s ease; display: inline-block; }
@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-8deg) scale(1.08); }
  75% { transform: rotate(8deg) scale(1.08); }
}

/* ---------- Gentle pulse dot (status indicators, opt-in) ---------- */
.pulse-dot { position: relative; }
.pulse-dot::after {
  content: ''; position: absolute; inset: -4px; border-radius: 9999px;
  border: 2px solid currentColor; opacity: .5;
  animation: pulseRing 1.8s ease-out infinite;
}
@keyframes pulseRing {
  from { transform: scale(.6); opacity: .7; }
  to   { transform: scale(1.4); opacity: 0; }
}

/* ---------- Respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Submit-button working state (double-submit guard) ---------- */
.inov-submitting { opacity: .75; cursor: wait; }
.inov-spin {
  display: inline-block; width: 1em; height: 1em; margin-right: .45em;
  vertical-align: -0.15em; border-radius: 9999px;
  border: 2px solid rgba(255,255,255,.45); border-top-color: #fff;
  animation: inovSpin .7s linear infinite;
}
@keyframes inovSpin { to { transform: rotate(360deg); } }
