/* ==========================================================================
   Animations & Interactive Effects
   ========================================================================== */

/* Technology Background Animations */
.tech-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    animation: backgroundFadeIn 2s ease-out;
}

@keyframes backgroundFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Technology Icons Animations */
.tech-icon {
    position: absolute;
    left: var(--x);
    top: var(--y);
    font-size: 2rem;
    color: var(--tech-default);
    animation: 
        float 6s ease-in-out infinite var(--delay), 
        pulse 3s ease-in-out infinite calc(var(--delay) + 1s);
    transform: translateZ(0);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tech-icon:hover {
    color: rgba(59, 130, 246, 0.8);
    transform: translateZ(0) scale(1.2);
    filter: drop-shadow(0 0 25px rgba(59, 130, 246, 0.7));
}

.tech-icon i {
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.3));
    transition: filter 0.3s ease;
}

/* Icon Float Animation - Increased Motion Area */
@keyframes float {
    0%, 100% { 
        transform: translateY(0px) translateX(0px) rotate(0deg) scale(1); 
        opacity: 0.3;
        filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.2));
    }
    25% { 
        transform: translateY(-25px) translateX(15px) rotate(5deg) scale(1.05); 
        opacity: 0.6;
        filter: drop-shadow(0 0 15px rgba(59, 130, 246, 0.4));
    }
    50% { 
        transform: translateY(-35px) translateX(-10px) rotate(-3deg) scale(1.1); 
        opacity: 0.8;
        filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.6));
    }
    75% { 
        transform: translateY(-30px) translateX(20px) rotate(4deg) scale(1.03); 
        opacity: 0.5;
        filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.3));
    }
}

/* Icon Pulse Animation */
@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
    }
    50% { 
        transform: scale(1.08);
    }
}

/* Data Particles Animations */
.data-particle {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 4px;
    height: 4px;
    background: radial-gradient(
        circle, 
        var(--particle-glow) 0%, 
        rgba(147, 197, 253, 0.6) 50%, 
        transparent 100%
    );
    border-radius: 50%;
    animation: 
        dataFlow 8s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite var(--delay), 
        sparkle 2s ease-in-out infinite calc(var(--delay) + 0.5s);
}

.data-particle::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: radial-gradient(
        circle, 
        transparent 30%, 
        rgba(59, 130, 246, 0.1) 70%
    );
    border-radius: 50%;
    animation: expand 3s ease-in-out infinite var(--delay);
}

@keyframes dataFlow {
    0% { 
        transform: translate(0, 0) scale(0);
        opacity: 0;
        box-shadow: 0 0 0px rgba(59, 130, 246, 0);
    }
    15% { 
        opacity: 1;
        transform: translate(20px, -10px) scale(1);
        box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
    }
    30% { 
        transform: translate(40px, -25px) scale(1.3);
        opacity: 0.9;
        box-shadow: 0 0 15px rgba(59, 130, 246, 0.8);
    }
    60% { 
        transform: translate(80px, -35px) scale(1.5);
        opacity: 0.7;
        box-shadow: 0 0 20px rgba(59, 130, 246, 1);
    }
    85% { 
        transform: translate(120px, -20px) scale(0.8);
        opacity: 0.4;
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
    }
    100% { 
        transform: translate(150px, 0px) scale(0);
        opacity: 0;
        box-shadow: 0 0 0px rgba(59, 130, 246, 0);
    }
}

@keyframes sparkle {
    0%, 100% { 
        filter: brightness(1);
    }
    50% { 
        filter: brightness(1.5) saturate(1.3);
    }
}

@keyframes expand {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.3;
    }
    50% { 
        transform: scale(2);
        opacity: 0.1;
    }
}

