/**
 * 한국미래사업학교 강연장 대관 - Animations Stylesheet
 * Cosmic theme animations with Antigravity effects
 * Selected Effects: 유성우 (Meteor Shower), 빛 페이드 (Light Fade)
 */

/* ========================================
   Cosmic Background Effects
======================================== */

/* Stars Background */
.cosmic-stars {
    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%;
    animation: twinkle var(--duration, 3s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

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

/* ========================================
   Meteor Shower Effect (유성우)
======================================== */
.meteor-shower {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.meteor {
    position: absolute;
    width: 2px;
    height: 80px;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.8) 50%,
        rgba(255, 215, 0, 1) 100%
    );
    transform: rotate(-45deg);
    animation: meteor-fall linear infinite;
    opacity: 0;
}

.meteor::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: var(--color-accent-gold);
    border-radius: 50%;
    box-shadow:
        0 0 10px var(--color-accent-gold),
        0 0 20px var(--color-accent-gold),
        0 0 40px rgba(255, 215, 0, 0.5);
}

@keyframes meteor-fall {
    0% {
        opacity: 0;
        transform: translateX(0) translateY(0) rotate(-45deg);
    }
    5% {
        opacity: 1;
    }
    95% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateX(-500px) translateY(500px) rotate(-45deg);
    }
}

/* Meteor Variations */
.meteor-1 {
    top: -80px;
    left: 20%;
    animation-duration: 2s;
    animation-delay: 0s;
}

.meteor-2 {
    top: -80px;
    left: 40%;
    animation-duration: 2.5s;
    animation-delay: 1.5s;
    height: 100px;
}

.meteor-3 {
    top: -80px;
    left: 60%;
    animation-duration: 1.8s;
    animation-delay: 3s;
    height: 60px;
}

.meteor-4 {
    top: -80px;
    left: 80%;
    animation-duration: 2.2s;
    animation-delay: 4.5s;
}

.meteor-5 {
    top: -80px;
    left: 10%;
    animation-duration: 2.8s;
    animation-delay: 6s;
    height: 120px;
}

.meteor-6 {
    top: -80px;
    left: 50%;
    animation-duration: 2s;
    animation-delay: 7.5s;
}

.meteor-7 {
    top: -80px;
    left: 70%;
    animation-duration: 2.3s;
    animation-delay: 9s;
    height: 90px;
}

.meteor-8 {
    top: -80px;
    left: 30%;
    animation-duration: 1.9s;
    animation-delay: 10.5s;
}

/* ========================================
   Light Fade Effect (빛 페이드)
======================================== */
.light-fade-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.light-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    animation: light-fade ease-in-out infinite;
}

.light-orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 35, 102, 0.3) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    animation-duration: 8s;
}

.light-orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.2) 0%, transparent 70%);
    bottom: -150px;
    left: -150px;
    animation-duration: 10s;
    animation-delay: 2s;
}

.light-orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.15) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 6s;
    animation-delay: 4s;
}

@keyframes light-fade {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

/* ========================================
   Page Load Animations
======================================== */
.page-transition-enter {
    opacity: 0;
}

.page-transition-enter-active {
    opacity: 1;
    transition: opacity 500ms ease-out;
}

.page-transition-exit {
    opacity: 1;
}

.page-transition-exit-active {
    opacity: 0;
    transition: opacity 500ms ease-in;
}

/* Staggered Load Animation */
[data-animate="fade-up"] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-animate="fade-up"].animated {
    opacity: 1;
    transform: translateY(0);
}

[data-animate="fade-down"] {
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-animate="fade-down"].animated {
    opacity: 1;
    transform: translateY(0);
}

[data-animate="fade-left"] {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-animate="fade-left"].animated {
    opacity: 1;
    transform: translateX(0);
}

[data-animate="fade-right"] {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-animate="fade-right"].animated {
    opacity: 1;
    transform: translateX(0);
}

[data-animate="scale-up"] {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-animate="scale-up"].animated {
    opacity: 1;
    transform: scale(1);
}

[data-animate="zoom-in"] {
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

[data-animate="zoom-in"].animated {
    opacity: 1;
    transform: scale(1);
}

/* Stagger delays */
[data-delay="100"] { transition-delay: 100ms; }
[data-delay="200"] { transition-delay: 200ms; }
[data-delay="300"] { transition-delay: 300ms; }
[data-delay="400"] { transition-delay: 400ms; }
[data-delay="500"] { transition-delay: 500ms; }
[data-delay="600"] { transition-delay: 600ms; }
[data-delay="700"] { transition-delay: 700ms; }
[data-delay="800"] { transition-delay: 800ms; }

/* ========================================
   Button Hover Animations
======================================== */
.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s ease;
}

.btn-shine:hover::before {
    left: 100%;
}

/* Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-effect 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-effect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

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

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

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

.card-hover-glow:hover {
    box-shadow:
        0 0 20px rgba(0, 35, 102, 0.2),
        0 10px 40px rgba(0, 0, 0, 0.1);
}

/* Border Animation */
.card-border-animate {
    position: relative;
}

