/* 任务列表组件样式 */
.task-list-component {
    width: 100%;
}

/* 工具栏样式 */
.task-list-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.task-list-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.task-count {
    font-size: 0.875rem;
    color: #718096;
}

.count-number {
    font-weight: 600;
    color: #4a5568;
}

.task-list-actions {
    display: flex;
    gap: 0.75rem;
}

.task-list-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.task-list-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.task-list-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-icon {
    width: 16px;
    height: 16px;
}

/* 内容区域 */
.task-list-content {
    margin-bottom: 2rem;
}

/* 任务网格 */
.task-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

/* 紧凑模式 */
.task-list-compact .task-list-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
}

/* 任务卡片 */
.task-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e0;
}

/* 任务卡片头部 */
.task-card-header {
    padding: 1rem;
    border-bottom: 1px solid #f7fafc;
}

.task-header-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.task-product-name {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.task-created-time {
    font-size: 0.75rem;
    color: #718096;
    flex-shrink: 0;
}

.task-status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* 状态颜色 */
.status-draft {
    background: #edf2f7;
    color: #4a5568;
}

.status-pending {
    background: #fef5e7;
    color: #dd6b20;
}

.status-processing {
    background: #ebf8ff;
    color: #3182ce;
    animation: pulse 2s infinite;
}

.status-succeeded {
    background: #c6f6d5;
    color: #22543d;
}

.status-failed {
    background: #fed7d7;
    color: #742a2a;
}

.status-cancelled {
    background: #e2e8f0;
    color: #4a5568;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* 任务卡片内容 */
.task-card-body {
    padding: 1rem;
}

/* 缩略图样式 */
.task-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
    max-height: 100px;
    overflow: hidden;
}

.thumbnail-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
}

.thumbnail-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.2s ease;
}

.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.thumbnail-more {
    background: #f7fafc;
    border: 2px dashed #cbd5e0;
}

/* 无图片状态 */
.task-no-images {
    text-align: center;
    padding: 1rem;
    color: #718096;
    font-size: 0.875rem;
    background: #f7fafc;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* 排队信息 */
.task-queue-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: #ebf8ff;
    border-radius: 6px;
    margin-bottom: 1rem;
    border: 1px solid #bee3f8;
}

.queue-label {
    font-size: 0.75rem;
    color: #2b6cb0;
    font-weight: 500;
}

.queue-position {
    font-size: 0.75rem;
    font-weight: 600;
    color: #3182ce;
}

/* 任务操作按钮 */
.task-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.task-btn {
    flex: 1;
    min-width: 80px;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.download-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.download-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    transform: translateY(-1px);
}

.preview-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.preview-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a67d8 0%, #667eea 100%);
    transform: translateY(-1px);
}

.retry-btn {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.retry-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #dd6b20 0%, #c05621 100%);
    transform: translateY(-1px);
}

.delete-btn {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.delete-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    transform: translateY(-1px);
}

.task-btn:disabled {
    background: #e2e8f0;
    color: #a0aec0;
    cursor: not-allowed;
    transform: none;
}

.task-btn .btn-icon {
    width: 14px;
    height: 14px;
}

/* 分页样式 */
.task-list-pagination {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.pagination-btn {
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 4px;
    color: #4a5568;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.pagination-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn svg {
    width: 16px;
    height: 16px;
}

.pagination-ellipsis {
    padding: 0 0.5rem;
    color: #718096;
    font-size: 0.875rem;
}

.pagination-info {
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid #e2e8f0;
    font-size: 0.75rem;
    color: #718096;
    white-space: nowrap;
}

/* 加载状态 */
.task-list-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    color: #718096;
    min-height: 200px; /* 确保有足够高度进行居中 */
    text-align: center;
    width: 100%; /* 确保占满整个宽度 */
    box-sizing: border-box;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1rem;
    color: #4a5568;
    margin: 0;
    font-weight: 500;
}

/* 空状态 */
.task-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.empty-icon {
    width: 64px;
    height: 64px;
    color: #cbd5e0;
    margin-bottom: 1rem;
}

.empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #4a5568;
    margin: 0 0 0.5rem 0;
}

.empty-desc {
    font-size: 0.875rem;
    color: #718096;
    margin: 0;
    line-height: 1.5;
}

/* 错误状态 */
.task-list-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.error-icon {
    width: 64px;
    height: 64px;
    color: #f56565;
    margin-bottom: 1rem;
}

.error-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #e53e3e;
    margin: 0 0 0.5rem 0;
}

.error-desc {
    font-size: 0.875rem;
    color: #718096;
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
}

.retry-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.retry-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}


/* 弹窗中的加载状态优化 */
.modal-content .task-list-loading {
    min-height: 300px; /* 弹窗中提供更多高度 */
    padding: 4rem 2rem;
}

/* 任务列表弹窗需要占满整个容器宽度 */
.modal-content:has(.task-list-component) {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    
    .modal-content:has(.task-list-component) {
        margin-left: 0 !important;
    }

    .task-list-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .task-list-info {
        justify-content: center;
    }
    
    .task-list-actions {
        justify-content: center;
    }
    
    .task-list-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .task-card-header,
    .task-card-body {
        padding: 0.75rem;
    }
    
    .task-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .pagination-info {
        order: -1;
        width: 100%;
        text-align: center;
        margin: 0 0 0.5rem 0;
        padding: 0;
        border: none;
    }
}

@media (max-width: 480px) {
    /* 移除负边距，避免在弹窗中造成左右不对称 */
    .task-list-component {
        margin: 0;
    }
    
    .task-card {
        border-radius: 8px;
    }
    
    .task-product-name {
        font-size: 0.875rem;
    }
    
    .task-thumbnails {
        grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
        gap: 0.25rem;
        max-height: 80px;
    }
    
    .task-actions {
        grid-template-columns: 1fr;
    }
    
    .task-btn {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}



/* 紧凑模式特殊样式 */
.task-list-compact .task-card {
    border-radius: 8px;
}

.task-list-compact .task-card-header,
.task-list-compact .task-card-body {
    padding: 0.75rem;
}

.task-list-compact .task-product-name {
    font-size: 0.875rem;
}

.task-list-compact .task-thumbnails {
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 0.25rem;
    max-height: 80px;
}

.task-list-compact .task-btn {
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
    min-width: 60px;
}
