/* ========================================
   Animations - 动画效果
   ======================================== */

/* ===== 页面切换动画 ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 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 scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ===== 按钮交互动画 ===== */
@keyframes buttonPress {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes ripple {
    0% {
        box-shadow: 0 0 0 0 rgba(151, 115, 222, 0.4);
    }
    100% {
        box-shadow: 0 0 0 20px rgba(151, 115, 222, 0);
    }
}

/* ===== 页面切换类 ===== */
.page-enter {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-exit {
    animation: fadeOut 0.3s ease-out forwards;
}

.modal-enter {
    animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-exit {
    animation: fadeOut 0.3s ease-out forwards;
}

/* ===== 交互反馈 ===== */
.hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.hover-glow {
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(151, 115, 222, 0.4);
    transform: scale(1.02);
}

.hover-scale {
    transition: transform var(--transition-fast);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-scale:active {
    transform: scale(0.98);
}

/* ===== 列表项延迟动画 ===== */
.stagger-item {
    opacity: 0;
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.4s; }
.stagger-item:nth-child(9) { animation-delay: 0.45s; }
.stagger-item:nth-child(n+10) { animation-delay: 0.5s; }

/* ===== 加载动画 ===== */
.loading-spinner {
    animation: spin 1s linear infinite;
}

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

/* ===== 输入框焦点动画 ===== */
@keyframes inputFocus {
    0% {
        box-shadow: 0 0 0 0 rgba(151, 115, 222, 0.4);
    }
    100% {
        box-shadow: 0 0 0 4px rgba(151, 115, 222, 0);
    }
}

.input-focus-effect:focus {
    animation: inputFocus 0.6s ease-out;
}
