/* ===== Animation Keyframes ===== */
/* Fade and Move Animations */
@keyframes fadeIn {
    from { 
        opacity: 0;
        transform: translateY(10px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from { 
        opacity: 0;
        transform: translate3d(0, 30px, 0);
    }
    to { 
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInDown {
    from { 
        opacity: 0;
        transform: translate3d(0, -30px, 0);
    }
    to { 
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInLeft {
    from { 
        opacity: 0;
        transform: translate3d(30px, 0, 0);
    }
    to { 
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInRight {
    from { 
        opacity: 0;
        transform: translate3d(-30px, 0, 0);
    }
    to { 
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from { 
        opacity: 0;
        transform: scale3d(0.95, 0.95, 1);
    }
    to { 
        opacity: 1;
        transform: scale3d(1, 1, 1);
    }
}

@keyframes scaleUp {
    from { 
        opacity: 0;
        transform: scale3d(0.8, 0.8, 1);
    }
    to { 
        opacity: 1;
        transform: scale3d(1, 1, 1);
    }
}

@keyframes pulse {
    0% { 
        transform: scale3d(1, 1, 1);
    }
    50% { 
        transform: scale3d(1.05, 1.05, 1);
    }
    100% { 
        transform: scale3d(1, 1, 1);
    }
}

/* Special Effects */
@keyframes float {
    0%, 100% { 
        transform: translate3d(0, 0, 0);
    }
    50% { 
        transform: translate3d(0, -10px, 0);
    }
}

@keyframes gradientBG {
    0% { 
        background-position: 0% 50%;
    }
    50% { 
        background-position: 100% 50%;
    }
    100% { 
        background-position: 0% 50%;
    }
}

@keyframes shimmer {
    0% { 
        background-position: -1000px 0;
    }
    100% { 
        background-position: 1000px 0;
    }
}

@keyframes rotate {
    from { 
        transform: rotate(0deg);
    }
    to { 
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dashoffset: 1000;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* Scroll-triggered animations */
@keyframes revealFromLeft {
    from { 
        opacity: 0;
        clip-path: inset(0 100% 0 0);
    }
    to { 
        opacity: 1;
        clip-path: inset(0 0 0 0);
    }
}

@keyframes revealFromRight {
    from { 
        opacity: 0;
        clip-path: inset(0 0 0 100%);
    }
    to { 
        opacity: 1;
        clip-path: inset(0 0 0 0);
    }
}

@keyframes revealFromTop {
    from { 
        opacity: 0;
        clip-path: inset(0 0 100% 0);
    }
    to { 
        opacity: 1;
        clip-path: inset(0 0 0 0);
    }
}

@keyframes revealFromBottom {
    from { 
        opacity: 0;
        clip-path: inset(100% 0 0 0);
    }
    to { 
        opacity: 1;
        clip-path: inset(0 0 0 0);
    }
}

/* Hover Effects */
@keyframes hoverUp {
    from { 
        transform: translateY(0);
    }
    to { 
        transform: translateY(-5px);
    }
}

@keyframes hoverDown {
    from { 
        transform: translateY(0);
    }
    to { 
        transform: translateY(5px);
    }
}

@keyframes hoverShake {
    0%, 100% { 
        transform: translateX(0);
    }
    25% { 
        transform: translateX(-5px);
    }
    75% { 
        transform: translateX(5px);
    }
}

/* Loading Animations */
@keyframes dotPulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(0.8);
        opacity: 0.5;
    }
}

@keyframes loadingBar {
    0% { 
        width: 0;
        left: 0;
    }
    50% { 
        width: 100%;
        left: 0;
    }
    100% { 
        width: 0;
        left: 100%;
    }
}

/* 3D Transformations */
@keyframes rotate3dX {
    from { 
        transform: rotateX(0);
    }
    to { 
        transform: rotateX(360deg);
    }
}

@keyframes rotate3dY {
    from { 
        transform: rotateY(0);
    }
    to { 
        transform: rotateY(360deg);
    }
}

@keyframes rotate3dZ {
    from { 
        transform: rotateZ(0);
    }
    to { 
        transform: rotateZ(360deg);
    }
}

/* Text Effects */
@keyframes textReveal {
    from { 
        clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
    }
    to { 
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

@keyframes textGradient {
    0% { 
        background-position: 0% 50%;
    }
    50% { 
        background-position: 100% 50%;
    }
    100% { 
        background-position: 0% 50%;
    }
}

/* Glow Effects */
@keyframes glow {
    0%, 100% { 
        box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    }
    50% { 
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.9);
    }
}

@keyframes glowPulse {
    0%, 100% { 
        filter: drop-shadow(0 0 5px rgba(99, 102, 241, 0.5));
    }
    50% { 
        filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.9));
    }
}

/* Background Effects */
@keyframes backgroundPan {
    from { 
        background-position: 0% center;
    }
    to { 
        background-position: -200% center;
    }
}

@keyframes backgroundShift {
    0% { 
        background-position: 0% 50%;
    }
    50% { 
        background-position: 100% 50%;
    }
    100% { 
        background-position: 0% 50%;
    }
}

/* Scroll Progress */
@keyframes scrollProgress {
    from { 
        transform: scaleX(0);
    }
    to { 
        transform: scaleX(1);
    }
}

/* Morphing Shapes */
@keyframes morph {
    0% { 
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% { 
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    100% { 
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
}

/* Particle Effects */
@keyframes particleMove {
    0% { 
        transform: translate(0, 0);
    }
    100% { 
        transform: translate(var(--tx, 100px), var(--ty, 100px));
    }
}

@keyframes particleFade {
    0%, 100% { 
        opacity: 0;
    }
    50% { 
        opacity: 1;
    }
}

/* Parallax Effects */
@keyframes parallaxBackground {
    from { 
        transform: translateY(0);
    }
    to { 
        transform: translateY(calc(var(--parallax-intensity, 20) * 1px));
    }
}

@keyframes parallaxForeground {
    from { 
        transform: translateY(0);
    }
    to { 
        transform: translateY(calc(var(--parallax-intensity, -20) * 1px));
    }
}

/* 3D Card Hover */
@keyframes cardHover {
    0% { 
        transform: perspective(1000px) rotateX(0) rotateY(0);
    }
    100% { 
        transform: perspective(1000px) rotateX(var(--rotate-x, 0)) rotateY(var(--rotate-y, 0));
    }
}

/* Staggered Animations */
@keyframes staggerIn {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ripple Effect */
@keyframes ripple {
    to { 
        transform: scale(4);
        opacity: 0;
    }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% { 
        background-position: -1000px 0;
    }
    100% { 
        background-position: 1000px 0;
    }
}

/* ===== Animation Classes ===== */
/* Base Animation Class */
.animate {
    animation-duration: 0.6s;
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Fade Animations */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.6s forwards;
}

.fade-up {
    opacity: 0;
    transform: translate3d(0, 30px, 0);
    animation: fadeInUp 0.6s forwards;
}

.fade-down {
    opacity: 0;
    transform: translate3d(0, -30px, 0);
    animation: fadeInDown 0.6s forwards;
}

.fade-left {
    opacity: 0;
    transform: translate3d(30px, 0, 0);
    animation: fadeInLeft 0.6s forwards;
}

.fade-right {
    opacity: 0;
    transform: translate3d(-30px, 0, 0);
    animation: fadeInRight 0.6s forwards;
}

/* Delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }

/* Durations */
.duration-1 { animation-duration: 0.3s; }
.duration-2 { animation-duration: 0.6s; }
.duration-3 { animation-duration: 0.9s; }
.duration-4 { animation-duration: 1.2s; }

/* Hover Effects */
.hover-scale {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hover-scale:hover {
    transform: scale(1.03);
}

.hover-lift {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 
                0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Scroll Reveal */
[data-scroll] {
    opacity: 0;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-scroll="in"] {
    opacity: 1;
    transform: translate3d(0, 0, 0) !important;
}

/* Staggered Children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    animation: staggerIn 0.6s forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.5s; }

/* Text Effects */
.text-gradient {
    background: linear-gradient(90deg, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    background-size: 200% auto;
    animation: textGradient 3s ease infinite;
}

/* Glow Effects */
.glow {
    position: relative;
}

.glow::before {
    content: '';
    position: absolute;
    inset: -5px;
    background: inherit;
    filter: blur(20px);
    opacity: 0.7;
    z-index: -1;
    border-radius: inherit;
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple:after {
    content: "";
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, #fff 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform .5s, opacity 1s;
}

.ripple:active:after {
    transform: scale(0, 0);
    opacity: .3;
    transition: 0s;
}

/* Shimmer Effect */
.shimmer {
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* 3D Transform */
.transform-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* Parallax */
.parallax-bg {
    will-change: transform;
    transform: translateZ(-1px) scale(1.2);
}

.parallax-fg {
    will-change: transform;
    transform: translateZ(1px);
}

/* Responsive Animations */
@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;
    }
}

/* Animation Classes */
.fade-in {
    opacity: 0;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.slide-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.slide-down {
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.slide-left {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.slide-right {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scale-in {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

/* In-view State */
.in-view {
    opacity: 1;
    transform: translate(0, 0) scale(1) !important;
}

/* Staggered Animation */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.stagger-item.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Tooltip Styles */
.tooltip {
    position: fixed;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    max-width: 250px;
    text-align: center;
    line-height: 1.4;
}

.tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px 5px 0;
    border-style: solid;
    border-color: rgba(15, 23, 42, 0.95) transparent transparent;
}

/* Loading Animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(79, 70, 229, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    vertical-align: middle;
    margin-right: 8px;
}

/* Hover Effects */
.hover-scale {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-scale:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}

/* Button Hover Effects */
.btn-hover-effect {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-hover-effect::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%, -50%);
    transform-origin: 50% 50%;
}

.btn-hover-effect:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

/* Glow Effect */
.glow {
    position: relative;
}

.glow::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--gradient);
    z-index: -1;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.glow:hover::before {
    opacity: 0.7;
    filter: blur(10px);
}

/* Shine Effect */
.shine {
    position: relative;
    overflow: hidden;
}

.shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to bottom right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0) 40%,
        rgba(255, 255, 255, 0.7) 48%,
        rgba(255, 255, 255, 0.8) 50%,
        rgba(255, 255, 255, 0.7) 52%,
        rgba(255, 255, 255, 0) 60%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    animation: shine 3s infinite;
    opacity: 0;
}

@keyframes shine {
    0% {
        left: -100%;
        opacity: 0;
    }
    20% {
        opacity: 0.5;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        left: 100%;
        opacity: 0;
    }
}

/* 3D Transform Effects */
.perspective {
    perspective: 1000px;
}

.tilt {
    transition: transform 0.3s ease;
}

.tilt:hover {
    transform: rotateY(5deg) rotateX(5deg);
}

/* Text Effects */
.text-gradient {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .slide-up, .slide-down, .slide-left, .slide-right {
        opacity: 1;
        transform: none;
    }
    
    .in-view {
        transform: none !important;
    }
}
