/* ============================================================
   Short Video Parser v2 — 动画效果库
   高级微交互、弹性动画、粒子效果
   ============================================================ */

/* ========== 页面加载动画 ========== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* 页面元素入场动画 */
.animate-on-load {
    animation: fadeInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.animate-on-load:nth-child(1) { animation-delay: 0.1s; }
.animate-on-load:nth-child(2) { animation-delay: 0.2s; }
.animate-on-load:nth-child(3) { animation-delay: 0.3s; }
.animate-on-load:nth-child(4) { animation-delay: 0.4s; }
.animate-on-load:nth-child(5) { animation-delay: 0.5s; }

/* ========== 弹性按钮动画 ========== */
@keyframes buttonBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

.btn-bounce:hover {
    animation: buttonBounce 0.6s ease-in-out;
}

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

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

.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    pointer-events: none;
    animation: ripple 0.6s ease-out;
}

/* ========== 脉冲呼吸效果 ========== */
@keyframes breathe {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.breathe-animation {
    animation: breathe 3s ease-in-out infinite;
}

/* ========== 发光脉冲 ========== */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.3),
                    0 0 40px rgba(99, 102, 241, 0.2);
    }
    50% {
        box-shadow: 0 0 30px rgba(99, 102, 241, 0.5),
                    0 0 60px rgba(99, 102, 241, 0.3);
    }
}

.glow-pulse {
    animation: glowPulse 2s ease-in-out infinite;
}

/* ========== 旋转加载动画 ========== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spin-animation {
    animation: spin 1s linear infinite;
}

@keyframes spinSlow {
    to {
        transform: rotate(360deg);
    }
}

.spin-slow {
    animation: spinSlow 3s linear infinite;
}

/* ========== 彩虹加载进度条 ========== */
@keyframes rainbowProgress {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.rainbow-progress {
    background: linear-gradient(90deg,
        #6366f1 0%,
        #8b5cf6 25%,
        #ec4899 50%,
        #f59e0b 75%,
        #6366f1 100%);
    background-size: 200% 100%;
    animation: rainbowProgress 2s linear infinite;
}

/* ========== 闪烁效果 ========== */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.blink-animation {
    animation: blink 1.5s ease-in-out infinite;
}

/* ========== 摇晃提示 ========== */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

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

/* ========== 弹跳提示 ========== */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

.bounce-animation {
    animation: bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========== 3D翻转卡片 ========== */
.flip-card {
    perspective: 1000px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover {
    transform: rotateY(10deg) rotateX(5deg);
}

@keyframes flip {
    0% {
        transform: rotateY(0);
    }
    100% {
        transform: rotateY(180deg);
    }
}

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

/* ========== 3D浮起效果 ========== */
.float-3d {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.float-3d:hover {
    transform: translateY(-8px) rotateX(5deg) rotateY(-5deg) scale(1.02);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.15),
                0 10px 30px rgba(99, 102, 241, 0.2);
}

/* ========== 打字机效果 ========== */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

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

.typing-effect {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid;
    animation: typing 3s steps(40) 1s normal both,
               blinkCursor 0.75s step-end infinite;
}

/* ========== 光泽扫过效果 ========== */
@keyframes shine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.shine-effect {
    position: relative;
    overflow: hidden;
}

.shine-effect::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%);
    animation: shine 3s infinite;
}

/* ========== 下划线滑入效果 ========== */
.underline-slide {
    position: relative;
}

.underline-slide::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    transition: width 0.3s ease;
}

.underline-slide:hover::after {
    width: 100%;
}

/* ========== 渐变移动背景 ========== */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-shift {
    background-size: 200% 200%;
    animation: gradientShift 5s ease infinite;
}

/* ========== 波浪动画 ========== */
@keyframes wave {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.wave-animation {
    animation: wave 2s ease-in-out infinite;
}

.wave-animation:nth-child(1) { animation-delay: 0s; }
.wave-animation:nth-child(2) { animation-delay: 0.1s; }
.wave-animation:nth-child(3) { animation-delay: 0.2s; }
.wave-animation:nth-child(4) { animation-delay: 0.3s; }
.wave-animation:nth-child(5) { animation-delay: 0.4s; }

/* ========== 骨架屏加载动画 ========== */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg,
        rgba(240, 242, 245, 0.8) 0%,
        rgba(248, 250, 252, 0.9) 50%,
        rgba(240, 242, 245, 0.8) 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ========== 放大镜效果 ========== */
.zoom-on-hover {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.zoom-on-hover:hover {
    transform: scale(1.1);
}

.zoom-on-hover img {
    transition: transform 0.4s ease;
}

.zoom-on-hover:hover img {
    transform: scale(1.2);
}

/* ========== 粒子漂浮效果 ========== */
@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate(100px, -100px) rotate(360deg);
        opacity: 0;
    }
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.8) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 3s ease-in-out infinite;
}

