/* ========================================
   Enterprise V9 - Animation System
   מערכת אנימציות מתקדמת
   ======================================== */

@layer utilities {
/* ========================================
   Base Animation Variables - משתני אנימציה בסיסיים
   ======================================== */

:root {
  --animation-duration-fast: 150ms;
  --animation-duration-normal: 300ms;
  --animation-duration-slow: 500ms;
  --animation-duration-slower: 750ms;
  
  --animation-easing-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --animation-easing-ease-in: cubic-bezier(0.4, 0, 1, 1);
  --animation-easing-ease-out: cubic-bezier(0, 0, 0.2, 1);
  --animation-easing-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --animation-easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --animation-easing-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ========================================
   Entrance Animations - אנימציות כניסה
   ======================================== */

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

.fade-in {
  animation: fadeIn var(--animation-duration-normal) var(--animation-easing-ease);
}

.fade-in-fast {
  animation: fadeIn var(--animation-duration-fast) var(--animation-easing-ease);
}

.fade-in-slow {
  animation: fadeIn var(--animation-duration-slow) var(--animation-easing-ease);
}

/* Slide In From Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-right {
  animation: slideInRight var(--animation-duration-normal) var(--animation-easing-ease-out);
}

/* Slide In From Left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-left {
  animation: slideInLeft var(--animation-duration-normal) var(--animation-easing-ease-out);
}

/* Slide In From Top */
@keyframes slideInTop {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in-top {
  animation: slideInTop var(--animation-duration-normal) var(--animation-easing-ease-out);
}

/* Slide In From Bottom */
@keyframes slideInBottom {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in-bottom {
  animation: slideInBottom var(--animation-duration-normal) var(--animation-easing-ease-out);
}

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

.scale-in {
  animation: scaleIn var(--animation-duration-normal) var(--animation-easing-ease-out);
}

/* Bounce In */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.bounce-in {
  animation: bounceIn var(--animation-duration-slow) var(--animation-easing-bounce);
}

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

.rotate-in {
  animation: rotateIn var(--animation-duration-slow) var(--animation-easing-ease-out);
}

/* ========================================
   Exit Animations - אנימציות יציאה
   ======================================== */

/* Fade Out */
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.fade-out {
  animation: fadeOut var(--animation-duration-normal) var(--animation-easing-ease);
}

/* Slide Out Right */
@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(30px);
  }
}

.slide-out-right {
  animation: slideOutRight var(--animation-duration-normal) var(--animation-easing-ease-in);
}

/* Slide Out Left */
@keyframes slideOutLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-30px);
  }
}

.slide-out-left {
  animation: slideOutLeft var(--animation-duration-normal) var(--animation-easing-ease-in);
}

/* Scale Out */
@keyframes scaleOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

.scale-out {
  animation: scaleOut var(--animation-duration-normal) var(--animation-easing-ease-in);
}

/* ========================================
   Hover Animations - אנימציות hover
   ======================================== */

/* Hover Lift */
.hover-lift {
  transition: transform var(--animation-duration-fast) var(--animation-easing-ease);
}

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

/* Hover Scale */
.hover-scale {
  transition: transform var(--animation-duration-fast) var(--animation-easing-ease);
}

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

/* Hover Rotate */
.hover-rotate {
  transition: transform var(--animation-duration-normal) var(--animation-easing-ease);
}

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

