/**
 * animations.css - 애니메이션 스타일
 * 교대역 강연장 - 한국미래사업학교 강연장 대관
 * Cosmic theme with Duolingo-inspired gamified effects
 */

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

.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-duration-fast { animation-duration: 0.3s; }
.animate-duration-normal { animation-duration: 0.6s; }
.animate-duration-slow { animation-duration: 1s; }

/* ===== Fade Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

@keyframes fadeInDown {
    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);
    }
}

.fade-in { animation-name: fadeIn; }
.fade-out { animation-name: fadeOut; }
.fade-in-up { animation-name: fadeInUp; }
.fade-in-down { animation-name: fadeInDown; }
.fade-in-left { animation-name: fadeInLeft; }
.fade-in-right { animation-name: fadeInRight; }

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

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

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

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

.scale-in { animation-name: scaleIn; }
.scale-out { animation-name: scaleOut; }
.pop-in { animation-name: popIn; }
.bounce-in { animation-name: bounceIn; }

/* ===== Slide Animations ===== */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

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

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

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.slide-in-up { animation-name: slideInUp; }
.slide-in-down { animation-name: slideInDown; }
.slide-in-left { animation-name: slideInLeft; }
.slide-in-right { animation-name: slideInRight; }

/* ===== Pulse & Glow Animations ===== */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.8), 0 0 30px rgba(102, 126, 234, 0.4);
    }
}

@keyframes cosmicGlow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(102, 126, 234, 0.3), 0 0 20px rgba(118, 75, 162, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.6), 0 0 40px rgba(118, 75, 162, 0.4);
    }
}

.pulse { animation: pulse 2s ease-in-out infinite; }
.pulse-soft { animation: pulseSoft 2s ease-in-out infinite; }
.glow { animation: glow 2s ease-in-out infinite; }
.cosmic-glow { animation: cosmicGlow 3s ease-in-out infinite; }

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

@keyframes floatSlow {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(2deg);
    }
}

.float { animation: float 3s ease-in-out infinite; }
.float-slow { animation: floatSlow 5s ease-in-out infinite; }

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

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

.shake { animation: shake 0.6s ease-in-out; }
.wiggle { animation: wiggle 0.5s ease-in-out infinite; }

/* ===== Duolingo-style Bounce Effect ===== */
@keyframes duolingoBounce {
    0% {
        transform: translateY(0);
    }
    20% {
        transform: translateY(-15px);
    }
    40% {
        transform: translateY(0);
    }
    60% {
        transform: translateY(-7px);
    }
    80% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(0);
    }
}

@keyframes successBounce {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.2);
    }
    50% {
        transform: scale(0.95);
    }
    75% {
        transform: scale(1.05);
    }
}

@keyframes celebrateShake {
    0%, 100% {
        transform: translateX(0) rotate(0);
    }
    25% {
        transform: translateX(-2px) rotate(-2deg);
    }
    50% {
        transform: translateX(2px) rotate(2deg);
    }
    75% {
        transform: translateX(-1px) rotate(-1deg);
    }
}

.duolingo-bounce { animation: duolingoBounce 0.8s ease; }
.success-bounce { animation: successBounce 0.5s ease; }
.celebrate { animation: celebrateShake 0.5s ease; }

/* ===== Counter Animation ===== */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.count-up { animation: countUp 0.5s ease-out forwards; }

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

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

.spin { animation: spin 1s linear infinite; }
.spin-slow { animation: spin 3s linear infinite; }
.spin-reverse { animation: spinReverse 1s linear infinite; }

/* ===== Loading Dots ===== */
@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: var(--color-cosmic-1);
    border-radius: 50%;
    animation: loadingDots 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

/* ===== Ripple Effect ===== */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

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

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

.ripple-effect.active::after {
    animation: ripple 0.6s ease-out;
}

