/* ==========================================================================
   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); } }

/* ---------- Product tour ---------- */
#inov-tour { position: fixed; inset: 0; z-index: 9999; }
.inov-tour-backdrop {
  position: absolute; inset: 0; background: rgba(2, 44, 34, .45);
  backdrop-filter: blur(2px); animation: inovFadeIn .25s ease;
}
.inov-tour-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(92vw, 430px); background: #fff; border-radius: 24px;
  box-shadow: 0 25px 60px rgba(0,0,0,.28); padding: 30px 28px 22px;
  text-align: center; animation: inovPop .35s cubic-bezier(.2, 1.4, .4, 1);
}
.inov-tour-x {
  position: absolute; top: 12px; right: 14px; width: 32px; height: 32px;
  border-radius: 9999px; color: #94a3b8; font-size: 15px; line-height: 1;
}
.inov-tour-x:hover { background: #f1f5f9; color: #475569; }
.inov-tour-icon { font-size: 52px; margin-bottom: 10px; }
.inov-tour-title { font-size: 21px; font-weight: 800; color: #0f172a; margin-bottom: 8px; }
.inov-tour-body { font-size: 14.5px; line-height: 1.55; color: #475569; min-height: 66px; }
.inov-tour-dots { display: flex; gap: 6px; justify-content: center; margin: 16px 0 18px; flex-wrap: wrap; }
.inov-tour-dot { width: 8px; height: 8px; border-radius: 9999px; background: #e2e8f0; transition: all .25s; }
.inov-tour-dot.on { background: #059669; width: 22px; }
.inov-tour-btns { display: flex; gap: 10px; }
.inov-tour-back {
  flex: 1; padding: 12px; border-radius: 14px; border: 1.5px solid #cbd5e1;
  font-weight: 700; color: #334155; background: #fff;
}
.inov-tour-back:hover { background: #f8fafc; }
.inov-tour-next {
  flex: 2; padding: 12px; border-radius: 14px; border: none;
  font-weight: 800; color: #fff; background: #059669;
  box-shadow: 0 8px 20px rgba(5,150,105,.35);
}
.inov-tour-next:hover { background: #047857; }
.inov-tour-skip { margin-top: 12px; font-size: 12.5px; color: #94a3b8; }
.inov-tour-skip:hover { color: #64748b; text-decoration: underline; }
.inov-tour-glow {
  outline: 3px solid #34d399 !important; outline-offset: 2px;
  border-radius: 12px; animation: inovGlowPulse 1.2s ease-in-out infinite;
}
@keyframes inovGlowPulse {
  0%, 100% { outline-color: #34d399; }
  50% { outline-color: #a7f3d0; }
}
@keyframes inovFadeIn { from { opacity: 0; } }
@keyframes inovPop { from { opacity: 0; transform: translate(-50%, -46%) scale(.94); } }

/* ==========================================================================
   PREMIUM 3D LAYER — tilt, spotlight, aurora, ripple, reveal, parallax
   Vanilla CSS. All effects are progressive: no-JS pages stay fully readable.
   ========================================================================== */

/* ---------- App ambient aurora (very light, slow drift) ---------- */
body.inov-app {
  background-image:
    radial-gradient(720px 420px at 12% -6%, rgba(52, 211, 153, .14), transparent 65%),
    radial-gradient(820px 480px at 96% 4%, rgba(56, 189, 248, .10), transparent 65%),
    radial-gradient(700px 520px at 55% 108%, rgba(167, 139, 250, .09), transparent 65%);
  background-attachment: fixed;
  animation: inovAurora 30s ease-in-out infinite alternate;
}
@keyframes inovAurora {
  from { background-position: 0 0, 0 0, 0 0; }
  to   { background-position: 60px 24px, -70px 36px, 40px -30px; }
}

/* ---------- Cursor glow follower (app pages) ---------- */
#inov-glow {
  position: fixed; left: 0; top: 0; width: 520px; height: 520px;
  margin: -260px 0 0 -260px; border-radius: 9999px; pointer-events: none;
  background: radial-gradient(circle, rgba(16, 185, 129, .075), rgba(16, 185, 129, .028) 42%, transparent 68%);
  z-index: 1; will-change: transform;
}

/* ---------- 3D tilt cards ---------- */
.inov-tilt {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform .45s cubic-bezier(.22, 1, .36, 1), box-shadow .35s ease;
}
.inov-tilt.inov-tilting {
  transition: transform .08s linear, box-shadow .35s ease;
  box-shadow: 0 30px 50px -18px rgba(2, 44, 34, .28), 0 10px 22px -10px rgba(15, 23, 42, .14);
}
.inov-tilt .inov-pop { transform: translateZ(34px); }
.inov-glare {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%),
              rgba(255, 255, 255, .38), rgba(255, 255, 255, .06) 46%, transparent 68%);
  opacity: 0; transition: opacity .3s ease; mix-blend-mode: soft-light;
}
.inov-tilt.inov-tilting .inov-glare { opacity: 1; }

/* ---------- Spotlight hover for cards ---------- */
.card-hover { position: relative; }
.card-hover::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; opacity: 0; transition: opacity .35s ease; z-index: 0;
  background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%),
              rgba(16, 185, 129, .13), transparent 65%);
}
.card-hover:hover::before { opacity: 1; }
.card-hover > * { position: relative; z-index: 1; }

/* ---------- Reveal on scroll ---------- */
.inov-reveal { opacity: 0; transform: translateY(20px) scale(.985); }
.inov-reveal.inov-in {
  opacity: 1; transform: translateY(0) scale(1);
  transition: opacity .7s ease, transform .7s cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Button ripple ---------- */
.inov-ripple {
  position: absolute; border-radius: 9999px; pointer-events: none;
  background: rgba(255, 255, 255, .5); transform: scale(0);
  animation: inovRipple .65s ease-out forwards;
}
@keyframes inovRipple { to { transform: scale(2.6); opacity: 0; } }

/* ---------- Top navigation progress bar ---------- */
#inov-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 10001;
  background: linear-gradient(90deg, #059669, #34d399, #38bdf8);
  box-shadow: 0 0 12px rgba(52, 211, 153, .75);
  border-radius: 0 3px 3px 0; opacity: 0; pointer-events: none;
}

/* ---------- Page entrance ---------- */
.inov-enter { animation: inovPageIn .5s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes inovPageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Animated progress bars ---------- */
.inov-barfill { position: relative; overflow: hidden; }
.inov-barfill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 25%, rgba(255, 255, 255, .5) 50%, transparent 75%);
  animation: shimmerMove 1.8s infinite;
}

/* ---------- Table polish (app pages) ---------- */
body.inov-app table tbody tr { transition: background-color .2s ease, transform .2s ease; }
body.inov-app table tbody tr:hover { background-color: rgba(236, 253, 245, .65); }

/* ---------- Sidebar premium touches ---------- */
body.inov-app aside .navlink.active {
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, .35), 0 6px 16px -6px rgba(16, 185, 129, .45);
}
body.inov-app aside .navlink svg { transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
body.inov-app aside .navlink:hover svg { transform: scale(1.18) rotate(-4deg); }
.inov-logo-float { animation: inovLogoFloat 5s ease-in-out infinite; }
@keyframes inovLogoFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(-3deg); }
}

/* ---------- 3D parallax scene (login / public brand panels) ---------- */
.inov-scene { perspective: 1100px; }
.inov-float-wrap { position: absolute; will-change: transform; z-index: 5; }
.inov-float-card {
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: 1rem; padding: .7rem .95rem; color: #fff;
  box-shadow: 0 24px 44px -14px rgba(0, 0, 0, .5);
  font-size: .78rem; font-weight: 600; white-space: nowrap;
  animation: inovFloaty 7s ease-in-out infinite;
  transform-style: preserve-3d;
}
.inov-float-card small { display: block; font-weight: 500; color: rgba(255, 255, 255, .65); font-size: .68rem; margin-top: 2px; }
.inov-float-card .ok { color: #34d399; }
@keyframes inovFloaty {
  0%, 100% { transform: translateY(0) rotateX(6deg) rotateY(-8deg); }
  50% { transform: translateY(-13px) rotateX(-4deg) rotateY(7deg); }
}

/* ---------- Login form card tilt ---------- */
.inov-login-card { transform-style: preserve-3d; will-change: transform; }

/* ---------- Skeleton shimmer block ---------- */
.inov-skeleton {
  border-radius: .75rem; min-height: 1rem;
  background: linear-gradient(100deg, #e2e8f0 40%, #f1f5f9 50%, #e2e8f0 60%);
  background-size: 200% 100%; animation: inovSkel 1.4s infinite;
}
@keyframes inovSkel { from { background-position: 120% 0; } to { background-position: -80% 0; } }

/* ---------- Number rendering ---------- */
.inov-num { font-variant-numeric: tabular-nums; }

/* ---------- Selection + focus ---------- */
::selection { background: rgba(52, 211, 153, .35); }
:focus-visible { outline: 2px solid #34d399; outline-offset: 2px; border-radius: 6px; }
