/* 动画样式模块 v2.4.0 */

/* 关键帧动画定义 */

/* 渐入动画 - 从下方滑入 */
@keyframes slideInUp {
    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 fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/**
 * 缩放动画
 */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/**
 * 波纹动画
 */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/**
 * 弹跳动画
 */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-30px);
    }
    70% {
        transform: translateY(-15px);
    }
    90% {
        transform: translateY(-4px);
    }
}

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

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

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

/* ===== 动画类定义 ===== */

/**
 * 渐入类
 */
.animate-in {
    animation-name: slideInUp;
    animation-duration: 0.6s;
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-in-left {
    animation-name: slideInLeft;
    animation-duration: 0.6s;
    animation-fill-mode: forwards;
}

.animate-in-right {
    animation-name: slideInRight;
    animation-duration: 0.6s;
    animation-fill-mode: forwards;
}

.animate-fade-in {
    animation-name: fadeIn;
    animation-duration: 0.4s;
    animation-fill-mode: forwards;
}

.animate-scale-in {
    animation-name: scaleIn;
    animation-duration: 0.4s;
    animation-fill-mode: forwards;
}

/**
 * 悬停动画效果
 */
.hover-lift {
    transition: transform var(--transition-normal) ease, box-shadow var(--transition-normal) ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

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

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

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

.hover-pulse:hover {
    animation: pulse 1s infinite;
}

/**
 * 按钮动画
 */
.btn-animate {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal) ease;
}

.btn-animate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 120, 212, 0.3);
}

.btn-animate:active {
    transform: translateY(0);
    transition: all 0.1s ease;
}

/**
 * 加载动画
 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0078d4;
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

/**
 * 成功动画
 */
.success-bounce {
    animation: bounce 1s ease-in-out;
}

/**
 * 错误动画
 */
.error-shake {
    animation: shake 0.5s ease-in-out;
}

/* ===== 响应式动画适配 ===== */

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

/**
 * 针对慢速设备的动画优化
 */
@media (max-width: 480px) {
    .animate-in {
        animation-duration: 0.4s;
    }
    
    .hover-lift:hover {
        transform: none;
    }
    
    .hover-scale:hover {
        transform: none;
    }
}

/* ===== 暗色主题动画适配 ===== */
.theme-apple .btn-animate:hover {
    box-shadow: 0 8px 20px rgba(192, 192, 192, 0.3);
}

.theme-apple .success-bounce {
    animation: bounce 1s ease-in-out;
}

/* ===== 高对比度模式适配 ===== */
@media (prefers-contrast: high) {
    .animate-in,
    .animate-fade-in,
    .animate-scale-in {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* ===== 自定义属性动画支持 ===== */
:root {
    --animation-delay: 0s;
    --animation-duration: 0.6s;
    --animation-timing: cubic-bezier(0.4, 0, 0.2, 1);
}

/**
 * 延迟动画
 */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

/**
 * 持续时间
 */
.animate-duration-fast { animation-duration: 0.3s; }
.animate-duration-normal { animation-duration: 0.6s; }
.animate-duration-slow { animation-duration: 1s; }