/*
===============================================
Roteiro Seguros - Animation Styles
Anime.js and CSS Animation Integration
===============================================
*/

/* Animation Base Classes for Anime.js */
.anime-element {
  opacity: 0;
}

/* Fade Animations */
.fade-in {
  opacity: 0;
}

.fade-in-up {
  opacity: 0;
  transform: translateY(60px);
}

.fade-in-down {
  opacity: 0;
  transform: translateY(-60px);
}

.fade-in-left {
  opacity: 0;
  transform: translateX(-60px);
}

.fade-in-right {
  opacity: 0;
  transform: translateX(60px);
}

/* Scale Animations */
.scale-in {
  opacity: 0;
  transform: scale(0.8);
}

.scale-in-center {
  opacity: 0;
  transform: scale(0.5);
}

/* Rotate Animations */
.rotate-in {
  opacity: 0;
  transform: rotate(-180deg) scale(0.8);
}

/* Slide Animations */
.slide-in-top {
  opacity: 0;
  transform: translateY(-100px);
}

.slide-in-bottom {
  opacity: 0;
  transform: translateY(100px);
}

.slide-in-left {
  opacity: 0;
  transform: translateX(-100px);
}

.slide-in-right {
  opacity: 0;
  transform: translateX(100px);
}

/* Stagger Animation Classes */
.stagger-item {
  opacity: 0;
  transform: translateY(30px);
}

/* Hover Animation Classes */
.hover-lift {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-8px);
}

.hover-scale {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.hover-rotate {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Loading Animations */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-200);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-dots {
  display: inline-block;
  position: relative;
  width: 80px;
  height: 80px;
}

.loading-dots div {
  position: absolute;
  top: 33px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--primary-color);
  animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.loading-dots div:nth-child(1) {
  left: 8px;
  animation: dots1 0.6s infinite;
}

.loading-dots div:nth-child(2) {
  left: 8px;
  animation: dots2 0.6s infinite;
}

.loading-dots div:nth-child(3) {
  left: 32px;
  animation: dots2 0.6s infinite;
}

.loading-dots div:nth-child(4) {
  left: 56px;
  animation: dots3 0.6s infinite;
}

@keyframes dots1 {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes dots3 {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(0);
  }
}

@keyframes dots2 {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(24px, 0);
  }
}

/* Pulse Animation */
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: .5;
  }
}

/* Bounce Animation */
.bounce {
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    transform: translate3d(0,0,0);
  }
  40%, 43% {
    animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
    transform: translate3d(0, -30px, 0);
  }
  70% {
    animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
    transform: translate3d(0, -15px, 0);
  }
  90% {
    transform: translate3d(0,-4px,0);
  }
}

/* Floating Animation */
.float {
  animation: float 6s ease-in-out infinite;
}

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

/* Gradient Animation */
.gradient-animation {
  background: linear-gradient(-45deg, var(--primary-color), var(--accent-color), var(--secondary-color), var(--primary-color));
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

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

/* Text Animation Effects */
.text-reveal {
  position: relative;
  overflow: hidden;
}

.text-reveal::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary-color);
  transform: translateX(-100%);
  transition: transform 0.6s cubic-bezier(0.7, 0, 0.3, 1);
}

.text-reveal.animate::after {
  transform: translateX(100%);
}

.typewriter {
  overflow: hidden;
  border-right: .15em solid var(--primary-color);
  white-space: nowrap;
  margin: 0 auto;
  letter-spacing: .15em;
  animation: 
    typing 3.5s steps(40, end),
    blink-caret .75s step-end infinite;
}

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

@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: var(--primary-color); }
}

/* Parallax and Scroll Animations */
.parallax-element {
  will-change: transform;
}

.parallax-slow {
  transform: translateY(var(--scroll-offset, 0px));
}

.parallax-fast {
  transform: translateY(calc(var(--scroll-offset, 0px) * 1.5));
}

/* Morphing Shapes */
.morph-shape {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.morph-shape:hover {
  border-radius: 50%;
}

/* Glitch Effect */
.glitch {
  position: relative;
  color: var(--white);
  mix-blend-mode: lighten;
}

.glitch:before,
.glitch:after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.glitch:before {
  animation: glitch-animation 2s infinite;
  color: #ff0000;
  z-index: -1;
}

.glitch:after {
  animation: glitch-animation 2s infinite;
  color: #00ff00;
  z-index: -2;
}

@keyframes glitch-animation {
  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);
  }
}

/* Custom Easing Classes */
.ease-out-expo {
  transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
}

.ease-out-quart {
  transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);
}

.ease-out-circ {
  transition-timing-function: cubic-bezier(0.075, 0.82, 0.165, 1);
}

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

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

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

/* Responsive Animation Controls */
@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;
  }
  
  .parallax-element {
    transform: none !important;
  }
}

/* Mobile Animation Adjustments */
@media (max-width: 768px) {
  .fade-in-up,
  .fade-in-down,
  .fade-in-left,
  .fade-in-right {
    transform: translateY(30px);
  }
  
  .slide-in-top,
  .slide-in-bottom {
    transform: translateY(50px);
  }
  
  .slide-in-left,
  .slide-in-right {
    transform: translateX(50px);
  }
}