/* ========================================
   INSUSMART - Advanced Animations
   Premium Motion Design
   ======================================== */

/* ===== AOS Fallback - Ensure elements are visible ===== */
[data-aos] {
    opacity: 1 !important;
    transform: none !important;
}

/* When AOS is loaded, it will handle the animations */
.aos-init [data-aos] {
    opacity: 0;
    transform: translateY(30px);
}

.aos-init [data-aos].aos-animate {
    opacity: 1;
    transform: none;
}

/* ===== 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 scaleUp {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Rotate Animations */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

/* Bounce Animations */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceY {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes bounceX {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-10px); }
}

/* Shake Animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Pulse Animations */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes pulseRing {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.1); }
    28% { transform: scale(1); }
    42% { transform: scale(1.1); }
    70% { transform: scale(1); }
}

/* Glow Animations */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--primary), 0 0 10px var(--primary);
    }
    50% {
        box-shadow: 0 0 20px var(--primary), 0 0 30px var(--primary);
    }
}

@keyframes glowAccent {
    0%, 100% {
        box-shadow: 0 0 5px var(--accent), 0 0 10px var(--accent);
    }
    50% {
        box-shadow: 0 0 20px var(--accent), 0 0 30px var(--accent);
    }
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.6);
    }
}

/* Wave Animations */
@keyframes wave {
    0% { transform: translateX(0) translateY(0); }
    25% { transform: translateX(-5px) translateY(-10px); }
    50% { transform: translateX(0) translateY(-5px); }
    75% { transform: translateX(5px) translateY(-10px); }
    100% { transform: translateX(0) translateY(0); }
}

@keyframes waveHorizontal {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(20px); }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* 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 blink {
    0%, 100% { border-color: transparent; }
    50% { border-color: var(--primary); }
}

/* Particle Float */
@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: translateY(-20px) translateX(10px) rotate(90deg);
    }
    50% {
        transform: translateY(-40px) translateX(-10px) rotate(180deg);
        opacity: 0.5;
    }
    75% {
        transform: translateY(-20px) translateX(10px) rotate(270deg);
    }
}

/* Morph Animation */
@keyframes morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

/* Counter Animation */
@keyframes countUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Line Draw */
@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Slide Animations */
@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Animation Classes ===== */

/* Fade Classes */
.animate-fadeIn {
    animation: fadeIn 0.5s ease forwards;
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-fadeInDown {
    animation: fadeInDown 0.6s ease forwards;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.6s ease forwards;
}

.animate-fadeInRight {
    animation: fadeInRight 0.6s ease forwards;
}

/* Scale Classes */
.animate-scaleIn {
    animation: scaleIn 0.5s ease forwards;
}

.animate-popIn {
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Bounce Classes */
.animate-bounceIn {
    animation: bounceIn 0.8s ease forwards;
}

.animate-bounceY {
    animation: bounceY 2s ease-in-out infinite;
}

/* Pulse Classes */
.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

/* Glow Classes */
.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

.animate-glowAccent {
    animation: glowAccent 2s ease-in-out infinite;
}

/* Float Classes */
.animate-float {
    animation: bounceY 3s ease-in-out infinite;
}

/* Rotate Classes */
.animate-rotate {
    animation: rotate 10s linear infinite;
}

/* Shimmer Class */
.animate-shimmer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* ===== Hover Animations ===== */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-10px);
    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 30px rgba(6, 58, 92, 0.4);
}

.hover-shine {
    position: relative;
    overflow: hidden;
}

.hover-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s ease;
}

.hover-shine:hover::before {
    left: 100%;
}

/* ===== Scroll Triggered Animations ===== */

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* ===== Delay Classes ===== */

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* ===== Duration Classes ===== */

.duration-300 { animation-duration: 0.3s; }
.duration-500 { animation-duration: 0.5s; }
.duration-700 { animation-duration: 0.7s; }
.duration-1000 { animation-duration: 1s; }
.duration-1500 { animation-duration: 1.5s; }
.duration-2000 { animation-duration: 2s; }

/* ===== Special Effects ===== */

/* Particle Effect Container */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0.5;
    animation: particleFloat 5s ease-in-out infinite;
}

.particle:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; top: 80%; animation-delay: 1s; }
.particle:nth-child(3) { left: 30%; top: 40%; animation-delay: 2s; }
.particle:nth-child(4) { left: 40%; top: 60%; animation-delay: 3s; }
.particle:nth-child(5) { left: 50%; top: 30%; animation-delay: 4s; }
.particle:nth-child(6) { left: 60%; top: 70%; animation-delay: 0.5s; }
.particle:nth-child(7) { left: 70%; top: 50%; animation-delay: 1.5s; }
.particle:nth-child(8) { left: 80%; top: 20%; animation-delay: 2.5s; }
.particle:nth-child(9) { left: 90%; top: 90%; animation-delay: 3.5s; }
.particle:nth-child(10) { left: 5%; top: 50%; animation-delay: 4.5s; }