/* Card Entrance Animations */
.card-container {
    animation: cardSlideIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Profile Section Animations */
.profile-section {
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.contact-section {
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

.action-section {
    animation: fadeInUp 0.6s ease-out 0.6s both;
}

.company-logo-section {
    animation: fadeInUp 0.6s ease-out 0.8s both;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover Animations for Contact Items */
.contact-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

/* vCard Download Button Animations */
@keyframes pulseGlow {
    0%, 100% {
        opacity: 0;
        transform: scale(0.9);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    40% {
        transform: translateY(-8px) rotate(-5deg);
    }
    60% {
        transform: translateY(-4px) rotate(3deg);
    }
}

@keyframes downloadPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes successBounce {
    0% {
        transform: scale(1);
    }
    20% {
        transform: scale(1.1);
    }
    40% {
        transform: scale(0.95);
    }
    60% {
        transform: scale(1.05);
    }
    80% {
        transform: scale(0.98);
    }
    100% {
        transform: scale(1);
    }
}

/* Advanced floating animation for download icon */
@keyframes floatingIcon {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-3px) rotate(2deg);
    }
    50% {
        transform: translateY(-6px) rotate(0deg);
    }
    75% {
        transform: translateY(-3px) rotate(-2deg);
    }
}

/* Shimmer effect for button text */
@keyframes textShimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Gradient shift animation for button glow */
@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Magnetic hover effect */
@keyframes magneticPull {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(var(--mouse-x), var(--mouse-y));
    }
}

/* Social Button Animations */
.social-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.social-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.social-btn:hover::before {
    width: 100px;
    height: 100px;
}

/* Special Color Animations for Tech Icons */
.tech-icon:nth-child(1) { /* Brain */
    animation-duration: 7s;
    color: var(--tech-brain);
}

.tech-icon:nth-child(2) { /* Robot */
    animation-duration: 5s;
    color: var(--tech-robot);
}

.tech-icon:nth-child(5) { /* Cloud */
    animation-duration: 8s;
    color: var(--tech-cloud);
}

.tech-icon:nth-child(12) { /* Python */
    color: var(--tech-python);
}

.tech-icon:nth-child(13) { /* Docker */
    color: var(--tech-docker);
}

.tech-icon:nth-child(14) { /* AWS */
    color: var(--tech-aws);
}

/* Enhanced hover effects for special icons */
.tech-icon:nth-child(1):hover { color: var(--tech-brain-hover); }
.tech-icon:nth-child(2):hover { color: var(--tech-robot-hover); }
.tech-icon:nth-child(12):hover { color: var(--tech-python-hover); }
.tech-icon:nth-child(13):hover { color: var(--tech-docker-hover); }
.tech-icon:nth-child(14):hover { color: var(--tech-aws-hover); }

/* Loading States */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Mobile Animation Optimizations */
@media (max-width: 768px) {
    .tech-icon:hover {
        transform: translateZ(0) scale(1.1);
    }
    
    .data-particle {
        width: 3px;
        height: 3px;
    }
    
    /* Reduce motion range on mobile for better performance */
    .tech-icon {
        animation-duration: 10s;
    }
    
    @keyframes float {
        0%, 100% { 
            transform: translateY(0px) translateX(0px) rotate(0deg) scale(1); 
            opacity: 0.3;
        }
        25% { 
            transform: translateY(-15px) translateX(8px) rotate(3deg) scale(1.03); 
            opacity: 0.6;
        }
        50% { 
            transform: translateY(-20px) translateX(-5px) rotate(-2deg) scale(1.05); 
            opacity: 0.8;
        }
        75% { 
            transform: translateY(-18px) translateX(10px) rotate(2deg) scale(1.02); 
            opacity: 0.5;
        }
    }
}

/* CSS-only animations for fallback mode */
.fallback-mode .tech-background {
    background: radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(147, 197, 253, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 40% 80%, rgba(96, 165, 250, 0.1) 0%, transparent 50%);
    animation: backgroundShift 15s ease-in-out infinite;
}

@keyframes backgroundShift {
    0%, 100% { 
        background-position: 0% 50%, 100% 0%, 50% 100%;
    }
    50% { 
        background-position: 50% 0%, 0% 50%, 100% 50%;
    }
}

/* Enhanced ripple effect */
.click-ripple {
    animation: rippleExpand 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes rippleExpand {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Touch feedback */
.touch-active {
    transform: scale(0.98);
    filter: brightness(1.1);
}

/* Loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg, 
        transparent, 
        rgba(255, 255, 255, 0.2), 
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Accessibility - Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .tech-icon {
        animation: none !important;
    }
    
    .data-particle {
        animation: none !important;
    }
}