/* =======================================================================
   ORGANIZER CHATBOT - ANIMATIONS CSS
   Keyframes, transitions, hover effects and micro-interactions
   ======================================================================= */

/* =======================================================================
   KEYFRAME ANIMATIONS
   ======================================================================= */

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

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

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

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

/* Bounce animation */
@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translateY(0);
  }
  40%, 43% {
    transform: translateY(-15px);
  }
  70% {
    transform: translateY(-7px);
  }
  90% {
    transform: translateY(-3px);
  }
}

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

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

/* Gradient animation */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

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

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

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

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

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

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

/* Morphing animations */
@keyframes morphBorder {
  0%, 100% {
    border-radius: var(--radius-lg);
  }
  25% {
    border-radius: var(--radius-xl);
  }
  50% {
    border-radius: var(--radius-full);
  }
  75% {
    border-radius: var(--radius);
  }
}

/* Glowing effect */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.6);
  }
}

/* Wave animation */
@keyframes wave {
  0% {
    transform: rotate(0deg);
  }
  10% {
    transform: rotate(14deg);
  }
  20% {
    transform: rotate(-8deg);
  }
  30% {
    transform: rotate(14deg);
  }
  40% {
    transform: rotate(-4deg);
  }
  50% {
    transform: rotate(10deg);
  }
  60% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

/* =======================================================================
   SCROLL-TRIGGERED ANIMATIONS
   ======================================================================= */

/* Elements that animate on scroll */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease-out;
}

.animate-on-scroll.animated {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered animations */
.animate-on-scroll:nth-child(1) {
  transition-delay: 0.1s;
}

.animate-on-scroll:nth-child(2) {
  transition-delay: 0.2s;
}

.animate-on-scroll:nth-child(3) {
  transition-delay: 0.3s;
}

.animate-on-scroll:nth-child(4) {
  transition-delay: 0.4s;
}

.animate-on-scroll:nth-child(5) {
  transition-delay: 0.5s;
}

.animate-on-scroll:nth-child(6) {
  transition-delay: 0.6s;
}

/* Slide in from different directions */
.slide-in-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.6s ease-out;
}

.slide-in-left.animated {
  opacity: 1;
  transform: translateX(0);
}

.slide-in-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.6s ease-out;
}

.slide-in-right.animated {
  opacity: 1;
  transform: translateX(0);
}

.scale-in {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.6s ease-out;
}

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

/* =======================================================================
   HERO SECTION ANIMATIONS
   ======================================================================= */

.hero-title {
  animation: fadeInUp 1s ease-out;
}

.hero-subtitle {
  animation: fadeInUp 1s ease-out 0.2s both;
}

.hero-cta {
  animation: fadeInUp 1s ease-out 0.4s both;
}

.hero-image {
  animation: fadeInRight 1s ease-out 0.6s both;
}

/* Particles floating animation */
.hero-particles::before {
  animation: float 6s ease-in-out infinite;
}

.hero-particles::after {
  animation: float 8s ease-in-out infinite reverse;
}

/* Hero background gradient animation */
.hero {
  background: linear-gradient(-45deg, 
    rgba(102, 126, 234, 0.05), 
    rgba(118, 75, 162, 0.05), 
    rgba(240, 147, 251, 0.05), 
    rgba(102, 126, 234, 0.05));
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

/* =======================================================================
   NAVIGATION ANIMATIONS
   ======================================================================= */

/* Navbar slide in */
.header {
  animation: slideInDown 0.5s ease-out;
}

/* Active nav link animation */
.nav-link.active::after {
  animation: scaleIn 0.3s ease-out;
}

/* Mobile menu animations */
.nav-menu {
  animation: slideInDown 0.3s ease-out;
}

.nav-menu.closing {
  animation: slideOutUp 0.3s ease-in;
}

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

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

/* Hamburger animation */
.nav-toggle .bar {
  transition: all 0.3s ease-in-out;
}

.nav-toggle.active .bar:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.nav-toggle.active .bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active .bar:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* =======================================================================
   BUTTON ANIMATIONS
   ======================================================================= */

/* Button hover effects */
.btn {
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn:active {
  transform: scale(0.98);
}

/* Primary button gradient animation */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

/* Loading button animation */
.btn-loading::after {
  animation: spin 1s linear infinite;
}

/* Button ripple effect */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%);
  transform-origin: 50% 50%;
}

.btn-ripple:focus:not(:active)::after {
  animation: ripple 1s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 1;
  }
  20% {
    transform: scale(25, 25);
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(40, 40);
  }
}

/* =======================================================================
   CARD ANIMATIONS
   ======================================================================= */

/* Feature cards */
.feature-card {
  transition: all var(--transition-base);
  transform-origin: center bottom;
}

.feature-card:hover {
  transform: translateY(-8px) rotateX(5deg);
  box-shadow: var(--shadow-xl);
}

.feature-card::before {
  transition: transform var(--transition-base);
}

.feature-card:hover::before {
  transform: scaleX(1);
}

/* Pricing cards */
.pricing-card {
  transition: all var(--transition-base);
  position: relative;
}

.pricing-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-2xl);
}

.pricing-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent, rgba(102, 126, 234, 0.05));
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.pricing-card:hover::after {
  opacity: 1;
}

/* Testimonial cards */
.testimonial-card {
  transition: all var(--transition-slow);
}

