/* Modern AI Effects - Glassmorphism & Animations */

/* Neural Network Background Pattern */
.neural-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.03;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 25% 25%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(245, 158, 11, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 50% 10%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
}

/* Floating Particles */
@keyframes float-particle {
    0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 0.3; }
    25% { transform: translateY(-20px) rotate(90deg); opacity: 0.6; }
    50% { transform: translateY(-10px) rotate(180deg); opacity: 0.4; }
    75% { transform: translateY(-30px) rotate(270deg); opacity: 0.5; }
}

.floating-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    border-radius: 50%;
    animation: float-particle 8s ease-in-out infinite;
}

.particle:nth-child(2) { animation-delay: -2s; left: 20%; animation-duration: 10s; }
.particle:nth-child(3) { animation-delay: -4s; left: 40%; animation-duration: 12s; }
.particle:nth-child(4) { animation-delay: -6s; left: 60%; animation-duration: 9s; }
.particle:nth-child(5) { animation-delay: -8s; left: 80%; animation-duration: 11s; }

/* AI Glow Effects */
.ai-glow {
    position: relative;
}

.ai-glow::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #3b82f6, #06b6d4, #f59e0b);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    filter: blur(8px);
}

.ai-glow:hover::after {
    opacity: 0.6;
}

/* Holographic Text Effect */
.holographic-text {
    background: linear-gradient(45deg, #3b82f6, #06b6d4, #f59e0b, #ef4444);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: holographic-shift 3s ease-in-out infinite;
}

@keyframes holographic-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Magnetic Hover Effect */
.magnetic {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.magnetic:hover {
    transform: scale(1.05) rotate(2deg);
}

/* Breathing Animation */
@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.breathe {
    animation: breathe 4s ease-in-out infinite;
}

/* Typing Effect */
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #3b82f6; }
}

.typing-effect {
    overflow: hidden;
    border-right: 3px solid #3b82f6;
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

/* Glass Card Effect */
.glass-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

/* Gradient Border */
.gradient-border {
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2px;
}

.gradient-border::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(45deg, #3b82f6, #06b6d4, #f59e0b);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
}

/* Neon Glow */
.neon-glow {
    text-shadow: 0 0 5px #3b82f6, 0 0 10px #3b82f6, 0 0 15px #3b82f6;
    animation: neon-pulse 2s ease-in-out infinite alternate;
}

@keyframes neon-pulse {
    from { text-shadow: 0 0 5px #3b82f6, 0 0 10px #3b82f6; }
    to { text-shadow: 0 0 5px #3b82f6, 0 0 20px #3b82f6, 0 0 30px #3b82f6; }
}

/* Morphing Background */
@keyframes morph-bg {
    0%, 100% {
        background: linear-gradient(45deg, #3b82f6, #06b6d4);
    }
    25% {
        background: linear-gradient(45deg, #06b6d4, #f59e0b);
    }
    50% {
        background: linear-gradient(45deg, #f59e0b, #ef4444);
    }
    75% {
        background: linear-gradient(45deg, #ef4444, #3b82f6);
    }
}

.morphing-bg {
    animation: morph-bg 8s ease-in-out infinite;
}

/* 3D Tilt Effect */
.tilt-effect {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.tilt-effect:hover {
    transform: rotateX(10deg) rotateY(10deg) scale(1.05);
}

/* Liquid Button Effect */
.liquid-btn {
    position: relative;
    overflow: hidden;
}

.liquid-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.liquid-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Scroll-triggered Animations */
.animate-in {
    animation: fadeInUp 0.8s ease-out forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation for multiple elements */
.project-card:nth-child(1) { animation-delay: 0.1s; }
.project-card:nth-child(2) { animation-delay: 0.2s; }
.project-card:nth-child(3) { animation-delay: 0.3s; }
.project-card:nth-child(4) { animation-delay: 0.4s; }

/* Loading state */
body.loading {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease-out;
}

body.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Modern Hover Effects */
.project-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.project-card:hover {
    transform: translateY(-12px) rotateX(5deg);
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 20px rgba(59, 130, 246, 0.3);
}

/* Enhanced Button Interactions */
.btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* Smooth scrolling improvements */
html {
    scroll-behavior: smooth;
}

@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;
    }
}

/* Responsive Design Enhancements */
/* Mobile Optimizations */
@media (max-width: 768px) {
    .floating-particles {
        display: none; /* Disable particles on mobile for performance */
    }

    .ai-glow::after {
        filter: blur(4px);
    }

    .holographic-text {
        animation-duration: 6s; /* Slower on mobile */
    }

    .animate-in {
        animation-duration: 0.6s; /* Faster on mobile */
    }

    .tilt-effect:hover {
        transform: none; /* Disable 3D tilt on touch devices */
    }

    .magnetic:hover {
        transform: none; /* Disable magnetic effect on touch devices */
    }
}

/* Tablet Optimizations */
@media (max-width: 1024px) and (min-width: 769px) {
    .floating-particles .particle {
        width: 3px;
        height: 3px;
    }

    .hero h1 {
        font-size: 3.5rem;
    }
}

/* Dark mode support (if user prefers) */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --border-color: #334155;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .glass-card {
        background: rgba(255, 255, 255, 0.95);
        border: 2px solid #000;
    }

    .holographic-text {
        background: none;
        -webkit-text-fill-color: #000;
        color: #000;
        animation: none;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .floating-particles,
    .holographic-text,
    .morphing-bg,
    .breathe,
    .neon-glow {
        animation: none;
    }

    .tilt-effect:hover {
        transform: none;
    }
}