/* ===== Text Animations ===== */
@keyframes textReveal {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

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

.text-reveal {
    animation: textReveal 0.8s ease-out forwards;
}

.text-gradient-animate {
    background: linear-gradient(90deg, var(--color-cosmic-1), var(--color-cosmic-2), var(--color-cosmic-1));
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textGradient 3s ease infinite;
}

/* ===== Scroll Trigger Animations ===== */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-animate-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.scroll-animate-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.scroll-animate-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Stagger animations for lists */
.stagger-animate > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-animate.visible > *:nth-child(1) { transition-delay: 0s; }
.stagger-animate.visible > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-animate.visible > *:nth-child(3) { transition-delay: 0.2s; }
.stagger-animate.visible > *:nth-child(4) { transition-delay: 0.3s; }
.stagger-animate.visible > *:nth-child(5) { transition-delay: 0.4s; }
.stagger-animate.visible > *:nth-child(6) { transition-delay: 0.5s; }

.stagger-animate.visible > * {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Progress Bar Animation ===== */
@keyframes progressFill {
    from {
        width: 0;
    }
}

.progress-animate {
    animation: progressFill 1s ease-out forwards;
}

/* ===== Card Hover Effects ===== */
.card-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-lift:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.card-glow {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-glow:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

/* ===== Button Press Effect ===== */
.btn-press {
    transition: transform 0.1s ease;
}

.btn-press:active {
    transform: scale(0.95);
}

/* ===== Image Zoom Effect ===== */
.img-zoom-container {
    overflow: hidden;
}

.img-zoom {
    transition: transform 0.5s ease;
}

.img-zoom-container:hover .img-zoom {
    transform: scale(1.1);
}

/* ===== Cosmic Background Animation ===== */
@keyframes cosmicBg {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.cosmic-bg-animate {
    background: linear-gradient(
        -45deg,
        var(--color-primary),
        var(--color-cosmic-1),
        var(--color-cosmic-2),
        var(--color-primary-light)
    );
    background-size: 400% 400%;
    animation: cosmicBg 15s ease infinite;
}

/* ===== Star Twinkle Animation ===== */
@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.star {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: twinkle 2s ease-in-out infinite;
}

.star:nth-child(odd) {
    animation-duration: 3s;
}

.star:nth-child(even) {
    animation-duration: 2.5s;
    animation-delay: 0.5s;
}

/* ===== Wave Animation ===== */
@keyframes wave {
    0% {
        transform: translateX(0) translateY(0);
    }
    50% {
        transform: translateX(-25%) translateY(5px);
    }
    100% {
        transform: translateX(-50%) translateY(0);
    }
}

.wave-animation {
    animation: wave 8s linear infinite;
}

/* ===== Attention Seekers ===== */
@keyframes heartbeat {
    0%, 28%, 70%, 100% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.3);
    }
    42% {
        transform: scale(1);
    }
    56% {
        transform: scale(1.2);
    }
}

@keyframes jello {
    0%, 11.1%, 100% {
        transform: none;
    }
    22.2% {
        transform: skewX(-12.5deg) skewY(-12.5deg);
    }
    33.3% {
        transform: skewX(6.25deg) skewY(6.25deg);
    }
    44.4% {
        transform: skewX(-3.125deg) skewY(-3.125deg);
    }
    55.5% {
        transform: skewX(1.5625deg) skewY(1.5625deg);
    }
    66.6% {
        transform: skewX(-0.78125deg) skewY(-0.78125deg);
    }
    77.7% {
        transform: skewX(0.390625deg) skewY(0.390625deg);
    }
    88.8% {
        transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
    }
}

.heartbeat { animation: heartbeat 1.5s ease-in-out infinite; }
.jello:hover { animation: jello 1s ease; }

/* ===== Notification Badge Animation ===== */
@keyframes notificationPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.notification-pulse {
    animation: notificationPulse 2s infinite;
}

/* ===== Skeleton Loading Animation ===== */
@keyframes skeletonShimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0px,
        #e0e0e0 40px,
        #f0f0f0 80px
    );
    background-size: 200px 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 16px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-image {
    height: 200px;
}

/* ===== Reduce Motion Preference ===== */
@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;
    }
}
