/* ==========================================
   CSS 变量定义 - 参照聊天页面的高端风格
   ========================================== */
:root {
    /* 暗色主题 */
    --bg-primary: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    --bg-secondary: linear-gradient(145deg, rgba(20, 20, 30, 0.8), rgba(10, 10, 20, 0.7));
    --bg-tertiary: #0a0a0b;
    --bg-glass: rgba(255, 255, 255, 0.1);
    --bg-hover: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --text-muted: rgba(255, 255, 255, 0.6);
    --accent-primary: linear-gradient(135deg, #ff6b9d, #d4af37);
    --accent-secondary: linear-gradient(135deg, #4a90e2, #74b9ff);
    --accent-success: linear-gradient(135deg, #00ff88, #00ccdd);
    --accent-warning: linear-gradient(135deg, #ffa500, #ff6347);
    --accent-danger: linear-gradient(135deg, #ff6b9d, #ff3d71);
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --glass-border: rgba(255, 255, 255, 0.2);
}

/* 亮色主题 */
[data-theme="light"] {
    --bg-primary: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(248, 249, 250, 0.8));
    --bg-secondary: linear-gradient(145deg, rgba(240, 242, 245, 0.9), rgba(230, 235, 240, 0.8));
    --bg-tertiary: linear-gradient(135deg, #f8f9fa, #e9ecef);
    --bg-glass: rgba(255, 255, 255, 0.7);
    --bg-hover: rgba(0, 0, 0, 0.03);
    --text-primary: #1a1a1a;
    --text-secondary: rgba(26, 26, 26, 0.8);
    --text-muted: rgba(26, 26, 26, 0.6);
    --accent-primary: linear-gradient(135deg, #5865f2, #4752c4);
    --accent-secondary: linear-gradient(135deg, #7289da, #5865f2);
    --accent-success: linear-gradient(135deg, #248046, #2d9748);
    --accent-warning: linear-gradient(135deg, #f0b232, #e6a200);
    --accent-danger: linear-gradient(135deg, #d83c3e, #c23a3c);
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --glass-border: rgba(0, 0, 0, 0.1);
}

/* ==========================================
   基础样式 - 全屏设计
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-tertiary);
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden; /* 防止滚动条 */
    width: 100vw;
    height: 100vh;
}

/* 动态背景效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    opacity: 0.04;
    background:
            radial-gradient(circle at 15% 15%, rgba(255, 107, 157, 0.2) 0%, transparent 40%),
            radial-gradient(circle at 85% 15%, rgba(74, 144, 226, 0.15) 0%, transparent 40%),
            radial-gradient(circle at 50% 85%, rgba(212, 175, 55, 0.12) 0%, transparent 50%);
    animation: backgroundFlow 25s ease-in-out infinite;
}

@keyframes backgroundFlow {
    0%, 100% { background-position: 0% 0%, 100% 0%, 50% 100%; }
    33% { background-position: 20% 20%, 80% 20%, 30% 80%; }
    66% { background-position: 80% 10%, 20% 30%, 70% 90%; }
}

/* 全屏容器 */
.container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
}

/* SVG定义隐藏 */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ==========================================
   头部样式 - 紧凑设计
   ========================================== */
.header {
    text-align: center;
    padding: 20px 40px 15px;
    background: var(--bg-primary);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.header::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg,
    rgba(255, 107, 157, 0.8) 0%,
    rgba(212, 175, 55, 0.8) 25%,
    rgba(74, 144, 226, 0.8) 50%,
    rgba(212, 175, 55, 0.8) 75%,
    rgba(255, 107, 157, 0.8) 100%);
    animation: borderGlow 3s ease-in-out infinite;
}

@keyframes borderGlow {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.header h1 {
    color: var(--text-primary);
    font-size: 2rem;
    margin-bottom: 8px;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #ff6b9d 25%, #d4af37 50%, #4a90e2 75%, #ffffff 100%);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleShimmer 4s ease-in-out infinite;
}

@keyframes titleShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.header p {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
}

/* ==========================================
   主内容区域 - 全屏网格布局
   ========================================== */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1;
    height: calc(100vh - 88px); /* 减去头部高度 */
    overflow: hidden;
}

.upload-section,
.tasks-section {
    padding: 25px;
    background: var(--bg-primary);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    height: 100%;
}

.tasks-section {
    border-right: none;
}

/* ==========================================
   文件上传样式
   ========================================== */
.file-input-label {
    display: block;
    padding: 35px 25px;
    border: 3px dashed var(--border-color);
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-glass);
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.file-input-label:hover {
    border-color: rgba(255, 107, 157, 0.6);
    background: rgba(255, 107, 157, 0.05);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 107, 157, 0.2);
}

.file-input-label.has-file {
    border-color: #28a745;
    background: linear-gradient(145deg, rgba(40, 167, 69, 0.1), rgba(40, 167, 69, 0.05));
}

.file-input-label.has-file:hover {
    border-color: #34ce57;
    background: linear-gradient(145deg, rgba(40, 167, 69, 0.15), rgba(40, 167, 69, 0.08));
}

.file-input {
    display: none;
}

.file-input-label i {
    display: block;
    font-size: 2.5rem;
    margin-bottom: 12px;
    color: rgba(255, 107, 157, 0.8);
    transition: all 0.3s ease;
}

.file-input-label:hover i {
    color: rgba(255, 107, 157, 1);
    transform: scale(1.1);
}

.file-input-label strong {
    font-size: 1rem;
    color: var(--text-primary);
    display: block;
    margin-bottom: 8px;
}

.file-input-label small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ==========================================
   输入框和按钮样式
   ========================================== */
.prompt-input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    font-size: 15px;
    min-height: 90px;
    margin-bottom: 20px;
    resize: vertical;
    background: var(--bg-glass);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-family: inherit;
}

.prompt-input:focus {
    outline: none;
    border-color: rgba(255, 107, 157, 0.6);
    box-shadow: 0 0 0 4px rgba(255, 107, 157, 0.1);
}

.prompt-input::placeholder {
    color: var(--text-muted);
}

.generate-btn {
    width: 100%;
    padding: 16px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 25px rgba(255, 107, 157, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(255, 107, 157, 0.4);
    background: linear-gradient(135deg, #ff8bb4, #e6c966);
}

.generate-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==========================================
   进度容器样式
   ========================================== */
.progress-container {
    display: none;
    margin: 20px 0;
    padding: 30px 25px;
    background: var(--bg-primary);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    animation: slideInUp 0.5s ease-out;
}

.progress-container.error {
    border: 2px solid rgba(220, 53, 69, 0.4);
    background: linear-gradient(145deg, rgba(220, 53, 69, 0.05), rgba(220, 53, 69, 0.02));
}

.progress-container.error .progress-ring-fill {
    stroke: url(#errorGradient);
}

.progress-container.success {
    border: 2px solid rgba(40, 167, 69, 0.4);
    background: linear-gradient(145deg, rgba(40, 167, 69, 0.05), rgba(40, 167, 69, 0.02));
}

.progress-container.success .progress-ring-fill {
    stroke: url(#successGradient);
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.progress-header {
    text-align: center;
    margin-bottom: 25px;
}

.progress-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    background: var(--accent-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.progress-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 10px;
    font-weight: 500;
}

.progress-time {
    color: var(--text-muted);
    font-size: 14px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

/* ==========================================
   环形进度条样式 - 紧凑版
   ========================================== */
.circular-progress {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 25px;
}

.progress-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 10;
}

.progress-ring-fill {
    fill: none;
    stroke: url(#progressGradient);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 534.07;
    stroke-dashoffset: 534.07;
    transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 8px rgba(255, 107, 157, 0.4));
}

.progress-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

.progress-percentage-small {
    font-size: 16px;
    color: var(--text-muted);
    margin-left: 2px;
}

/* ==========================================
   阶段指示器样式 - 紧凑版
   ========================================== */
.progress-stages {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 25px 0;
    position: relative;
}

.progress-stages::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 25px;
    right: 25px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 1;
    border-radius: 1px;
}

.progress-stages::after {
    content: '';
    position: absolute;
    top: 18px;
    left: 25px;
    height: 2px;
    background: var(--accent-primary);
    z-index: 2;
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 1px;
}

.stage {
    position: relative;
    z-index: 3;
    text-align: center;
    flex: 1;
}

.stage-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
    font-size: 15px;
    backdrop-filter: blur(10px);
    border: 2px solid transparent;
}

.stage.active .stage-icon {
    background: var(--accent-primary);
    color: white;
    animation: pulse 2s infinite;
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.stage.completed .stage-icon {
    background: var(--accent-success);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 157, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 107, 157, 0);
    }
}

.stage-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    transition: all 0.3s ease;
}

.stage.active .stage-label {
    color: var(--text-primary);
    font-weight: 700;
}

.stage.completed .stage-label {
    color: var(--text-secondary);
}

/* ==========================================
   详细信息面板样式 - 紧凑版
   ========================================== */
.progress-details {
    background: var(--bg-glass);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row:hover {
    background: var(--bg-hover);
    margin: 0 -10px;
    padding: 8px 10px;
    border-radius: 6px;
}

.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
}

.detail-value {
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: 500;
}

.ai-response {
    background: var(--bg-glass);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 16px;
    margin-top: 16px;
    max-height: 150px;
    overflow-y: auto;
    backdrop-filter: blur(10px);
}

.ai-response-header {
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.ai-response-header i {
    color: rgba(255, 107, 157, 0.8);
    font-size: 16px;
}

.ai-response-content {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.4;
}

/* ==========================================
   任务历史样式 - 全屏优化
   ========================================== */
.tasks-header h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
}

.tasks-header i {
    color: rgba(255, 107, 157, 0.8);
    font-size: 22px;
}

.task-item {
    display: flex;
    gap: 15px;
    padding: 18px;
    margin-bottom: 12px;
    background: var(--bg-glass);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    backdrop-filter: blur(15px);
    animation: fadeInUp 0.5s ease-out;
    align-items: flex-start;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.task-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 107, 157, 0.3);
}

.task-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.task-item:hover .task-image {
    transform: scale(1.02);
    border-color: rgba(255, 107, 157, 0.4);
}

.task-info {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 16px;
    color: var(--text-primary);
}

.task-prompt {
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.task-time {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

.task-status {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.status-pending {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2), rgba(255, 193, 7, 0.1));
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.status-processing {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.2), rgba(74, 144, 226, 0.1));
    color: #4a90e2;
    border: 1px solid rgba(74, 144, 226, 0.3);
    animation: statusPulse 2s infinite;
}

.status-completed {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.2), rgba(40, 167, 69, 0.1));
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.status-failed {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.2), rgba(220, 53, 69, 0.1));
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.task-video-container {
    flex-shrink: 0;
    margin-left: 12px;
    align-self: flex-start;
}

.task-video {
    width: 160px;
    height: 90px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: block;
}

.task-video:hover {
    transform: scale(1.02);
    border-color: rgba(255, 107, 157, 0.4);
}

.error-message {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.05));
    color: #dc3545;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 13px;
    border: 1px solid rgba(220, 53, 69, 0.2);
    backdrop-filter: blur(10px);
}

.empty-state {
    text-align: center;
    padding: 60px 30px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3.5rem;
    color: rgba(255, 107, 157, 0.3);
    margin-bottom: 20px;
    display: block;
}

.empty-state p {
    font-size: 15px;
    line-height: 1.6;
}

/* ==========================================
   提示消息样式
   ========================================== */
.alert {
    padding: 15px 20px;
    border-radius: 12px;
    margin: 15px 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(15px);
    border: 1px solid transparent;
    animation: slideInDown 0.4s ease-out;
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.15), rgba(40, 167, 69, 0.05));
    color: #28a745;
    border-color: rgba(40, 167, 69, 0.3);
}

