/* 爱心动画样式 */
@keyframes floatUpAndFade {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.7);
    }
    10% {
        opacity: 1;
        transform: translateY(-10px) scale(1.2);
    }
    25% {
        transform: translateY(-30px) scale(1.0) rotate(8deg);
    }
    40% {
        transform: translateY(-50px) scale(0.95) rotate(-5deg);
    }
    60% {
        transform: translateY(-70px) scale(0.9) rotate(3deg);
    }
    80% {
        opacity: 0.8;
        transform: translateY(-90px) scale(0.85) rotate(-2deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-120px) scale(0.7);
    }
}

/* 新增第二种动画路径 */
@keyframes floatUpAndFadeAlt {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }
    15% {
        opacity: 1;
        transform: translateY(-15px) scale(1.1) rotate(-5deg);
    }
    30% {
        transform: translateY(-35px) scale(1.0) rotate(8deg);
    }
    55% {
        transform: translateY(-65px) scale(0.9) rotate(-3deg);
    }
    75% {
        opacity: 0.7;
        transform: translateY(-85px) scale(0.8) rotate(2deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-110px) scale(0.6);
    }
}

/* 新增第三种动画路径 */
@keyframes floatUpAndFadeWide {
    0% {
        opacity: 0;
        transform: translateY(0) translateX(0) scale(0.6);
    }
    20% {
        opacity: 1;
        transform: translateY(-20px) translateX(15px) scale(1.1);
    }
    40% {
        transform: translateY(-40px) translateX(20px) scale(0.95) rotate(12deg);
    }
    70% {
        transform: translateY(-80px) translateX(10px) scale(0.85) rotate(-8deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-130px) translateX(5px) scale(0.75);
    }
}

.heart-animation {
    position: fixed;
    color: #ff4081;
    font-size: 24px;
    pointer-events: none;
    z-index: 9999;
    animation-duration: 2s;
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); /* 优化缓动函数 */
    /* 优化渲染性能 */
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    /* 随机水平偏移 */
    transform-origin: center center;
}

/* 不同颜色的爱心 */
.heart-color-1 { color: #ff4081; text-shadow: 0 0 5px rgba(255, 64, 129, 0.7); }
.heart-color-2 { color: #ff5722; text-shadow: 0 0 5px rgba(255, 87, 34, 0.7); }
.heart-color-3 { color: #e91e63; text-shadow: 0 0 5px rgba(233, 30, 99, 0.7); }
.heart-color-4 { color: #9c27b0; text-shadow: 0 0 5px rgba(156, 39, 176, 0.7); }
.heart-color-5 { color: #ff1744; text-shadow: 0 0 5px rgba(255, 23, 68, 0.7); }
.heart-color-6 { color: #ff9800; text-shadow: 0 0 5px rgba(255, 152, 0, 0.7); }
.heart-color-7 { color: #f06292; text-shadow: 0 0 5px rgba(240, 98, 146, 0.7); }

/* 随机大小变化 */
.heart-size-1 { font-size: 16px; }
.heart-size-2 { font-size: 20px; }
.heart-size-3 { font-size: 24px; }
.heart-size-4 { font-size: 28px; }
.heart-size-5 { font-size: 32px; }

/* 动画类型 */
.heart-anim-1 { animation-name: floatUpAndFade; }
.heart-anim-2 { animation-name: floatUpAndFadeAlt; }
.heart-anim-3 { animation-name: floatUpAndFadeWide; }

/* 点赞按钮点击效果 */
@keyframes button-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 10px rgba(255, 64, 129, 0.6); }
    100% { transform: scale(1); }
}

.like-button-pulse {
    animation: button-pulse 0.3s ease forwards;
}

/* 点赞数字变化动画 */
@keyframes number-change {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: #ff4081; }
    100% { transform: scale(1); }
}

.number-change {
    animation: number-change 0.5s ease forwards;
}

/* 浮入淡出动画 */
@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-10px); }
}

/* 爱心破碎动画 - 裂成两半 */
.heart-half {
    position: fixed; /* 改为fixed定位，确保在任何上下文中都能正确显示 */
    font-size: 24px; /* 心形大小，可以根据需要调整 */
    color: #e74c3c; /* 心形颜色 */
    pointer-events: none;
    z-index: 10000; /* 增加z-index确保在模态框之上 */
    /* 确保 transform-origin 在中心，方便旋转 */
    transform-origin: center center;
    /* 提高渲染性能 */
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.heart-left-half {
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0% 100%);
    animation: heartBreakLeft 1.2s ease-out forwards;
}

.heart-right-half {
    clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%);
    animation: heartBreakRight 1.2s ease-out forwards;
}

@keyframes heartBreakLeft {
    0% {
        opacity: 1;
        transform: translateX(0) translateY(0) rotate(0deg) scale(1);
    }
    20% {
        /* 轻微向左上移动和旋转，模拟裂开的初始动作 */
        transform: translateX(-3px) translateY(-3px) rotate(-8deg) scale(1.05);
    }
    100% {
        opacity: 0;
        /* 向左上方飞出并缩小 */
        transform: translateX(-50px) translateY(-80px) rotate(-45deg) scale(0.3);
    }
}

@keyframes heartBreakRight {
    0% {
        opacity: 1;
        transform: translateX(0) translateY(0) rotate(0deg) scale(1);
    }
    20% {
        /* 轻微向右上移动和旋转 */
        transform: translateX(3px) translateY(-3px) rotate(8deg) scale(1.05);
    }
    100% {
        opacity: 0;
        /* 向右上方飞出并缩小 */
        transform: translateX(50px) translateY(-80px) rotate(45deg) scale(0.3);
    }
}

/* 移除旧的 brokenHeartFly 动画，如果不再使用 */
/* @keyframes brokenHeartFly { ... } */
/* .fa-heart-broken.broken-heart-animation { ... } */
