/* 高级动画效果库 */

/* 页面加载动画（优化性能） */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #2c3e50, #3498db);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease; /* 从0.8s优化到0.3s */
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 50px; /* 从60px减小到50px */
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3); /* 从4px减小到3px */
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite; /* 从1s加快到0.8s */
}

/* 滚动显现动画 */
.fade-in-up {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease;
}

.fade-in-up.animate {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s ease;
}

.fade-in-left.animate {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s ease;
}

.fade-in-right.animate {
    opacity: 1;
    transform: translateX(0);
}

.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s ease;
}

.scale-in.animate {
    opacity: 1;
    transform: scale(1);
}

.rotate-in {
    opacity: 0;
    transform: rotate(-180deg) scale(0.5);
    transition: all 1s ease;
}

.rotate-in.animate {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* 文字打字机效果已删除 */

/* 鼠标跟随效果已删除 */

/* 滚动进度条 */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(to right, var(--secondary-color), var(--accent-color));
    z-index: 1001;
    transition: width 0.25s ease;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.6);
    background: #2980b9;
}

/* 粒子动画背景 */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

/* 区域粒子样式 */
.section-particles {
    z-index: 1;
}

.section-particle {
    animation: sectionFloat 8s ease-in-out infinite;
}

/* 卡片悬停3D效果 */
.card-3d {
    perspective: 1000px;
    transition: all 0.3s ease;
}

.card-3d:hover {
    transform: rotateY(5deg) rotateX(5deg);
}

.card-flip {
    position: relative;
    perspective: 1000px;
    height: 250px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card-flip-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* 发光效果 */
.glow-effect {
    position: relative;
    overflow: hidden;
}

.glow-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s ease;
}

.glow-effect:hover::before {
    left: 100%;
}

/* 波浪动画 */
.wave-animation {
    position: relative;
    overflow: hidden;
}

.wave-animation::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 20px;
    background: linear-gradient(90deg, var(--secondary-color), transparent, var(--secondary-color));
    animation: wave 3s linear infinite;
    opacity: 0.7;
}

/* 脉冲动画 */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

.pulse-ring {
    position: relative;
}

.pulse-ring::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 2px solid var(--secondary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse-ring 2s ease-out infinite;
    opacity: 0;
}

/* 震动效果 */
.shake {
    animation: shake 0.5s ease-in-out;
}

/* 弹跳效果 */
.bounce-in {
    animation: bounceIn 1s ease;
}

/* 旋转加载效果 */
.rotating {
    animation: rotate 2s linear infinite;
}

/* CSS 关键帧动画定义 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 打字机动画已删除 */

/* 英雄区域粒子动画 */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0;
    }
    25% {
        transform: translateY(-10px) rotate(90deg);
        opacity: 0.7;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 1;
    }
    75% {
        transform: translateY(-10px) rotate(270deg);
        opacity: 0.7;
    }
}

/* 其他区域粒子动画 */
@keyframes sectionFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.3;
    }
    25% {
        transform: translateY(-15px) rotate(90deg);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-25px) rotate(180deg);
        opacity: 1;
    }
    75% {
        transform: translateY(-15px) rotate(270deg);
        opacity: 0.8;
    }
}

@keyframes wave {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.4);
        opacity: 0;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@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);
    }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 媒体查询 - 减少移动端动画 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 响应式动画调整 */
@media (max-width: 768px) {
    .cursor-dot,
    .cursor-outline {
        display: none;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .particles-container {
        display: none;
    }
}