/* ============================================================
   Animations & Micro-interactions
   ============================================================ */

/* ── Keyframes ────────────────────────────────────────────── */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

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

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

@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

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

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes pulseGlow {
    0%, 100% { 
        box-shadow: 0 0 5px rgba(102, 192, 244, 0.2);
    }
    50% { 
        box-shadow: 0 0 20px rgba(102, 192, 244, 0.4);
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

@keyframes borderGlow {
    0%, 100% { 
        border-color: rgba(102, 192, 244, 0.2);
    }
    50% { 
        border-color: rgba(102, 192, 244, 0.5);
    }
}

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

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

/* ── Animation Utility Classes ────────────────────────────── */

.animate-fadeIn { animation: fadeIn 0.5s ease; }
.animate-fadeInUp { animation: fadeInUp 0.5s ease; }
.animate-fadeInDown { animation: fadeInDown 0.3s ease; }
.animate-fadeInLeft { animation: fadeInLeft 0.5s ease; }
.animate-fadeInRight { animation: fadeInRight 0.5s ease; }
.animate-scaleIn { animation: scaleIn 0.3s ease; }
.animate-pulse { animation: pulse 2s ease infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }

/* Staggered animations for lists */
.stagger-children > * {
    opacity: 0;
    animation: fadeInUp 0.4s ease forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(11) { animation-delay: 0.55s; }
.stagger-children > *:nth-child(12) { animation-delay: 0.6s; }

/* ── Hover Effects ────────────────────────────────────────── */

.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.hover-scale {
    transition: transform var(--transition-base);
}

.hover-scale:hover {
    transform: scale(1.02);
}

.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow);
}

.hover-border-glow {
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.hover-border-glow:hover {
    border-color: var(--color-accent);
    box-shadow: 0 0 15px rgba(102, 192, 244, 0.1);
}

/* ── Loading Spinner ──────────────────────────────────────── */

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 2rem auto;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(14, 20, 25, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    border-radius: inherit;
}

/* ── Page Transitions ─────────────────────────────────────── */

.page-enter {
    animation: fadeInUp 0.4s ease;
}

/* ── Scroll reveal (triggered by JS) ─────────────────────── */

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ── Gradient text animation ──────────────────────────────── */

.text-gradient-animated {
    background: linear-gradient(270deg, #66c0f4, #4fc978, #9b59b6, #66c0f4);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textGradient 6s ease infinite;
}

/* ── Ripple Effect ────────────────────────────────────────── */

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: scale(0);
    pointer-events: none;
}

.ripple:active::after {
    width: 200px;
    height: 200px;
    margin-top: -100px;
    margin-left: -100px;
    animation: rippleEffect 0.6s ease;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}
