/* AI小说自动创作系统 - 监督模式样式 */

/* 暗色主题（默认） */
:root {
    --primary: #5b21b6;
    --primary-light: #7c3aed;
    --primary-dark: #4c1d95;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --bg-main: #0f0f0f;
    --bg-card: #1a1a1a;
    --bg-hover: #262626;
    --bg-active: #2d2d2d;
    
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    --border: #27272a;
    --border-light: #3f3f46;
    
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
    
    --radius: 12px;
    --radius-sm: 8px;
}

/* 明亮主题 */
[data-theme="light"] {
    --primary: #7c3aed;
    --primary-light: #8b5cf6;
    --primary-dark: #6d28d9;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #2563eb;
    
    --bg-main: #f9fafb;
    --bg-card: #ffffff;
    --bg-hover: #f3f4f6;
    --bg-active: #e5e7eb;
    
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    --border: #e5e7eb;
    --border-light: #d1d5db;
    
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

/* 应用容器 */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* 顶部控制栏 */
.control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

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

.app-title {
    font-size: 20px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-light), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 2s infinite;
}

.status-dot.active {
    background: var(--success);
}

.status-dot.paused {
    background: var(--warning);
}

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

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

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    margin-right: 12px;
}

.user-info span {
    color: var(--text-secondary);
    font-size: 14px;
}

.btn-start {
    padding: 10px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-start:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.btn-pause {
    padding: 10px 24px;
    background: var(--warning);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 18px;
}

.btn-icon:hover {
    background: var(--bg-active);
    border-color: var(--border-light);
}

/* 主布局 */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 1px;
    background: var(--border);
}

/* 项目面板 */
.project-panel {
    width: 320px;
    background: var(--bg-card);
    overflow-y: auto;
    padding: 20px;
}

.panel-section {
    margin-bottom: 32px;
}

.panel-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.project-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-item label {
    font-size: 13px;
    color: var(--text-secondary);
}

