/* ===================================
   Animations CSS
   Advanced animations and effects
   =================================== */

/* ===== AOS Library Integration ===== */
[data-aos] {
  opacity: 0;
  transition-property: transform, opacity;
}

[data-aos].aos-animate {
  opacity: 1;
}

[data-aos="fade-up"] {
  transform: translateY(50px);
}

[data-aos="fade-up"].aos-animate {
  transform: translateY(0);
}

[data-aos="fade-down"] {
  transform: translateY(-50px);
}

[data-aos="fade-down"].aos-animate {
  transform: translateY(0);
}

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

[data-aos="fade-left"].aos-animate {
  transform: translateX(0);
}

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

[data-aos="fade-right"].aos-animate {
  transform: translateX(0);
}

/* ===== Smooth Scroll Reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* ===== 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, #667EEA, #00E0FF, #764BA2);
  background-size: 600% 600%;
  animation: gradientShift 8s ease infinite;
}

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

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

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

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

/* ===== Bounce Animation ===== */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

.bounce {
  animation: bounce 2s ease infinite;
}

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

.shake {
  animation: shake 0.5s ease;
}

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

.rotate {
  animation: rotate 2s linear infinite;
}

/* ===== Slide In Animations ===== */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

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

.slide-in-left {
  animation: slideInLeft 0.6s ease-out;
}

.slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

.slide-in-up {
  animation: slideInUp 0.6s ease-out;
}

.slide-in-down {
  animation: slideInDown 0.6s ease-out;
}

/* ===== Zoom Animations ===== */
@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.3);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes zoomOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.3);
  }
}

.zoom-in {
  animation: zoomIn 0.5s ease-out;
}

.zoom-out {
  animation: zoomOut 0.5s ease-out;
}

/* ===== Fade Animations ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

.fade-in {
  animation: fadeIn 0.5s ease-in;
}

.fade-out {
  animation: fadeOut 0.5s ease-out;
}

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

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

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

/* ===== Glitch Effect ===== */
@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);
  }
}

.glitch {
  animation: glitch 0.3s ease-in-out;
}

/* ===== Glow Effect ===== */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 10px var(--accent-primary),
                0 0 20px var(--accent-primary),
                0 0 30px var(--accent-primary);
  }
  50% {
    box-shadow: 0 0 20px var(--accent-primary),
                0 0 30px var(--accent-primary),
                0 0 40px var(--accent-primary);
  }
}

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

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

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

.ripple-effect::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100px;
  height: 100px;
  background: var(--accent-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
}

.ripple-effect:active::after {
  animation: ripple 0.6s ease-out;
}

/* ===== Progress Bar Animation ===== */
@keyframes progressFill {
  from {
    width: 0;
  }
}

.progress-animated {
  animation: progressFill 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ===== Number Counter Animation ===== */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.count-up {
  animation: countUp 0.8s ease-out;
}

/* ===== Skeleton Loading ===== */
@keyframes skeleton-loading {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 0px, var(--bg-tertiary) 40px, var(--bg-secondary) 80px);
  background-size: 200px 100%;
  animation: skeleton-loading 1.2s ease-in-out infinite;
}

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

.shimmer {
  background: linear-gradient(to right, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* ===== Card Flip Animation ===== */
.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);
}

/* ===== Hover Lift Effect ===== */
.hover-lift {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px var(--glass-shadow);
}

/* ===== Hover Scale Effect ===== */
.hover-scale {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ===== Hover Rotate Effect ===== */
.hover-rotate {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.hover-glow:hover {
  box-shadow: 0 0 20px var(--accent-primary),
              0 0 30px var(--accent-primary),
              0 0 40px var(--accent-primary);
}

/* ===== Magnetic Effect (for cursor) ===== */
.magnetic {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Parallax Layers ===== */
.parallax-layer {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

/* ===== Smooth Appear on Scroll ===== */
.scroll-fade {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ===== Border Animation ===== */
@keyframes border-dance {
  0%, 100% {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
  25% {
    clip-path: polygon(0 0, 100% 0, 95% 100%, 0 100%);
  }
  50% {
    clip-path: polygon(5% 0, 100% 0, 100% 100%, 0 100%);
  }
  75% {
    clip-path: polygon(0 0, 100% 5%, 100% 100%, 0 95%);
  }
}

.border-dance {
  position: relative;
  overflow: hidden;
}

.border-dance::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 2px solid var(--accent-primary);
  animation: border-dance 4s linear infinite;
}

/* ===== Text Reveal Animation ===== */
@keyframes text-reveal {
  from {
    clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
  }
  to {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
}

.text-reveal {
  animation: text-reveal 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ===== Gradient Border Animation ===== */
@keyframes gradient-border {
  0%, 100% {
    border-image-source: linear-gradient(45deg, #667EEA, #00E0FF);
  }
  50% {
    border-image-source: linear-gradient(45deg, #00E0FF, #764BA2);
  }
}

.gradient-border {
  border: 2px solid;
  border-image-slice: 1;
  animation: gradient-border 3s ease-in-out infinite;
}

/* ===== Blob Animation ===== */
@keyframes blob {
  0%, 100% {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  }
  50% {
    border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
  }
}

.blob {
  animation: blob 8s ease-in-out infinite;
}

/* ===== Loading Spinner ===== */
@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spinner 0.6s linear infinite;
}

/* ===== Dots Loading ===== */
@keyframes dots {
  0%, 20% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.dots-loading span {
  animation: dots 1.4s infinite;
}

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

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

/* ===== Attention Seeker ===== */
@keyframes attention {
  0%, 100% {
    transform: scale(1);
  }
  10%, 20% {
    transform: scale(0.9) rotate(-3deg);
  }
  30%, 50%, 70%, 90% {
    transform: scale(1.1) rotate(3deg);
  }
  40%, 60%, 80% {
    transform: scale(1.1) rotate(-3deg);
  }
}

.attention {
  animation: attention 2s ease-in-out;
}

/* ===== Slide & Fade ===== */
@keyframes slide-fade-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-fade-down {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-fade-up {
  animation: slide-fade-up 0.6s ease-out;
}

.slide-fade-down {
  animation: slide-fade-down 0.6s ease-out;
}

/* ===== Continuous Scroll ===== */
@keyframes scroll-left {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.scroll-container {
  overflow: hidden;
  white-space: nowrap;
}

.scroll-content {
  display: inline-block;
  animation: scroll-left 20s linear infinite;
}

/* ===== Morphing Shape ===== */
@keyframes morph {
  0%, 100% {
    border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%;
  }
  34% {
    border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%;
  }
  67% {
    border-radius: 100% 60% 60% 100% / 100% 100% 60% 60%;
  }
}

.morph {
  animation: morph 8s ease-in-out infinite;
}

/* ===== Page Transition ===== */
@keyframes page-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.page-transition {
  animation: page-fade-in 0.5s ease-in;
}

/* ===== Stagger Children Animation ===== */
.stagger-children > * {
  animation: fadeInUp 0.6s ease-out backwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.6s; }

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

/* ===== Performance Optimizations ===== */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* ===== Reduce Motion for Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}