/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0a0f1a;
    --bg-card: #141c2e;
    --bg-card-hover: #1e2a42;
    --bg-input: #0d1220;
    --primary: #f97316;
    --primary-hover: #ea580c;
    --primary-glow: rgba(249, 115, 22, 0.3);
    --secondary: #8b5cf6;
    --text-main: #f1f5f9;
    --text-muted: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #1e293b;
    --border-hover: #334155;
    --glass: rgba(20, 28, 46, 0.8);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-dark) !important;
    background-image: linear-gradient(135deg, #0a0f1a 0%, #1a1f2e 100%) !important;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* 顶部导航栏 */
.header {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.main-nav {
    display: flex;
    gap: 4px;
    margin-left: 40px;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    font-size: 26px;
    background: linear-gradient(135deg, var(--primary), #fb923c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-main), #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
    padding: 6px 12px;
    background: var(--bg-input);
    border-radius: 20px;
    border: 1px solid var(--border);
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #ea580c);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
    position: relative;
    z-index: 10; /* 确保按钮在上层 */
    pointer-events: auto; /* 确保可以点击 */
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--primary-glow);
    cursor: pointer;
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

/* 修复禁用按钮样式 */
.btn-primary:disabled,
.btn:disabled,
button:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    filter: grayscale(0.5);
}

/* 确保启用状态的按钮可点击 */
.btn-primary:not(:disabled),
.btn:not(:disabled),
button:not(:disabled) {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border-hover);
    border-color: var(--border-hover);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* 主内容 */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 80px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
}

/* 登录/注册区域 */
.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 40px 20px;
}

.auth-box {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px var(--border),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.auth-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary));
    background-size: 200% 100%;
    animation: gradientMove 3s ease infinite;
}

@keyframes gradientMove {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.auth-box h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #fb923c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 14px;
    transition: all 0.25s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    background: var(--bg-dark);
}

.form-group input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.auth-switch {
    text-align: center;
    margin-top: 25px;
    color: var(--text-muted);
    font-size: 14px;
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    margin-left: 5px;
    font-weight: 600;
    transition: all 0.2s;
}

.auth-switch a:hover {
    text-shadow: 0 0 10px var(--primary-glow);
}

/* 任务创建区域 */
.create-task-box {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.create-task-box::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    opacity: 0.3;
    pointer-events: none;
}

.create-task-box h2 {
    margin-bottom: 25px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
}

.create-task-box h2 i {
    color: var(--primary);
}

/* 视频参数选择行 */
.video-params-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.param-group {
    flex: 1;
    margin-bottom: 0 !important;
}

.param-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.param-group label i {
    color: var(--primary);
    font-size: 12px;
}

.param-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

.param-group select:hover {
    border-color: var(--primary);
}

.param-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.param-group select option {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 10px;
}

@media (max-width: 768px) {
    .video-params-row {
        flex-direction: column;
        gap: 15px;
    }
}

.prompt-tips {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.prompt-tips .char-count {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

/* 任务列表 */
.tasks-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.tasks-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-tabs {
    display: flex;
    gap: 10px;
}

.tab-btn {
    padding: 8px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.tab-btn:hover {
    border-color: var(--primary);
    color: var(--text-main);
}

.tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* 任务网格 */
.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

/* 任务卡片 */
.task-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.task-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(249, 115, 22, 0.03) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.task-card:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px var(--primary);
}

.task-card:hover::before {
    opacity: 1;
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.task-status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.02em;
}

.task-status.pending {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(251, 146, 60, 0.2));
    color: var(--primary);
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.2);
}

.task-status.processing {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(96, 165, 250, 0.2));
    color: #60a5fa;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.task-status.completed {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(52, 211, 153, 0.2));
    color: var(--success);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.task-status.failed {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(248, 113, 113, 0.2));
    color: var(--danger);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.task-prompt {
    color: var(--text-main);
    margin-bottom: 15px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 13px;
}

.task-progress {
    margin-top: 15px;
}

/* 进度条 */
.progress-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #fb923c, var(--warning));
    background-size: 200% 100%;
    animation: progressGlow 2s ease infinite;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 3px;
    box-shadow: 0 0 10px var(--primary-glow);
}

@keyframes progressGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.task-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.task-actions .btn {
    flex: 1;
    font-size: 13px;
    padding: 8px 15px;
}

/* 视频预览 */
.task-video {
    margin-top: 15px;
    border-radius: 8px;
    overflow: hidden;
}

.task-video video {
    width: 100%;
    display: block;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 100px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 72px;
    margin-bottom: 25px;
    background: linear-gradient(135deg, var(--border), var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
    max-width: 300px;
    margin: 0 auto;
    line-height: 1.6;
}

/* 模态框 */
.modal {
    display: none !important;
    position: fixed !important;
    z-index: 1000 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.7) !important;
    overflow-y: auto !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.modal.active {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-large {
    max-width: 900px;
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--bg-dark);
    color: var(--text-main);
}

.modal-body {
    padding: 30px;
}

/* API Key 列表 */
.keys-list {
    margin-top: 30px;
}

.key-item {
    background: var(--bg-dark);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.key-info h4 {
    margin-bottom: 5px;
}

.key-info p {
    color: var(--text-muted);
    font-size: 13px;
}

.key-actions {
    display: flex;
    gap: 10px;
}

.key-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.spinner {
    border: 3px solid var(--bg-card-hover);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 通知消息 */
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--bg-card);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: 2000;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 400px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.success::before {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.error::before {
    content: '✕';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.warning::before {
    content: '!';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

/* 响应式 */
@media (max-width: 768px) {
    .header-title {
        font-size: 16px;
    }

    .tasks-grid {
        grid-template-columns: 1fr;
    }

    .tasks-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-tabs {
        overflow-x: auto;
        width: 100%;
    }

    .modal-content {
        margin: 10px;
    }
}

/* 科幻风格进度条动画 */
@keyframes progressFlow {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

@keyframes progressShine {
    0%, 100% { transform: translateX(-100%); opacity: 0; }
    50% { transform: translateX(100%); opacity: 1; }
}

@keyframes dotPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

@keyframes edgePulse {
    0%, 100% { 
        opacity: 0.8; 
        transform: scaleY(1);
        box-shadow: 
            0 0 8px rgba(59,130,246,0.9),
            0 0 16px rgba(139,92,246,0.7),
            inset 0 0 4px rgba(255,255,255,0.5);
    }
    50% { 
        opacity: 1; 
        transform: scaleY(1.15);
        box-shadow: 
            0 0 12px rgba(59,130,246,1),
            0 0 24px rgba(139,92,246,0.9),
            inset 0 0 6px rgba(255,255,255,0.7);
    }
}

@keyframes timeIconPulse {
    0%, 100% { 
        opacity: 0.8;
        filter: drop-shadow(0 0 3px rgba(59,130,246,0.7));
    }
    50% { 
        opacity: 1;
        filter: drop-shadow(0 0 6px rgba(59,130,246,1));
    }
}