.alert-error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.15), rgba(220, 53, 69, 0.05));
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.3);
}

/* ==========================================
   滚动条样式
   ========================================== */
.upload-section::-webkit-scrollbar,
.tasks-section::-webkit-scrollbar,
.ai-response::-webkit-scrollbar {
    width: 6px;
}

.upload-section::-webkit-scrollbar-track,
.tasks-section::-webkit-scrollbar-track,
.ai-response::-webkit-scrollbar-track {
    background: transparent;
}

.upload-section::-webkit-scrollbar-thumb,
.tasks-section::-webkit-scrollbar-thumb,
.ai-response::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.6), rgba(212, 175, 55, 0.6));
    border-radius: 10px;
}

.upload-section::-webkit-scrollbar-thumb:hover,
.tasks-section::-webkit-scrollbar-thumb:hover,
.ai-response::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.8), rgba(212, 175, 55, 0.8));
}

/* ==========================================
   响应式设计
   ========================================== */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: auto;
    }

    .upload-section,
    .tasks-section {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        height: auto;
        min-height: 45vh;
        overflow-y: visible;
    }

    .tasks-section {
        border-bottom: none;
    }

    .container {
        height: auto;
        min-height: 100vh;
    }

    body {
        overflow: auto;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 15px 20px 12px;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    .header p {
        font-size: 0.9rem;
    }

    .upload-section,
    .tasks-section {
        padding: 20px;
    }

    .circular-progress {
        width: 140px;
        height: 140px;
    }

    .progress-percentage {
        font-size: 24px;
    }

    .progress-stages {
        flex-wrap: wrap;
        gap: 10px;
    }

    .progress-stages::before,
    .progress-stages::after {
        display: none;
    }

    .stage {
        flex-basis: calc(33.33% - 7px);
    }

    .stage-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .task-item {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .task-video-container {
        margin-left: 0;
        margin-top: 10px;
        align-self: center;
    }

    .task-video {
        width: 200px;
        height: 112px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.4rem;
    }

    .upload-section,
    .tasks-section {
        padding: 15px;
    }

    .progress-container {
        padding: 25px 15px;
    }

    .circular-progress {
        width: 120px;
        height: 120px;
    }

    .progress-percentage {
        font-size: 20px;
    }

    .task-video {
        width: 100%;
        max-width: 240px;
        height: auto;
    }
}