/* ============================================
 * Animations CSS - 动画效果
 * 包含：淡入淡出、滑动、脉冲、悬停效果
 * ============================================ */

/* 基础动画 */
.animate-fade-in {
    animation: fadeIn var(--transition-normal) forwards;
}

.animate-fade-out {
    animation: fadeOut var(--transition-normal) forwards;
}

.animate-slide-up {
    animation: slideUp var(--transition-normal) forwards;
}

.animate-slide-down {
    animation: slideDown var(--transition-normal) forwards;
}

.animate-slide-left {
    animation: slideLeft var(--transition-normal) forwards;
}

.animate-slide-right {
    animation: slideRight var(--transition-normal) forwards;
}

.animate-scale-in {
    animation: scaleIn var(--transition-normal) forwards;
}

.animate-scale-out {
    animation: scaleOut var(--transition-normal) forwards;
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

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

.animate-shake {
    animation: shake 0.5s ease;
}

/* 动画定义 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@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 pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 217, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 217, 255, 0.6);
    }
}

/* 悬停效果 */
.hover-lift {
    transition: transform var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

.hover-scale {
    transition: transform var(--transition-normal);
}

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

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

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

.hover-bg {
    transition: background var(--transition-normal);
}

.hover-bg:hover {
    background: var(--bg-hover);
}

.hover-border {
    transition: border-color var(--transition-normal);
}

.hover-border:hover {
    border-color: var(--accent-blue);
}

/* 点击效果 */
.click-ripple {
    position: relative;
    overflow: hidden;
}

.click-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.click-ripple:active::after {
    width: 200%;
    height: 200%;
}

/* 入场动画序列 */
.stagger-children > * {
    opacity: 0;
    animation: slideUp var(--transition-normal) forwards;
}

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

/* 页面入场动画 */
.page-enter {
    animation: pageEnter 0.6s ease forwards;
}

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

/* 加载动画 */
.loading-dots {
    display: flex;
    gap: var(--spacing-sm);
}

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

.loading-dots span:nth-child(1) { animation-delay: 0ms; }
.loading-dots span:nth-child(2) { animation-delay: 200ms; }
.loading-dots span:nth-child(3) { animation-delay: 400ms; }

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

/* 渐变动画 */
.gradient-animate {
    background-size: 200% 200%;
    animation: gradientMove 3s ease infinite;
}

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

/* 文字动画 */
.text-shimmer {
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* 性能优化 - 使用 transform 和 opacity */
.animate-optimize {
    will-change: transform, opacity;
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}