/* 任务列表页面样式 */

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    min-height: 100vh;
}

/* 顶部导航栏 */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.header-left h1 {
    font-size: 20px;
    color: #333;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right .username {
    font-size: 14px;
    color: #666;
}

.header-right .logout-btn {
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.header-right .nav-link {
    color: #1890ff;
    text-decoration: none;
    font-size: 14px;
}

.header-right .nav-link:hover {
    text-decoration: underline;
}

/* 主容器 */
.tasks-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
    width: 100%;
}

/* 页面头部 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 20px;
    color: #333;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 状态筛选 */
.status-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label {
    font-size: 13px;
    color: #666;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    background: #fff;
    cursor: pointer;
    outline: none;
    height: 38px;
    transition: border-color 0.3s;
}

.filter-select:hover {
    border-color: #1890ff;
}

.filter-select:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

.selected-count {
    font-size: 14px;
    color: #1890ff;
    font-weight: 500;
}

.batch-download-btn {
    padding: 8px 16px;
    background: #1890ff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    color: #fff;
    cursor: pointer;
    height: 38px;
    transition: all 0.3s;
}

.batch-download-btn:hover {
    background: #40a9ff;
}

.batch-delete-btn {
    padding: 8px 16px;
    background: #ff4d4f;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    color: #fff;
    cursor: pointer;
    height: 38px;
    transition: all 0.3s;
}

.batch-delete-btn:hover {
    background: #ff7875;
}

.refresh-btn {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    height: 38px;
    transition: all 0.3s;
}

.refresh-btn:hover:not(:disabled) {
    color: #1890ff;
    border-color: #1890ff;
}

.refresh-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* 空状态 */
.empty-tasks {
    text-align: center;
    padding: 80px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.empty-tasks .empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: #f0f0f0;
    border-radius: 50%;
}

.empty-tasks p {
    color: #999;
    font-size: 16px;
    margin-bottom: 20px;
}

.create-btn {
    display: inline-block;
    padding: 10px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
}

/* 任务列表 */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 全选栏 */
.select-all-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.select-all-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.select-all-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.task-total {
    font-size: 13px;
    color: #999;
}

.task-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}

.task-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.task-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.task-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.task-id {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.task-status {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    background: #fff7e6;
    color: #fa8c16;
}

.status-processing {
    background: #e6f7ff;
    color: #1890ff;
}

.status-completed {
    background: #f6ffed;
    color: #52c41a;
}

.status-failed {
    background: #fff2f0;
    color: #ff4d4f;
}

.task-time {
    font-size: 13px;
    color: #999;
}

.task-content {
    padding: 20px;
}

/* 参数区域 */
.task-params {
    margin-bottom: 20px;
}

.task-params h4 {
    font-size: 14px;
    color: #333;
    font-weight: 600;
}

.params-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px 0;
}

.expand-icon {
    font-size: 13px;
    color: #1890ff;
}

.task-params.collapsed .params-content {
    display: none;
}

.params-content {
    margin-top: 12px;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.param-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.param-label {
    font-size: 12px;
    color: #999;
}

.param-value {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

.param-requirements {
    padding: 12px 16px;
    background: #fafafa;
    border-radius: 8px;
}

.param-requirements .param-label {
    display: block;
    margin-bottom: 6px;
}

.param-requirements p {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
}

/* 图片区域 */
.task-images {
    display: flex;
    gap: 24px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.images-section {
    flex: 1;
}

.images-section h5 {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
    font-weight: 500;
}

.image-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.image-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    border: 1px solid #e8e8e8;
}

.image-item.small {
    width: 80px;
    height: 80px;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-item:hover {
    border-color: #1890ff;
}

/* 图片悬停操作层 */
.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.icon-btn {
    width: 24px;
    height: 24px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.75);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: background 0.2s;
    text-decoration: none;
    box-sizing: border-box;
}

.icon-btn svg {
    width: 16px;
    height: 16px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.95);
}

.image-item.small:hover .image-overlay {
    opacity: 1;
}

.no-results {
    padding: 24px;
    color: #999;
    font-size: 13px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px dashed #d9d9d9;
    text-align: left;
    margin: 0 20px 20px 20px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.page-btn {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.page-btn:hover:not(:disabled) {
    color: #1890ff;
    border-color: #1890ff;
}

.page-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.page-info {
    font-size: 14px;
    color: #666;
}

/* 响应式 */
@media (max-width: 768px) {
    .header-bar {
        padding: 12px 16px;
    }

    .tasks-container {
        padding: 20px 16px;
    }

    .params-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .task-images {
        flex-direction: column;
        gap: 16px;
    }

    .image-item.small {
        width: 64px;
        height: 64px;
    }
}

/* 图片查看模态框 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    cursor: default;
}

.modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 任务标题(替代 task-id) */
.task-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

/* 标签行 + 操作链接 外层容器 */
.task-tag-action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px 0;
}

/* 标签行 */
.task-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.task-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    background: #f0f0f0;
    color: #555;
    line-height: 1.5;
    white-space: nowrap;
}

.task-tag.primary {
    background: #e6f7e6;
    color: #16a34a;
    font-weight: 500;
}

/* 操作链接行 */
.task-action-row {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
}

.task-action-link {
    font-size: 13px;
    color: #666;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
}

.task-action-link:hover {
    color: #1890ff;
}

/* 生成结果大图 */
.task-result-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    padding: 14px 20px 20px;
}

.result-img-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    border: 1px solid #e8e8e8;
}

.result-img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-img-item:hover {
    border-color: #1890ff;
}

.result-img-item:hover .image-overlay {
    opacity: 1;
}

/* 文本模态框 */
.text-modal-content {
    background: #fff;
    border-radius: 10px;
    width: 640px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.text-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.text-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.text-modal-header .modal-close {
    position: static;
    background: #f5f5f5;
    color: #666;
}

.text-modal-header .modal-close:hover {
    background: #e8e8e8;
}

.text-modal-body {
    padding: 16px 20px;
    overflow: auto;
    max-height: 60vh;
    flex: 1;
}

.text-modal-body pre {
    font-family: inherit;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    color: #333;
    line-height: 1.7;
    margin: 0;
}

.text-modal-empty {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 40px 0;
}

/* 参考图网格 */
.images-modal-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.images-modal-item {
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    border: 1px solid #e8e8e8;
}

.images-modal-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
