/* Animation and Motion Styles */
/* ========================================================================== */

/* Keyframe Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    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 pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

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

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    }
}

@keyframes neon {
    0%, 100% {
        text-shadow: 
            0 0 5px #fff,
            0 0 10px #fff,
            0 0 15px #fff,
            0 0 20px var(--accent-primary),
            0 0 35px var(--accent-primary),
            0 0 40px var(--accent-primary),
            0 0 50px var(--accent-primary),
            0 0 75px var(--accent-primary);
    }
    50% {
        text-shadow: 
            0 0 5px #fff,
            0 0 10px #fff,
            0 0 15px #fff,
            0 0 20px var(--accent-secondary),
            0 0 35px var(--accent-secondary),
            0 0 40px var(--accent-secondary),
            0 0 50px var(--accent-secondary),
            0 0 75px var(--accent-secondary);
    }
}

@keyframes glitch {
    0%, 100% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
}

@keyframes scanline {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100%);
    }
}

@keyframes flicker {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

@keyframes rotate3d {
    from {
        transform: rotate3d(1, 1, 0, 0deg);
    }
    to {
        transform: rotate3d(1, 1, 0, 360deg);
    }
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes scaleOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.8);
        opacity: 0;
    }
}

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

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes breathing {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

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

.animate-fade-in-up {
    animation: fadeInUp 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-pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

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

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

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

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

.animate-scanline {
    animation: scanline 4s linear infinite;
}

.animate-flicker {
    animation: flicker 1.5s ease-in-out infinite alternate;
}

.animate-rotate {
    animation: rotate3d 10s linear infinite;
}

.animate-slide-in-top {
    animation: slideInFromTop 0.6s ease-out;
}

.animate-slide-in-bottom {
    animation: slideInFromBottom 0.6s ease-out;
}

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

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

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

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

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

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

.animate-breathing {
    animation: breathing 4s ease-in-out infinite;
}

/* Staggered Animations */
.stagger-children > * {
    opacity: 0;
}

.stagger-children.animate > * {
    animation: fadeInUp 0.6s ease-out forwards;
}

.stagger-children.animate > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children.animate > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children.animate > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children.animate > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children.animate > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-children.animate > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-children.animate > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-children.animate > *:nth-child(8) { animation-delay: 0.8s; }
.stagger-children.animate > *:nth-child(9) { animation-delay: 0.9s; }
.stagger-children.animate > *:nth-child(10) { animation-delay: 1.0s; }

/* Smooth Transitions */
* {
    transition: transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease, background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Hover Effects */
.demo-card:hover {
    transform: translateY(-8px);
}

.btn:hover {
    transform: translateY(-2px);
}

.nav-link:hover {
    transform: translateX(4px);
}

.lang-btn:hover {
    transform: translateY(-2px);
}

/* Loading Shimmer */
.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* Section Transitions */
.section {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.8s ease-out forwards;
    animation-delay: calc(var(--delay, 0) * 0.1s);
}

.section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Canvas Container Effects */
.demo-visual {
    position: relative;
    overflow: hidden;
}

.demo-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at top, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0.5;
}

.demo-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(0,0,0,0.05));
    pointer-events: none;
    opacity: 0.3;
}

/* Glassmorphism Effects */
.glass {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Neon Effects */
.neon-text {
    color: #fff;
    text-shadow: 
        0 0 5px #fff,
        0 0 10px #fff,
        0 0 15px #fff,
        0 0 20px var(--accent-primary),
        0 0 35px var(--accent-primary),
        0 0 40px var(--accent-primary);
}

.neon-border {
    border: 2px solid var(--accent-primary);
    box-shadow: 
        0 0 10px var(--accent-primary),
        0 0 20px var(--accent-primary),
        0 0 30px var(--accent-primary);
}

/* Particle Effects */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-primary);
    border-radius: 50%;
    pointer-events: none;
    animation: float 3s ease-in-out infinite;
}

.particle::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 60%);
    border-radius: 50%;
    animation: flicker 2s ease-in-out infinite;
}

/* Performance Optimized Animations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .demo-card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .demo-visual {
        border-width: 2px;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .nav-link {
        border: 1px solid transparent;
    }
    
    .nav-link:hover {
        border-color: var(--text-primary);
    }
}

/* Dark Mode Specific Animations */
@media (prefers-color-scheme: dark) {
    .demo-visual::before {
        background: radial-gradient(ellipse at top, rgba(255,255,255,0.05) 0%, transparent 70%);
    }
    
    .demo-visual::after {
        background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.1));
    }
}

/* Focus Ring Animation */
:focus-visible {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Scroll Progress Animation */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    z-index: 3000;
    transition: width 0.1s ease;
}

/* Notification Animations */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 2000;
}

.notification.show {
    transform: translateX(0);
}

.notification.hide {
    transform: translateX(100%);
}

/* Tooltip Animations */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Modal Animation */
.modal-content {
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal:not([hidden]) .modal-content {
    transform: scale(1);
    opacity: 1;
}

/* Responsive Animation Adjustments */
@media (max-width: 768px) {
    .animate-fade-in-up {
        animation-duration: 0.5s;
    }
    
    .stagger-children.animate > * {
        animation-duration: 0.4s;
    }
    
    .demo-card:hover {
        transform: none;
    }
}

@media (max-width: 480px) {
    .animate-fade-in-up {
        animation-duration: 0.4s;
    }
    
    .stagger-children.animate > * {
        animation-duration: 0.3s;
    }
}