/* ============================================
   主题系统 - 两套完整的颜色模板
   ============================================ */

/* 深色主题（默认） */
:root,
body.theme-dark {
    /* 文字颜色 */
    --text-primary: #dadada;
    --text-secondary: #999999;
    --text-tertiary: #666666;
    --text-disabled: #555555;
    
    /* 背景颜色 */
    --background-nav: #212122;
    --background-gray-main: #272728;
    --background-card: #2d2d2e;
    --background-hover: rgba(255, 255, 255, 0.08);
    --background-active: rgba(255, 255, 255, 0.15);
    --background-input: #1e1e1f;
    
    /* 边框颜色 */
    --border-primary: rgba(255, 255, 255, 0.1);
    --border-secondary: rgba(255, 255, 255, 0.05);
    --border-hover: rgba(255, 255, 255, 0.2);
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    
    /* 品牌色 */
    --color-primary: #667eea;
    --color-primary-hover: #5568d3;
    --color-success: #4caf50;
    --color-error: #f44336;
    --color-warning: #ffc107;
    --color-warning-bg: rgba(255, 195, 7, 0.1);
    --color-warning-border: rgba(255, 195, 7, 0.3);
    --color-warning-text: #ffc107;
    
    /* 图标和Logo */
    --logo-color: var(--text-primary);
    --icon-primary: var(--text-primary);
    --icon-secondary: var(--text-primary);
    --icon-disable: var(--text-disabled);
    
    /* 按钮颜色 */
    --btn-submit-bg: #ffffff;
    --btn-submit-bg-hover: #f5f5f5;
    --btn-submit-icon: #1a1a19;
    
    /* 特殊用途 */
    --placeholder-color: #666666;
    --divider-color: rgba(255, 255, 255, 0.1);
}

/* 亮色主题 */
body.theme-light {
    /* 文字颜色 */
    --text-primary: #34322d;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --text-disabled: #cccccc;
    
    /* 背景颜色 */
    --background-nav: #f5f5f5;
    --background-gray-main: #f8f8f7;
    --background-card: #ffffff;
    --background-hover: rgba(0, 0, 0, 0.04);
    --background-active: rgba(0, 0, 0, 0.08);
    --background-input: #fafafa;
    
    /* 边框颜色 */
    --border-primary: #e8e8e8;
    --border-secondary: #f0f0f0;
    --border-hover: #d0d0d0;
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    
    /* 品牌色（亮色主题下可能需要稍微调整） */
    --color-primary: #667eea;
    --color-primary-hover: #5568d3;
    --color-success: #4caf50;
    --color-error: #f44336;
    --color-warning: #ffc107;
    --color-warning-bg: #fff3cd;
    --color-warning-border: #ffc107;
    --color-warning-text: #856404;
    
    /* 图标和Logo */
    --logo-color: var(--text-primary);
    --icon-primary: var(--text-primary);
    --icon-secondary: var(--text-primary);
    --icon-disable: var(--text-disabled);
    
    /* 按钮颜色 */
    --btn-submit-bg: #1a1a1a;
    --btn-submit-bg-hover: #2a2a2a;
    --btn-submit-icon: #ffffff;
    
    /* 特殊用途 */
    --placeholder-color: #999999;
    --divider-color: #e8e8e8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 全局文字颜色 */
* {
    color: var(--text-primary);
}

/* 登录弹窗样式已移至 login-modal/login-modal.css */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px; /* 基础字体大小 */
    line-height: 1.5; /* 基础行高 */
    font-weight: 400; /* 基础字体粗细 */
    background: var(--background-gray-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column; /* 上下布局：导航栏在上，主内容在下 */
    margin: 0;
    padding: 0;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    color: var(--text-primary);
}

/* 全局字体工具类 */
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 20px; }
.text-3xl { font-size: 24px; }
.text-4xl { font-size: 28px; }
.text-5xl { font-size: 48px; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-primary { color: var(--text-primary); }

/* 通用工具类 */
.hidden { display: none !important; }

/* 消息容器样式 */
.message-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 12px auto;
    padding: 0 20px;
}

/* 文件列表容器样式 */
.file-list-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 12px auto;
}

