/* ========== 애니메이션 키프레임 ========== */

/* 스핀 애니메이션 */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 펄스 글로우 */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        filter: drop-shadow(0 0 0 rgba(99, 102, 241, 0));
    }
    50% {
        opacity: 0.8;
        filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.5));
    }
}

/* 페이드 펄스 */
@keyframes fade-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 모달 인 */
@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 모달 아웃 */
@keyframes modal-out {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
}

/* 하트 팝 */
@keyframes heart-pop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

/* 바운스 */
@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* 토스트 인 */
@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 토스트 아웃 */
@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* 쉬머 효과 */
@keyframes shimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

.admin-mark {
    background: linear-gradient(
        90deg,
        #38bdf8 0%,
        #60a5fa 25%,
        #3b82f6 50%,
        #60a5fa 75%,
        #38bdf8 100%
    );
    background-size: 200% auto;
    animation: shimmer 3s linear infinite;
}

/* 슬라이드 업 */
@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 슬라이드 다운 */
@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 페이드 인 */
@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 페이드 아웃 */
@keyframes fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* 스케일 인 */
@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 흔들기 */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* 플로트 */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* 글로우 펄스 */
@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.8), 0 0 30px rgba(99, 102, 241, 0.6);
    }
}

/* 그라데이션 시프트 */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 타이핑 효과 */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* 블링크 커서 */
@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* 리플 효과 */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* 회전 그라데이션 */
@keyframes rotate-gradient {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* 파티클 플로트 */
@keyframes particle-float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.5;
    }
}

/* ========== 애니메이션 유틸리티 클래스 ========== */

.animate-fade-in {
    animation: fade-in 0.5s ease forwards;
}

.animate-slide-up {
    animation: slide-up 0.5s ease forwards;
}

.animate-slide-down {
    animation: slide-down 0.5s ease forwards;
}

.animate-scale-in {
    animation: scale-in 0.3s ease forwards;
}

.animate-shake {
    animation: shake 0.5s ease;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-glow {
    animation: glow-pulse 2s ease-in-out infinite;
}

/* 스태거드 애니메이션 */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* 포스트 카드 입장 애니메이션 */
.post-card {
    animation: slide-up 0.5s ease forwards;
    opacity: 0;
}

.post-card:nth-child(1) { animation-delay: 0.1s; }
.post-card:nth-child(2) { animation-delay: 0.15s; }
.post-card:nth-child(3) { animation-delay: 0.2s; }
.post-card:nth-child(4) { animation-delay: 0.25s; }
.post-card:nth-child(5) { animation-delay: 0.3s; }
.post-card:nth-child(n+6) { animation-delay: 0.35s; }

/* 버튼 호버 효과 */
.btn-hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* 카드 호버 효과 */
.card-hover-glow:hover {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.3);
}

/* 링크 밑줄 애니메이션 */
.link-underline {
    position: relative;
}

.link-underline::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

.link-underline:hover::after {
    width: 100%;
}

/* 리플 버튼 */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* 3D 카드 틸트 효과 */
.card-3d {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.card-3d:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(-5deg);
}

/* 글래스모피즘 호버 */
.glass-hover {
    transition: all 0.3s ease;
}

.glass-hover:hover {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(30px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* 네온 글로우 텍스트 */
.neon-text {
    text-shadow: 
        0 0 5px var(--primary),
        0 0 10px var(--primary),
        0 0 20px var(--primary),
        0 0 40px var(--primary);
}

/* 그라데이션 텍스트 */
.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 회전 보더 */
.rotating-border {
    position: relative;
}

.rotating-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--gradient-primary);
    border-radius: inherit;
    z-index: -1;
    animation: rotate-gradient 3s linear infinite;
}

/* 파티클 배경 */
.particle-bg {
    position: relative;
    overflow: hidden;
}

.particle-bg::before,
.particle-bg::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    animation: particle-float 4s ease-in-out infinite;
}

.particle-bg::before {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.particle-bg::after {
    bottom: 20%;
    right: 10%;
    animation-delay: 2s;
}

/* 마우스 팔로우 글로우 (JS 필요) */
.mouse-glow {
    position: relative;
}

.mouse-glow::before {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mouse-glow:hover::before {
    opacity: 1;
}

/* 스무스 스크롤 인디케이터 */
.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient-primary);
    transform-origin: left;
    transform: scaleX(0);
    z-index: 9999;
}

/* 페이지 트랜지션 */
.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.page-transition-exit {
    opacity: 1;
    transform: translateY(0);
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 스켈레톤 로딩 */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--bg-secondary) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-card {
    height: 200px;
}
