/* ==========================================================================
   MICRO-INTERACTIONS.CSS — Fun & Delightful UI Layer
   ==========================================================================
   Scroll progress, ripples, toasts, confetti, sparkles, tilt, etc.
   All transitions use transform & opacity for GPU acceleration.
   ========================================================================== */

/* ==========================================================================
   1. SCROLL PROGRESS BAR
   ========================================================================== */

#scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #0058be 0%, #8b5cf6 50%, #ec4899 100%);
  z-index: 999;
  pointer-events: none;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

/* ==========================================================================
   2. BUTTON RIPPLE
   ========================================================================== */

.btn {
  overflow: hidden;
}

.mi-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  animation: mi-ripple-anim 0.65s cubic-bezier(0, 0, 0.3, 1) forwards;
  pointer-events: none;
  z-index: 10;
}

@keyframes mi-ripple-anim {
  from {
    transform: scale(0);
    opacity: 0.7;
  }
  to {
    transform: scale(1);
    opacity: 0;
  }
}

/* ==========================================================================
   3. INPUT TOAST MESSAGES
   ========================================================================== */

.mi-input-toast {
  position: absolute;
  background: linear-gradient(135deg, #0058be, #8b5cf6);
  color: #ffffff;
  padding: 0.45rem 1rem;
  border-radius: 2rem;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-body, 'Inter', sans-serif);
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transform: translateX(-50%) translateY(6px);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 20px rgba(0, 88, 190, 0.35);
}

.mi-input-toast::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px 5px 0;
  border-style: solid;
  border-color: #8b5cf6 transparent transparent;
}

.mi-input-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   4. CHARACTER COUNTER
   ========================================================================== */

.mi-char-counter {
  font-size: 11px;
  font-weight: 600;
  color: var(--outline, #76777d);
  text-align: right;
  margin-top: 4px;
  transition: color 0.3s ease;
}

.mi-char-counter--warn {
  color: #ff9f43;
}

.mi-char-counter--max {
  color: #ff5252;
  animation: mi-counter-pulse 0.5s ease;
}

@keyframes mi-counter-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ==========================================================================
   5. CART BADGE BOUNCE
   ========================================================================== */

.mi-badge-bounce {
  animation: mi-badge-bounce-anim 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes mi-badge-bounce-anim {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.6); }
  60%  { transform: scale(0.9); }
  80%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ==========================================================================
   6. CONFETTI
   ========================================================================== */

.mi-confetti {
  position: fixed;
  top: -20px;
  z-index: 99999;
  pointer-events: none;
  animation: mi-confetti-fall linear forwards;
}

@keyframes mi-confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg) scale(0.5);
    opacity: 0;
  }
}

/* ==========================================================================
   7. CURSOR SPARKLES
   ========================================================================== */

.mi-sparkle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99998;
  transform: translate(-50%, -50%);
  animation: mi-sparkle-anim 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes mi-sparkle-anim {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0) translateY(-20px);
  }
}

/* ==========================================================================
   8. COPY TOAST
   ========================================================================== */

.mi-copy-toast {
  position: absolute;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 2rem;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.mi-copy-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   9. GENERAL TOAST NOTIFICATIONS
   ========================================================================== */

.mi-toast {
  position: fixed;
  bottom: 6rem;
  right: 1.5rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-xl, 1rem);
  font-size: 14px;
  font-weight: 700;
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px) scale(0.95);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  max-width: 300px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.mi-toast--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.mi-toast--success {
  background: linear-gradient(135deg, #25D366, #1ea952);
  color: #fff;
}

.mi-toast--info {
  background: linear-gradient(135deg, #0058be, #0076f7);
  color: #fff;
}

.mi-toast--warning {
  background: linear-gradient(135deg, #ff9f43, #ff5252);
  color: #fff;
}

/* ==========================================================================
   10. FOCUS PARTICLE DOTS
   ========================================================================== */

.mi-focus-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--secondary, #0076f7);
  pointer-events: none;
  z-index: 9999;
  animation: mi-focus-dot-anim 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes mi-focus-dot-anim {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dot-x, 20px), var(--dot-y, -20px)) scale(0);
  }
}

/* ==========================================================================
   11. PASSWORD STRENGTH METER
   ========================================================================== */

.mi-pwd-strength {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mi-pwd-strength__bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(198, 198, 205, 0.4);
  position: relative;
  overflow: hidden;
  transition: background 0.4s ease;
}

