/* 任务卡片样式 */

/* 任务列表 */
.task-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem 0;
}

.task-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.2s;
    animation: fadeInUp 0.3s ease-out;
}

.task-card:hover {
    box-shadow: var(--shadow-lg);
}

/* 生成中状态 */
.task-card.task-pending {
    border: 2px solid var(--accent-gold);
    background: linear-gradient(135deg, var(--bg-secondary), rgba(212, 175, 55, 0.05));
    position: relative;
    overflow: hidden;
}

.task-card.task-pending::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

.task-card.task-pending .task-stats {
    color: var(--accent-gold);
    font-weight: 600;
}

/* 骨架屏样式 */
.task-card.skeleton-card {
    pointer-events: none;
}

.skeleton-header,
.skeleton-prompt,
.skeleton-images,
.skeleton-actions {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer-loading 2s infinite;
    border-radius: 8px;
}

.skeleton-header {
    height: 24px;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-prompt {
    height: 60px;
    width: 100%;
    margin-bottom: 1rem;
}

.skeleton-images {
    height: 200px;
    width: 100%;
    margin-bottom: 1rem;
}

.skeleton-actions {
    height: 36px;
    width: 100%;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.task-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.task-mode-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: normal;
    letter-spacing: 0;
    white-space: nowrap;
}

.task-stats {
    font-size: 0.7rem;
    color: var(--text-secondary);
    padding: 0.2rem 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    white-space: nowrap;
}

.task-prompt-wrapper {
    margin-bottom: 1rem;
}

.task-prompt-label {
    display: none; /* 隐藏"提示词"标签 */
}

.task-prompt {
    padding: 0; /* 移除内边距 */
    background: transparent; /* 移除背景 */
    border-radius: 0; /* 移除圆角 */
    color: var(--text-primary);
    font-size: 0.95rem; /* 稍微增大字号 */
    line-height: 1.6;
    word-break: break-word;
    font-weight: 600; /* 加粗作为任务标题 */
    margin-bottom: 0.75rem;
}

.task-meta {
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
}

.task-meta-item {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.task-images {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.no-images {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer-loading 2s infinite;
    border-radius: 8px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes shimmer-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.task-image-wrapper {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* 统一宽度：315px */
    width: 315px;
    flex: 0 0 auto;
}

.task-image-wrapper:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.task-image-download {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 2;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.task-image-download svg {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.task-image-wrapper:hover .task-image-download,
.task-image-wrapper:focus-within .task-image-download {
    opacity: 1;
    transform: translateY(0);
}

.task-image-progress {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(15, 23, 42, 0.65);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 3;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.task-image-progress::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse-dot 1.2s ease-in-out infinite;
}

.task-image-progress[data-status="queued"] {
    background: rgba(30, 64, 175, 0.7);
    color: #dbeafe;
}

.task-image-progress[data-status="upload"] {
    background: rgba(14, 116, 144, 0.7);
    color: #cffafe;
}

.task-image-progress[data-status="success"] {
    background: rgba(21, 128, 61, 0.75);
    color: #dcfce7;
}

.task-image-progress[data-status="error"] {
    background: rgba(190, 18, 60, 0.8);
    color: #fee2e2;
}

@keyframes pulse-dot {
    0% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.4; transform: scale(0.9); }
}

@media (max-width: 768px) {
    .task-image-download {
        opacity: 0.9;
    }
}

/* 响应式：小屏幕时所有图片都占满宽 */
@media (max-width: 768px) {
    .task-image-wrapper[data-aspect] {
        width: 100% !important;
        min-width: 100% !important;
    }
}

/* 加载状态的图标 - 重点：只在有 loading-spinner class 时显示 */
.task-image-wrapper.loading-spinner {
    background: var(--bg-tertiary);
    min-height: 315px;  /* 默认正方形高度 */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 根据不同画面比例设置不同的占位高度 */
.task-image-wrapper.loading-spinner[data-aspect="16:9"] {
    min-height: 177px;  /* 16:9 横屏：315 / 16 * 9 = 177 */
}

.task-image-wrapper.loading-spinner[data-aspect="4:3"] {
    min-height: 236px;  /* 4:3 横屏：315 / 4 * 3 = 236 */
}

.task-image-wrapper.loading-spinner[data-aspect="3:2"] {
    min-height: 210px;  /* 3:2 横屏：315 / 3 * 2 = 210 */
}

.task-image-wrapper.loading-spinner[data-aspect="9:16"] {
    min-height: 560px;  /* 9:16 竖屏：315 / 9 * 16 = 560 */
}

.task-image-wrapper.loading-spinner[data-aspect="3:4"] {
    min-height: 420px;  /* 3:4 竖屏：315 / 3 * 4 = 420 */
}

.task-image-wrapper.loading-spinner[data-aspect="2:3"] {
    min-height: 472px;  /* 2:3 竖屏：315 / 2 * 3 = 472 */
}

.task-image-wrapper.loading-spinner[data-aspect="1:1"] {
    min-height: 315px;  /* 1:1 正方形 */
}

.task-image-wrapper.loading-spinner::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: rgb(99, 102, 241);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.task-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
    display: block;
}

/* 图片渐显动画 */
.task-image.fade-in {
    animation: fadeInScale 0.5s ease-out forwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.task-action-btn {
    padding: 0.375rem 0.625rem;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: normal;
}

.task-action-btn i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    stroke-width: 2;
}

.task-action-btn:hover {
    color: var(--text-primary);
    transform: translateY(-1px);
}

.task-action-btn.regenerate:hover,
.task-action-btn.copy:hover,
.task-action-btn.delete:hover {
    color: var(--accent-primary);
}

/* 图片占位符样式 */
.task-image-placeholder {
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    position: absolute;
    top: 0;
    left: 0;
}

.task-image-placeholder .placeholder-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.4;
}

/* 图片加载状态 */
.task-image-placeholder.loading {
    border-style: solid;
    position: relative;
    overflow: hidden;
}

.task-image-placeholder.loading::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.task-image-placeholder.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
}

.task-image-placeholder.error .placeholder-text {
    color: var(--error);
}

/* 流式显示动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 进度指示器 */
.progress-indicator {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-gold);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    transition: opacity 0.3s;
}

/* 进度数字脉冲动画 */
#progress-count {
    transition: transform 0.2s ease;
}

/* 再次生成指示器脉冲动画 */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.02);
        opacity: 0.9;
    }
}

.regenerating-indicator {
    transition: opacity 0.3s ease;
}
