/* 动画关键帧 */

/* 淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 淡出动画 */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* 从下滑入 */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 从上滑入 */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 从左滑入 */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 从右滑入 */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 缩放弹入 */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 弹跳动画 */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translate3d(0, -30px, 0);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0, -4px, 0);
    }
}

/* 脉冲动画 */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* 旋转动画 */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 浮动动画 */
@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
    100% {
        transform: translateY(0px);
    }
}

/* 摇晃动画 */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* 闪烁动画 */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 波纹动画 */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* 渐变动画 */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 打字机效果 */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blinkCursor {
    0%, 100% {
        border-right-color: transparent;
    }
    50% {
        border-right-color: currentColor;
    }
}

/* 卡片入场动画 */
@keyframes cardEnter {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 列表项入场动画 */
@keyframes listItemEnter {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 移动端模态框从底部滑入 */
@keyframes slideUpMobile {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 模态框弹入动画 */
@keyframes modalEnter {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 模态框弹出动画 */
@keyframes modalExit {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
}

/* 通知滑入动画 */
@keyframes notificationEnter {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 通知滑出动画 */
@keyframes notificationExit {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* 进度条动画 */
@keyframes progressBar {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

/* 骨架屏动画 */
@keyframes skeletonLoading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* 呼吸灯效果 */
@keyframes breathe {
    0% {
        box-shadow: 0 0 5px rgba(26, 115, 232, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(26, 115, 232, 0.8);
    }
    100% {
        box-shadow: 0 0 5px rgba(26, 115, 232, 0.5);
    }
}

/* 动画工具类 */

/* 淡入 */
.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* 从下滑入 */
.animate-slide-up {
    animation: slideUp 0.3s ease-out;
}

/* 从上滑入 */
.animate-slide-down {
    animation: slideDown 0.3s ease-out;
}

/* 从左滑入 */
.animate-slide-left {
    animation: slideInLeft 0.3s ease-out;
}

/* 从右滑入 */
.animate-slide-right {
    animation: slideInRight 0.3s ease-out;
}

/* 缩放弹入 */
.animate-scale-in {
    animation: scaleIn 0.3s ease-out;
}

/* 弹跳 */
.animate-bounce {
    animation: bounce 1s ease infinite;
}

/* 脉冲 */
.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* 旋转 */
.animate-spin {
    animation: spin 1s linear infinite;
}

/* 浮动 */
.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* 摇晃 */
.animate-shake {
    animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
}

/* 闪烁 */
.animate-blink {
    animation: blink 1s ease-in-out infinite;
}

/* 呼吸灯 */
.animate-breathe {
    animation: breathe 2s ease-in-out infinite;
}

/* 渐变背景 */
.animate-gradient {
    background-size: 200% 200%;
    animation: gradientShift 3s ease 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;
}

.delay-600 {
    animation-delay: 600ms;
}

.delay-700 {
    animation-delay: 700ms;
}

.delay-800 {
    animation-delay: 800ms;
}

.delay-900 {
    animation-delay: 900ms;
}

.delay-1000 {
    animation-delay: 1000ms;
}

/* 动画持续时间 */
.duration-100 {
    animation-duration: 100ms;
}

.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;
}

/* 动画填充模式 */
.fill-forwards {
    animation-fill-mode: forwards;
}

.fill-backwards {
    animation-fill-mode: backwards;
}

.fill-both {
    animation-fill-mode: both;
}

/* 动画迭代次数 */
.iterate-1 {
    animation-iteration-count: 1;
}

.iterate-2 {
    animation-iteration-count: 2;
}

.iterate-3 {
    animation-iteration-count: 3;
}

.iterate-infinite {
    animation-iteration-count: infinite;
}

/* 动画方向 */
.direction-normal {
    animation-direction: normal;
}

.direction-reverse {
    animation-direction: reverse;
}

.direction-alternate {
    animation-direction: alternate;
}

.direction-alternate-reverse {
    animation-direction: alternate-reverse;
}

/* 动画时间函数 */
.ease-linear {
    animation-timing-function: linear;
}

.ease-ease {
    animation-timing-function: ease;
}

.ease-ease-in {
    animation-timing-function: ease-in;
}

.ease-ease-out {
    animation-timing-function: ease-out;
}

.ease-ease-in-out {
    animation-timing-function: ease-in-out;
}

.ease-cubic-bezier {
    animation-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* 悬停动画效果 */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.hover-scale {
    transition: transform var(--transition-base);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(26, 115, 232, 0.4);
}

.hover-rotate {
    transition: transform var(--transition-base);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* 点击动画效果 */
.active-scale {
    transition: transform var(--transition-fast);
}

.active-scale:active {
    transform: scale(0.95);
}

.active-brightness {
    transition: filter var(--transition-fast);
}

.active-brightness:active {
    filter: brightness(0.9);
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-fade-in,
    .animate-slide-up,
    .animate-slide-down,
    .animate-slide-left,
    .animate-slide-right,
    .animate-scale-in,
    .animate-bounce,
    .animate-pulse,
    .animate-spin,
    .animate-float,
    .animate-shake,
    .animate-blink,
    .animate-breathe,
    .animate-gradient {
        animation: none !important;
    }
    
    .hover-lift:hover,
    .hover-scale:hover,
    .hover-glow:hover,
    .hover-rotate:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    .active-scale:active,
    .active-brightness:active {
        transform: none !important;
        filter: none !important;
    }
}

/* 打印模式 */
@media print {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}