/**
 * animations.css - 애니메이션 스타일시트
 * 소리튠영어 - Cosmic Visual Effects
 * Selected Effects: 앰비언트 (Light Ambient), 소용돌이 (Swirl), 픽셀화 (Pixelate)
 */

/* ==========================================
   Keyframe Animations
   ========================================== */

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

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

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

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

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(99, 102, 241, 0.6);
    }
}

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

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

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

/* Shimmer Animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Twinkle (Stars) */
@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Bounce */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
        transform: translateY(0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translateY(-15px);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translateY(-7px);
    }
    90% {
        transform: translateY(-2px);
    }
}

/* ==========================================
   Cosmic Background Effects - Ambient Glow
   ========================================== */
.ambient-glow {
    position: relative;
    overflow: hidden;
}

.ambient-glow::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        ellipse at center,
        rgba(99, 102, 241, 0.15) 0%,
        rgba(139, 92, 246, 0.1) 25%,
        rgba(236, 72, 153, 0.05) 50%,
        transparent 70%
    );
    animation: ambientRotate 30s linear infinite;
    pointer-events: none;
}

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

/* Ambient Orbs */
.ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.4;
    pointer-events: none;
    animation: orbFloat 20s ease-in-out infinite;
}

.ambient-orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.6) 0%, transparent 70%);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.ambient-orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.5) 0%, transparent 70%);
    top: 50%;
    right: -100px;
    animation-delay: -7s;
}

.ambient-orb-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.4) 0%, transparent 70%);
    bottom: -100px;
    left: 30%;
    animation-delay: -14s;
}

@keyframes orbFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(30px, -30px) scale(1.1);
    }
    50% {
        transform: translate(-20px, 20px) scale(0.9);
    }
    75% {
        transform: translate(10px, 10px) scale(1.05);
    }
}

/* ==========================================
   Swirl Effect
   ========================================== */
.swirl-effect {
    position: relative;
}

.swirl-effect::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: conic-gradient(
        from 0deg at 50% 50%,
        transparent 0deg,
        rgba(99, 102, 241, 0.1) 60deg,
        transparent 120deg,
        rgba(139, 92, 246, 0.1) 180deg,
        transparent 240deg,
        rgba(236, 72, 153, 0.1) 300deg,
        transparent 360deg
    );
    transform: translate(-50%, -50%);
    animation: swirlRotate 20s linear infinite;
    pointer-events: none;
    opacity: 0.5;
}

@keyframes swirlRotate {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Swirl on hover */
.swirl-hover {
    transition: transform 0.5s ease;
}

.swirl-hover:hover {
    animation: swirlWobble 0.5s ease;
}

@keyframes swirlWobble {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(2deg) scale(1.02);
    }
    50% {
        transform: rotate(-1deg) scale(1.01);
    }
    75% {
        transform: rotate(1deg) scale(1.02);
    }
}

/* ==========================================
   Pixelate Effect (on load/transition)
   ========================================== */
.pixelate-reveal {
    animation: pixelateIn 0.8s ease-out forwards;
}

@keyframes pixelateIn {
    0% {
        filter: blur(10px);
        opacity: 0;
        transform: scale(0.95);
    }
    30% {
        filter: blur(5px);
        opacity: 0.5;
    }
    60% {
        filter: blur(2px);
        opacity: 0.8;
    }
    100% {
        filter: blur(0);
        opacity: 1;
        transform: scale(1);
    }
}

