/**
 * TitanPlan Animation Framework
 * 
 * CSS animations to replace React transitions and provide smooth user experience
 */

/* Animation Base Classes */
.animate-element {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-element.animate-in {
  opacity: 1;
  transform: translateY(0);
}

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

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

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

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

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

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

/* Slide Animations */
@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

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

@keyframes slideOutLeft {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}

/* Scale Animations */
@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 zoomIn {
  from {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
  }
  to {
    transform: scale(1);
  }
}

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

/* Rotation Animations */
@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-200deg);
  }
  to {
    opacity: 1;
    transform: rotate(0);
  }
}

@keyframes rotateOut {
  from {
    opacity: 1;
    transform: rotate(0);
  }
  to {
    opacity: 0;
    transform: rotate(200deg);
  }
}

/* Bounce Animations */
@keyframes bounceIn {
  0%, 20%, 40%, 60%, 80%, 100% {
    animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
  }
  0% {
    opacity: 0;
    transform: scale3d(.3, .3, .3);
  }
  20% {
    transform: scale3d(1.1, 1.1, 1.1);
  }
  40% {
    transform: scale3d(.9, .9, .9);
  }
  60% {
    opacity: 1;
    transform: scale3d(1.03, 1.03, 1.03);
  }
  80% {
    transform: scale3d(.97, .97, .97);
  }
  100% {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
}

@keyframes bounceInUp {
  0%, 60%, 75%, 90%, 100% {
    animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
  }
  0% {
    opacity: 0;
    transform: translate3d(0, 3000px, 0);
  }
  60% {
    opacity: 1;
    transform: translate3d(0, -20px, 0);
  }
  75% {
    transform: translate3d(0, 10px, 0);
  }
  90% {
    transform: translate3d(0, -5px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

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

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

@keyframes loading {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

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

/* Animation Classes */
.animate-fadeIn {
  animation: fadeIn 0.6s ease-out both;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* 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-rotate {
  transition: transform 0.3s ease;
}

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

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

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(8, 176, 160, 0.3);
}

.hover-brightness {
  transition: filter 0.3s ease;
}

.hover-brightness:hover {
  filter: brightness(110%);
}

/* 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;
}

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

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

.btn-ripple .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  animation: ripple 0.6s linear;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Card Animations */
.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.card-flip {
  perspective: 1000px;
}

.card-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s;
  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;
}

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

/* Pricing Table Animations */
.pricing-card {
  transition: all 0.3s ease;
}

.pricing-card:hover {
  transform: scale(1.05);
  z-index: 10;
}

.pricing-card.featured {
  animation: pulse 2s infinite;
}

/* Modal Animations */
.modal {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  transform: scale(0.7) translateY(-100px);
  transition: transform 0.3s ease;
}

.modal.active .modal-content {
  transform: scale(1) translateY(0);
}

/* Mobile Menu Animations */
.mobile-menu {
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

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

.mobile-menu li {
  opacity: 0;
  transform: translateX(-20px);
}

.mobile-menu.active li {
  opacity: 1;
  transform: translateX(0);
  transition: all 0.3s ease;
}

/* Testimonial Animations */
.testimonial-slide {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.5s ease;
}

.testimonial-slide.active {
  opacity: 1;
  transform: translateX(0);
}

/* Feature Animation */
.feature-item {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.5s ease;
}

.feature-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.feature-item.hidden {
  opacity: 0;
  transform: translateY(-30px);
}

/* Stats Counter Animation */
.stat-number {
  display: inline-block;
  transition: all 0.3s ease;
}

.stat-number.counting {
  transform: scale(1.1);
  color: var(--primary-color, #08B0A0);
}

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

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

/* Loading States */
.loading-spinner {
  animation: spin 1s linear infinite;
}

.loading-dots {
  display: inline-block;
}

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

@keyframes loadingDots {
  0%, 20% {
    content: '';
  }
  40% {
    content: '.';
  }
  60% {
    content: '..';
  }
  80%, 100% {
    content: '...';
  }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, #f0f0f0 63%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* Notification Animations */
.notification {
  transform: translateY(-100px);
  opacity: 0;
  transition: all 0.3s ease;
}

.notification.show {
  transform: translateY(0);
  opacity: 1;
}

/* Scroll Reveal */
.scroll-reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.6s ease;
}

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

/* Stagger Animation Delays */
.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; }

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .animate-pulse {
    animation: none;
  }
  
  .animate-spin {
    animation: none;
  }
}

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

/* Viewport-based Animations */
@media (max-width: 768px) {
  .animate-element {
    transform: translateY(10px);
  }
  
  .hover-lift:hover {
    transform: translateY(-4px);
  }
  
  .hover-scale:hover {
    transform: scale(1.02);
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .hover-glow:hover {
    box-shadow: 0 0 20px rgba(8, 176, 160, 0.5);
  }
  
  .skeleton {
    background: linear-gradient(90deg, #2a2a2a 25%, transparent 37%, #2a2a2a 63%);
    background-size: 400% 100%;
  }
}

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

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

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

/* CSS Grid Animations */
.grid-animate-in {
  display: grid;
  gap: 1rem;
}

.grid-animate-in > * {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
}

.grid-animate-in.animate-in > * {
  opacity: 1;
  transform: translateY(0);
}

/* Flexbox Animations */
.flex-animate-in {
  display: flex;
  gap: 1rem;
}

.flex-animate-in > * {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.5s ease;
}

.flex-animate-in.animate-in > * {
  opacity: 1;
  transform: scale(1);
}