.mi-pwd-strength__bar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), background 0.4s ease;
}

.mi-pwd-strength__bar--weak::after    { transform: scaleX(0.2); background: #ff5252; }
.mi-pwd-strength__bar--fair::after    { transform: scaleX(0.4); background: #ff9f43; }
.mi-pwd-strength__bar--good::after    { transform: scaleX(0.6); background: #ffd700; }
.mi-pwd-strength__bar--strong::after  { transform: scaleX(0.8); background: #25D366; }
.mi-pwd-strength__bar--beast::after   { transform: scaleX(1);   background: linear-gradient(90deg, #0076f7, #8b5cf6); }

.mi-pwd-strength__label {
  font-size: 11px;
  font-weight: 700;
  min-width: 90px;
  color: var(--on-surface-variant, #45464d);
  transition: color 0.3s ease;
}

/* ==========================================================================
   12. NAV LINK UNDERLINE SWEEP
   ========================================================================== */

.mi-nav-link {
  position: relative;
}

.mi-nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #0076f7, #8b5cf6);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 2px;
}

.mi-nav-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ==========================================================================
   13. INPUT FOCUS GLOW PULSE
   ========================================================================== */

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  animation: mi-focus-pulse 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mi-focus-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 88, 190, 0.4); }
  50%  { box-shadow: 0 0 0 6px rgba(0, 88, 190, 0.12); }
  100% { box-shadow: 0 0 0 3px rgba(0, 88, 190, 0.1); }
}

/* ==========================================================================
   14. FORM LABEL FLOAT ANIMATION (when filled)
   ========================================================================== */

.form-label {
  transition: color 0.25s ease, transform 0.25s ease, font-size 0.25s ease;
}

.form-label.is-focused {
  color: var(--secondary, #0076f7);
}

/* ==========================================================================
   15. SUCCESS CHECKMARK BOUNCE
   ========================================================================== */

.form-success.is-visible {
  animation: mi-success-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes mi-success-in {
  from { transform: scale(0.8) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0);     opacity: 1; }
}

/* ==========================================================================
   16. CARD SHIMMER EFFECT on hover
   ========================================================================== */

.glass-card {
  position: relative;
  overflow: hidden;
}

.glass-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0) 100%
  );
  transform: skewX(-20deg);
  pointer-events: none;
  transition: left 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover::after {
  left: 150%;
}

/* ==========================================================================
   17. PRICING CARD POPULAR BADGE GLOW PULSE
   ========================================================================== */

.pricing-card__badge {
  animation: mi-badge-glow 2.5s ease-in-out infinite;
}

@keyframes mi-badge-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 117, 0, 0); }
  50%       { box-shadow: 0 0 12px 4px rgba(184, 117, 0, 0.25); }
}

/* ==========================================================================
   18. SERVICE CARD ICON ROTATE ON HOVER
   ========================================================================== */

.service-card:hover .service-card__icon .material-symbols-outlined {
  animation: mi-icon-spin 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes mi-icon-spin {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(-12deg) scale(1.15); }
  100% { transform: rotate(0deg) scale(1); }
}

/* ==========================================================================
   19. HERO TITLE GRADIENT TEXT SHIMMER
   ========================================================================== */

.hero__highlight {
  background-size: 200% auto;
  animation: mi-text-shimmer 4s linear infinite;
}

@keyframes mi-text-shimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* ==========================================================================
   20. WHATSAPP FAB TOOLTIP
   ========================================================================== */

.whatsapp-fab::before {
  content: 'Chat with us!';
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 0.4rem 0.8rem;
  border-radius: 2rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.whatsapp-fab::after {
  content: '';
  position: absolute;
  right: calc(100% + 7px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  border-width: 5px 0 5px 6px;
  border-style: solid;
  border-color: transparent transparent transparent rgba(0,0,0,0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.whatsapp-fab:hover::before,
.whatsapp-fab:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ==========================================================================
   REDUCED MOTION OVERRIDES
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .mi-ripple,
  .mi-sparkle,
  .mi-confetti,
  .mi-focus-dot,
  #scroll-progress-bar,
  .mi-badge-bounce {
    animation: none !important;
  }

  .glass-card::after,
  .hero__highlight,
  .pricing-card__badge {
    animation: none !important;
  }
}
