/* ==========================================================================
   Animation Styles
   Author: John Evans Okyere
   Description: Custom animations and transitions
   ========================================================================== */

/* ==========================================================================
   Keyframe Animations
   ========================================================================== */

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

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes glow {
  0% {
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
  }
  100% {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.8), 0 0 30px rgba(59, 130, 246, 0.6);
  }
}

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

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideLeft {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.8);
  }
}

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

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

@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-180deg) scale(0.5);
  }
  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

@keyframes wave {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(20deg);
  }
  75% {
    transform: rotate(-20deg);
  }
}

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

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

@keyframes morphing {
  0%, 100% {
    border-radius: 50%;
    transform: rotate(0deg);
  }
  33% {
    border-radius: 20%;
    transform: rotate(120deg);
  }
  66% {
    border-radius: 30%;
    transform: rotate(240deg);
  }
}

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

@keyframes progressFill {
  from {
    width: 0%;
  }
  to {
    width: var(--target-width, 100%);
  }
}

/* ==========================================================================
   Fade In Animations
   ========================================================================== */

.fade-in-up {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-down {
  opacity: 0;
  transform: translateY(-50px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fade-in-down.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fade-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.fade-in-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fade-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.fade-in-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* Staggered animations */
.fade-in-up.delay-100 { transition-delay: 0.1s; }
.fade-in-up.delay-200 { transition-delay: 0.2s; }
.fade-in-up.delay-300 { transition-delay: 0.3s; }
.fade-in-up.delay-400 { transition-delay: 0.4s; }
.fade-in-up.delay-500 { transition-delay: 0.5s; }

/* ==========================================================================
   Hover Effects & Interactions
   ========================================================================== */

.hover-lift {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.hover-scale {
  transition: transform 0.3s ease;
}

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

.hover-rotate {
  transition: transform 0.3s ease;
}

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

.hover-glow {
  transition: all 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
  transform: translateY(-2px);
}

.hover-bounce {
  transition: transform 0.2s ease;
}

.hover-bounce:hover {
  animation: bounceIn 0.6s ease;
}

.hover-shake {
  transition: transform 0.1s ease;
}

.hover-shake:hover {
  animation: shake 0.5s ease-in-out;
}

/* ==========================================================================
   Loading & Spinner Animations
   ========================================================================== */

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

.loading-dots::after {
  content: '';
  animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
  0%, 20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%, 100% {
    content: '...';
  }
}

.pulse-animation {
  animation: pulse 2s infinite;
}

.float-animation {
  animation: float 3s ease-in-out infinite;
}

.glow-animation {
  animation: glow 2s ease-in-out infinite alternate;
}

/* ==========================================================================
   Text Animations
   ========================================================================== */

.text-shimmer {
  background: linear-gradient(
    90deg,
    #000 0%,
    #fff 50%,
    #000 100%
  );
  background-size: 200% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s ease-in-out infinite;
}

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

.gradient-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-size: 400% 400%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 4s ease infinite;
}

.typewriter {
  overflow: hidden;
  border-right: 3px solid;
  white-space: nowrap;
  animation: typing 4s steps(30) infinite, blink 1s infinite;
}

/* ==========================================================================
   Scroll-triggered Animations
   ========================================================================== */

.scroll-reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.parallax-element {
  transition: transform 0.1s linear;
}

/* ==========================================================================
   Button Animations
   ========================================================================== */

.btn-animated {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-animated::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.btn-animated:hover::before {
  left: 100%;
}

.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.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
  width: 300px;
  height: 300px;
}

/* ==========================================================================
   Card Animations
   ========================================================================== */

.card-flip {
  perspective: 1000px;
}

.card-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

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

.card-flip-front,
.card-flip-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 1rem;
}

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

.card-slide-up {
  position: relative;
  overflow: hidden;
}

.card-slide-up .card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  transform: translateY(100%);
  transition: transform 0.3s ease;
  padding: 2rem;
  color: white;
}

.card-slide-up:hover .card-overlay {
  transform: translateY(0);
}

/* ==========================================================================
   Navigation Animations
   ========================================================================== */

.nav-slide-down {
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.nav-slide-down.visible {
  transform: translateY(0);
}

.mobile-menu-slide {
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.mobile-menu-slide.open {
  transform: translateX(0);
}

/* ==========================================================================
   Progress Animations
   ========================================================================== */

.progress-bar-animated {
  position: relative;
  background: #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar-animated::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  width: 0;
  transition: width 2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.progress-bar-animated.animate::before {
  width: var(--progress-width, 0%);
}

/* ==========================================================================
   Skill Tag Animations
   ========================================================================== */

.skill-tag-hover {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.skill-tag-hover:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Modal & Overlay Animations
   ========================================================================== */

.modal-fade {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-fade.show {
  opacity: 1;
}

.modal-scale {
  transform: scale(0.8);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.modal-scale.show {
  transform: scale(1);
  opacity: 1;
}

.overlay-slide-up {
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.overlay-slide-up.show {
  transform: translateY(0);
}

/* ==========================================================================
   Counter Animations
   ========================================================================== */

.counter {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s ease;
}

.counter.animate {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Particle Effects
   ========================================================================== */

.particles {
  position: relative;
  overflow: hidden;
}

.particles::before,
.particles::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  animation: sparkle 3s infinite;
}

.particles::before {
  top: 20%;
  left: 20%;
  animation-delay: 0s;
}

.particles::after {
  top: 60%;
  right: 30%;
  animation-delay: 1.5s;
}

/* ==========================================================================
   Utility Animation Classes
   ========================================================================== */

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

.animate-duration-fast { animation-duration: 0.3s; }
.animate-duration-normal { animation-duration: 0.5s; }
.animate-duration-slow { animation-duration: 1s; }

.animate-infinite { animation-iteration-count: infinite; }
.animate-once { animation-iteration-count: 1; }
.animate-twice { animation-iteration-count: 2; }

.animate-ease { animation-timing-function: ease; }
.animate-ease-in { animation-timing-function: ease-in; }
.animate-ease-out { animation-timing-function: ease-out; }
.animate-ease-in-out { animation-timing-function: ease-in-out; }
.animate-linear { animation-timing-function: linear; }

/* ==========================================================================
   Responsive Animations
   ========================================================================== */

@media (max-width: 768px) {
  .fade-in-up,
  .fade-in-down,
  .fade-in-left,
  .fade-in-right {
    transform: translateY(20px);
  }
  
  .fade-in-up.visible,
  .fade-in-down.visible,
  .fade-in-left.visible,
  .fade-in-right.visible {
    transform: translateY(0);
  }
  
  .hover-lift:hover {
    transform: translateY(-4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .fade-in-up,
  .fade-in-down,
  .fade-in-left,
  .fade-in-right,
  .fade-in-scale {
    opacity: 1;
    transform: none;
  }
}