/* 动画样式文件 */

/* 页面进入动画 */
.page-enter {
    opacity: 0;
    transform: translateY(30px);
    animation: pageEnter 0.8s ease-out forwards;
}

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

/* 元素进入动画 */
.element-enter {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.element-enter.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 延迟动画 */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }

/* 悬停动画 */
.hover-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.hover-scale {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.hover-rotate {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-glow {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
}

/* 文字动画 */
.text-reveal {
    overflow: hidden;
    position: relative;
}

.text-reveal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #295DFC;
    transform: translateX(-100%);
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.text-reveal.revealed::before {
    transform: translateX(100%);
}

.text-reveal span {
    position: relative;
    z-index: 2;
}

/* 数字计数动画 */
.counter {
    font-weight: 700;
    color: #295DFC;
}

/* 进度条动画 */
.progress-animate {
    width: 0;
    transition: width 2s ease-in-out;
}

.progress-animate.animate {
    width: var(--progress-width);
}

/* 圆形进度条 */
.circular-progress {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(#295DFC 0deg, #ecf0f1 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s ease;
}

.circular-progress::before {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
}

.circular-progress .progress-text {
    position: relative;
    z-index: 1;
    font-weight: 700;
    color: #2c3e50;
}

/* 加载动画 */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

/* 脉冲动画 */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 心跳动画 */
.heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.1);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.1);
    }
    70% {
        transform: scale(1);
    }
}

/* 摇摆动画 */
.wobble {
    animation: wobble 1s ease-in-out;
}

@keyframes wobble {
    0% {
        transform: translateX(0%);
    }
    15% {
        transform: translateX(-25%) rotate(-5deg);
    }
    30% {
        transform: translateX(20%) rotate(3deg);
    }
    45% {
        transform: translateX(-15%) rotate(-3deg);
    }
    60% {
        transform: translateX(10%) rotate(2deg);
    }
    75% {
        transform: translateX(-5%) rotate(-1deg);
    }
    100% {
        transform: translateX(0%);
    }
}

/* 弹跳进入 */
.bounce-in-left {
    animation: bounceInLeft 1s ease-out;
}

@keyframes bounceInLeft {
    0% {
        opacity: 0;
        transform: translateX(-2000px);
    }
    60% {
        opacity: 1;
        transform: translateX(30px);
    }
    80% {
        transform: translateX(-10px);
    }
    100% {
        transform: translateX(0);
    }
}

.bounce-in-right {
    animation: bounceInRight 1s ease-out;
}

@keyframes bounceInRight {
    0% {
        opacity: 0;
        transform: translateX(2000px);
    }
    60% {
        opacity: 1;
        transform: translateX(-30px);
    }
    80% {
        transform: translateX(10px);
    }
    100% {
        transform: translateX(0);
    }
}

/* 翻转动画 */
.flip-in-x {
    animation: flipInX 1s ease-out;
}

@keyframes flipInX {
    0% {
        opacity: 0;
        transform: perspective(400px) rotateX(90deg);
    }
    40% {
        transform: perspective(400px) rotateX(-20deg);
    }
    60% {
        opacity: 1;
        transform: perspective(400px) rotateX(10deg);
    }
    80% {
        transform: perspective(400px) rotateX(-5deg);
    }
    100% {
        transform: perspective(400px) rotateX(0deg);
    }
}

.flip-in-y {
    animation: flipInY 1s ease-out;
}

@keyframes flipInY {
    0% {
        opacity: 0;
        transform: perspective(400px) rotateY(90deg);
    }
    40% {
        transform: perspective(400px) rotateY(-20deg);
    }
    60% {
        opacity: 1;
        transform: perspective(400px) rotateY(10deg);
    }
    80% {
        transform: perspective(400px) rotateY(-5deg);
    }
    100% {
        transform: perspective(400px) rotateY(0deg);
    }
}

/* 缩放进入 */
.zoom-in {
    animation: zoomIn 0.8s ease-out;
}

@keyframes zoomIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}

.zoom-in-up {
    animation: zoomInUp 0.8s ease-out;
}

@keyframes zoomInUp {
    0% {
        opacity: 0;
        transform: scale(0.1) translateY(1000px);
    }
    60% {
        opacity: 1;
        transform: scale(0.475) translateY(-60px);
    }
    100% {
        transform: scale(1) translateY(0);
    }
}