/* 左侧边栏 */
.sidebar {
    width: 280px;
    min-width: 280px; /* 确保最小宽度 */
    max-width: 280px; /* 确保最大宽度 */
    flex: 0 0 280px; /* 不增长，不缩小，固定280px */
    background-color: var(--background-nav);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    position: relative; /* 确保定位正确 */
    flex-shrink: 0; /* 明确禁止缩小 */
}

.sidebar-header {
    /* 左侧与下方菜单图标对齐：下方菜单整体左边距为 8px(sidebar-content) + 20px(menu-link) = 28px */
    padding: 20px 8px 0 28px;
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.sidebar-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sidebar-title-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: block;
    color: var(--icon-secondary);
}

.sidebar-content {
    flex: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
}

.sidebar-menu-wrapper {
    flex: 1;
}

.sidebar-footer {
    padding: 12px 8px;
    margin-top: auto;
}

.sidebar-footer-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 主题切换按钮 */
.theme-toggle-btn {
    width: 100%;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid var(--border-primary);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
}

.theme-toggle-btn:hover {
    border-color: var(--border-hover);
}

/* 主题切换段 */
.theme-toggle-segment {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    transition: all 0.2s ease;
}

.theme-toggle-segment-light {
    opacity: 0.9;
}

.theme-toggle-segment-dark {
    opacity: 0.9;
}

/* 亮色主题激活时，亮色段高亮 */
body.theme-light .theme-toggle-segment-light {
    background: var(--background-active);
}

/* 暗色主题激活时，暗色段高亮 */
body.theme-dark .theme-toggle-segment-dark {
    background: var(--background-active);
}

.theme-toggle-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: block;
}

.theme-toggle-icon path {
    fill: currentColor;
}

/* 默认深色主题：显示深色图标，隐藏浅色图标 */
.theme-toggle-icon-light {
    display: none;
}

.theme-toggle-icon-dark {
    display: block;
}

/* 浅色主题：显示浅色图标，隐藏深色图标 */
body.theme-light .theme-toggle-icon-light {
    display: block;
}

body.theme-light .theme-toggle-icon-dark {
    display: none;
}

.sidebar-footer-item {
    margin: 0;
}

.sidebar-footer-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar-footer-link:hover {
    background: #ffffff0f;
    color: var(--text-primary);
}

.sidebar-footer-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    display: inline-block;
    flex-shrink: 0;
    font-size: 16px;
}

.sidebar-footer-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* 侧边栏菜单项 */
.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-menu-item {
    margin: 0 0 2px 0;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar-menu-link:hover {
    background: var(--background-hover);
    color: var(--text-primary);
}

.sidebar-menu-link.active {
    background: var(--background-active);
    color: var(--text-primary);
    border-radius: 8px;
    font-weight: 600;
}

.sidebar-menu-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    display: inline-block;
    flex-shrink: 0;
    font-size: 18px;
}

.sidebar-menu-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* 父级菜单 */
.sidebar-menu-link.parent {
    cursor: pointer;
}