.particle:nth-child(1) { animation-delay: 0s; left: 10%; }
.particle:nth-child(2) { animation-delay: 0.5s; left: 30%; }
.particle:nth-child(3) { animation-delay: 1s; left: 50%; }
.particle:nth-child(4) { animation-delay: 1.5s; left: 70%; }
.particle:nth-child(5) { animation-delay: 2s; left: 90%; }

/* ========== 心跳效果 ========== */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(1.1);
    }
    20%, 40% {
        transform: scale(1);
    }
}

.heartbeat-animation {
    animation: heartbeat 1.5s ease-in-out infinite;
}

/* ========== 翻书效果 ========== */
@keyframes pageFlip {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

.page-flip {
    animation: pageFlip 0.8s ease-in-out;
}

/* ========== 涟漪扩散 ========== */
@keyframes rippleExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.5;
    }
    100% {
        width: 500px;
        height: 500px;
        opacity: 0;
    }
}

.ripple-expand {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--primary);
    animation: rippleExpand 1.5s ease-out;
}

/* ========== 数字滚动效果 ========== */
@keyframes numberRoll {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    50% {
        transform: translateY(-10%);
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.number-roll {
    animation: numberRoll 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========== 渐变文字动画 ========== */
@keyframes gradientText {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-text-animated {
    background: linear-gradient(90deg,
        #6366f1 0%,
        #8b5cf6 25%,
        #ec4899 50%,
        #8b5cf6 75%,
        #6366f1 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientText 3s linear infinite;
}

/* ========== 描边动画 ========== */
@keyframes drawStroke {
    to {
        stroke-dashoffset: 0;
    }
}

.draw-stroke {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawStroke 2s ease-in-out forwards;
}

/* ========== 弹性缩放 ========== */
@keyframes elasticScale {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.elastic-scale {
    animation: elasticScale 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ========== 模糊到清晰 ========== */
@keyframes blurToSharp {
    from {
        filter: blur(10px);
        opacity: 0;
    }
    to {
        filter: blur(0);
        opacity: 1;
    }
}

.blur-to-sharp {
    animation: blurToSharp 0.8s ease-out;
}

/* ========== 降低动画（辅助功能） ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .ripple-effect,
    .particle,
    .blob {
        display: none !important;
    }
}

/* ========== 悬停微调整 ========== */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.15);
}

/* ========== 图标跳动 ========== */
@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

.icon-bounce:hover svg,
.icon-bounce:hover i {
    animation: iconBounce 0.5s ease-in-out;
}

/* ========== 加载点动画 ========== */
@keyframes dotPulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

.dot-pulse {
    display: inline-flex;
    gap: 6px;
}

.dot-pulse span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: dotPulse 1.4s ease-in-out infinite;
}

.dot-pulse span:nth-child(1) { animation-delay: 0s; }
.dot-pulse span:nth-child(2) { animation-delay: 0.2s; }
.dot-pulse span:nth-child(3) { animation-delay: 0.4s; }
