/* 高级动画效果 */

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

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(212, 175, 55, 0.6);
    }
}

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

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@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 shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

@keyframes colorShift {
    0% {
        filter: hue-rotate(0deg);
    }
    50% {
        filter: hue-rotate(180deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    }
    50% {
        text-shadow:
            0 0 20px rgba(212, 175, 55, 0.8),
            0 0 30px rgba(212, 175, 55, 0.6),
            0 0 40px rgba(212, 175, 55, 0.4);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 50% {
        border-color: transparent;
    }
    51%, 100% {
        border-color: var(--primary-color);
    }
}

/* 页面进入动画 */
.fade-in {
    animation: fadeIn 0.8s ease-out;
}

.slide-in-up {
    animation: slideInUp 0.8s ease-out;
}

.slide-in-left {
    animation: slideInLeft 0.8s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.8s ease-out;
}

.scale-in {
    animation: scaleIn 0.6s ease-out;
}

.bounce-in {
    animation: bounceIn 0.8s ease-out;
}

/* 悬停动画 */
.float-on-hover {
    transition: transform 0.3s ease;
}

.float-on-hover:hover {
    animation: float 2s ease-in-out infinite;
}

.pulse-on-hover:hover {
    animation: pulse 1.5s ease-in-out infinite;
}

.glow-on-hover:hover {
    animation: glow 2s ease-in-out infinite;
}

.shake-on-error {
    animation: shake 0.5s ease-in-out;
}

/* 特殊文字效果 */
.text-glow {
    animation: textGlow 3s ease-in-out infinite;
}

.text-typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    white-space: nowrap;
    animation:
        typewriter 3s steps(20) 1s 1 normal both,
        blink 1s step-end infinite;
}

/* 背景动画 */
.animated-background {
    background: linear-gradient(-45deg, #1a1a1a, #2d2d2d, #1a1a1a, #333);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 3D翻转效果 */
.flip-card {
    perspective: 1000px;
    width: 100%;
    height: 200px;
}

.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%;
    backface-visibility: hidden;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.flip-card-front {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
}

.flip-card-back {
    background: var(--gradient-gold);
    color: var(--dark-bg);
    transform: rotateY(180deg);
}

/* 滚动触发动画 */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}

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

.scroll-reveal.delay-1 {
    transition-delay: 0.2s;
}

.scroll-reveal.delay-2 {
    transition-delay: 0.4s;
}

.scroll-reveal.delay-3 {
    transition-delay: 0.6s;
}

/* 进度条动画 */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-gold);
    width: 0%;
    transition: width 0.8s ease-out;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 20px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5));
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-20px);
    }
    100% {
        transform: translateX(20px);
    }
}

/* 点击涟漪效果 */
.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::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-effect:active::before {
    width: 300px;
    height: 300px;
}

/* 光线扫描效果 */
.scan-effect {
    position: relative;
    overflow: hidden;
}

.scan-effect::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(212, 175, 55, 0.3),
        transparent
    );
    animation: scan 2s ease-in-out infinite;
}

@keyframes scan {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* 星空背景动画 */
.starfield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite alternate;
}

.star.small {
    width: 1px;
    height: 1px;
}

.star.medium {
    width: 2px;
    height: 2px;
}

.star.large {
    width: 3px;
    height: 3px;
}

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

/* 悬浮卡片效果 */
.floating-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.floating-card:hover {
    transform: translateY(-10px) rotateX(5deg) rotateY(5deg);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(212, 175, 55, 0.3);
}

/* 磁场效果 */
.magnetic-effect {
    transition: transform 0.1s ease;
}

.magnetic-effect:hover {
    transform: translate(var(--mouse-x, 0), var(--mouse-y, 0));
}

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

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

@keyframes loadingDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

/* 页面转场动画 */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark-bg);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.page-transition.active {
    opacity: 1;
    visibility: visible;
}

.page-transition::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(212, 175, 55, 0.1) 50%,
        transparent 70%
    );
    transform: translateX(-100%);
    animation: sweep 0.8s ease-out;
}

@keyframes sweep {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}