.sidebar-menu-link.parent::after {
    content: '▶';
    margin-left: auto;
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.sidebar-menu-link.parent.expanded::after {
    transform: rotate(90deg);
}

/* 子菜单 */
.sidebar-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-submenu.expanded {
    max-height: 1000px;
}

.sidebar-submenu-item {
    margin: 0;
}

.sidebar-submenu-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;  /* 与「所有任务」左对齐 */
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar-submenu-link:hover {
    background: var(--background-hover);
    color: var(--text-primary);
}

.sidebar-submenu-link.active {
    background: var(--background-active);
    color: var(--text-primary);
    font-weight: 500;
}

/* 右侧主内容区域 */
.main-content {
    flex: 1 1 auto; /* 允许增长和缩小，占据剩余空间 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0; /* 允许flex子元素缩小到内容宽度以下 */
    position: relative; /* 为 control-bar 的绝对定位提供定位上下文 */
    background-color: var(--background-gray-main);
}

/* 页面容器 */
.page-container {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.page-container.active {
    display: flex;
}

/* 新建任务页面 */
.page-new-task {
    display: flex;
    flex-direction: column;
}

/* 作品库页面 */
.page-works {
    padding: 40px;
    overflow-y: auto;
}

.works-header {
    margin-bottom: 30px;
}

.works-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.works-header p {
    color: var(--text-primary);
    font-size: 14px;
}

.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.work-card {
    background: var(--background-card);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
}

.work-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

/* 缩略图区域占满卡片宽度，限制最大高度 */
.work-card-thumbnail {
    width: 100%;
    max-height: 600px;
    aspect-ratio: 16/9;
    background: var(--background-input);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 48px;
    position: relative;
    overflow: hidden;
}

/* 图片按原始比例显示在 16:9 容器内，不裁剪，限制大小 */
.work-card-thumbnail img,
.work-card-thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
}

.work-card-info {
    padding: 16px;
}

.work-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.work-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* 所有任务页面 */
.page-all-tasks {
    padding: 40px;
    overflow-y: auto;
}

.tasks-header {
    margin-bottom: 30px;
}

.tasks-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-item {
    background: var(--background-card);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.task-item:hover {
    border-color: var(--border-hover);
    background: var(--background-hover);
}

.task-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.task-item-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.task-item-time {
    font-size: 13px;
    color: var(--text-primary);
}

.task-item-preview {
    font-size: 14px;
    color: var(--text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 对话记录页面 */
.page-conversation {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.conversation-header {
    padding: 20px 40px;
    border-bottom: 1px solid var(--divider-color);
    background: var(--background-card);
}

.conversation-header .conversation-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.conversation-messages > .conversation-processing-strip-wrap.message-item {
    margin-left: auto;
    align-self: flex-end;
    flex-shrink: 0;
    min-width: 0;
    width: auto;
    max-width: 100%;
}

.conversation-processing-videos.hidden {
    display: none !important;
}

.conversation-processing-strip-bubble.message-content {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
}

.conversation-processing-strip-body {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: nowrap;
    gap: 12px;
    min-width: 0;
}

.conversation-processing-thumbs {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    flex-shrink: 0;
}

.conversation-processing-prompts {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-primary);
    text-align: left;
}

.conversation-processing-prompt-text {
    word-break: break-word;
}

.conversation-processing-prompt-item {
    margin-bottom: 10px;
}

.conversation-processing-prompt-item:last-child {
    margin-bottom: 0;
}

.conversation-processing-prompt-index {
    color: var(--text-tertiary);
    font-weight: 600;
    margin-right: 6px;
}

.conversation-processing-prompt-missing {
    color: var(--text-tertiary);
    font-size: 13px;
}

.conversation-processing-thumb {
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 0;
}

.conversation-processing-thumb .file-status-thumb-wrap {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.conversation-processing-thumb:focus-visible {
    outline: none;
}

.conversation-processing-thumb:focus-visible .file-status-thumb-wrap {
    outline: 2px solid var(--color-primary, #3b82f6);
    outline-offset: 2px;
}

.conversation-processing-thumb:hover .file-status-thumb-wrap {
    opacity: 0.92;
}

.conversation-processing-thumb .file-status-play {
    pointer-events: none;
}

.conversation-messages {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 1200px; /* 与输入框对齐 */
    margin: 0 auto; /* 居中 */
    width: 100%;
    box-sizing: border-box;
    padding-bottom: 120px; /* 为置底的输入框留出空间 */
}

.message-item {
    display: flex;
    gap: 16px;
    max-width: 800px; /* 消息的最大宽度，保持自然宽度 */
}

.message-item.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

/* 不显示角色（ME/AI），仅展示消息内容 */
.message-avatar {
    display: none;
}

.message-content {
    flex: 1;
    background: var(--background-input);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

.message-item.user .message-content {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

/* 对话内工作流状态（排队/执行/取消完成）：随主题可读，勿用固定浅色字 */
.workflow-status-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.workflow-status-row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.workflow-status-row-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--text-primary);
}

.workflow-status-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 2px solid var(--border-primary);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.workflow-status-progress-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.workflow-status-progress-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.workflow-status-bar-track {
    width: 100%;
    height: 8px;
    background: var(--background-active);
    border-radius: 4px;
    overflow: hidden;
}

.workflow-status-bar-fill {
    height: 100%;
    max-width: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.35);
}

.workflow-status-time-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.45;
}

.workflow-status-cancel-done {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-primary);
}

button.workflow-cancel-btn {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid var(--border-hover);
    background: var(--background-hover);
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
}

button.workflow-cancel-btn:hover:not(:disabled) {
    background: var(--background-active);
}

button.workflow-cancel-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.workflow-result-preview-heading {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.workflow-result-meta {
    font-weight: 400;
    color: var(--text-tertiary);
    margin-left: 8px;
}

/* 设置引导界面 */
.settings-guide {
    padding: 16px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-top: 12px;
}

.setting-item {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.setting-item label {
    min-width: 100px;
    font-weight: 500;
    color: var(--text-primary);
}

.setting-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    font-size: 14px;
    background: var(--background-card);
}

.setting-item input[type="checkbox"] {
    margin-right: 8px;
}

.settings-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-start-processing,
.btn-use-defaults {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-start-processing {
    background: #667eea;
    color: white;
}

.btn-start-processing:hover {
    background: #5568d3;
}

.btn-use-defaults {
    background: var(--background-input);
    color: var(--text-tertiary);
}

.btn-use-defaults:hover {
    background: var(--background-hover);
}

.countdown-display {
    margin-top: 16px;
    padding: 12px;
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    border-radius: 6px;
    text-align: center;
    color: var(--color-warning-text);
    font-size: 14px;
}

.countdown-display #countdownValue {
    font-weight: 600;
    color: #f57c00;
}

.header {
    padding: 0 40px 40px;
    margin-top: 15%;
    text-align: center;
    transition: opacity 0.3s ease;
}

.header.hidden {
    opacity: 0;
    padding: 20px 20px 10px;
}

.header h1 {
    color: #34322d;
    font-size: 36px;
    font-weight: 600;
    margin-bottom: 0;
    font-family: 'Noto Serif SC', 'Noto Serif SC Fallback', 'SimSun', '宋体', 'NSimSun', '新宋体', serif;
    letter-spacing: -0.5px;
    transition: font-size 0.3s ease;
}

.header.hidden h1 {
    font-size: 24px;
}

.header .subtitle {
    display: none;
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
    overflow-y: auto;
    transition: justify-content 0.3s ease;
}

.content.has-content {
    justify-content: flex-start;
    padding-top: 60px;
    padding-bottom: 120px; /* 确保有足够空间，不与按钮重叠 */
}

.control-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    margin: 0 auto;
    position: relative;
    transition: all 0.3s ease;
}

.control-bar.fixed {
    position: fixed;
    bottom: 0;
    left: 0; /* Portal 页面没有 sidebar，从左边开始 */
    right: 0;
    padding: 20px 40px 40px;
    border-top: 1px solid var(--divider-color);
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: center; /* 居中内容 */
}

.control-bar.fixed .input-container {
    max-width: 1200px; /* 与对话消息对齐 */
    width: 100%;
    margin: 0 auto;
}

.control-bar.centered {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%; /* 在主页时拉伸到全宽 */
    max-width: 1200px;
    padding: 0 40px;
    bottom: auto;
}

/* Manus 风格的输入框容器 - 大输入框 */
.input-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    background: var(--background-card);
    border-radius: 12px;
    padding: 0;
    gap: 0;
    transition: all 0.2s ease;
    border: 1px solid var(--border-primary);
    box-shadow: var(--shadow-sm);
    min-height: 80px;
    position: relative;
}

.input-container:focus-within {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

/* 输入框内部的上边缘区域（用于显示上传状态） */
.input-top-bar {
    display: none;
    padding: 8px 16px;
    border-bottom: 1px solid var(--divider-color);
    background: var(--background-hover);
    border-radius: 12px 12px 0 0;
    min-height: 40px;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.input-top-bar.has-files {
    display: flex;
}

/* 文件上传状态项 */
.file-status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: var(--background-card);
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid var(--border-primary);
}

.file-status-item.uploading {
    border-color: #667eea;
}

.file-status-item.success {
    border-color: var(--border-primary);
}

.file-status-item.success:hover {
    border-color: var(--border-hover);
}

.file-status-item.success button,
.file-status-item.success .file-status-thumb-wrap {
    cursor: pointer;
}

.file-status-item.error {
    border-color: #f44336;
}

.file-status-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-status-icon.uploading {
    animation: spin 1s linear infinite;
}

.file-status-name-wrap {
    position: relative;
    display: inline-block;
    max-width: 100px;
    min-width: 0;
    vertical-align: middle;
}

.file-status-name {
    color: var(--text-primary);
    font-weight: 500;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    position: relative;
    z-index: 1;
}

.file-status-size {
    color: var(--text-primary);
    font-size: 12px;
}

.file-status-item.success .file-status-size,
.file-status-item.error .file-status-size {
    display: none;
}

/* 文件状态项右上角关闭按钮 */
.file-status-close {
    margin-left: 4px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 0;
}

.file-status-close:hover {
    color: var(--text-primary);
}

.file-status-item.success .file-status-name-wrap .file-status-move {
    position: absolute;
    z-index: 3;
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 17px;
    font-weight: 600;
    font-family: system-ui, 'Segoe UI', sans-serif;
    white-space: nowrap;
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    background: rgba(32, 32, 36, 0.88);
    color: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.12);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.file-status-item.success .file-status-name-wrap .file-status-move-double {
    font-size: 12px;
    letter-spacing: -0.2em;
    padding-right: 0.15em;
}

@media (hover: hover) and (pointer: fine) {
    .file-status-item.success:hover .file-status-name-wrap .file-status-move:not(:disabled) {
        opacity: 1;
        pointer-events: auto;
    }

    .file-status-item.success:hover .file-status-name-wrap .file-status-move:disabled {
        opacity: 0.28;
        pointer-events: none;
    }
}

@media (hover: none), (pointer: coarse) {
    .file-status-item.success .file-status-name-wrap .file-status-move:not(:disabled) {
        opacity: 1;
        pointer-events: auto;
    }

    .file-status-item.success .file-status-name-wrap .file-status-move:disabled {
        opacity: 0.32;
        pointer-events: none;
    }
}

.file-status-move-first {
    left: -6px;
    bottom: calc(100% + 6px);
    transform: none;
}

.file-status-move-left {
    right: -6px;
    bottom: calc(100% + 6px);
    transform: none;
}

.file-status-move-right {
    left: -6px;
    top: calc(100% + 6px);
    transform: none;
}

.file-status-move-last {
    right: -6px;
    top: calc(100% + 6px);
    transform: none;
}

.file-status-move:hover:not(:disabled),
.file-status-move:active:not(:disabled) {
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(48, 48, 54, 0.95);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
}

.file-status-move:active:not(:disabled) {
    transform: scale(0.94);
}

/* 已上传视频：file_id 缩略图 + 全屏预览（与主站 main.css 一致） */
.file-status-item.file-status-with-preview {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.file-status-item.file-status-with-preview > .file-status-icon {
    display: none !important;
}

.file-status-thumb-col {
    display: flex;
    justify-content: flex-start;
}

.file-status-thumb-wrap {
    position: relative;
    height: 100px;
    width: fit-content;
    max-width: min(100%, 280px);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.22);
}

.file-status-thumb {
    display: block;
    height: 100px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    vertical-align: top;
}

.file-status-thumb-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-secondary);
    pointer-events: none;
}

.file-status-play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.file-status-play:hover {
    background: rgba(0, 0, 0, 0.78);
}

.file-status-play-icon {
    font-size: 16px;
    line-height: 1;
    margin-left: 3px;
}

.file-status-bottom-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}

