/* ========================================
   知辰在线工具网 - 动画效果
   ======================================== */

/* ========================================
   关键帧动画
   ======================================== */

/* 旋转发光动画 */
@keyframes rotate-glow {
    0% {
        transform: rotate(0deg);
        filter: drop-shadow(0 0 5px rgba(0, 198, 255, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(0, 198, 255, 0.8));
    }
    100% {
        transform: rotate(360deg);
        filter: drop-shadow(0 0 5px rgba(0, 198, 255, 0.5));
    }
}

/* 标题发光动画 */
@keyframes title-glow {
    0%, 100% {
        filter: drop-shadow(0 0 20px rgba(0, 198, 255, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 40px rgba(0, 198, 255, 0.8));
    }
}

/* 脉冲动画 */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* 淡入向上 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 淡入 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 从左滑入 */
@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 wave {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* 浮动动画 */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* 闪烁动画 */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* 边框流动 */
@keyframes border-flow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 渐变移动 */
@keyframes gradient-move {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 数字滚动 */
@keyframes number-roll {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ========================================
   通用动画类
   ======================================== */

.animate-fadeIn {
    animation: fadeIn 0.5s ease-out;
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out;
}

.animate-slideInLeft {
    animation: slideInLeft 0.5s ease-out;
}

.animate-slideInRight {
    animation: slideInRight 0.5s ease-out;
}

.animate-scaleIn {
    animation: scaleIn 0.4s ease-out;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-blink {
    animation: blink 1.5s ease-in-out infinite;
}

/* ========================================
   延迟动画
   ======================================== */

.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

.delay-400 {
    animation-delay: 0.4s;
}

.delay-500 {
    animation-delay: 0.5s;
}

/* ========================================
   工具卡片动画
   ======================================== */

.tool-card {
    animation: fadeInUp 0.5s ease-out;
    transition: all 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 0 30px rgba(0, 198, 255, 0.4);
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(0, 198, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tool-card:hover::before {
    opacity: 1;
    animation: border-flow 2s linear infinite;
}

/* ========================================
   导航树动画
   ======================================== */

.nav-category {
    animation: slideInLeft 0.4s ease-out;
    transition: all 0.2s ease;
}

.nav-category:hover {
    transform: translateX(5px);
}

.nav-category.active {
    animation: pulse 0.5s ease-out;
}

/* ========================================
   热榜项动画
   ======================================== */

.rank-item {
    animation: fadeInUp 0.5s ease-out;
    transition: all 0.2s ease;
}

.rank-item:hover {
    transform: translateX(-5px);
    background: rgba(0, 198, 255, 0.1);
}

.rank-item .rank-number {
    transition: transform 0.3s ease;
}

.rank-item:hover .rank-number {
    transform: scale(1.2) rotate(5deg);
}

/* ========================================
   搜索建议动画
   ======================================== */

.suggestion-item {
    animation: fadeInUp 0.3s ease-out;
    transition: all 0.2s ease;
}

.suggestion-item:hover {
    background: rgba(0, 198, 255, 0.15);
    transform: translateX(5px);
}

/* ========================================
   按钮悬浮效果
   ======================================== */

button,
.btn {
    position: relative;
    overflow: hidden;
}

button::after,
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

button:hover::after,
.btn:hover::after {
    width: 300px;
    height: 300px;
}

/* ========================================
   加载动画
   ======================================== */

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 198, 255, 0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   骨架屏动画
   ======================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========================================
   进度条动画
   ======================================== */

.progress-bar {
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 198, 255, 0.5),
        transparent
    );
    animation: progress-shine 2s ease-in-out infinite;
}

@keyframes progress-shine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ========================================
   涟漪效果
   ======================================== */

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 198, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.ripple:active::before {
    width: 200%;
    height: 200%;
}

/* ========================================
   文字打字效果
   ======================================== */

.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--accent);
    white-space: nowrap;
    animation: typing 3s steps(30) 1s 1 normal both,
               blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink-caret {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--accent);
    }
}

/* ========================================
   3D翻转效果
   ======================================== */

.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    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;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* ========================================
   视差滚动效果
   ======================================== */

.parallax {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ========================================
   响应式动画优化
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
