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

.tasks-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    padding: 16px 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: 12px;
    overflow: visible !important;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, border-color 0.4s ease;
    will-change: transform, box-shadow;
    transform: translateZ(0);
    z-index: 10;
    font-size: 12px;
}

/* 确保按钮容器有足够的底部空间，不会被裁剪 */
/* 注意：.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;
}

/* 卡片头部：图片/视频预览 - 9:16 竖屏比例 */
.task-card-header {
    position: relative;
    aspect-ratio: 9 / 16;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1 !important;
    border-radius: 12px 12px 0 0;
}

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

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

/* 悬停播放视频 */
.card-hover-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.card-hover-video-only {
    opacity: 0;
}

.card-video-poster {
    transition: opacity 0.3s ease;
    z-index: 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: 8px 10px 6px;
    pointer-events: auto !important;
}

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

.task-id {
    font-size: 10px;
    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: 11px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.4;
    margin-bottom: 8px;
    height: 32px;
    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: 4px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.task-tag {
    font-size: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
    padding: 2px 6px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 4px;
}

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

/* 操作按钮 */
.task-actions {
    display: flex;
    gap: 4px;
    padding: 6px 6px 4px;
    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: 28px;
    min-height: 28px !important;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px;
    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 28px; 
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.4);
}

.task-btn.delete { 
    flex: 0 0 28px; 
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

/* 卡片视频倍速按钮 */
.card-video-speed {
    position: absolute;
    bottom: 6px;
    left: 6px;
    display: flex;
    gap: 4px;
    z-index: 11;
    opacity: 0.9;
}

.card-speed-btn {
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.card-speed-btn:hover,
.card-speed-btn.active {
    background: rgba(139, 92, 246, 0.85);
    color: #fff;
    border-color: rgba(167, 139, 250, 0.8);
}

/* 卡片视频播放进度条 */
.card-video-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10;
    cursor: pointer;
    transition: height 0.15s ease, opacity 0.3s ease;
    opacity: 0.85;
}

.card-video-progress:hover {
    height: 8px;
    opacity: 1;
}

.card-video-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8b5cf6, #6366f1);
    border-radius: 0 2px 2px 0;
    transition: width 0.1s linear;
    pointer-events: none;
    position: relative;
}

.card-video-progress:hover .card-video-progress-bar::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: #a78bfa;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.6);
}

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