/* =============================================================================
   IT-Life Animations & Transitions
   Class-based animations that work with Elementor's layout system.
   User adds .il-reveal, .il-hover-lift etc. via Elementor CSS Classes field.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   KEYFRAMES
   ----------------------------------------------------------------------------- */

@keyframes ilFadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes ilFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ilSlideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes ilSlideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes ilScaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes ilPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes ilBounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

@keyframes ilFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes ilShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes ilSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes ilShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}


/* -----------------------------------------------------------------------------
   SCROLL REVEAL — IntersectionObserver triggers .il-visible
   Add class "il-reveal" to any Elementor widget via CSS Classes field.
   ----------------------------------------------------------------------------- */

.il-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.il-reveal.il-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered delays for grid items */
.il-reveal:nth-child(2) { transition-delay: 0.1s; }
.il-reveal:nth-child(3) { transition-delay: 0.2s; }
.il-reveal:nth-child(4) { transition-delay: 0.3s; }
.il-reveal:nth-child(5) { transition-delay: 0.4s; }
.il-reveal:nth-child(6) { transition-delay: 0.5s; }


/* -----------------------------------------------------------------------------
   HOVER EFFECTS — Add via Elementor CSS Classes field
   ----------------------------------------------------------------------------- */

/* Lift on hover */
.il-hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

.il-hover-lift:hover {
  transform: translateY(-6px) !important;
  box-shadow: var(--il-shadow-card-hover) !important;
}

/* Scale on hover */
.il-hover-scale {
  transition: transform 0.3s ease !important;
}

.il-hover-scale:hover {
  transform: scale(1.03) !important;
}

/* Glow on hover (gradient theme) */
.il-hover-glow {
  transition: box-shadow 0.3s ease !important;
}

html[data-theme="gradient"] .il-hover-glow:hover {
  box-shadow: 0 0 30px rgba(247, 37, 133, 0.2), 0 0 60px rgba(76, 201, 240, 0.1) !important;
}


/* -----------------------------------------------------------------------------
   ANIMATION UTILITY CLASSES
   ----------------------------------------------------------------------------- */

.il-animate-pulse { animation: ilPulse 2s ease-in-out infinite; }
.il-animate-bounce { animation: ilBounce 0.6s ease; }
.il-animate-float { animation: ilFloat 3s ease-in-out infinite; }
.il-animate-spin { animation: ilSpin 1s linear infinite; }
.il-animate-shake { animation: ilShake 0.5s ease; }


/* -----------------------------------------------------------------------------
   THEME SWITCHER BUTTON
   ----------------------------------------------------------------------------- */

.il-theme-switcher {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--il-border-radius-full);
  background: var(--il-bg-tertiary);
  color: var(--il-text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  outline: none;
  z-index: var(--il-z-header);
}

.il-theme-switcher:hover {
  background: var(--il-accent-primary-light);
  color: var(--il-accent-primary);
  transform: scale(1.1);
}

.il-theme-switcher svg {
  width: 20px;
  height: 20px;
}

/* Fixed position fallback (when can't insert into header) */
.il-theme-switcher--fixed {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--il-z-toast);
  box-shadow: var(--il-shadow-lg);
  width: 48px;
  height: 48px;
}

.il-theme-switcher--fixed:hover {
  transform: scale(1.15);
}

/* Switching animation */
.il-theme-switcher--animating {
  animation: ilSpin 0.4s ease;
}

/* Dark theme switcher */
html[data-theme="dark"] .il-theme-switcher {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

html[data-theme="dark"] .il-theme-switcher:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

/* Gradient theme switcher */
html[data-theme="gradient"] .il-theme-switcher {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

html[data-theme="gradient"] .il-theme-switcher:hover {
  background: rgba(247, 37, 133, 0.15);
  color: #f72585;
}


/* -----------------------------------------------------------------------------
   LOADING STATES
   ----------------------------------------------------------------------------- */

.il-loading {
  position: relative;
  pointer-events: none;
}

.il-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 3px solid var(--il-border-color);
  border-top-color: var(--il-accent-primary);
  border-radius: 50%;
  animation: ilSpin 0.6s linear infinite;
}

/* Skeleton loading */
.il-skeleton {
  background: linear-gradient(90deg, var(--il-bg-tertiary) 25%, var(--il-bg-secondary) 50%, var(--il-bg-tertiary) 75%);
  background-size: 400% 100%;
  animation: ilShimmer 1.5s ease infinite;
  border-radius: var(--il-border-radius);
}


/* -----------------------------------------------------------------------------
   REDUCED MOTION
   ----------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .il-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .il-animate-pulse,
  .il-animate-bounce,
  .il-animate-float,
  .il-animate-spin {
    animation: none !important;
  }

  .il-hover-lift:hover,
  .il-hover-scale:hover {
    transform: none !important;
  }
}