.card-border-animate::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent-blue), var(--color-zendesk-green));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.card-border-animate:hover::before {
    transform: scaleX(1);
}

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

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

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

/* Ken Burns Effect */
.img-kenburns {
    animation: kenburns 20s ease-in-out infinite;
}

@keyframes kenburns {
    0% {
        transform: scale(1) translate(0, 0);
    }
    25% {
        transform: scale(1.1) translate(-2%, -2%);
    }
    50% {
        transform: scale(1.15) translate(2%, 2%);
    }
    75% {
        transform: scale(1.1) translate(-1%, 1%);
    }
    100% {
        transform: scale(1) translate(0, 0);
    }
}

/* ========================================
   Text Animations
======================================== */
/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--color-accent-gold);
    animation:
        typing 3.5s steps(40, end),
        blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--color-accent-gold) }
}

/* Text Reveal */
.text-reveal {
    position: relative;
    display: inline-block;
}

.text-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-accent-blue);
    animation: text-reveal 1s ease forwards;
    animation-delay: var(--reveal-delay, 0s);
}

@keyframes text-reveal {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(101%);
    }
}

/* Gradient Text Animation */
.text-gradient-animate {
    background: linear-gradient(
        90deg,
        var(--color-accent-blue),
        var(--color-nebula-pink),
        var(--color-accent-gold),
        var(--color-accent-blue)
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-flow 5s linear infinite;
}

@keyframes gradient-flow {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 300% 50%;
    }
}

/* ========================================
   Loading Animations
======================================== */
/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--color-accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

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

.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: 0; }

@keyframes dots-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-light-bg) 25%,
        #e5e7eb 50%,
        var(--color-light-bg) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

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

/* ========================================
   Counter Animation
======================================== */
.counter-animate {
    display: inline-block;
    min-width: 1em;
}

/* ========================================
   Scroll-triggered Animations
======================================== */
/* Parallax Effect */
.parallax {
    will-change: transform;
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent-blue), var(--color-zendesk-green));
    z-index: var(--z-fixed);
    transition: width 0.1s linear;
}

/* ========================================
   Modal Animations
======================================== */
.modal-fade-in {
    animation: modal-fade-in 0.3s ease-out forwards;
}

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

.modal-slide-up {
    animation: modal-slide-up 0.3s ease-out forwards;
}

@keyframes modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-scale-in {
    animation: modal-scale-in 0.3s ease-out forwards;
}

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

/* ========================================
   Notification Animations
======================================== */
.toast-enter {
    animation: toast-enter 0.3s ease-out forwards;
}

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

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

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

/* ========================================
   Slider Animations
======================================== */
/* Slide transition */
.slide-enter {
    opacity: 0;
    transform: translateX(100%);
}

.slide-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: all 500ms ease-out;
}

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

.slide-exit-active {
    opacity: 0;
    transform: translateX(-100%);
    transition: all 500ms ease-in;
}

/* Fade transition for slides */
.slide-fade-enter {
    opacity: 0;
}

.slide-fade-enter-active {
    opacity: 1;
    transition: opacity 500ms ease-out;
}

.slide-fade-exit {
    opacity: 1;
}

.slide-fade-exit-active {
    opacity: 0;
    transition: opacity 500ms ease-in;
}

/* ========================================
   Interactive Element Animations
======================================== */
/* Checkbox Animation */
.checkbox-animated {
    position: relative;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox-animated.checked {
    background: var(--color-accent-blue);
    border-color: var(--color-accent-blue);
}

.checkbox-animated.checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    animation: check-mark 0.2s ease-out forwards;
}

@keyframes check-mark {
    from {
        opacity: 0;
        transform: rotate(45deg) scale(0);
    }
    to {
        opacity: 1;
        transform: rotate(45deg) scale(1);
    }
}

/* Toggle Switch Animation */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border-medium);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.toggle-switch.active {
    background: var(--color-accent-blue);
}

.toggle-switch.active::after {
    transform: translateX(20px);
}

/* ========================================
   Success/Error Animations
======================================== */
/* Success Checkmark */
.success-checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-success);
    animation: success-pop 0.5s ease-out forwards;
}

.success-checkmark svg {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: draw-check 0.5s 0.3s ease-out forwards;
}

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

@keyframes draw-check {
    to {
        stroke-dashoffset: 0;
    }
}

/* Error Shake */
.shake-error {
    animation: shake 0.5s ease-in-out;
}

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

/* ========================================
   Performance Optimizations
======================================== */
/* Use will-change for frequently animated elements */
.animate-optimized {
    will-change: transform, opacity;
}

/* GPU acceleration for smooth animations */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
}

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

    .meteor-shower,
    .cosmic-stars,
    .light-fade-container {
        display: none;
    }

    [data-animate] {
        opacity: 1 !important;
        transform: none !important;
    }
}