.testimonial-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* =======================================================================
   FAQ ACCORDION ANIMATIONS
   ======================================================================= */

.faq-answer {
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.faq-item.active .faq-answer {
  animation: expandAccordion 0.3s ease-out;
}

@keyframes expandAccordion {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.faq-icon {
  transition: transform var(--transition-base);
}

.faq-question:hover .faq-icon {
  transform: rotate(90deg);
}

.faq-item.active .faq-icon {
  transform: rotate(45deg);
}

/* =======================================================================
   CAROUSEL ANIMATIONS
   ======================================================================= */

.testimonial-slide {
  transition: all 0.5s ease-in-out;
}

.testimonial-slide.active {
  animation: slideInRight 0.5s ease-out;
}

.testimonial-slide.exiting {
  animation: slideOutLeft 0.5s ease-in;
}

.carousel-dots .dot {
  transition: all var(--transition-base);
}

.carousel-dots .dot:hover {
  transform: scale(1.3);
}

/* =======================================================================
   TABS ANIMATIONS
   ======================================================================= */

.tab-panel {
  animation-fill-mode: both;
}

.tab-panel.active {
  animation: fadeInUp 0.4s ease-out;
}

.tab-btn {
  transition: all var(--transition-base);
}

.tab-btn:hover {
  transform: translateY(-2px);
}

.tab-btn.active {
  animation: pulse 0.6s ease-out;
}

/* =======================================================================
   FORM ANIMATIONS
   ======================================================================= */

.form-control {
  transition: all var(--transition-base);
}

.form-control:focus {
  animation: inputFocus 0.3s ease-out;
}

@keyframes inputFocus {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

/* Form validation animations */
.form-control.error {
  animation: shake 0.5s ease-in-out;
  border-color: var(--error);
}

.form-control.success {
  animation: pulse 0.5s ease-out;
  border-color: var(--success);
}

/* =======================================================================
   DEMO CHATBOT ANIMATIONS
   ======================================================================= */

.chatbot-widget {
  animation: scaleIn 0.5s ease-out;
}

.message {
  animation: fadeInUp 0.4s ease-out;
}

.bot-message {
  animation-delay: 0.2s;
}

/* Typing indicator */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

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

/* Quick button animations */
.quick-btn {
  transition: all var(--transition-base);
  transform-origin: left center;
}

.quick-btn:hover {
  transform: scale(1.02);
  background: var(--primary);
  color: var(--white);
}

/* =======================================================================
   COUNTER ANIMATIONS
   ======================================================================= */

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

.stat-number {
  animation: countUp 1s ease-out;
}

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

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(102, 126, 234, 0.1);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: loadingPulse 1.5s ease-in-out infinite;
}

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

/* =======================================================================
   TOAST ANIMATIONS
   ======================================================================= */

.message-toast {
  transition: transform var(--transition-base);
}

.message-toast.show {
  animation: toastSlideIn 0.3s ease-out;
}

.message-toast.hide {
  animation: toastSlideOut 0.3s ease-in;
}

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

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

/* =======================================================================
   MICRO INTERACTIONS
   ======================================================================= */

/* Link hover effects */
a {
  transition: color var(--transition-base);
}

/* Image hover effects */
img {
  transition: transform var(--transition-base), filter var(--transition-base);
}

img:hover {
  transform: scale(1.02);
}

/* Icon hover effects */
.icon {
  transition: all var(--transition-base);
}

.icon:hover {
  transform: rotate(5deg) scale(1.1);
}

/* Badge animations */
.badge {
  transition: all var(--transition-base);
}

.badge:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Social link animations */
.social-link:hover svg {
  animation: wave 2s ease-in-out;
}

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

/* Reduce animations for users who prefer reduced motion */
@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;
  }
  
  .hero-particles::before,
  .hero-particles::after {
    animation: none;
  }
}

/* GPU acceleration for smooth animations */
.gpu-accelerated {
  will-change: transform;
  transform: translateZ(0);
}

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

/* =======================================================================
   ADVANCED ANIMATIONS (Progressive Enhancement)
   ======================================================================= */

/* CSS Scroll-driven animations (future enhancement) */
@supports (animation-timeline: scroll()) {
  .parallax-element {
    animation: parallaxScroll linear;
    animation-timeline: scroll();
    animation-range: 0% 100%;
  }
  
  @keyframes parallaxScroll {
    0% {
      transform: translateY(0);
    }
    100% {
      transform: translateY(-50px);
    }
  }
}

/* View Transitions API (future enhancement) */
@supports (view-transition-name: auto) {
  .page-transition {
    view-transition-name: main-content;
  }
}

/* =======================================================================
   CUSTOM ANIMATION CLASSES
   ======================================================================= */

/* Animation utility classes */
.animate-fade-in {
  animation: fadeIn 0.5s ease-out;
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in-down {
  animation: fadeInDown 0.6s ease-out;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.6s ease-out;
}

.animate-fade-in-right {
  animation: fadeInRight 0.6s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.5s ease-out;
}

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

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

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

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

/* Delay variants */
.delay-100 {
  animation-delay: 0.1s;
}

.delay-200 {
  animation-delay: 0.2s;
}

.delay-300 {
  animation-delay: 0.3s;
}

.delay-500 {
  animation-delay: 0.5s;
}

.delay-700 {
  animation-delay: 0.7s;
}

.delay-1000 {
  animation-delay: 1s;
}