/* Modern Animations */

/*
 * Anti-FOUC reveal: This file is the LAST stylesheet in the link chain.
 * The inline <style> in <head> sets  body { opacity:0 !important }  to
 * hide everything until all external CSS (Bootstrap, AdminKit, theme
 * overrides) has been parsed.  The rule below cancels that with a
 * higher-specificity selector, so the body becomes visible only after
 * this file — and therefore every stylesheet before it — has loaded.
 */
html[data-theme] body[data-theme] {
  opacity: 1 !important;
  transition: none !important;
}

/* Fade In Up Base Animation */
.fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

/*
 * During Turbo Drive navigations the body is swapped, which re-triggers
 * animations and can amplify a theme flash.  Adding [data-turbo-preview]
 * on Turbo cache previews prevents the animation from replaying during
 * the brief preview→live swap.
 */
[data-turbo-preview] .fade-in-up,
[data-turbo-preview] .fade-in-up .card,
[data-turbo-preview] .fade-in-up .table tbody tr {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 
   Cascading Animations 
   Applues to children of .fade-in-up containers
*/

/* Cards Cascade */
.fade-in-up .card {
  opacity: 0;
  animation: fadeInUp 0.5s ease-out forwards;
}

.fade-in-up .card:nth-child(1) {
  animation-delay: 0.1s;
}

.fade-in-up .card:nth-child(2) {
  animation-delay: 0.15s;
}

.fade-in-up .card:nth-child(3) {
  animation-delay: 0.2s;
}

.fade-in-up .card:nth-child(4) {
  animation-delay: 0.25s;
}

.fade-in-up .card:nth-child(5) {
  animation-delay: 0.3s;
}

.fade-in-up .card:nth-child(n+6) {
  animation-delay: 0.35s;
}

/* Grid Columns Cascade (for dashboard stats etc) */
.fade-in-up .col-12:nth-child(1),
.fade-in-up .col-md-6:nth-child(1),
.fade-in-up .col-xl-3:nth-child(1) {
  animation-delay: 0.1s;
}

.fade-in-up .col-12:nth-child(2),
.fade-in-up .col-md-6:nth-child(2),
.fade-in-up .col-xl-3:nth-child(2) {
  animation-delay: 0.15s;
}

.fade-in-up .col-12:nth-child(3),
.fade-in-up .col-md-6:nth-child(3),
.fade-in-up .col-xl-3:nth-child(3) {
  animation-delay: 0.2s;
}

.fade-in-up .col-12:nth-child(4),
.fade-in-up .col-md-6:nth-child(4),
.fade-in-up .col-xl-3:nth-child(4) {
  animation-delay: 0.25s;
}

/* Table Rows Cascade */
.fade-in-up .table tbody tr {
  opacity: 0;
  animation: fadeInUp 0.4s ease-out forwards;
}

.fade-in-up .table tbody tr:nth-child(1) {
  animation-delay: 0.1s;
}

.fade-in-up .table tbody tr:nth-child(2) {
  animation-delay: 0.15s;
}

.fade-in-up .table tbody tr:nth-child(3) {
  animation-delay: 0.2s;
}

.fade-in-up .table tbody tr:nth-child(4) {
  animation-delay: 0.25s;
}

.fade-in-up .table tbody tr:nth-child(5) {
  animation-delay: 0.3s;
}

.fade-in-up .table tbody tr:nth-child(6) {
  animation-delay: 0.35s;
}

.fade-in-up .table tbody tr:nth-child(7) {
  animation-delay: 0.4s;
}

.fade-in-up .table tbody tr:nth-child(8) {
  animation-delay: 0.45s;
}

.fade-in-up .table tbody tr:nth-child(9) {
  animation-delay: 0.5s;
}

.fade-in-up .table tbody tr:nth-child(10) {
  animation-delay: 0.55s;
}

.fade-in-up .table tbody tr:nth-child(n+11) {
  animation-delay: 0.6s;
}


/* Icon Pulse */
.icon-pulse {
  animation: iconPulse 2s infinite;
}

@keyframes iconPulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Hover Lift */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Icon Spin on Hover */
.icon-spin-hover:hover .feather {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Progress Bar Animation */
.progress-bar-animated {
  background-size: 1rem 1rem;
  animation: progress-bar-stripes 1s linear infinite;
}

/* Status Dot Pulse */
.status-dot-pulse {
  position: relative;
}

.status-dot-pulse::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
  animation: ripple 1.5s infinite;
}

@keyframes ripple {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }

  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}