/**
 * 动画和过渡效果
 */

/* ==================== 页面过渡动画 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ==================== 元素入场动画 ==================== */
.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.3s ease-out;
}

.animate-bounce {
    animation: bounce 0.5s ease-in-out;
}

/* 延迟动画类 */
.animate-delay-100 {
    animation-delay: 100ms;
}

.animate-delay-200 {
    animation-delay: 200ms;
}

.animate-delay-300 {
    animation-delay: 300ms;
}

/* ==================== 卡片悬停效果 ==================== */
.app-card {
    transition: all 0.2s ease;
}

.app-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.15);
}

.app-card:active {
    transform: translateY(-2px) scale(1.01);
}

/* 快捷操作按钮动效 */
.quick-action-btn {
    transition: all 0.15s ease;
}

.quick-action-btn:hover {
    transform: scale(1.15) rotate(5deg);
}

.quick-action-btn:active {
    transform: scale(0.95);
}

/* ==================== 按钮动效 ==================== */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.btn::before {
    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.4s ease, height 0.4s ease;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ==================== 输入框焦点动效 ==================== */
.form-input {
    transition: all 0.2s ease;
}

.form-input:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* 拖拽悬停效果 */
.form-input.drag-hover {
    background: var(--color-blue-50);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ==================== 加载动画 ==================== */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ==================== 历史记录动效 ==================== */
.history-item {
    transition: all 0.15s ease;
}

.history-item:hover {
    transform: translateX(4px);
    background: var(--color-gray-50);
}

.history-item.dragging {
    opacity: 0.5;
    transform: scale(1.05);
}

/* ==================== 任务进度动画 ==================== */
@keyframes progress {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 40px 0;
    }
}

.task-progress-fill {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 40px 40px;
    animation: progress 1s linear infinite;
}

/* ==================== 模态框动效 ==================== */
.modal-backdrop {
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    animation: scaleIn 0.3s ease-out;
}

/* ==================== 标签悬停效果 ==================== */
.param-badge {
    transition: all 0.15s ease;
    cursor: grab;
}

.param-badge:hover {
    transform: scale(1.05);
    background: var(--color-gray-200);
}

.param-badge.dragging {
    cursor: grabbing;
    opacity: 0.5;
    transform: scale(1.1);
}

/* ==================== 分类按钮动效 ==================== */
.category-btn {
    transition: all 0.15s ease;
    position: relative;
}

.category-btn::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 0;
    background: var(--color-primary);
    transition: width 0.2s ease;
}

.category-btn.active::after {
    width: 100%;
}

.category-btn:hover {
    padding-left: 16px;
}

/* ==================== 右侧面板滑入效果 ==================== */
#quickPanel {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#quickPanel.hidden {
    transform: translateX(100%);
    opacity: 0;
}

/* ==================== Toast 动画增强 ==================== */
@keyframes toastSlideIn {
    from {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }
}

.toast {
    animation: toastSlideIn 0.3s ease-out;
}

.toast.removing {
    animation: toastSlideOut 0.3s ease-in;
}

/* ==================== 媒体预览动效 ==================== */
.media-container img,
.media-container video {
    transition: all 0.2s ease;
}

.media-container img:hover {
    transform: scale(1.02);
}

.cursor-zoom-in {
    cursor: zoom-in;
}

/* ==================== 拖拽时的应用卡片效果 ==================== */
.app-card.drag-hover {
    border: 2px dashed var(--color-primary);
    background: var(--color-blue-50);
    transform: scale(1.02);
}

/* ==================== 响应式动画优化 ==================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==================== 微交互反馈 ==================== */
/* 点击涟漪效果 */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple 0.6s ease-out;
    pointer-events: none;
}