.file-status-bottom-row .file-status-name-wrap {
    max-width: 80px;
}

.file-status-bottom-row .file-status-close {
    margin-left: auto;
}

.upload-video-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.upload-video-preview-overlay.hidden {
    display: none !important;
}

.upload-video-preview-inner {
    position: relative;
    width: 100%;
    max-width: min(calc(100vw - 48px), 1200px);
}

.upload-video-preview-video {
    width: 100%;
    max-height: calc(100vh - 96px);
    display: block;
    border-radius: 8px;
    background: #000;
}

.upload-video-preview-close {
    position: absolute;
    top: -12px;
    right: -12px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-video-preview-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* 总时长显示 */
.total-duration {
    padding: 4px 12px;
    background: var(--background-input);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.total-duration-label {
    color: var(--text-primary);
    font-size: 12px;
}

/* 输入框主体区域 */
.input-main-area {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    gap: 16px;
    flex: 1;
}

/* 左侧图标组 */
.input-left-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all 0.2s ease;
    border: none;
    background: var(--background-input);
    border-radius: 8px;
    padding: 0;
    font-size: 20px;
    flex-shrink: 0;
}

.input-icon:hover {
    background: var(--background-hover);
    color: var(--text-primary);
}

.input-icon svg {
    width: 18px;
    height: 18px;
    display: block;
    flex-shrink: 0;
}

/* 输入框 */
.chat-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    color: var(--text-primary);
    padding: 12px 16px;
    font-family: inherit;
    line-height: 1.6;
    min-height: 40px;
    resize: none;
}

