/* Common Animations CSS */

/* Global rule for all csem-anim- animations */
[class*="csem-anim-"] {
  animation-play-state: paused;
  animation-duration: 1.5s;
  animation-fill-mode: both;
  animation-timing-function: ease-in-out;
}

/* Trigger animations when csem-anim-now is added */
.csem-anim-now {
  animation-play-state: running !important;
}

/* Fade In */
.csem-anim-fade-in {
  animation-name: fadeIn;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Fade Out */
.csem-anim-fade-out {
  animation-name: fadeOut;
}
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Slide In from Left */
.csem-anim-slide-in-left {
  animation-name: slideInLeft;
}
@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Slide In from Right */
.csem-anim-slide-in-right {
  animation-name: slideInRight;
}
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Slide In from Top */
.csem-anim-slide-in-top {
  animation-name: slideInTop;
}
@keyframes slideInTop {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Slide In from Bottom */
.csem-anim-slide-in-bottom {
  animation-name: slideInBottom;
}
@keyframes slideInBottom {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Zoom In */
.csem-anim-zoom-in {
  animation-name: zoomIn;
}
@keyframes zoomIn {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Zoom Out */
.csem-anim-zoom-out {
  animation-name: zoomOut;
}
@keyframes zoomOut {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0.5);
    opacity: 0;
  }
}

/* Rotate */
.csem-anim-rotate {
  animation-name: rotate;
  animation-duration: 1s;
}
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Bounce */
.csem-anim-bounce {
  animation-name: bounce;
  animation-duration: 0.6s;
}
@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-30px);
  }
  60% {
    transform: translateY(-15px);
  }
}

/* Pulse */
.csem-anim-pulse {
  animation-name: pulse;
  animation-duration: 0.8s;
}
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* Shake */
.csem-anim-shake {
  animation-name: shake;
  animation-duration: 0.5s;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-10px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(10px);
  }
}

/* NEW: Flip (3D flip effect) */
.csem-anim-flip {
  animation-name: flip;
  animation-duration: 0.8s;
  transform-style: preserve-3d;
  perspective: 1000px;
}
@keyframes flip {
  from {
    transform: rotateY(-180deg);
    opacity: 0;
  }
  to {
    transform: rotateY(0deg);
    opacity: 1;
  }
}

/* NEW: Swing (pendulum-like swing) */
.csem-anim-swing {
  animation-name: swing;
  animation-duration: 1s;
  transform-origin: top center;
}
@keyframes swing {
  0% {
    transform: rotate(0deg);
  }
  20% {
    transform: rotate(15deg);
  }
  40% {
    transform: rotate(-10deg);
  }
  60% {
    transform: rotate(5deg);
  }
  80% {
    transform: rotate(-5deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

/* NEW: Pop In (elastic scale and fade) */
.csem-anim-pop-in {
  animation-name: popIn;
  animation-duration: 0.6s;
}
@keyframes popIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.7;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* NEW athletics: Twirl (3D rotation with scale) */
.csem-anim-twirl {
  animation-name: twirl;
  animation-duration: 1s;
  transform-style: preserve-3d;
  perspective: 1000px;
}
@keyframes twirl {
  0% {
    transform: rotateX(0deg) rotateY(0deg) scale(0.5);
    opacity: 0;
  }
  50% {
    transform: rotateX(180deg) rotateY(180deg) scale(1.2);
    opacity: 0.8;
  }
  100% {
    transform: rotateX(360deg) rotateY(360deg) scale(1);
    opacity: 1;
  }
}

/* NEW: Bounce Rotate (bouncing with rotation) */
.csem-anim-bounce-rotate {
  animation-name: bounceRotate;
  animation-duration: 0.8s;
}
@keyframes bounceRotate {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  40% {
    transform: translateY(-50px) rotate(90deg);
    opacity: 0.8;
  }
  60% {
    transform: translateY(-20px) rotate(120deg);
    opacity: 0.9;
  }
  100% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
}

/* Utility classes for animation duration */
.csem-anim-duration-300 {
  animation-duration: 0.3s !important;
}
.csem-anim-duration-500 {
  animation-duration: 0.5s !important;
}
.csem-anim-duration-700 {
  animation-duration: 0.7s !important;
}
.csem-anim-duration-1000 {
  animation-duration: 1s !important;
}

/* Utility classes for animation delay */
.csem-anim-delay-100 {
  animation-delay: 0.1s !important;
}
.csem-anim-delay-200 {
  animation-delay: 0.2s !important;
}
.csem-anim-delay-300 {
  animation-delay: 0.3s !important;
}
.csem-anim-delay-500 {
  animation-delay: 0.5s !important;
}
