/* 任务卡片 - 巅峰旗舰精简版 (视觉与性能的终极平衡) */

.tasks-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); /* 卡片调小 */
    gap: 20px;
    padding: 20px 0;
}

/* 核心卡片容器 - 修复按钮遮盖 */
.task-item {
    background: linear-gradient(165deg, rgba(35, 35, 50, 0.5) 0%, rgba(15, 15, 20, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    overflow: visible !important; /* 改为 visible，确保按钮可以点击 */
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, border-color 0.4s ease;
    
    /* 性能优化 - 移除 contain，避免限制按钮 */
    will-change: transform, box-shadow;
    transform: translateZ(0);
    z-index: 10; /* 确保任务卡片有正确的层级 */
}

/* 确保按钮容器有足够的底部空间，不会被裁剪 */
/* 注意：.task-actions 样式已在上方定义，这里不重复 */

/* 悬停时增强毛玻璃和位移 */
.task-item:hover {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 20px rgba(139, 92, 246, 0.2);
    transform: translateY(-8px) scale(1.02);
    z-index: 15; /* 提高悬停时的层级 */
}

/* 顶部流光线 - 降低层级避免遮挡按钮 */
.task-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 1.5px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    opacity: 0;
    transition: opacity 0.4s;
    z-index: 1 !important; /* 降低层级，确保不会遮挡按钮 */
    pointer-events: none !important; /* 禁止接收鼠标事件 */
}

.task-item:hover::after {
    opacity: 1;
}

/* 卡片头部：图片/视频预览 */
.task-card-header {
    position: relative;
    height: 115px; /* 高度调小 */
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1 !important; /* 降低层级，确保不覆盖按钮 */
    border-radius: 16px 16px 0 0; /* 保持圆角 */
}

/* 预览图片样式 */
.card-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.task-item:hover .card-preview-image {
    transform: scale(1.1);
}

/* 视频占位符样式 */
.status-placeholder.video-placeholder {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.05));
    border: 1.5px dashed rgba(139, 92, 246, 0.25);
    border-radius: 12px;
    padding: 15px;
    width: calc(100% - 24px);
    height: calc(100% - 24px);
    transition: all 0.4s ease;
}

.status-placeholder.video-placeholder i {
    font-size: 32px;
    color: rgba(139, 92, 246, 0.5);
    margin-bottom: 6px;
}

.status-placeholder.video-placeholder span {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

/* 状态角标 */
.task-status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 9px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 30px;
    z-index: 5;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.status-processing .task-status-badge { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.status-completed .task-status-badge { background: linear-gradient(135deg, #10b981, #065f46); }
.status-failed .task-status-badge { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.status-queued .task-status-badge { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }

/* 选择框 */
.task-select-box {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.task-select-box input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    border-radius: 6px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}

/* 状态占位符 */
.status-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.35);
    z-index: 2;
    width: 100%;
    height: 100%;
}

.status-placeholder:not(.video-placeholder) i {
    font-size: 28px;
    margin-bottom: 2px;
    opacity: 0.5;
}

.status-placeholder:not(.video-placeholder) span {
    font-size: 11px;
    font-weight: 600;
}

/* 卡片主体 - 确保按钮不被遮挡 */
.task-card-body {
    position: relative;
    z-index: 10 !important; /* 确保内容在伪元素之上，层级足够高 */
    overflow: visible !important; /* 允许按钮区域正常显示 */
    padding-bottom: 5px; /* 增加底部内边距 */
    padding: 15px; /* 间距缩小 */
    pointer-events: auto !important; /* 确保可以接收点击事件 */
}

.task-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.task-id {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.25);
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

/* 已清晰徽章 */
.enhance-badge {
    font-size: 9px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.enhance-badge.done {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.enhance-badge.processing {
    background: rgba(139, 92, 246, 0.1);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.enhance-badge.failed {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* 提示词区域 */
.task-prompt {
    font-size: 13px; /* 字体调小 */
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
    margin-bottom: 15px;
    height: 40px; /* 高度调小 */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* 参数标签组 */
.task-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.task-tag {
    font-size: 9px; /* 字体调小 */
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
    padding: 4px 10px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 6px;
}

.task-tag i {
    color: var(--primary);
    font-size: 9px;
    opacity: 0.7;
}

/* 操作按钮 - 修复遮盖问题 */
.task-actions {
    display: flex;
    gap: 8px;
    padding: 15px 10px 10px 10px; /* 增加内边距，防止按钮被裁剪 */
    margin-bottom: 2px; /* 底部边距确保不被裁剪 */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative !important;
    z-index: 200 !important; /* 确保按钮容器在最上层，层级足够高 */
    background: var(--bg-card) !important; /* 恢复卡片背景 */
    pointer-events: auto !important; /* 确保按钮容器可以接收点击事件 */
}

.task-btn {
    flex: 1;
    height: 36px;
    min-height: 36px !important; /* 防止被压缩 */
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative !important;
    z-index: 250 !important; /* 按钮层级最高，确保在最上层 */
    pointer-events: auto !important; /* 确保可以点击 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); /* 添加阴影增强视觉层次 */
    user-select: none !important; /* 防止文字被选中 */
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    opacity: 1 !important; /* 确保按钮可见 */
}

/* 按钮内的图标和文字不拦截点击事件 */
.task-btn i,
.task-btn span,
.task-btn * {
    pointer-events: none !important; /* 让点击事件冒泡到按钮 */
}

.task-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.2);
    z-index: 30; /* 悬停时进一步提升层级 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.task-btn.view { 
    background: rgba(255, 255, 255, 0.15); /* 稍微提高不透明度 */
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.task-btn.enhance { 
    background: linear-gradient(135deg, #8b5cf6, #6366f1); 
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4); /* 增强阴影 */
}

.task-btn.enhanced { 
    background: linear-gradient(135deg, #10b981, #059669); 
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.task-btn.download { 
    flex: 0 0 38px; 
    background: rgba(59, 130, 246, 0.25); /* 提高透明度便于看清 */
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.4);
}

.task-btn.delete { 
    flex: 0 0 38px; 
    background: rgba(239, 68, 68, 0.2); /* 提高透明度便于看清 */
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

/* 响应式 */
@media (max-width: 768px) {
    .tasks-list {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 15px;
    }
}