.chat-input::placeholder {
    color: var(--text-primary);
}

/* 右侧按钮组 */
.input-right-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-action-primary {
    background: var(--btn-submit-bg);
    font-size: 18px;
    font-weight: 400;
    padding: 0;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    outline: none;
}

.btn-action-primary:hover:not(:disabled) {
    background: var(--btn-submit-bg-hover);
}

.btn-action-primary:disabled {
    background: var(--background-input);
    cursor: not-allowed;
}

.btn-action-primary svg {
    width: 15px;
    height: 15px;
    display: block;
}

/* Enabled 状态下箭头颜色使用主题变量 */
.btn-action-primary:not(:disabled) svg path {
    fill: var(--btn-submit-icon);
}

/* Disabled 状态下箭头颜色使用主题变量 */
.btn-action-primary:disabled svg path {
    fill: var(--icon-disable);
}

/* 旧的按钮样式（保留用于兼容） */
.btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-add {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-add:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-submit {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-submit:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4);
}

.btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none; /* 禁用点击事件 */
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}


.btn-primary {
    padding: 10px 30px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 10px 30px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--background-card);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #f8f9fa;
}

/* 上传进度遮罩 */
.upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.upload-overlay.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.upload-text {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

/* 空状态 */
.empty-state {
    text-align: center;
    color: var(--text-secondary);
    margin-top: 0;
    display: none;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 16px;
    color: var(--text-tertiary);
}

/* 弹框遮罩 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

/* 弹框 */
.modal {
    background: var(--background-card);
    border-radius: 12px;
    padding: 0;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--divider-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--background-input);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.6;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--divider-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.modal-btn-primary {
    background: #667eea;
    color: white;
}

.modal-btn-primary:hover {
    background: #5568d3;
}

.modal-overlay--confirm {
    background: rgba(12, 14, 22, 0.52);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10040;
}

body.theme-light .modal-overlay--confirm {
    background: rgba(30, 35, 50, 0.28);
}

.modal-overlay--confirm .modal--confirm {
    max-width: min(440px, calc(100vw - 32px));
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--border-primary);
    overflow: hidden;
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.28),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