/* Pixel Grid Background */
.pixel-grid {
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* ==========================================
   Animation Utility Classes
   ========================================== */
.animate-fadeIn {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fadeInDown {
    animation: fadeInDown 0.6s ease-out forwards;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.animate-fadeInRight {
    animation: fadeInRight 0.6s ease-out forwards;
}

.animate-scaleIn {
    animation: scaleIn 0.5s ease-out forwards;
}

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

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

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

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

.animate-shimmer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Stagger Delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }

/* Animation on Scroll (Initial State) */
.aos-init {
    opacity: 0;
    transform: translateY(30px);
}

.aos-animate {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* ==========================================
   Slider Animations
   ========================================== */
.slider-slide {
    transition: transform 500ms ease, opacity 500ms ease;
}

.slider-slide-enter {
    opacity: 0;
    transform: translateX(100%);
}

.slider-slide-enter-active {
    opacity: 1;
    transform: translateX(0);
}

.slider-slide-exit {
    opacity: 1;
    transform: translateX(0);
}

.slider-slide-exit-active {
    opacity: 0;
    transform: translateX(-100%);
}

/* Slider Navigation Dots */
.slider-dot {
    transition: all 0.3s ease;
}

.slider-dot:hover {
    transform: scale(1.2);
}

.slider-dot.active {
    background: var(--primary);
    transform: scale(1.3);
}

/* ==========================================
   Interactive Hover Effects
   ========================================== */

/* Card Hover with Glow */
.card-hover-glow {
    transition: all 0.4s ease;
}

.card-hover-glow:hover {
    transform: translateY(-8px);
    box-shadow:
        0 20px 40px rgba(99, 102, 241, 0.2),
        0 0 30px rgba(99, 102, 241, 0.1);
}

/* Button Hover Effects */
.btn-hover-lift {
    transition: all 0.3s ease;
}

.btn-hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

/* Image Hover Zoom */
.img-hover-zoom {
    overflow: hidden;
}

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

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

/* Link Underline Animation */
.link-underline {
    position: relative;
}

.link-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.link-underline:hover::after {
    width: 100%;
}

/* ==========================================
   Stars Background Animation
   ========================================== */
.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
}

.star-small {
    width: 1px;
    height: 1px;
    animation: twinkle 3s ease-in-out infinite;
}

.star-medium {
    width: 2px;
    height: 2px;
    animation: twinkle 4s ease-in-out infinite;
}

.star-large {
    width: 3px;
    height: 3px;
    animation: twinkle 5s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

/* Shooting Star */
@keyframes shootingStar {
    0% {
        transform: translateX(0) translateY(0) rotate(-45deg);
        opacity: 1;
    }
    100% {
        transform: translateX(300px) translateY(300px) rotate(-45deg);
        opacity: 0;
    }
}

.shooting-star {
    position: absolute;
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, white, transparent);
    animation: shootingStar 1.5s ease-out;
    opacity: 0;
}

/* ==========================================
   Gradient Text Animation
   ========================================== */
.gradient-text {
    background: linear-gradient(
        135deg,
        var(--primary) 0%,
        var(--secondary) 25%,
        var(--accent) 50%,
        var(--secondary) 75%,
        var(--primary) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 5s ease infinite;
}

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

/* ==========================================
   Loading Animations
   ========================================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        var(--bg-primary) 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-circle {
    border-radius: 50%;
}

/* Dots Loading */
.loading-dots {
    display: flex;
    gap: 6px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
}

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

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==========================================
   Progress Bar Animation
   ========================================== */
.progress-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--cosmic-gradient-light);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
    animation: progressGlow 2s ease-in-out infinite;
}

@keyframes progressGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.5);
    }
    50% {
        box-shadow: 0 0 15px rgba(99, 102, 241, 0.8);
    }
}

/* ==========================================
   VAK Test Specific Animations
   ========================================== */
.vak-option {
    transition: all 0.3s ease;
}

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

.vak-option.selected {
    border-color: var(--primary);
    background: var(--bg-secondary);
    animation: selectedPulse 0.3s ease;
}

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

/* Result Reveal Animation */
.result-reveal {
    animation: resultReveal 1s ease-out forwards;
}

@keyframes resultReveal {
    0% {
        opacity: 0;
        transform: scale(0.8) rotateY(-10deg);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.05) rotateY(5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotateY(0);
    }
}

/* Chart Animation */
.chart-container canvas {
    animation: chartFadeIn 0.8s ease-out forwards;
}

@keyframes chartFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================
   Number Counter Animation
   ========================================== */
.counter-value {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

.counter-animate {
    animation: counterPop 0.3s ease-out;
}

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

/* ==========================================
   Notification / Toast Animation
   ========================================== */
.toast {
    animation: toastSlideIn 0.3s ease-out forwards;
}

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

.toast-exit {
    animation: toastSlideOut 0.3s ease-in forwards;
}

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

/* ==========================================
   Reduced Motion Override
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    .animate-fadeIn,
    .animate-fadeInUp,
    .animate-fadeInDown,
    .animate-fadeInLeft,
    .animate-fadeInRight,
    .animate-scaleIn,
    .animate-pulse,
    .animate-float,
    .animate-bounce,
    .animate-rotate,
    .animate-shimmer {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}
