/**
 * 处理中任务卡片样式
 *
 * 高级 AI 风格动效：
 * - 流光渐变边框
 * - 脉冲呼吸效果
 * - 进度条光晕
 * - 步骤状态切换
 */

/* ========== 核心动画定义 ========== */

/* 边框流光旋转 */
@keyframes border-glow-rotate {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 进度条光晕移动 */
@keyframes progress-glow {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 步骤 spinner */
@keyframes step-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 脉冲效果 */
@keyframes processing-pulse {
    0%, 100% {
        box-shadow:
            0 0 20px rgba(129, 140, 248, 0.15),
            0 4px 24px rgba(102, 126, 234, 0.1);
    }
    50% {
        box-shadow:
            0 0 35px rgba(129, 140, 248, 0.25),
            0 8px 32px rgba(102, 126, 234, 0.18);
    }
}

/* 卡片出现动画 */
@keyframes card-appear {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 完成过渡动画 */
@keyframes card-complete {
    0% {
        border-color: rgba(167, 139, 250, 0.5);
        box-shadow: 0 0 30px rgba(167, 139, 250, 0.3);
    }
    50% {
        border-color: rgba(16, 185, 129, 0.6);
        box-shadow: 0 0 40px rgba(16, 185, 129, 0.4);
    }
    100% {
        border-color: rgba(16, 185, 129, 0.3);
        box-shadow: 0 4px 24px rgba(16, 185, 129, 0.15);
    }
}

/* AI 图标旋转 */
@keyframes ai-icon-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 卡片消失动画 */
@keyframes card-disappear {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
}

/* ========== 容器样式 ========== */

.processing-tasks-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

/* ========== 处理中卡片 ========== */

.processing-card {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.98) 0%,
        rgba(248, 250, 255, 0.95) 100%
    );
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
    animation:
        card-appear 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        processing-pulse 2.5s ease-in-out infinite;
}

/* 发光边框层 */
.processing-card::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(
        90deg,
        #667EEA 0%,
        #764BA2 25%,
        #A78BFA 50%,
        #764BA2 75%,
        #667EEA 100%
    );
    background-size: 300% 100%;
    animation: border-glow-rotate 3s ease infinite;
    border-radius: calc(var(--radius-xl) + 2px);
    z-index: -1;
}

/* 内层背景遮罩 */
.processing-card::after {
    content: '';
    position: absolute;
    inset: 2px;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.99) 0%,
        rgba(248, 250, 255, 0.97) 100%
    );
    border-radius: calc(var(--radius-xl) - 2px);
    z-index: -1;
}

/* ========== 卡片头部 ========== */

.processing-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    position: relative;
    z-index: 1;
}

.processing-card-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 50%, #A78BFA 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow:
        0 4px 12px rgba(129, 140, 248, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.processing-card-icon svg {
    width: 22px;
    height: 22px;
    stroke: white;
    fill: rgba(255, 255, 255, 0.2);
    animation: ai-icon-spin 4s linear infinite;
}

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

.processing-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--neutral-800);
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.processing-card-status {
    font-size: 13px;
    background: linear-gradient(90deg, #667EEA, #A78BFA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

.processing-cancel-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(239, 68, 68, 0.06);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.processing-cancel-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    transform: scale(1.05);
}

.processing-cancel-btn svg {
    width: 16px;
    height: 16px;
    stroke: #ef4444;
    stroke-width: 2;
}

/* ========== 进度条 ========== */

.processing-progress-bar {
    height: 8px;
    background: rgba(167, 139, 250, 0.12);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--space-4);
    position: relative;
    z-index: 1;
}

.processing-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667EEA 0%, #A78BFA 100%);
    border-radius: 4px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* 进度条光晕效果 */
.processing-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.5) 50%,
        transparent 100%
    );
    animation: progress-glow 1.5s ease-in-out infinite;
}

/* ========== 步骤列表 ========== */

.processing-steps {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    position: relative;
    z-index: 1;
}

