/* 动画样式文件 */

/* 基础动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@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 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 pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

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

/* 气球动画 */
@keyframes balloonFloat {
    0%, 100% {
        transform: translateY(0px) rotate(-2deg);
    }
    50% {
        transform: translateY(-20px) rotate(2deg);
    }
}

@keyframes balloonSway {
    0%, 100% {
        transform: translateX(0px);
    }
    50% {
        transform: translateX(10px);
    }
}

/* 彩带动画 */
@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes confettiSway {
    0%, 100% {
        transform: translateX(0px);
    }
    50% {
        transform: translateX(100px);
    }
}

/* 装饰元素样式 */
.decorations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.balloon {
    position: absolute;
    width: 60px;
    height: 80px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: balloonFloat 3s ease-in-out infinite;
}

.balloon::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100px;
    background: #333;
}

.balloon-1 {
    top: 20%;
    left: 10%;
    background: linear-gradient(45deg, #ff6b9d, #ff8fab);
    animation-delay: 0s;
}

.balloon-2 {
    top: 30%;
    right: 15%;
    background: linear-gradient(45deg, #4ecdc4, #6ee7dd);
    animation-delay: 1s;
}

.balloon-3 {
    top: 50%;
    left: 5%;
    background: linear-gradient(45deg, #ffe66d, #ffed8a);
    animation-delay: 2s;
}

/* 彩带效果 */
.confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.confetti::before,
.confetti::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    animation: confettiFall 3s linear infinite;
}

.confetti::before {
    left: 20%;
    animation-delay: 0s;
    background: var(--accent-color);
}

.confetti::after {
    left: 80%;
    animation-delay: 1.5s;
    background: var(--secondary-color);
}

/* 页面切换动画 */
.page-enter {
    animation: slideInRight 0.5s ease-out;
}

.page-exit {
    animation: slideInLeft 0.5s ease-out reverse;
}

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

.photo-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* 按钮动画 */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:active {
    transform: scale(0.98);
}

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

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

.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    white-space: nowrap;
    margin: 0 auto;
    animation: 
        typewriter 3s steps(40, end),
        blinkCursor 0.75s step-end 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);
    }
}

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

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

.rotate {
    animation: rotate 2s linear infinite;
}

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

.gradient-bg {
    background: linear-gradient(-45deg, #ff6b9d, #4ecdc4, #ffe66d, #ff8fab);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* 加载动画 */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

/* 音乐播放器动画 */
@keyframes musicBars {
    0%, 100% {
        height: 10px;
    }
    50% {
        height: 30px;
    }
}

.music-bars {
    display: flex;
    align-items: end;
    gap: 2px;
}

.music-bar {
    width: 4px;
    background: var(--primary-color);
    animation: musicBars 1s ease-in-out infinite;
}

.music-bar:nth-child(2) {
    animation-delay: 0.1s;
}

.music-bar:nth-child(3) {
    animation-delay: 0.2s;
}

.music-bar:nth-child(4) {
    animation-delay: 0.3s;
}

/* 响应式动画调整 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 弹幕动画效果 */
@keyframes danmaku-enter {
    0% {
        opacity: 0;
        transform: translateX(100vw) scale(0.8);
    }
    10% {
        opacity: 1;
        transform: translateX(90vw) scale(1);
    }
    90% {
        opacity: 1;
        transform: translateX(-90%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-100%) scale(0.8);
    }
}

/* 弹幕摇摆动画 */
@keyframes danmaku-sway {
    0%, 100% {
        transform: translateY(0px);
    }
    25% {
        transform: translateY(-2px);
    }
    75% {
        transform: translateY(2px);
    }
}

/* 弹幕闪烁动画 */
@keyframes danmaku-twinkle {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* 弹幕彩虹效果 */
@keyframes danmaku-rainbow {
    0% { filter: hue-rotate(0deg); }
    25% { filter: hue-rotate(90deg); }
    50% { filter: hue-rotate(180deg); }
    75% { filter: hue-rotate(270deg); }
    100% { filter: hue-rotate(360deg); }
}

/* 弹幕脉冲效果 */
@keyframes danmaku-pulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
    }
}

/* 特殊弹幕动画类 */
.danmaku-item.sway {
    animation: danmaku-move linear, danmaku-sway 2s ease-in-out infinite;
}

.danmaku-item.twinkle {
    animation: danmaku-move linear, danmaku-twinkle 1.5s ease-in-out infinite;
}

.danmaku-item.rainbow {
    animation: danmaku-move linear, danmaku-rainbow 3s linear infinite;
}

.danmaku-item.pulse {
    animation: danmaku-move linear, danmaku-pulse 2s ease-in-out infinite;
}

/* 弹幕控制按钮动画 */
@keyframes button-bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.danmaku-control-btn:active {
    animation: button-bounce 0.3s ease-out;
}

/* 弹幕出现动画 */
@keyframes danmaku-spawn {
    0% {
        opacity: 0;
        transform: translateX(50px) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.danmaku-item.spawning {
    animation: danmaku-spawn 0.5s ease-out, danmaku-move linear;
}

/* 移动端动画优化 */
@media (max-width: 768px) {
    .balloon {
        width: 40px;
        height: 60px;
    }

    .balloon::after {
        height: 60px;
    }

    .photo-item:hover {
        transform: translateY(-4px) scale(1.01);
    }

    /* 移动端祝福语动画调整 */
    .message-text {
        animation-duration: 0.6s;
    }

    .message-item.slide-in-right .message-text,
    .message-item.slide-in-left .message-text {
        animation-duration: 0.5s;
    }
}