/* Morphing Background */
.morph-bg {
    position: absolute;
    width: 500px;
    height: 500px;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    animation: morph 8s ease-in-out infinite;
    opacity: 0.1;
}

/* Gradient Text Animation */
.gradient-text {
    background: linear-gradient(
        90deg,
        var(--primary),
        var(--accent),
        var(--primary)
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

/* Ripple Button Effect */
.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--gray-200) 25%,
        var(--gray-100) 50%,
        var(--gray-200) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* Stagger Animation */
.stagger-animation > * {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   Additional Premium Animations
   ======================================== */

/* Particle Float Animation */
@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0.5;
    }
    25% {
        transform: translateY(-50px) translateX(20px);
        opacity: 1;
    }
    50% {
        transform: translateY(-100px) translateX(-20px);
        opacity: 0.7;
    }
    75% {
        transform: translateY(-50px) translateX(30px);
        opacity: 0.9;
    }
}

/* Text Reveal Animation */
@keyframes textReveal {
    0% {
        clip-path: inset(0 100% 0 0);
    }
    100% {
        clip-path: inset(0 0 0 0);
    }
}

.text-reveal {
    animation: textReveal 1s ease forwards;
}

/* Counter Animation */
@keyframes countUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Card Hover 3D Effect */
.card-3d {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-style: preserve-3d;
}

.card-3d:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(-5deg) translateZ(20px);
    box-shadow: 
        20px 20px 60px rgba(0, 0, 0, 0.2),
        -20px -20px 60px rgba(255, 255, 255, 0.1);
}

/* Morphing Background */
@keyframes morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    50% {
        border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%;
    }
    75% {
        border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%;
    }
}

.morphing-bg {
    animation: morph 8s ease-in-out infinite;
}

/* Icon Bounce on Hover */
@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.icon-bounce:hover i {
    animation: iconBounce 0.5s ease infinite;
}

/* Line Draw Animation */
@keyframes lineDraw {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

.line-draw path {
    stroke-dasharray: 1000;
    animation: lineDraw 2s ease forwards;
}

/* Magnetic Button Effect */
.magnetic-btn {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Typewriter Effect */
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blinkCursor {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent); }
}

.typewriter {
    overflow: hidden;
    border-left: 3px solid var(--accent);
    white-space: nowrap;
    animation: 
        typing 3.5s steps(40, end),
        blinkCursor 0.75s step-end infinite;
}

/* Parallax Layer */
.parallax-layer {
    will-change: transform;
    transition: transform 0.1s linear;
}

/* Reveal on Scroll */
.reveal-up {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-up.revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Neon Glow Text */
.neon-text {
    text-shadow: 
        0 0 5px var(--accent),
        0 0 10px var(--accent),
        0 0 20px var(--accent),
        0 0 40px var(--accent);
    animation: neonPulse 2s ease-in-out infinite;
}

@keyframes neonPulse {
    0%, 100% {
        text-shadow: 
            0 0 5px var(--accent),
            0 0 10px var(--accent),
            0 0 20px var(--accent),
            0 0 40px var(--accent);
    }
    50% {
        text-shadow: 
            0 0 10px var(--accent),
            0 0 20px var(--accent),
            0 0 40px var(--accent),
            0 0 80px var(--accent);
    }
}

/* Gradient Border Animation */
@keyframes gradientBorder {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.gradient-border {
    position: relative;
    background: var(--white);
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -3px;
    background: linear-gradient(
        45deg,
        var(--primary),
        var(--accent),
        var(--primary-light),
        var(--accent-light)
    );
    background-size: 300% 300%;
    border-radius: inherit;
    z-index: -1;
    animation: gradientBorder 4s ease infinite;
}

/* Liquid Fill Effect */
@keyframes liquidFill {
    0% {
        transform: translateY(100%);
    }
    100% {
        transform: translateY(0);
    }
}

.liquid-fill::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.liquid-fill:hover::after {
    transform: translateY(0);
}

/* Success Check Animation */
@keyframes checkmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.success-checkmark {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: checkmark 0.5s ease-in-out forwards;
    animation-delay: 0.3s;
}

/* Shake Animation for Errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Swiper Custom Animations */
.swiper-slide-active .project-card {
    animation: scaleIn 0.5s ease forwards;
}

/* Form Focus Animation */
.form-group input:focus + label,
.form-group textarea:focus + label {
    color: var(--primary);
    transform: translateY(-5px);
}

/* Number Counter Animation */
.counter-animate {
    display: inline-block;
    animation: countUp 0.5s ease forwards;
}

/* Badge Pulse */
.badge-pulse {
    position: relative;
}

.badge-pulse::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    animation: pulse 2s ease-out infinite;
    background: inherit;
    z-index: -1;
}
