/* 动画效果样式 */

/* 基础动画变量 */
:root {
    --animation-duration-fast: 0.15s;
    --animation-duration-normal: 0.3s;
    --animation-duration-slow: 0.6s;
    --animation-easing: cubic-bezier(0.4, 0, 0.2, 1);
    --animation-easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* 页面加载动画 */
@keyframes pageLoad {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-enter {
    animation: pageLoad var(--animation-duration-slow) var(--animation-easing);
}

/* 淡入动画 */
@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn var(--animation-duration-normal) var(--animation-easing);
}

/* 向上滑动 */
@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp var(--animation-duration-normal) var(--animation-easing);
}

/* 向下滑动 */
@keyframes slideDown {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-down {
    animation: slideDown var(--animation-duration-normal) var(--animation-easing);
}

/* 向左滑动 */
@keyframes slideLeft {
    0% {
        opacity: 0;
        transform: translateX(30px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-left {
    animation: slideLeft var(--animation-duration-normal) var(--animation-easing);
}

/* 向右滑动 */
@keyframes slideRight {
    0% {
        opacity: 0;
        transform: translateX(-30px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-right {
    animation: slideRight var(--animation-duration-normal) var(--animation-easing);
}

/* 缩放进入 */
@keyframes scaleIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scaleIn var(--animation-duration-normal) var(--animation-easing);
}

/* 弹跳进入 */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.bounce-in {
    animation: bounceIn var(--animation-duration-slow) var(--animation-easing-bounce);
}

/* 旋转进入 */
@keyframes rotateIn {
    0% {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

.rotate-in {
    animation: rotateIn var(--animation-duration-slow) var(--animation-easing);
}

/* 脉冲效果 */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* 心跳效果 */
@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.3);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.3);
    }
    70% {
        transform: scale(1);
    }
}

.heartbeat {
    animation: heartbeat 1.5s infinite;
}

/* 闪烁效果 */
@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

.blink {
    animation: blink 1s infinite;
}

/* 摇晃效果 */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.5s;
}

/* 悬停效果 */
.hover-lift {
    transition: transform var(--animation-duration-normal) var(--animation-easing);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

.hover-scale {
    transition: transform var(--animation-duration-normal) var(--animation-easing);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform var(--animation-duration-normal) var(--animation-easing);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* 按钮动画 */
.btn-animated {
    position: relative;
    overflow: hidden;
}

.btn-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-animated:hover::before {
    left: 100%;
}

/* 加载动画 */
@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.loading-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: loadingDots 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

/* 进度条动画 */
@keyframes progressFill {
    0% {
        width: 0%;
    }
    100% {
        width: var(--progress-width, 0%);
    }
}

.progress-fill {
    animation: progressFill var(--animation-duration-slow) var(--animation-easing);
}

/* 成功动画 */
@keyframes successCheck {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-45deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.2) rotate(-45deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.success-check {
    animation: successCheck var(--animation-duration-normal) var(--animation-easing);
}

/* 错误动画 */
@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

.error-shake {
    animation: errorShake 0.5s;
}

/* 滚动动画 */
@keyframes scrollIndicator {
    0% {
        opacity: 0;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(10px);
    }
    100% {
        opacity: 0;
        transform: translateY(20px);
    }
}

.scroll-indicator {
    animation: scrollIndicator 2s infinite;
}

/* 打字机效果 */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    white-space: nowrap;
    animation: typewriter 2s steps(40, end), blink 1s infinite;
}

/* 波浪效果 */
@keyframes wave {
    0%, 60%, 100% {
        transform: initial;
    }
    30% {
        transform: translateY(-15px);
    }
}

.wave-animation span {
    display: inline-block;
    animation: wave 1.3s infinite;
}

.wave-animation span:nth-child(2) { animation-delay: 0.1s; }
.wave-animation span:nth-child(3) { animation-delay: 0.2s; }
.wave-animation span:nth-child(4) { animation-delay: 0.3s; }
.wave-animation span:nth-child(5) { animation-delay: 0.4s; }
.wave-animation span:nth-child(6) { animation-delay: 0.5s; }

/* 浮动效果 */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.float {
    animation: float 3s ease-in-out infinite;
}

/* 渐变背景动画 */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-animate {
    background: linear-gradient(-45deg, var(--primary-color), var(--primary-hover), #7c3aed, #06b6d4);
    background-size: 400% 400%;
    animation: gradientShift 4s ease infinite;
}

/* 卡片悬停效果 */
.card-hover {
    transition: all var(--animation-duration-normal) var(--animation-easing);
}

.card-hover:hover {
    transform: translateY(-8px) rotate(1deg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 列表项动画 */
@keyframes listItemEnter {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.list-item-animated {
    animation: listItemEnter var(--animation-duration-normal) var(--animation-easing);
}

.list-item-animated:nth-child(1) { animation-delay: 0.1s; }
.list-item-animated:nth-child(2) { animation-delay: 0.2s; }
.list-item-animated:nth-child(3) { animation-delay: 0.3s; }
.list-item-animated:nth-child(4) { animation-delay: 0.4s; }
.list-item-animated:nth-child(5) { animation-delay: 0.5s; }

/* 模态框动画 */
@keyframes modalEnter {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-enter {
    animation: modalEnter var(--animation-duration-normal) var(--animation-easing);
}

/* 工具提示动画 */
@keyframes tooltipEnter {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.tooltip-enter {
    animation: tooltipEnter var(--animation-duration-fast) var(--animation-easing);
}

/* 数字计数动画 */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.count-up {
    animation: countUp var(--animation-duration-slow) var(--animation-easing);
}

/* 交错动画类 */
.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; }
.stagger-6 { animation-delay: 0.6s; }
.stagger-7 { animation-delay: 0.7s; }
.stagger-8 { animation-delay: 0.8s; }

/* 延迟显示类 */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-500 { animation-delay: 0.5s; }
.delay-1000 { animation-delay: 1s; }

/* 动画填充模式 */
.animation-fill-forwards {
    animation-fill-mode: forwards;
}

.animation-fill-backwards {
    animation-fill-mode: backwards;
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
