/* 下载中心页面样式 */

/* 任务卡片动画 */
.task-card {
    transition: all 0.3s ease-in-out;
}

.task-card.pending {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 进度条动画优化 */
.progress-fill {
    transition: width 0.3s ease-in-out !important;
}

/* 状态切换动画 */
.task-status {
    transition: all 0.2s ease-in-out;
}

.task-status.processing .status-dot {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* 任务完成时的高亮效果 */
.task-card.completing {
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f9ff 100%);
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

/* 批量任务展开动画 */
.batch-task-content {
    overflow: hidden;
    transition: all 0.3s ease-in-out;
}

.batch-expand-icon {
    transition: transform 0.3s ease-in-out;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 页面标题 */
.page-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

/* 统计信息区域 */
.stats-section {
    margin-bottom: 3rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.pending {
    background: rgba(246, 173, 85, 0.1);
    color: #f6ad55;
}

.stat-icon.success {
    background: rgba(72, 187, 120, 0.1);
    color: #48bb78;
}

.stat-icon.credits {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* 任务区域 */
.tasks-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* 刷新按钮 */
.refresh-button {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.refresh-button:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

.refresh-button.rotating svg {
    animation: rotate 0.5s ease;
}

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

/* 筛选控件 */
.filter-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.date-input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.date-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.date-separator {
    color: var(--text-secondary);
}

/* 任务列表 */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 任务卡片 */
.task-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    background: var(--bg-secondary);
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

.task-card:hover {
    border-color: #e0e0e0;
    box-shadow: var(--shadow-sm);
}

.task-card.pending {
    border-left: 4px solid #f6ad55;
}

.task-card.success {
    border-left: 4px solid #48bb78;
}

.task-card.failure {
    border-left: 4px solid #f56565;
}

.task-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.task-info {
    flex: 1;
    min-width: 0;
}

.task-filename {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.task-lang {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.task-credits {
    color: var(--primary-color);
    font-weight: 500;
}

/* 任务状态 */
.task-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    flex-shrink: 0;
}

.task-status.waiting {
    background: rgba(246, 173, 85, 0.1);
    color: #f6ad55;
}

.task-status.processing {
    background: rgba(66, 153, 225, 0.1);
    color: #4299e1;
}

.task-status.failure {
    background: rgba(245, 101, 101, 0.1);
    color: #f56565;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* 进度条 */
.task-progress {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 40px;
    text-align: right;
}

/* 任务操作 */
.task-actions {
    display: flex;
    gap: 0.5rem;
}

/* 错误信息 */
.error-message {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #f56565;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state svg {
    margin-bottom: 1rem;
}

.empty-state p {
    margin: 0;
    font-size: 1rem;
}

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.page-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* 批量任务容器样式 */
.batch-task-container {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.batch-task-container:hover {
    border-color: #e0e0e0;
    box-shadow: var(--shadow-sm);
}

.batch-task-container.expanded {
    border-color: var(--primary-color);
}

.batch-task-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    cursor: pointer;
    user-select: none;
    border-radius: var(--radius-md);
    transition: background-color 0.2s ease;
}

.batch-task-header:hover {
    background-color: var(--bg-tertiary);
}

.batch-task-info {
    flex: 1;
    min-width: 0;
}

.batch-task-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.batch-expand-icon {
    transition: transform 0.2s ease;
    color: var(--text-secondary);
}

.batch-task-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.batch-time {
    color: var(--text-secondary);
}

.batch-status {
    color: var(--text-secondary);
}

.batch-credits {
    color: var(--primary-color);
    font-weight: 500;
}

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

.batch-download-all {
    white-space: nowrap;
}

.batch-task-content {
    border-top: 1px solid var(--border-color);
    padding: 0 1.5rem 1.5rem 1.5rem;
}

.batch-task-content .task-card {
    margin-bottom: 1rem;
}

.batch-task-content .task-card:last-child {
    margin-bottom: 0;
}

/* 确保顶级任务卡片（非子任务）有统一的底部间距 */
.task-list > .task-card:last-child {
    margin-bottom: 0;
}

/* 子任务样式（在批量任务容器中的任务） */
.task-card.sub-task {
    margin-left: 1rem;
    border-left: 3px solid var(--primary-color);
    background: white;
}

.task-card.sub-task:hover {
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-controls {
        width: 100%;
    }
    
    .search-input {
        width: 100%;
    }
    
    .task-header {
        flex-direction: column;
    }
    
    .task-actions {
        width: 100%;
        margin-top: 1rem;
    }
    
    .task-actions .btn {
        flex: 1;
    }
    
    /* 批量任务容器移动端样式 */
    .batch-task-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .batch-task-info {
        width: 100%;
    }
    
    .batch-task-actions {
        width: 100%;
    }
    
    .batch-download-all {
        width: 100%;
        justify-content: center;
    }
    
    .batch-task-content {
        padding: 0 1rem 1rem 1rem;
    }
    
    .task-card.sub-task {
        margin-left: 0;
    }
}