/* 滑动进入 */
.slide-in-up {
    animation: slideInUp 0.8s ease-out;
}

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

.slide-in-down {
    animation: slideInDown 0.8s ease-out;
}

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

/* 淡入动画 */
.fade-in {
    animation: fadeIn 1s ease-out;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.fade-in-up {
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-down {
    animation: fadeInDown 1s ease-out;
}

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

.fade-in-left {
    animation: fadeInLeft 1s ease-out;
}

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

.fade-in-right {
    animation: fadeInRight 1s ease-out;
}

@keyframes fadeInRight {
    0% {
        opacity: 0;
        transform: translateX(30px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 旋转进入 */
.rotate-in {
    animation: rotateIn 1s ease-out;
}

@keyframes rotateIn {
    0% {
        opacity: 0;
        transform: rotate(-200deg);
    }
    100% {
        opacity: 1;
        transform: rotate(0deg);
    }
}

.rotate-in-down-left {
    animation: rotateInDownLeft 1s ease-out;
}

@keyframes rotateInDownLeft {
    0% {
        opacity: 0;
        transform: rotate(-45deg);
        transform-origin: left bottom;
    }
    100% {
        opacity: 1;
        transform: rotate(0deg);
        transform-origin: left bottom;
    }
}

/* 特殊效果 */
.shake {
    animation: shake 0.5s ease-in-out;
}

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

.rubber-band {
    animation: rubberBand 1s ease-out;
}

@keyframes rubberBand {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scaleX(1.25) scaleY(0.75);
    }
    40% {
        transform: scaleX(0.75) scaleY(1.25);
    }
    50% {
        transform: scaleX(1.15) scaleY(0.85);
    }
    65% {
        transform: scaleX(0.95) scaleY(1.05);
    }
    75% {
        transform: scaleX(1.05) scaleY(0.95);
    }
    100% {
        transform: scale(1);
    }
}

/* 滚动触发动画 */
.scroll-trigger {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* 3D变换 */
.transform-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.card-3d {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-3d:hover {
    transform: rotateY(180deg);
}

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

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

/* 响应式动画 */
@media (max-width: 1024px) {
    .hover-lift:hover {
        transform: translateY(-8px);
    }
    
    .hover-scale:hover {
        transform: scale(1.03);
    }
    
    .circular-progress {
        width: 110px;
        height: 110px;
    }
    
    .circular-progress::before {
        width: 75px;
        height: 75px;
    }
}

@media (max-width: 768px) {
    .hover-lift:hover {
        transform: translateY(-5px);
    }
    
    .hover-scale:hover {
        transform: scale(1.02);
    }
    
    .circular-progress {
        width: 100px;
        height: 100px;
    }
    
    .circular-progress::before {
        width: 70px;
        height: 70px;
    }
    
    /* 调整动画在小屏幕上的表现 */
    .element-enter,
    .page-enter,
    .slide-in-up,
    .slide-in-down,
    .fade-in-up,
    .fade-in-down,
    .fade-in-left,
    .fade-in-right {
        animation-duration: 0.6s;
    }
}

@media (max-width: 576px) {
    .hover-lift:hover {
        transform: translateY(-3px);
    }
    
    .hover-scale:hover {
        transform: scale(1.01);
    }
    
    .circular-progress {
        width: 90px;
        height: 90px;
    }
    
    .circular-progress::before {
        width: 60px;
        height: 60px;
    }
    
    .circular-progress .progress-text {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .hover-lift:hover,
    .hover-scale:hover {
        /* 在触摸设备上减少悬停效果，因为悬停在移动设备上不适用 */
        transform: none;
    }
    
    .circular-progress {
        width: 80px;
        height: 80px;
    }
    
    .circular-progress::before {
        width: 50px;
        height: 50px;
    }
    
    .circular-progress .progress-text {
        font-size: 0.8rem;
    }
    
    /* 优化小屏幕上的动画性能 */
    .pulse,
    .heartbeat,
    .wobble,
    .bounce-in-left,
    .bounce-in-right {
        animation-duration: 1.2s;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .circular-progress {
        width: 70px;
        height: 70px;
    }
    
    .circular-progress::before {
        width: 45px;
        height: 45px;
    }
    
    .circular-progress .progress-text {
        font-size: 0.75rem;
    }
}

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

/* 打印时隐藏动画 */
@media print {
    * {
        animation: none !important;
        transition: none !important;
    }
}