body.theme-light .modal-overlay--confirm .modal--confirm {
    box-shadow:
        0 20px 50px rgba(15, 23, 42, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.06);
}

.modal-overlay--confirm .modal-header {
    padding: 18px 22px;
    background: var(--background-input);
    border-bottom: 1px solid var(--divider-color);
}

.modal-overlay--confirm .modal-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.modal-overlay--confirm .modal-close {
    color: var(--text-secondary);
}

.modal-overlay--confirm .modal-close:hover {
    background: var(--background-hover);
    color: var(--text-primary);
}

.modal-overlay--confirm .modal-body {
    padding: 22px 24px 10px;
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.modal-overlay--confirm .modal-footer--confirm {
    padding: 18px 24px 22px;
    border-top: 1px solid var(--divider-color);
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.modal-confirm-btn {
    min-height: 44px;
    padding: 0 22px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.12s ease;
    border: 1px solid transparent;
}

.modal-confirm-btn:active {
    transform: scale(0.98);
}

.modal-confirm-btn--cancel {
    background: var(--background-input);
    border-color: var(--border-primary);
    color: var(--text-primary);
}

.modal-confirm-btn--cancel:hover {
    background: var(--background-hover);
    border-color: var(--text-tertiary);
    color: var(--text-primary);
}

.modal-confirm-btn--primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #764ba2 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.35);
}

.modal-confirm-btn--primary:hover {
    filter: brightness(1.07);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.42);
}

/* 错误提示和成功提示 - 含关闭按钮 */
.error-message,
.success-message {
    position: relative;
    padding-right: 36px;
}

.error-message .message-close,
.success-message .message-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.7;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.error-message .message-close:hover,
.success-message .message-close:hover {
    opacity: 1;
}

.error-message {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: none;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-warning-border);
}

.error-message.show {
    display: block;
}

.success-message {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #2e7d32;
}

.success-message.show {
    display: block;
}

/* 登录弹窗样式已移至 login-modal/login-modal.css */
