/* ========================================
   CBI Analytics Theme - Animations
   ======================================== */

/* ========================================
   Gradient Animations
   ======================================== */

@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.gradient-animated {
  background-size: 200% 200%;
  animation: gradient-shift 8s ease infinite;
}

/* Slow moving gradient background */
@keyframes gradient-move {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-2%, -2%);
  }
  100% {
    transform: translate(0, 0);
  }
}

.gradient-moving {
  animation: gradient-move 15s ease-in-out infinite;
}

/* ========================================
   Fade & Entrance Animations
   ======================================== */

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in-down {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in-left {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fade-in-right {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in {
  animation: fade-in 0.5s ease;
}

.fade-in-up {
  animation: fade-in-up 0.6s ease;
}

.fade-in-down {
  animation: fade-in-down 0.6s ease;
}

.fade-in-left {
  animation: fade-in-left 0.6s ease;
}

.fade-in-right {
  animation: fade-in-right 0.6s ease;
}

/* Staggered animation delays for lists */
.fade-in-up.delay-1 {
  animation-delay: 0.1s;
}

.fade-in-up.delay-2 {
  animation-delay: 0.2s;
}

.fade-in-up.delay-3 {
  animation-delay: 0.3s;
}

.fade-in-up.delay-4 {
  animation-delay: 0.4s;
}

.fade-in-up.delay-5 {
  animation-delay: 0.5s;
}

.fade-in-up.delay-6 {
  animation-delay: 0.6s;
}

/* ========================================
   Glow & Pulse Effects
   ======================================== */

@keyframes glow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(22, 139, 238, 0.3),
      0 0 10px rgba(66, 213, 232, 0.1);
  }
  50% {
    box-shadow: 0 0 15px rgba(22, 139, 238, 0.5),
      0 0 20px rgba(66, 213, 232, 0.3);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.glow {
  animation: glow 3s ease-in-out infinite;
}

.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ========================================
   Hover Effects
   ======================================== */

@keyframes hover-lift {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-4px);
  }
}

.hover-lift:hover {
  animation: hover-lift 0.3s ease forwards;
}

@keyframes scale-pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.scale-pulse:hover {
  animation: scale-pulse 0.4s ease;
}

/* ========================================
   Smooth Transitions
   ======================================== */

.transition-colors {
  transition: background-color var(--transition-base),
    border-color var(--transition-base), color var(--transition-base);
}

.transition-transform {
  transition: transform var(--transition-base);
}

.transition-all {
  transition: all var(--transition-base);
}

.transition-slow {
  transition: all var(--transition-slow);
}

/* ========================================
   Skeleton Loading
   ======================================== */

@keyframes skeleton-loading {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton {
  background: linear-gradient(90deg,
      var(--color-bg-card),
      rgba(255, 255, 255, 0.1),
      var(--color-bg-card));
  background-size: 1000px 100%;
  animation: skeleton-loading 2s infinite;
  border-radius: 6px;
}

/* ========================================
   Transitions - Respect Reduced Motion
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .gradient-animated,
  .gradient-moving,
  .fade-in,
  .fade-in-up,
  .fade-in-down,
  .fade-in-left,
  .fade-in-right,
  .glow,
  .pulse,
  .hover-lift:hover,
  .scale-pulse:hover,
  .skeleton {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ========================================
   Text Animations
   ======================================== */

@keyframes text-shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.text-gradient {
  background: linear-gradient(90deg,
      var(--color-accent-primary),
      var(--color-accent-secondary),
      var(--color-accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 100%;
  animation: text-shimmer 3s linear infinite;
}

/* ========================================
   Loading Spinner
   ======================================== */

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ========================================
   Button Press Animation
   ======================================== */

@keyframes button-press {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

button:active,
.button:active,
input[type="button"]:active,
input[type="submit"]:active {
  animation: button-press 0.2s ease;
}
