/*
====================================
Tafasel Technology - Animations
Advanced CSS Animations & Effects
Version: 2.0
====================================
*/

/* ===========================
   ENTRANCE ANIMATIONS
   =========================== */

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

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

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

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

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

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

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

/* ===========================
   CONTINUOUS ANIMATIONS
   =========================== */

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

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

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-15px);
  }
  60% {
    transform: translateY(-7px);
  }
}

@keyframes swing {
  20% {
    transform: rotate(15deg);
  }
  40% {
    transform: rotate(-10deg);
  }
  60% {
    transform: rotate(5deg);
  }
  80% {
    transform: rotate(-5deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

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

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

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

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

@keyframes glitch {
  0% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
  100% {
    transform: translate(0);
  }
}

@keyframes textShine {
  to {
    background-position: 200% center;
  }
}

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

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

@keyframes dots {
  0%, 20% {
    color: rgba(0, 0, 0, 0);
    text-shadow: 0.25em 0 0 rgba(0, 0, 0, 0),
                 0.5em 0 0 rgba(0, 0, 0, 0);
  }
  40% {
    color: currentColor;
    text-shadow: 0.25em 0 0 rgba(0, 0, 0, 0),
                 0.5em 0 0 rgba(0, 0, 0, 0);
  }
  60% {
    text-shadow: 0.25em 0 0 currentColor,
                 0.5em 0 0 rgba(0, 0, 0, 0);
  }
  80%, 100% {
    text-shadow: 0.25em 0 0 currentColor,
                 0.5em 0 0 currentColor;
  }
}

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

.animate-fadeIn {
  animation: fadeIn 0.6s ease-out;
}

.animate-fadeInUp {
  animation: fadeInUp 0.8s ease-out;
}

.animate-fadeInDown {
  animation: fadeInDown 0.8s ease-out;
}

.animate-fadeInLeft {
  animation: fadeInLeft 0.8s ease-out;
}

.animate-fadeInRight {
  animation: fadeInRight 0.8s ease-out;
}

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

.animate-rotateIn {
  animation: rotateIn 0.8s ease-out;
}

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

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-bounce {
  animation: bounce 1s ease infinite;
}

.animate-swing {
  animation: swing 1s ease-in-out;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* ===========================
   DELAY CLASSES
   =========================== */

.delay-100 {
  animation-delay: 100ms;
}

.delay-200 {
  animation-delay: 200ms;
}

.delay-300 {
  animation-delay: 300ms;
}

.delay-400 {
  animation-delay: 400ms;
}

.delay-500 {
  animation-delay: 500ms;
}

/* ===========================
   HOVER EFFECTS
   =========================== */

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

.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-brightness {
  transition: filter 0.3s ease;
}

.hover-brightness:hover {
  filter: brightness(1.1);
}

.hover-shadow {
  transition: box-shadow 0.3s ease;
}

.hover-shadow:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* ===========================
   SCROLL ANIMATIONS
   =========================== */

[data-scroll] {
  opacity: 0;
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-scroll="fade"] {
  transform: translateY(30px);
}

[data-scroll="fade"].in-view {
  opacity: 1;
  transform: translateY(0);
}

[data-scroll="slide-left"] {
  transform: translateX(-50px);
}

[data-scroll="slide-left"].in-view {
  opacity: 1;
  transform: translateX(0);
}

[data-scroll="slide-right"] {
  transform: translateX(50px);
}

[data-scroll="slide-right"].in-view {
  opacity: 1;
  transform: translateX(0);
}

[data-scroll="scale"] {
  transform: scale(0.8);
}

[data-scroll="scale"].in-view {
  opacity: 1;
  transform: scale(1);
}

/* ===========================
   PARALLAX EFFECTS
   =========================== */

.parallax {
  will-change: transform;
}

.parallax-slow {
  transition: transform 0.3s ease-out;
}

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

.counter {
  font-variant-numeric: tabular-nums;
}

/* ===========================
   PAGE TRANSITION
   =========================== */

.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #FF6B00, #F57C00);
  z-index: 9999;
  transform: translateY(-100%);
  transition: transform 0.6s cubic-bezier(0.65, 0, 0.35, 1);
}

.page-transition.active {
  transform: translateY(0);
}

/* ===========================
   SKELETON LOADING
   =========================== */

.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 0%,
    #e0e0e0 50%,
    #f0f0f0 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

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

/* ===========================
   RIPPLE EFFECT
   =========================== */

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

.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;
}

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

/* ===========================
   CARD FLIP EFFECT
   =========================== */

.flip-card {
  perspective: 1000px;
}

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

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

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

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

/* ===========================
   MODAL ANIMATIONS
   =========================== */

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

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

.modal-backdrop {
  animation: modalFadeIn 0.3s ease;
}

.modal-content {
  animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===========================
   PROGRESS BAR ANIMATIONS
   =========================== */

@keyframes progressFill {
  from {
    width: 0;
  }
}

.progress-bar {
  animation: progressFill 1.5s ease-out forwards;
}

/* ===========================
   STAGGER ANIMATIONS
   =========================== */

.stagger-item {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }
.stagger-item:nth-child(7) { animation-delay: 0.7s; }
.stagger-item:nth-child(8) { animation-delay: 0.8s; }

/* ===========================
   MAGNETIC BUTTON EFFECT
   =========================== */

.magnetic {
  position: relative;
  transition: transform 0.2s ease;
}

/* ===========================
   GLASSMORPHISM EFFECTS
   =========================== */

.glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ===========================
   GRADIENT ANIMATION
   =========================== */

.animated-gradient {
  background: linear-gradient(
    -45deg,
    #FF6B00,
    #F57C00,
    #3949AB,
    #5C6BC0
  );
  background-size: 400% 400%;
  animation: gradient 15s ease infinite;
}

/* ===========================
   TYPING INDICATOR
   =========================== */

.typing-indicator {
  display: inline-flex;
  gap: 4px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: typing 1.4s ease-in-out infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

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

.will-animate {
  will-change: transform, opacity;
}

/* Remove will-change after animation */
.animated {
  will-change: auto;
}
