/* ===========================================
   Mada Edu - Animations Library
   Keyframes and animation utilities
   =========================================== */

/* ========== Keyframe Definitions ========== */

/* Fade Animations */
@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in-down {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide Animations */
@keyframes slide-up {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slide-down {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slide-left {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slide-right {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Scale Animations */
@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes pop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

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

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(102, 126, 234, 0);
    }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Bubble Animation (for backgrounds) */
@keyframes bubble-rise {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(-100vh) scale(1);
        opacity: 0;
    }
}

/* Gradient Shift */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ========== Animation Utility Classes ========== */

/* Base Animation Properties */
.animate {
    animation-duration: 0.5s;
    animation-fill-mode: both;
}

.animate-slow {
    animation-duration: 1s;
}

.animate-fast {
    animation-duration: 0.3s;
}

.animate-delay-100 { animation-delay: 100ms; }
.animate-delay-200 { animation-delay: 200ms; }
.animate-delay-300 { animation-delay: 300ms; }
.animate-delay-400 { animation-delay: 400ms; }
.animate-delay-500 { animation-delay: 500ms; }

.animate-infinite {
    animation-iteration-count: infinite;
}

/* Named Animations */
.animate-fade-in {
    animation-name: fade-in;
}

.animate-fade-in-up {
    animation-name: fade-in-up;
}

.animate-fade-in-down {
    animation-name: fade-in-down;
}

.animate-slide-up {
    animation-name: slide-up;
}

.animate-slide-left {
    animation-name: slide-left;
}

.animate-scale-in {
    animation-name: scale-in;
}

.animate-bounce {
    animation-name: bounce;
    animation-duration: 1s;
    animation-iteration-count: infinite;
}

.animate-bounce-in {
    animation-name: bounce-in;
}

.animate-shake {
    animation-name: shake;
    animation-duration: 0.5s;
}

.animate-pulse {
    animation-name: pulse;
    animation-duration: 2s;
    animation-iteration-count: infinite;
}

.animate-float {
    animation-name: float;
    animation-duration: 3s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
}

.animate-rotate {
    animation-name: rotate;
    animation-duration: 1s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

/* ========== Hover Effects ========== */
.hover-scale {
    transition: transform var(--transition-normal);
}

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

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

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

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

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

.hover-bright {
    transition: filter var(--transition-fast);
}

.hover-bright:hover {
    filter: brightness(1.1);
}

/* ========== Staggered List Animation ========== */
.stagger-list > * {
    opacity: 0;
    animation: fade-in-up 0.5s ease forwards;
}

.stagger-list > *:nth-child(1) { animation-delay: 0ms; }
.stagger-list > *:nth-child(2) { animation-delay: 50ms; }
.stagger-list > *:nth-child(3) { animation-delay: 100ms; }
.stagger-list > *:nth-child(4) { animation-delay: 150ms; }
.stagger-list > *:nth-child(5) { animation-delay: 200ms; }
.stagger-list > *:nth-child(6) { animation-delay: 250ms; }
.stagger-list > *:nth-child(7) { animation-delay: 300ms; }
.stagger-list > *:nth-child(8) { animation-delay: 350ms; }
.stagger-list > *:nth-child(9) { animation-delay: 400ms; }
.stagger-list > *:nth-child(10) { animation-delay: 450ms; }

/* ========== Scroll Reveal ========== */
[data-reveal] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ========== Background Animations ========== */
.animated-gradient {
    background: linear-gradient(270deg, var(--color-primary), var(--color-secondary), var(--color-accent));
    background-size: 600% 600%;
    animation: gradient-shift 10s ease infinite;
}

/* Animated Bubbles Container */
.bubbles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.bubble {
    position: absolute;
    bottom: -100px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    animation: bubble-rise 15s infinite ease-in;
}

.bubble:nth-child(1) { left: 10%; width: 40px; height: 40px; animation-duration: 12s; }
.bubble:nth-child(2) { left: 20%; width: 60px; height: 60px; animation-duration: 16s; animation-delay: 2s; }
.bubble:nth-child(3) { left: 35%; width: 30px; height: 30px; animation-duration: 10s; animation-delay: 4s; }
.bubble:nth-child(4) { left: 50%; width: 80px; height: 80px; animation-duration: 18s; animation-delay: 1s; }
.bubble:nth-child(5) { left: 65%; width: 50px; height: 50px; animation-duration: 14s; animation-delay: 3s; }
.bubble:nth-child(6) { left: 80%; width: 35px; height: 35px; animation-duration: 11s; animation-delay: 5s; }
.bubble:nth-child(7) { left: 90%; width: 70px; height: 70px; animation-duration: 20s; animation-delay: 0s; }

/* ========== Reduce Motion ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
