* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

/* 两列布局 */
.main-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.left-column {
    flex: 1;
    min-width: 0; /* 允许 flex 子元素缩小 */
}

.right-column {
    flex: 1; /* 与左列等宽 */
    min-width: 0; /* 允许 flex 子元素缩小 */
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }
    
    .right-column {
        flex: 1;
        position: static;
        max-height: none;
    }
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
}

header h1 {
    font-size: 32px;
}

.worker-status {
    margin-top: 15px;
    padding: 12px 20px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
}

.worker-status.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.worker-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #dc3545;
}

.worker-status .status-icon {
    font-size: 18px;
}

.worker-status .status-message {
    flex: 1;
}

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

.section {
    background: white;
    padding: 30px;
    margin-bottom: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.section h2 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input[type="file"] {
    padding: 5px;
}

.preview {
    margin-top: 10px;
    max-width: 200px;
}

.preview img {
    max-width: 100%;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.preview audio {
    width: 100%;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

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

/* 进度条 */
.progress-container {
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e9ecef;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

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

.progress-text {
    text-align: center;
    margin-top: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #667eea;
}

/* 步骤列表 */
.steps-list {
    margin-bottom: 30px;
}

.step-item {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    border-left: 4px solid #ddd;
    background: #f8f9fa;
    transition: all 0.3s;
}

.step-item.active {
    border-left-color: #667eea;
    background: #e7f1ff;
}

.step-item.completed {
    border-left-color: #28a745;
    background: #d4edda;
}

.step-item.error {
    border-left-color: #dc3545;
    background: #f8d7da;
}

.step-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.step-message {
    color: #666;
    font-size: 14px;
}

.step-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.step-actions .btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

/* 日志 */
.log-container {
    margin-top: 30px;
}

.log-container h3 {
    margin-bottom: 10px;
    color: #333;
}

.log-content {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 5px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.log-line {
    margin-bottom: 5px;
    word-wrap: break-word;
}

.log-line.error {
    color: #f48771;
}

.log-line.success {
    color: #89d185;
}

/* 错误信息 */
.error-content {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #dc3545;
}

/* 结果展示 */
.result-container {
    text-align: center;
}

.result-container video {
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.result-actions {
    margin-top: 20px;
}

/* 进度操作按钮 */
.progress-actions {
    display: flex;
    gap: 10px;
}

.btn-warning {
    background: #ffc107;
    color: #000;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* 中间结果 */
.intermediate-results {
    margin-top: 20px;
}

.intermediate-item {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 5px;
    border-left: 4px solid #667eea;
}

.intermediate-item.has-result {
    border-left: 4px solid #28a745;
    background: #f0f9ff;
}

.intermediate-item.no-result {
    border-left: 4px solid #ddd;
    background: #f9f9f9;
    opacity: 0.6;
}

.intermediate-item h4 {
    margin-bottom: 10px;
    color: #333;
}

.intermediate-item .step-result {
    background: white;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.intermediate-item .step-preview {
    margin-top: 10px;
}

.intermediate-item .step-preview img {
    max-width: 200px;
    border-radius: 5px;
    margin-right: 10px;
}

.intermediate-item .step-preview video {
    max-width: 200px;
    border-radius: 5px;
    margin-right: 10px;
}

.intermediate-item .step-preview audio {
    width: 100%;
    max-width: 400px;
}

.intermediate-item .step-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.intermediate-item .step-actions .btn {
    padding: 5px 10px;
    font-size: 12px;
}

.intermediate-editor {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    margin-top: 20px;
}

.intermediate-editor .form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.intermediate-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 1200px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.modal-header h3 {
    margin: 0;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

#editStepResultText {
    min-height: 400px;
    font-size: 13px;
    font-family: monospace;
}

/* 富媒体表格结果样式 */
.rich-result-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.rich-result-table th,
.rich-result-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
}

.rich-result-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.rich-result-table tr:hover {
    background-color: #f1f1f1;
}

.media-thumbnail {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #eee;
}

.media-thumbnail:hover {
    opacity: 0.9;
    border-color: #667eea;
}

.media-video {
    width: 200px;
    border-radius: 4px;
}

.media-audio {
    width: 200px;
}

.script-text {
    max-width: 300px;
    font-size: 14px;
    color: #333;
}

.prompt-text {
    max-width: 250px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.retry-item-btn {
    padding: 6px 12px;
    font-size: 12px;
    background-color: #ffc107;
    color: #000;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.retry-item-btn:hover {
    background-color: #e0a800;
}

.retry-item-btn:disabled {
    background-color: #e2e6ea;
    color: #6c757d;
    cursor: not-allowed;
}

/* 草稿功能样式 */
.draft-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.draft-controls .btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
}

.draft-info {
    padding: 10px;
    background: #e7f3ff;
    border-left: 4px solid #2196F3;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #1976D2;
}