/**
 * Animations & Effects
 * Keyframes, transitions, and interactive animations
 */

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

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

@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 slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

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

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

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

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

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

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

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

@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 {
        opacity: 1;
        transform: scale(1);
    }
}

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

@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);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    20% {
        transform: scale3d(1.1, 1.1, 1.1);
    }
    40% {
        transform: scale3d(0.9, 0.9, 0.9);
    }
    60% {
        opacity: 1;
        transform: scale3d(1.03, 1.03, 1.03);
    }
    80% {
        transform: scale3d(0.97, 0.97, 0.97);
    }
    100% {
        opacity: 1;
        transform: scale3d(1, 1, 1);
    }
}

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

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

@keyframes wobble {
    0% {
        transform: translate3d(0, 0, 0);
    }
    15% {
        transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
    }
    30% {
        transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
    }
    45% {
        transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
    }
    60% {
        transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
    }
    75% {
        transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
    }
    100% {
        transform: translate3d(0, 0, 0);
    }
}

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

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

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--primary-blue);
    }
    50% {
        box-shadow: 0 0 20px var(--primary-blue), 0 0 30px var(--primary-blue);
    }
}

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

@keyframes blink {
    0%, 50% {
        border-color: transparent;
    }
    51%, 100% {
        border-color: var(--primary-blue);
    }
}

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

@keyframes morphBackground {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

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

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

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

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

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

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

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

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

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

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

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

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

.animate-slide-out-left {
    animation: slideOutLeft 0.6s ease-out;
}

.animate-slide-out-right {
    animation: slideOutRight 0.6s ease-out;
}

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

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

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

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

.animate-bounce {
    animation: bounce 1s infinite;
}

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

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

.animate-shake {
    animation: shake 0.8s ease-in-out;
}

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

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

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

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

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

.animate-typewriter {
    animation: typewriter 3s steps(40, end), blink 0.75s step-end infinite;
    white-space: nowrap;
    overflow: hidden;
    border-right: 2px solid var(--primary-blue);
}

.animate-gradient {
    background: linear-gradient(-45deg, var(--primary-blue), var(--secondary-blue), var(--primary-purple), var(--secondary-purple));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

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

/* Animation Delays */
.animate-delay-75 {
    animation-delay: 75ms;
}

.animate-delay-100 {
    animation-delay: 100ms;
}

.animate-delay-150 {
    animation-delay: 150ms;
}

.animate-delay-200 {
    animation-delay: 200ms;
}

.animate-delay-300 {
    animation-delay: 300ms;
}

.animate-delay-500 {
    animation-delay: 500ms;
}

.animate-delay-700 {
    animation-delay: 700ms;
}

.animate-delay-1000 {
    animation-delay: 1000ms;
}

/* Animation Durations */
.animate-duration-75 {
    animation-duration: 75ms;
}

.animate-duration-100 {
    animation-duration: 100ms;
}

.animate-duration-150 {
    animation-duration: 150ms;
}

.animate-duration-200 {
    animation-duration: 200ms;
}

.animate-duration-300 {
    animation-duration: 300ms;
}

.animate-duration-500 {
    animation-duration: 500ms;
}

.animate-duration-700 {
    animation-duration: 700ms;
}

.animate-duration-1000 {
    animation-duration: 1000ms;
}

/* Animation Iteration Counts */
.animate-once {
    animation-iteration-count: 1;
}

.animate-twice {
    animation-iteration-count: 2;
}

.animate-infinite {
    animation-iteration-count: infinite;
}

/* Animation Fill Modes */
.animate-fill-none {
    animation-fill-mode: none;
}

.animate-fill-forwards {
    animation-fill-mode: forwards;
}

.animate-fill-backwards {
    animation-fill-mode: backwards;
}

.animate-fill-both {
    animation-fill-mode: both;
}

/* Animation Play States */
.animate-paused {
    animation-play-state: paused;
}

.animate-running {
    animation-play-state: running;
}

/* Hover Animations */
.hover-lift {
    transition: var(--transition-transform);
}

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

.hover-scale {
    transition: var(--transition-transform);
}

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

.hover-rotate {
    transition: var(--transition-transform);
}

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

.hover-glow {
    transition: box-shadow var(--transition-normal);
}

.hover-glow:hover {
    box-shadow: 0 0 20px var(--primary-blue);
}

.hover-fade {
    transition: var(--transition-opacity);
}

.hover-fade:hover {
    opacity: 0.8;
}

.hover-slide-right {
    position: relative;
    overflow: hidden;
    transition: var(--transition-all);
}

.hover-slide-right::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: var(--transition-all);
}

.hover-slide-right:hover::before {
    left: 100%;
}

/* Scroll Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.scroll-reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* Stagger Animations */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.stagger-children.animate > *:nth-child(1) {
    transition-delay: 0.1s;
}

.stagger-children.animate > *:nth-child(2) {
    transition-delay: 0.2s;
}

.stagger-children.animate > *:nth-child(3) {
    transition-delay: 0.3s;
}

.stagger-children.animate > *:nth-child(4) {
    transition-delay: 0.4s;
}

.stagger-children.animate > *:nth-child(5) {
    transition-delay: 0.5s;
}

.stagger-children.animate > *:nth-child(6) {
    transition-delay: 0.6s;
}

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

/* Loading Animations */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-blue);
    animation: pulse 1.4s ease-in-out infinite both;
}

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

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

.loading-bars {
    display: inline-flex;
    gap: 2px;
    align-items: end;
}

.loading-bars span {
    width: 4px;
    height: 20px;
    background: var(--primary-blue);
    animation: loading-bar 1.2s ease-in-out infinite;
}

.loading-bars span:nth-child(1) {
    animation-delay: -1.1s;
}

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

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

.loading-bars span:nth-child(4) {
    animation-delay: -0.8s;
}

.loading-bars span:nth-child(5) {
    animation-delay: -0.7s;
}

@keyframes loading-bar {
    0%, 40%, 100% {
        transform: scaleY(0.4);
    }
    20% {
        transform: scaleY(1.0);
    }
}

/* Parallax Effects */
.parallax {
    transform: translateZ(0);
    will-change: transform;
}

.parallax-slow {
    transform: translate3d(0, 0, 0);
}

.parallax-medium {
    transform: translate3d(0, 0, 0);
}

.parallax-fast {
    transform: translate3d(0, 0, 0);
}

/* Performance Optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

.smooth-animation {
    backface-visibility: hidden;
    perspective: 1000px;
}

/* 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;
        scroll-behavior: auto !important;
    }
    
    .animate-bounce,
    .animate-pulse,
    .animate-spin,
    .animate-ping,
    .animate-float,
    .animate-glow,
    .animate-gradient,
    .animate-morph {
        animation: none !important;
    }
    
    .parallax,
    .parallax-slow,
    .parallax-medium,
    .parallax-fast {
        transform: none !important;
    }
}