.input-field {
    padding: 10px 14px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

textarea.input-field {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* 工作流进度 */
.workflow-progress {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stage-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    transition: all 0.3s;
}

.stage-item.active {
    background: var(--bg-active);
    border: 1px solid var(--primary);
}

.stage-item.completed {
    opacity: 0.7;
}

.stage-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    font-size: 20px;
}

.stage-info {
    flex: 1;
}

.stage-info h4 {
    font-size: 14px;
    margin-bottom: 6px;
}

.progress-bar {
    height: 4px;
    background: var(--bg-main);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width 0.3s;
}

/* 快速操作 */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    padding: 10px 16px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.action-btn:hover {
    background: var(--bg-active);
    border-color: var(--border-light);
}

/* 工作流显示 */
.workflow-display {
    flex: 1;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
}

.workflow-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.workflow-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.task-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.workflow-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 执行日志 */
.execution-log {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.log-entry {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.log-entry.welcome {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
    border-color: var(--primary);
}

.log-time {
    min-width: 80px;
    font-size: 12px;
    color: var(--text-muted);
}

.log-content {
    flex: 1;
    line-height: 1.8;
}

.log-content ol {
    margin-left: 20px;
    margin-top: 12px;
}

.log-content li {
    margin-bottom: 6px;
}

.log-entry.role-architect { border-left: 3px solid #8b5cf6; }
.log-entry.role-character { border-left: 3px solid #ec4899; }
.log-entry.role-plot { border-left: 3px solid #3b82f6; }
.log-entry.role-narrative { border-left: 3px solid #10b981; }
.log-entry.role-continuity { border-left: 3px solid #f59e0b; }
.log-entry.role-quality { border-left: 3px solid #ef4444; }
.log-entry.role-director { border-left: 3px solid #6366f1; }

/* 审核面板 */
.review-panel {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 20px;
    max-height: 50vh;
    overflow-y: auto;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.review-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.review-role {
    padding: 4px 12px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.review-content {
    background: var(--bg-hover);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.review-actions {
    display: flex;
    gap: 12px;
}

.btn-approve {
    flex: 1;
    padding: 12px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-modify {
    flex: 1;
    padding: 12px;
    background: var(--warning);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-reject {
    flex: 1;
    padding: 12px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.modify-input {
    margin-top: 16px;
}

.modify-input textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    resize: vertical;
    margin-bottom: 12px;
}

.btn-submit {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* 输出面板 */
.output-panel {
    width: 380px;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
}

.output-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 14px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

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

.tab-btn.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary-light);
}

.tab-content {
    display: none;
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

.tab-content h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.content-display {
    background: var(--bg-hover);
    padding: 16px;
    border-radius: var(--radius-sm);
    min-height: 200px;
}

.placeholder {
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
}

/* 状态栏 */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

.status-left,
.status-center,
.status-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-separator {
    color: var(--text-muted);
    margin: 0 8px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow);
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.setting-group {
    margin-bottom: 32px;
}

.setting-group h4 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.form-item {
    margin-bottom: 16px;
}

.form-item label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border);
}

.btn-cancel {
    padding: 10px 20px;
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.btn-save {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.log-entry {
    animation: fadeIn 0.3s ease-out;
}

/* 响应式 */
@media (max-width: 1400px) {
    .project-panel {
        width: 280px;
    }
    .output-panel {
        width: 320px;
    }
}

@media (max-width: 1200px) {
    .output-panel {
        display: none;
    }
}

/* 角色标识颜色 */
.role-tag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.role-tag.architect { background: #8b5cf6; }
.role-tag.character { background: #ec4899; }
.role-tag.plot { background: #3b82f6; }
.role-tag.narrative { background: #10b981; }
.role-tag.continuity { background: #f59e0b; }
.role-tag.quality { background: #ef4444; }
.role-tag.director { background: #6366f1; }

/* 移动端响应式设计 */
@media (max-width: 768px) {
    /* 隐藏侧边栏，改为抽屉式 */
    .project-panel,
    .output-panel {
        position: fixed;
        top: 0;
        height: 100vh;
        width: 85%;
        max-width: 320px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    
    .output-panel {
        right: 0;
        left: auto;
        transform: translateX(100%);
    }
    
    .project-panel.active,
    .output-panel.active {
        transform: translateX(0);
    }
    
    /* 主布局调整 */
    .main-layout {
        flex-direction: column;
        padding: 0;
    }
    
    .workflow-display {
        flex: 1;
        border-radius: 0;
        margin: 0;
    }
    
    /* 顶部控制栏优化 */
    .control-bar {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 12px;
    }
    
    .app-title {
        font-size: 16px;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    /* 按钮尺寸调整 */
    .btn-start,
    .btn-pause,
    .btn-icon {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    /* 工作流内容优化 */
    .workflow-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .workflow-header h2 {
        font-size: 16px;
        width: 100%;
    }
    
    .execution-log {
        height: 300px;
        font-size: 13px;
    }
    
    /* 审核面板优化 */
    .review-panel {
        padding: 16px;
    }
    
    .review-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .review-actions button {
        flex: 1;
        min-width: 100px;
    }
    
    /* 状态栏优化 */
    .status-bar {
        flex-wrap: wrap;
        padding: 8px 12px;
        font-size: 12px;
        gap: 12px;
    }
    
    .status-left,
    .status-center,
    .status-right {
        flex: 1;
        text-align: center;
    }
    
    /* 模态框优化 */
    .modal-content {
        width: 95%;
        max-width: 400px;
        max-height: 90vh;
        margin: 5vh auto;
    }
    
    .modal-body {
        max-height: 70vh;
        overflow-y: auto;
    }
    
    /* 表单优化 */
    .input-field {
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    /* 进度条优化 */
    .stage-item {
        padding: 12px;
    }
    
    .stage-icon {
        font-size: 20px;
    }
    
    /* 添加移动端菜单按钮 */
    .mobile-menu-btn {
        display: block;
        position: fixed;
        bottom: 20px;
        left: 20px;
        width: 56px;
        height: 56px;
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 50%;
        box-shadow: var(--shadow);
        z-index: 999;
        font-size: 24px;
        cursor: pointer;
    }
    
    .mobile-output-btn {
        display: block;
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        background: var(--info);
        color: white;
        border: none;
        border-radius: 50%;
        box-shadow: var(--shadow);
        z-index: 999;
        font-size: 24px;
        cursor: pointer;
    }
    
    /* 遮罩层 */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }
    
    .mobile-overlay.active {
        display: block;
    }
}

/* 小屏幕手机优化 */
@media (max-width: 480px) {
    .control-bar {
        padding: 10px 12px;
    }
    
    .app-title {
        font-size: 14px;
    }
    
    .btn-start,
    .btn-pause,
    .btn-icon {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .execution-log {
        height: 250px;
        font-size: 12px;
    }
    
    .review-actions button {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .stage-item {
        padding: 10px;
    }
    
    .stage-info h4 {
        font-size: 13px;
    }
}

/* 横屏优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .control-bar {
        padding: 8px 16px;
    }
    
    .execution-log {
        height: 200px;
    }
    
    .mobile-menu-btn,
    .mobile-output-btn {
        bottom: 10px;
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
}

/* 桌面端隐藏移动端元素 */
@media (min-width: 769px) {
    .mobile-menu-btn,
    .mobile-output-btn,
    .mobile-overlay {
        display: none !important;
    }
}