/*
 * CodeMiner Animations Stylesheet
 * Custom keyframes and animation effects
 */

/* ===================================
   KEYFRAME ANIMATIONS
   =================================== */

/* Fade In Up Animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Slide In From Left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In From Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide Out Right Animation */
@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

/* Scale In Animation */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Pulse Animation */
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

/* Glow Animation */
@keyframes glow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(255, 107, 53, 0.5),
      0 0 10px rgba(255, 107, 53, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.8),
      0 0 30px rgba(255, 107, 53, 0.5), 0 0 40px rgba(255, 107, 53, 0.3);
  }
}

/* Rotate Animation */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Float Animation */
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* Scroll Animation for Mouse Indicator */
@keyframes scroll {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(15px);
  }
}

/* Shimmer Effect */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Border Glow Animation */
@keyframes borderGlow {
  0%,
  100% {
    border-color: rgba(255, 107, 53, 0.3);
  }
  50% {
    border-color: rgba(255, 107, 53, 1);
  }
}

/* Bounce In Animation */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

/* ===================================
   UTILITY ANIMATION CLASSES
   =================================== */

.animate-fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}

.animate-fade-in-up {
  animation: fadeInUp 0.8s ease-out forwards;
}

.animate-slide-left {
  animation: slideInLeft 0.8s ease-out forwards;
}

.animate-slide-right {
  animation: slideInRight 0.8s ease-out forwards;
}

.animate-scale-in {
  animation: scaleIn 0.6s ease-out forwards;
}

.animate-bounce-in {
  animation: bounceIn 0.8s ease-out forwards;
}

/* Stagger Delays for Multiple Elements */
.stagger-1 {
  animation-delay: 0.1s;
}
.stagger-2 {
  animation-delay: 0.2s;
}
.stagger-3 {
  animation-delay: 0.3s;
}
.stagger-4 {
  animation-delay: 0.4s;
}
.stagger-5 {
  animation-delay: 0.5s;
}
.stagger-6 {
  animation-delay: 0.6s;
}

/* ===================================
   SCROLL-TRIGGERED ANIMATIONS
   =================================== */

/* Hidden state before scroll triggers animation */
.scroll-animate {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-animate.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Slide animations */
.scroll-slide-left {
  opacity: 0;
  transform: translateX(-100px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-slide-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-slide-right {
  opacity: 0;
  transform: translateX(100px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-slide-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Scale animations */
.scroll-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* ===================================
   HOVER ANIMATIONS
   =================================== */

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

.hover-lift:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

/* Glow Effect */
.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(255, 107, 53, 0.6), 0 0 40px rgba(255, 107, 53, 0.4);
}

/* Scale Effect */
.hover-scale {
  transition: transform 0.3s ease;
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* Rotate Effect */
.hover-rotate {
  transition: transform 0.3s ease;
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

/* Border Expand Effect */
.hover-border-expand {
  position: relative;
  transition: all 0.3s ease;
}

.hover-border-expand::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-orange), var(--accent-cyan));
  transition: width 0.3s ease, left 0.3s ease;
}

.hover-border-expand:hover::after {
  width: 100%;
  left: 0;
}

/* ===================================
   LOADING ANIMATIONS
   =================================== */

/* Spinner */
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-orange);
  border-radius: 50%;
  animation: rotate 1s linear infinite;
}

/* Dots Loader */
@keyframes dotPulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

.dots-loader {
  display: flex;
  gap: 10px;
}

.dots-loader span {
  width: 12px;
  height: 12px;
  background: var(--accent-orange);
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite;
}

.dots-loader span:nth-child(1) {
  animation-delay: 0s;
}

.dots-loader span:nth-child(2) {
  animation-delay: 0.2s;
}

.dots-loader span:nth-child(3) {
  animation-delay: 0.4s;
}

/* ===================================
   BACKGROUND ANIMATIONS
   =================================== */

/* Gradient Animation */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.animated-gradient {
  background: linear-gradient(
    270deg,
    var(--primary-dark),
    var(--accent-orange),
    var(--accent-cyan),
    var(--primary-dark)
  );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

/* Particles Effect */
@keyframes particleFloat {
  0%,
  100% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100vh) translateX(50px);
    opacity: 0;
  }
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--accent-cyan);
  border-radius: 50%;
  animation: particleFloat 10s linear infinite;
}

/* ===================================
   TEXT ANIMATIONS
   =================================== */

/* Typing Effect */
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

.typing-effect {
  overflow: hidden;
  border-right: 3px solid var(--accent-orange);
  white-space: nowrap;
  animation: typing 3.5s steps(40, end), blink 0.75s step-end infinite;
}

/* Gradient Text Animation */
@keyframes gradientText {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.animated-gradient-text {
  background: linear-gradient(
    270deg,
    var(--accent-orange),
    var(--accent-cyan),
    var(--accent-amber),
    var(--accent-orange)
  );
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientText 5s ease infinite;
}

/* ===================================
   ICON ANIMATIONS
   =================================== */

/* Icon Float */
.icon-float {
  animation: float 3s ease-in-out infinite;
}

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

/* Icon Spin */
.icon-spin {
  animation: rotate 2s linear infinite;
}

/* Icon Bounce */
@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.icon-bounce {
  animation: bounce 1s ease-in-out infinite;
}

/* ===================================
   CARD ANIMATIONS
   =================================== */

/* Card Flip */
@keyframes cardFlip {
  from {
    transform: rotateY(0deg);
  }
  to {
    transform: rotateY(180deg);
  }
}

.card-flip {
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.card-flip:hover {
  transform: rotateY(180deg);
}

/* Card Slide Up */
.card-slide-up {
  position: relative;
  overflow: hidden;
}

.card-slide-up::before {
  content: "";
  position: absolute;
  bottom: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(255, 107, 53, 0.2), transparent);
  transition: bottom 0.3s ease;
}

.card-slide-up:hover::before {
  bottom: 0;
}

/* ===================================
   BUTTON ANIMATIONS
   =================================== */

/* Button Ripple Effect */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
  width: 300px;
  height: 300px;
  animation: ripple 0.6s ease-out;
}

/* ===================================
   PERFORMANCE OPTIMIZATIONS
   =================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===================================
   3D ANIMATIONS
   =================================== */

/* 3D Card Tilt Effect */
.card-3d {
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

.card-3d:hover {
  transform: perspective(1000px) rotateY(10deg) rotateX(5deg);
}

/* Parallax Effect */
.parallax-layer {
  transition: transform 0.5s ease-out;
}

/* ===================================
   NUMBER COUNTER ANIMATION
   =================================== */

.counter-animate {
  transition: all 0.5s ease;
}

/* ===================================
   FORM ANIMATIONS
   =================================== */

/* Input Focus Effect */
@keyframes inputFocus {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

.input-animated {
  position: relative;
}

.input-animated::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-orange);
  transition: width 0.3s ease;
}

.input-animated:focus-within::after {
  width: 100%;
}