/* Hover Glow */
.hover-glow {
  transition: box-shadow var(--animation-duration-normal) var(--animation-easing-ease);
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

/* Hover Color */
.hover-color {
  transition: color var(--animation-duration-fast) var(--animation-easing-ease);
}

.hover-color:hover {
  color: var(--primary-600);
}

/* ========================================
   Loading Animations - אנימציות טעינה
   ======================================== */

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

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

/* Pulse */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

/* Bounce */
@keyframes bounce {
  0%, 100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

.bounce {
  animation: bounce 1s infinite;
}

/* Ping */
@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

.ping {
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* Wiggle */
@keyframes wiggle {
  0%, 100% {
    transform: rotate(-3deg);
  }
  50% {
    transform: rotate(3deg);
  }
}

.wiggle {
  animation: wiggle 1s ease-in-out infinite;
}

/* ========================================
   Micro-interactions - אינטראקציות קטנות
   ======================================== */

/* Button Press */
@keyframes buttonPress {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

.button-press {
  transition: transform var(--animation-duration-fast) var(--animation-easing-ease);
}

.button-press:active {
  animation: buttonPress var(--animation-duration-fast) var(--animation-easing-ease);
}

/* Check Mark */
@keyframes checkMark {
  0% {
    stroke-dashoffset: 100;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

.check-mark {
  stroke-dasharray: 100;
  animation: checkMark var(--animation-duration-slow) var(--animation-easing-ease-out) forwards;
}

/* Progress Fill */
@keyframes progressFill {
  from {
    width: 0%;
  }
  to {
    width: var(--progress-width, 100%);
  }
}

.progress-fill-animated {
  animation: progressFill var(--animation-duration-slow) var(--animation-easing-ease-out) forwards;
}

/* Typewriter */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  0%, 50% {
    border-color: transparent;
  }
  51%, 100% {
    border-color: currentColor;
  }
}

.typewriter {
  overflow: hidden;
  border-right: 2px solid currentColor;
  white-space: nowrap;
  animation: typewriter var(--animation-duration-slower) steps(40, end),
             blink 1s step-end infinite;
}

/* ========================================
   Stagger Animations - אנימציות מדורגות
   ======================================== */

.stagger-children > * {
  animation: fadeInUp var(--animation-duration-normal) var(--animation-easing-ease-out) both;
}

.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 100ms; }
.stagger-children > *:nth-child(3) { animation-delay: 200ms; }
.stagger-children > *:nth-child(4) { animation-delay: 300ms; }
.stagger-children > *:nth-child(5) { animation-delay: 400ms; }
.stagger-children > *:nth-child(6) { animation-delay: 500ms; }
.stagger-children > *:nth-child(7) { animation-delay: 600ms; }
.stagger-children > *:nth-child(8) { animation-delay: 700ms; }

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

/* ========================================
   RTL-aware Animations - אנימציות מודעות ל-RTL
   ======================================== */

[dir="rtl"] .slide-in-right {
  animation: slideInLeft var(--animation-duration-normal) var(--animation-easing-ease-out);
}

[dir="rtl"] .slide-in-left {
  animation: slideInRight var(--animation-duration-normal) var(--animation-easing-ease-out);
}

[dir="rtl"] .slide-out-right {
  animation: slideOutLeft var(--animation-duration-normal) var(--animation-easing-ease-in);
}

[dir="rtl"] .slide-out-left {
  animation: slideOutRight var(--animation-duration-normal) var(--animation-easing-ease-in);
}

[dir="rtl"] .hover-lift:hover {
  transform: translateY(-4px);
}

[dir="rtl"] .hover-rotate:hover {
  transform: rotate(-5deg);
}

/* ========================================
   Reduced Motion Support - תמיכה בתנועה מופחתת
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
    scroll-behavior: auto;
  }
  
  .hover-lift,
  .hover-scale,
  .hover-rotate,
  .hover-glow,
  .hover-color {
    transition: none;
  }
  
  .hover-lift:hover,
  .hover-scale:hover,
  .hover-rotate:hover {
    transform: none;
  }
  
  .hover-glow:hover {
    box-shadow: none;
  }
}

/* ========================================
   Animation Utilities - כלי עזר לאנימציות
   ======================================== */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--animation-duration-slow) var(--animation-easing-ease-out),
              transform var(--animation-duration-slow) var(--animation-easing-ease-out);
}

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

.animation-delay-100 { animation-delay: 100ms; }
.animation-delay-200 { animation-delay: 200ms; }
.animation-delay-300 { animation-delay: 300ms; }
.animation-delay-500 { animation-delay: 500ms; }
.animation-delay-700 { animation-delay: 700ms; }
.animation-delay-1000 { animation-delay: 1000ms; }

.animation-duration-75 { animation-duration: 75ms; }
.animation-duration-100 { animation-duration: 100ms; }
.animation-duration-150 { animation-duration: 150ms; }
.animation-duration-200 { animation-duration: 200ms; }
.animation-duration-300 { animation-duration: 300ms; }
.animation-duration-500 { animation-duration: 500ms; }
.animation-duration-700 { animation-duration: 700ms; }
.animation-duration-1000 { animation-duration: 1000ms; }

/* ========================================
   Performance Optimizations - אופטימיזציות ביצועים
   ======================================== */

.gpu-accelerated {
  transform: translateZ(0);
  will-change: transform;
}

.smooth-transition {
  transition: all var(--animation-duration-normal) var(--animation-easing-ease);
}

/* ========================================
   Custom Animation Classes - מחלקות אנימציה מותאמות
   ======================================== */

/* Card Hover Effect */
.card-hover {
  transition: all var(--animation-duration-normal) var(--animation-easing-ease);
}

.card-hover:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

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

.ripple-effect::before {
  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 var(--animation-duration-slow) ease, height var(--animation-duration-slow) ease;
}

.ripple-effect:active::before {
  width: 300px;
  height: 300px;
}

/* Modal Backdrop */
@keyframes modalBackdrop {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

.modal-backdrop {
  animation: modalBackdrop var(--animation-duration-normal) var(--animation-easing-ease);
}

.modal-content-animated {
  animation: modalContent var(--animation-duration-normal) var(--animation-easing-ease-out);
}
} /* סיום @layer utilities */
