/* ============================================
   AI Smart Classroom - Advanced Animations
   Premium 2026-style interactions
   ============================================ */

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .particle, .neural-node, .data-flow, .glow-line {
        display: none;
    }
}

/* ============================================
   Hero AI Visual - Neural Network Animation
   ============================================ */
.hero-ai-visual {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.neural-container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Central AI Brain */
.ai-brain {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, rgba(99, 102, 241, 0.1) 60%, transparent 70%);
    border: 2px solid rgba(139, 92, 246, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: brainPulse 3s ease-in-out infinite;
    box-shadow: 
        0 0 60px rgba(139, 92, 246, 0.4),
        inset 0 0 40px rgba(139, 92, 246, 0.2);
}

.ai-brain::before {
    content: '';
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    animation: brainGlow 3s ease-in-out infinite;
}

@keyframes brainPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
}

@keyframes brainGlow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

.ai-brain-icon {
    width: 60px;
    height: 60px;
    color: #C4B5FD;
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.8));
}

/* Neural Nodes */
.neural-node {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid rgba(139, 92, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: nodeFloat 4s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.2);
}

.neural-node::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid rgba(139, 92, 246, 0.2);
    animation: nodeRing 3s ease-in-out infinite;
}

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

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

.neural-node svg {
    width: 32px;
    height: 32px;
    color: #A78BFA;
}

/* Node Positions */
.node-teacher { top: 28%; left: 50%; transform: translateX(-50%); animation-delay: 0s; }
.node-voice { top: 50%; left: 15%; transform: translateY(-50%); animation-delay: 0.5s; }
.node-lesson { top: 50%; right: 15%; transform: translateY(-50%); animation-delay: 1s; }
.node-robot { bottom: 20%; left: 50%; transform: translateX(-50%); animation-delay: 1.5s; }

/* Connection Lines */
.connection-lines {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.glow-line {
    position: absolute;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.8), transparent);
    height: 2px;
    animation: lineGlow 2s ease-in-out infinite;
}

.glow-line::before {
    content: '';
    position: absolute;
    left: 0;
    top: -2px;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.3), transparent);
    filter: blur(4px);
}

@keyframes lineGlow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Data Particles */
.data-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8B5CF6;
    box-shadow: 0 0 10px #8B5CF6, 0 0 20px rgba(139, 92, 246, 0.5);
    animation: particleMove 4s linear infinite;
}

@keyframes particleMove {
    0% { 
        transform: translateY(0) translateX(0); 
        opacity: 0;
    }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { 
        transform: translateY(var(--dy, -100px)) translateX(var(--dx, 0)); 
        opacity: 0;
    }
}

/* Circuit Pattern Background */
.circuit-bg {
    position: absolute;
    inset: 0;
    opacity: 0.15;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 10h80v80H10z' fill='none' stroke='%238B5CF6' stroke-width='0.5'/%3E%3Ccircle cx='10' cy='10' r='2' fill='%238B5CF6'/%3E%3Ccircle cx='90' cy='10' r='2' fill='%238B5CF6'/%3E%3Ccircle cx='10' cy='90' r='2' fill='%238B5CF6'/%3E%3Ccircle cx='90' cy='90' r='2' fill='%238B5CF6'/%3E%3Cpath d='M50 10v30M10 50h30M50 90v-30M90 50h-30' stroke='%238B5CF6' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 100px 100px;
    animation: circuitScroll 20s linear infinite;
}

@keyframes circuitScroll {
    0% { background-position: 0 0; }
    100% { background-position: 100px 100px; }
}

/* ============================================
   Scroll Animations
   ============================================ */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* Staggered animations */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }
.stagger-5 { transition-delay: 0.5s; }
.stagger-6 { transition-delay: 0.6s; }

/* ============================================
   Hover Effects
   ============================================ */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.hover-glow {
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.hover-glow:hover {
    border-color: var(--primary) !important;
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.3);
}

/* ============================================
   Animated Borders
   ============================================ */
.animated-border {
    position: relative;
    overflow: hidden;
}

.animated-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--primary) 50%,
        transparent 100%
    );
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: borderSlide 3s linear infinite;
    background-size: 200% 100%;
}

@keyframes borderSlide {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ============================================
   Gradient Animations
   ============================================ */
.gradient-animate {
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ============================================
   Technology Diagram Animations
   ============================================ */
.tech-diagram {
    position: relative;
}

.tech-node {
    position: relative;
    animation: techNodeFloat 4s ease-in-out infinite;
    transition: all 0.3s ease;
}

.tech-node:hover {
    transform: scale(1.05);
    z-index: 10;
}

.tech-node:hover .tech-node-content {
    box-shadow: 0 0 50px rgba(139, 92, 246, 0.4);
    border-color: var(--primary);
}

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

/* Connection paths */
.connection-path {
    stroke-dasharray: 10 5;
    animation: pathFlow 1s linear infinite;
}

@keyframes pathFlow {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -15; }
}

/* ============================================
   Floating UI Elements
   ============================================ */
.float-element {
    animation: floatUI 6s ease-in-out infinite;
}

@keyframes floatUI {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(2deg); }
    75% { transform: translateY(10px) rotate(-2deg); }
}

/* ============================================
   Text Animations
   ============================================ */
.text-gradient-animate {
    background: linear-gradient(
        90deg,
        var(--text-primary) 0%,
        var(--primary-light) 50%,
        var(--text-primary) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textGradient 4s linear infinite;
}

@keyframes textGradient {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* ============================================
   Timeline/Process Animation
   ============================================ */
.timeline-step {
    position: relative;
}

.timeline-step::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    width: 2px;
    height: 0;
    background: var(--gradient-primary);
    transform: translateX(-50%);
    transition: height 0.5s ease;
}

.timeline-step.visible::before {
    height: var(--connector-height, 60px);
}

/* ============================================
   Card Interactions
   ============================================ */
.interactive-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.interactive-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(139, 92, 246, 0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.interactive-card:hover::before {
    opacity: 1;
}

/* ============================================
   Loading States
   ============================================ */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-elevated) 0%,
        var(--bg-muted) 50%,
        var(--bg-elevated) 100%
    );
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   Particle Network Background
   ============================================ */
.particle-network {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.network-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(139, 92, 246, 0.6);
    border-radius: 50%;
    animation: networkFloat 15s linear infinite;
}

@keyframes networkFloat {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% {
        transform: translate(var(--tx, 100px), var(--ty, -100px));
        opacity: 0;
    }
}
