/* 动画样式文件 - 流畅的动画效果 */

/* 浮动动画 */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

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

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

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

.animate-float-delayed {
    animation: float-delayed 8s ease-in-out infinite;
    animation-delay: 2s;
}

.animate-float-slow {
    animation: float-slow 10s ease-in-out infinite;
    animation-delay: 4s;
}

/* 淡入向上动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.animate-fade-in-up[data-delay="0.1s"] { animation-delay: 0.1s; }
.animate-fade-in-up[data-delay="0.2s"] { animation-delay: 0.2s; }
.animate-fade-in-up[data-delay="0.3s"] { animation-delay: 0.3s; }
.animate-fade-in-up[data-delay="0.4s"] { animation-delay: 0.4s; }

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

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

/* 脉冲动画 */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
}

/* 旋转动画 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 缩放动画 */
@keyframes scale {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0,0,0);
    }
    40%, 43% {
        transform: translate3d(0, -15px, 0);
    }
    70% {
        transform: translate3d(0, -7px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

/* 滑入动画 */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 渐变动画 */
@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 抖动动画 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

/* 加载动画 */
@keyframes loading {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes loading-dots {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

/* 动画类 */
.animate-fade-in-up { animation: fadeInUp 0.6s ease-out; }
.animate-fade-in-down { animation: fadeInDown 0.6s ease-out; }
.animate-fade-in-left { animation: fadeInLeft 0.6s ease-out; }
.animate-fade-in-right { animation: fadeInRight 0.6s ease-out; }
.animate-fade-in { animation: fadeIn 0.6s ease-out; }

.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.animate-pulse-glow { animation: pulse-glow 2s infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-spin-slow { animation: spin-slow 3s linear infinite; }
.animate-scale { animation: scale 2s ease-in-out infinite; }
.animate-bounce { animation: bounce 1s infinite; }

.animate-slide-in-up { animation: slideInUp 0.5s ease-out; }
.animate-slide-in-down { animation: slideInDown 0.5s ease-out; }
.animate-slide-in-left { animation: slideInLeft 0.5s ease-out; }
.animate-slide-in-right { animation: slideInRight 0.5s ease-out; }

.animate-gradient { animation: gradient 3s ease infinite; background-size: 200% 200%; }
.animate-shake { animation: shake 0.5s ease-in-out; }
.animate-loading { animation: loading 1s linear infinite; }

/* 延迟类 */
.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; }

/* 持续时间类 */
.duration-300 { animation-duration: 300ms; }
.duration-500 { animation-duration: 500ms; }
.duration-700 { animation-duration: 700ms; }
.duration-1000 { animation-duration: 1000ms; }

/* 缓动函数类 */
.ease-linear { animation-timing-function: linear; }
.ease-in { animation-timing-function: ease-in; }
.ease-out { animation-timing-function: ease-out; }
.ease-in-out { animation-timing-function: ease-in-out; }

/* 填充模式 */
.forwards { animation-fill-mode: forwards; }
.backwards { animation-fill-mode: backwards; }
.both { animation-fill-mode: both; }

/* 方向类 */
.alternate { animation-direction: alternate; }
.alternate-reverse { animation-direction: alternate-reverse; }
.reverse { animation-direction: reverse; }

/* 循环次数 */
.infinite { animation-iteration-count: infinite; }
.once { animation-iteration-count: 1; }
.twice { animation-iteration-count: 2; }

/* 暂停和播放 */
.paused { animation-play-state: paused; }
.running { animation-play-state: running; }

/* 悬停时的动画状态 */
.hover\:animate-pulse:hover { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.hover\:animate-scale:hover { animation: scale 0.3s ease-in-out; }
.hover\:animate-shake:hover { animation: shake 0.5s ease-in-out; }

/* 页面滚动时的动画 */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 加载动画组件 */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: loading 1s linear infinite;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

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

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

/* 打字机效果 */
.typewriter {
    overflow: hidden;
    border-right: .15em solid var(--primary-color);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret .75s step-end infinite;
}

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

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

/* 渐变背景动画 */
.animated-gradient {
    background: linear-gradient(-45deg, #3b82f6, #8b5cf6, #6366f1, #3b82f6);
    background-size: 400% 400%;
    animation: gradient 4s ease infinite;
}

/* 光效动画 */
.glow-effect {
    position: relative;
}

.glow-effect::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #3b82f6, #8b5cf6, #6366f1, #3b82f6);
    border-radius: inherit;
    z-index: -1;
    opacity: 0.7;
    animation: gradient 3s ease infinite;
    filter: blur(10px);
}

/* 波纹效果 */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::before {
    width: 300px;
    height: 300px;
}

/* 3D翻转效果 */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* 新增现代化动画效果 */

/* 微交互动画 */
@keyframes buttonPulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

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

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

@keyframes slideInFromLeft {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromTop {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 粒子动画 */
@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 1;
    }
    33% {
        transform: translateY(-30px) rotate(120deg);
        opacity: 0.8;
    }
    66% {
        transform: translateY(-60px) rotate(240deg);
        opacity: 0.6;
    }
}

/* 波纹扩散动画 */
@keyframes rippleExpand {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* 文字打字机效果增强 */
@keyframes typewriterAdvanced {
    0% { width: 0; }
    50% { width: 100%; }
    100% { width: 100%; }
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 磁性悬停效果 */
@keyframes magneticHover {
    0% { transform: translate(0, 0); }
    25% { transform: translate(2px, -2px); }
    50% { transform: translate(-1px, 2px); }
    75% { transform: translate(-3px, -1px); }
    100% { transform: translate(0, 0); }
}

/* 颜色变换动画 */
@keyframes colorShift {
    0% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(180deg); }
    100% { filter: hue-rotate(360deg); }
}

/* 数字滚动动画 */
@keyframes numberRoll {
    0% { transform: translateY(100%); }
    100% { transform: translateY(0); }
}

/* 进度条填充动画 */
@keyframes progressFill {
    0% { width: 0%; }
    100% { width: var(--progress-width, 100%); }
}

/* 动画类定义 */
.animate-button-pulse {
    animation: buttonPulse 1.5s infinite;
}

.animate-heartbeat {
    animation: heartbeat 1s ease-in-out infinite;
}

.animate-wiggle {
    animation: wiggle 0.5s ease-in-out;
}

.animate-slide-in-left {
    animation: slideInFromLeft 0.6s ease-out;
}

.animate-slide-in-right {
    animation: slideInFromRight 0.6s ease-out;
}

.animate-slide-in-top {
    animation: slideInFromTop 0.6s ease-out;
}

.animate-slide-in-bottom {
    animation: slideInFromBottom 0.6s ease-out;
}

.animate-particle-float {
    animation: particleFloat 4s ease-in-out infinite;
}

.animate-ripple {
    animation: rippleExpand 0.6s ease-out;
}

.animate-typewriter {
    animation: typewriterAdvanced 3s steps(40) 1s both;
}

.animate-cursor {
    animation: cursorBlink 1s step-end infinite;
}

.animate-magnetic:hover {
    animation: magneticHover 0.3s ease-in-out;
}

.animate-color-shift {
    animation: colorShift 3s linear infinite;
}

.animate-number-roll {
    animation: numberRoll 0.6s ease-out;
}

.animate-progress {
    animation: progressFill 2s ease-out;
}

/* 交互式动画增强 */
.interactive-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

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

.interactive-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.interactive-button::before {
    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 ease, height 0.6s ease;
    border-radius: 50%;
}

.interactive-button:hover::before {
    width: 300px;
    height: 300px;
}

/* 视差滚动效果 */
.parallax-element {
    transform: translateZ(0);
    will-change: transform;
}

/* 高级加载动画 */
.skeleton-loader {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
}

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

/* 彩虹边框动画 */
.rainbow-border {
    position: relative;
    background: var(--bg-primary);
    border-radius: 1rem;
}

.rainbow-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(from 0deg, #ff0000, #ff8800, #ffff00, #88ff00, #00ff00, #00ff88, #00ffff, #0088ff, #0000ff, #8800ff, #ff00ff, #ff0088, #ff0000);
    animation: rainbowSpin 3s linear infinite;
    z-index: -1;
}

@keyframes rainbowSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 液体按钮效果 */
.liquid-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.liquid-button::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 ease;
}

.liquid-button:hover::before {
    left: 100%;
}

/* 文本闪烁效果 */
.text-shimmer {
    background: linear-gradient(90deg, #000 0%, #fff 50%, #000 100%);
    background-size: 200% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textShimmer 2s ease-in-out infinite;
}

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

/* 高级滚动触发动画 */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal.from-left {
    transform: translateX(-50px) translateY(0);
}

.scroll-reveal.from-left.revealed {
    transform: translateX(0) translateY(0);
}

.scroll-reveal.from-right {
    transform: translateX(50px) translateY(0);
}

.scroll-reveal.from-right.revealed {
    transform: translateX(0) translateY(0);
}

/* 粘性悬停效果 */
.sticky-hover {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}

.sticky-hover:hover {
    transform: scale(1.05) rotate(1deg);
    filter: brightness(1.1);
}

/* 呼吸灯效果 */
.breathing-light {
    animation: breathe 3s ease-in-out infinite;
}

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

/* 多层阴影动画 */
.layered-shadow {
    transition: all 0.3s ease;
    box-shadow: 
        0 1px 3px rgba(0,0,0,0.12),
        0 1px 2px rgba(0,0,0,0.24);
}

.layered-shadow:hover {
    box-shadow: 
        0 14px 28px rgba(0,0,0,0.25),
        0 10px 10px rgba(0,0,0,0.22),
        0 0 20px rgba(59, 130, 246, 0.3);
}

/* 性能优化 */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* 动画延迟工具类 */
.delay-75 { animation-delay: 75ms; }
.delay-150 { animation-delay: 150ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-500 { animation-delay: 500ms; }
.delay-700 { animation-delay: 700ms; }
.delay-1000 { animation-delay: 1000ms; }

/* 动画持续时间工具类 */
.duration-150 { animation-duration: 150ms; }
.duration-200 { animation-duration: 200ms; }
.duration-300 { animation-duration: 300ms; }
.duration-500 { animation-duration: 500ms; }
.duration-700 { animation-duration: 700ms; }
.duration-1000 { animation-duration: 1000ms; }
.duration-1500 { animation-duration: 1500ms; }
.duration-2000 { animation-duration: 2000ms; }

/* 缓动函数工具类 */
.ease-in-quad { animation-timing-function: cubic-bezier(0.55, 0.085, 0.68, 0.53); }
.ease-out-quad { animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.ease-in-out-quad { animation-timing-function: cubic-bezier(0.455, 0.03, 0.515, 0.955); }
.ease-in-cubic { animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }
.ease-out-cubic { animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }
.ease-in-out-cubic { animation-timing-function: cubic-bezier(0.645, 0.045, 0.355, 1); }

/* 移动端动画优化 */
@media (max-width: 768px) {
    .animate-fade-in-up,
    .animate-slide-in-left,
    .animate-slide-in-right {
        animation-duration: 0.4s;
    }
    
    .interactive-card:hover {
        transform: translateY(-4px);
    }
}

/* 减少动画偏好设置 */
@media (prefers-reduced-motion: reduce) {
    .animate-button-pulse,
    .animate-heartbeat,
    .animate-particle-float,
    .breathing-light,
    .animate-color-shift,
    .rainbow-border::before {
        animation: none !important;
    }
    
    .interactive-card,
    .interactive-button,
    .sticky-hover {
        transition: none !important;
    }
}