.processing-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: var(--space-2) var(--space-1);
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-indicator {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.step-text {
    font-size: 12px;
    color: var(--neutral-500);
    text-align: center;
    white-space: nowrap;
    transition: all 0.3s ease;
    font-weight: 500;
}

/* 待处理状态 */
.processing-step.pending .step-indicator {
    background: var(--neutral-100);
    border: 2px solid var(--neutral-200);
}

.processing-step.pending .step-dot {
    width: 8px;
    height: 8px;
    background: var(--neutral-300);
    border-radius: 50%;
}

/* 进行中状态 */
.processing-step.active {
    background: linear-gradient(
        135deg,
        rgba(129, 140, 248, 0.08) 0%,
        rgba(167, 139, 250, 0.12) 100%
    );
}

.processing-step.active .step-indicator {
    background: linear-gradient(135deg, #667EEA, #A78BFA);
    box-shadow:
        0 2px 10px rgba(102, 126, 234, 0.4),
        0 0 0 3px rgba(167, 139, 250, 0.15);
}

.processing-step.active .step-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: step-spin 0.8s linear infinite;
}

.processing-step.active .step-text {
    background: linear-gradient(90deg, #667EEA, #A78BFA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* 已完成状态 */
.processing-step.completed .step-indicator {
    background: linear-gradient(135deg, #10b981, #34d399);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.processing-step.completed .step-indicator svg {
    width: 16px;
    height: 16px;
    stroke: white;
    stroke-width: 3;
    fill: none;
}

.processing-step.completed .step-text {
    color: #10b981;
    font-weight: 600;
}

/* ========== 卡片底部 ========== */

.processing-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-3);
    border-top: 1px solid rgba(167, 139, 250, 0.1);
    position: relative;
    z-index: 1;
}

.processing-elapsed-time {
    font-size: 12px;
    color: var(--neutral-500);
    display: flex;
    align-items: center;
    gap: 6px;
}

.processing-elapsed-time svg {
    width: 14px;
    height: 14px;
    stroke: var(--neutral-400);
}

.processing-progress-percent {
    font-size: 15px;
    font-weight: 800;
    background: linear-gradient(90deg, #667EEA, #A78BFA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-variant-numeric: tabular-nums;
}

/* ========== 完成状态 ========== */

.processing-card.completed {
    animation: card-complete 0.8s ease forwards;
}

.processing-card.completed::before {
    background: linear-gradient(
        90deg,
        #10b981 0%,
        #34d399 50%,
        #10b981 100%
    );
    animation: none;
}

.processing-card.completed .processing-card-icon {
    background: linear-gradient(135deg, #10b981, #34d399);
}

.processing-card.completed .processing-card-icon svg {
    animation: none;
}

.processing-card.completed .processing-card-status {
    background: linear-gradient(90deg, #10b981, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.processing-card.completed .processing-progress-fill {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

.processing-card.completed .processing-progress-percent {
    background: linear-gradient(90deg, #10b981, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== 失败状态 ========== */

.processing-card.failed::before {
    background: linear-gradient(
        90deg,
        #ef4444 0%,
        #f87171 50%,
        #ef4444 100%
    );
    animation: none;
}

.processing-card.failed .processing-card-icon {
    background: linear-gradient(135deg, #ef4444, #f87171);
}

.processing-card.failed .processing-card-status {
    background: linear-gradient(90deg, #ef4444, #f87171);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== 响应式 ========== */

@media (max-width: 640px) {
    .processing-steps {
        grid-template-columns: repeat(3, 1fr);
    }

    /* 移动端只显示关键步骤: 上传、转录、完成 */
    .processing-step[data-step="converting"],
    .processing-step[data-step="summary"] {
        display: none;
    }

    .processing-card {
        padding: var(--space-4);
    }

    .processing-card-title {
        font-size: 15px;
    }

    .processing-card-icon {
        width: 40px;
        height: 40px;
    }

    .processing-card-icon svg {
        width: 20px;
        height: 20px;
    }

    .step-indicator {
        width: 28px;
        height: 28px;
    }

    .step-text {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .processing-card-footer {
        flex-direction: column;
        gap: var(--space-2);
        align-items: flex-start;
    }

    .processing-progress-percent {
        align-self: flex-end;
    }
}
