/* ============================================
   主题系统 - 两套完整的颜色模板
   ============================================ */

/* 深色主题（默认） */
: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: #1a1a1a;
    --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 */

html, body {
    height: 100%; /* 确保 html 和 body 都有明确的高度 */
    margin: 0;
    padding: 0;
    overflow: hidden;
}

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);
    height: 100vh; /* 使用 100vh 而不是 min-height */
    display: flex;
    flex-direction: row; /* 横向排列 sidebar 和 main-content */
    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; 
}

/* 确保 hidden 类能覆盖所有页面容器的显示 */
.page-container.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: hidden; /* 侧边栏本身不滚动 */
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    position: relative; /* 确保定位正确 */
    flex-shrink: 0; /* 明确禁止缩小 */
}

/* 美化子菜单滚动条 - 暗色主题（默认） */
.sidebar-submenu::-webkit-scrollbar {
    width: 6px;
}

.sidebar-submenu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-submenu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    transition: background 0.2s ease;
}

.sidebar-submenu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 美化子菜单滚动条 - 亮色主题 */
body.theme-light .sidebar-submenu::-webkit-scrollbar-track {
    background: transparent;
}

body.theme-light .sidebar-submenu::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    transition: background 0.2s ease;
}

body.theme-light .sidebar-submenu::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Firefox 滚动条样式 - 暗色主题 */
.sidebar-submenu {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Firefox 滚动条样式 - 亮色主题 */
body.theme-light .sidebar-submenu {
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.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;
    overflow: hidden; /* 内容区域不滚动 */
    min-height: 0; /* 允许 flex 子元素缩小 */
}

.sidebar-menu-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* 允许 flex 子元素缩小 */
    overflow: hidden; /* 防止溢出 */
}

.sidebar-footer {
    padding: 12px 8px;
    margin-top: auto;
    flex-shrink: 0; /* 固定在底部，不参与滚动 */
}

.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;
    pointer-events: none; /* 防止内部元素阻止按钮点击 */
}

.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;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* 允许 flex 子元素缩小 */
    overflow: hidden; /* 防止溢出 */
}

.sidebar-menu-item {
    margin: 0 0 2px 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0; /* 菜单项不缩小 */
}

/* 当菜单项包含展开的子菜单时，让它占据剩余空间 */
.sidebar-menu-item:has(.sidebar-submenu.expanded) {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}


.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;
    flex-shrink: 0; /* 收起时不占据空间 */
}

.sidebar-submenu.expanded {
    flex: 1; /* 展开时占据父容器的剩余空间 */
    min-height: 0; /* 允许缩小 */
    max-height: none; /* 移除 max-height 限制，使用 flex 布局 */
    overflow-y: auto; /* 子菜单区域可以滚动 */
    overflow-x: hidden;
}

/* 全屏遮罩（点击子菜单项时显示） */
.full-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(1px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.full-screen-overlay.show {
    display: flex;
}

.full-screen-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.sidebar-submenu-item {
    margin: 0;
}

.sidebar-submenu-link {
    display: flex;
    align-items: center;
    padding: 10px 20px 10px 40px;
    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;
}

/* 任务列表 - processing 时仅显示小转圈，无间距 */
.task-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.task-status-spinner {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    margin: 0;
    padding: 0;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: task-status-spin 0.8s linear infinite;
}
@keyframes task-status-spin {
    to { transform: rotate(360deg); }
}

/* 右侧主内容区域 */
.main-content {
    flex: 1 1 auto; /* 允许增长和缩小，占据剩余空间 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0; /* 允许flex子元素缩小到内容宽度以下 */
    min-height: 0; /* flex 子元素需要设置 min-height: 0 才能正确收缩 */
    height: 100%; /* 确保占满父容器高度 */
    position: relative; /* 为 control-bar 的绝对定位提供定位上下文 */
    background-color: var(--background-gray-main);
}

/* 页面容器 */
.page-container {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    min-height: 0; /* flex 子元素需要设置 min-height: 0 才能正确收缩 */
    height: 100%; /* 确保占满父容器高度 */
    max-height: 100%; /* 限制最大高度，防止超出父容器 */
}

.page-container.active {
    display: flex;
}

/* 对话页面使用 grid 布局 */
.page-container.page-conversation.active {
    display: grid !important;
}

/* 新建任务页面 */
.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%;
    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;
}

.work-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.work-card-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    border-radius: 8px;
}

.work-card-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-secondary);
    font-size: 14px;
    z-index: 1;
}

.work-card-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #f44336;
    font-size: 14px;
    z-index: 1;
}

.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-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.work-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.work-card-date {
    color: var(--text-secondary);
}

.work-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.work-card-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--background-active);
    color: var(--text-primary);
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.work-card-download-btn:hover {
    background: var(--background-hover);
    transform: translateY(-1px);
}

.work-card-download-progress {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
}

.work-card-download-btn svg {
    width: 16px;
    height: 16px;
}

.work-card-no-url {
    color: var(--text-tertiary);
    font-size: 14px;
}

.works-loading,
.works-empty,
.works-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 16px;
}

.works-error {
    color: #f44336;
    white-space: nowrap;
}


.works-loading,
.works-empty,
.works-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 16px;
}

.works-error {
    color: #f44336;
}

/* 所有任务页面 */
.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: grid !important; /* 使用 !important 防止被 JavaScript 覆盖 */
    grid-template-rows: auto 1fr !important; /* 上下两行：header 自动高度，messages 占据剩余空间 */
    overflow: hidden;
    height: 100%;
    position: relative;
}

.conversation-header {
    padding: 20px 40px;
    border-bottom: 1px solid var(--divider-color);
    background: var(--background-card);
}

.conversation-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.conversation-messages {
    min-height: 0; /* 关键：grid 子元素也需要 min-height: 0 */
    padding: 40px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

/* 美化滚动条 - 暗色主题 */
.conversation-messages::-webkit-scrollbar {
    width: 8px;
}

.conversation-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.conversation-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.conversation-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 美化滚动条 - 亮色主题 */
body.theme-light .conversation-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

body.theme-light .conversation-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

body.theme-light .conversation-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Firefox 滚动条样式 */
.conversation-messages {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}

body.theme-light .conversation-messages {
    scrollbar-color: rgba(0, 0, 0, 0.2) rgba(0, 0, 0, 0.05);
}

/* 对话页面底部间距区域（已删除，不再需要） */

/* 结果区域中的新建任务按钮（在下载按钮旁边） */
.btn-new-task-in-result {
    padding: 8px 16px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: 1px solid #667eea;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-new-task-in-result:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #5568d3;
    color: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.btn-new-task-in-result:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.15);
}

/* 视频元素样式限制，防止撑破页面 */
.conversation-messages video {
    height: 320px !important; /* 固定高度 320px */
    width: auto !important; /* 宽度自动，保持原始宽高比 */
    max-width: 100% !important; /* 最大宽度不超过容器 */
    object-fit: contain !important; /* 保持视频比例，不裁剪 */
    display: block !important;
}

/* 图片预览样式，与视频保持一致 */
/* 默认隐藏，只有在 JavaScript 显式设置 display: block 时才显示 */
.conversation-messages img[id^="image-preview"] {
    height: 320px !important; /* 固定高度 320px */
    width: auto !important; /* 宽度自动，保持原始宽高比 */
    max-width: 100% !important; /* 最大宽度不超过容器 */
    object-fit: contain !important; /* 保持图片比例，不裁剪 */
    display: none !important; /* 默认隐藏，由 JavaScript 控制显示 */
}

/* 视频容器样式，确保不会超出父容器 */
.conversation-messages .video-item,
.conversation-messages .video-player-container {
    max-width: 100% !important;
    overflow: hidden !important;
    position: relative !important;
}

.conversation-messages .video-player-container video {
    max-height: 400px !important;
    width: 100% !important;
    height: auto !important;
}

.message-item {
    display: flex;
    gap: 16px;
    max-width: 800px; /* 消息的最大宽度，保持自然宽度 */
}

.message-item.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

.message-item.user .message-avatar {
    background: #4caf50;
}

.message-content {
    flex: 1;
    background: var(--background-input);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

.message-item.user .message-content {
    background: #667eea;
    color: var(--text-primary);
}

/* 设置引导界面 */
.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;
}

/* 右上角会员图标 */
.member-icon-link {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}
.member-icon-link:hover {
    color: var(--color-primary);
    background: var(--background-hover);
}

.header {
    padding: 60px 40px 40px;
    text-align: center;
    transition: opacity 0.3s ease;
}

.header.hidden {
    opacity: 0;
    padding: 20px 20px 10px;
}

.header h1 {
    color: var(--text-primary);
    font-size: 48px;
    font-weight: 600;
    margin-bottom: 0;
    font-family: inherit;
    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: -70px;
    left: 280px; /* 左侧边栏宽度 */
    right: 0;
    padding: 0; /* 去掉 padding */
    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: 20px;
    padding: 0.75rem;
    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;
    /* border-bottom: 1px solid var(--divider-color);
    background: var(--background-hover); */
    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: #4caf50;
}

.file-status-item.error {
    border-color: #f44336;
} */

.file-status-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-status-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
}

.file-status-icon.uploading {
    animation: spin 1s linear infinite;
}

.file-status-name {
    color: var(--text-primary);
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-status-size {
    color: var(--text-primary);
    font-size: 12px;
}

/* 文件状态项右上角关闭按钮（默认隐藏） */
.file-status-close {
    margin-left: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    width: 24px;
    height: 24px;
    display: none; /* 默认隐藏 */
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* 圆形轮廓 */
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* 鼠标悬停在文件状态项上时显示关闭按钮 */
.file-status-item:hover .file-status-close {
    display: flex;
}

.file-status-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* 总时长显示 */
.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;
    gap: 16px;
    flex: 1;
    justify-content: space-between; /* 左侧内容靠左，右侧按钮靠右 */
}

/* 左侧图标组 */
.input-left-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-icon {
    width: 32px;
    height: 32px;
    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: 50%;
    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[readonly] {
    cursor: default;
    background: transparent;
}

.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-bottom-actions 中靠右显示） */
.input-bottom-actions > .input-right-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0; /* 不收缩 */
    margin-left: auto; /* 自动靠右 */
    order: 999; /* 确保在最后（最右边） */
}

/* 右侧按钮组（在 input-main-area 中，如果存在） */
.input-main-area > .input-right-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

.btn-action-primary {
    background: var(--btn-submit-bg);
    font-size: 18px;
    font-weight: 400;
    padding: 0;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    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;
}

/* 错误提示（保留用于其他场景） */
.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 */

/* ============================================
   主页面选择功能样式
   ============================================ */

/* 短剧类型按钮（独立行，在输入框下方） */
.drama-type-buttons {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    width: 100%;
    max-width: 1200px;
    justify-content: center;
    align-items: center;
    margin-top: 12px;
}

.drama-type-btn {
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.drama-type-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.drama-type-btn.active {
    /* background: #667eea;
    border-color: #667eea; */
    color: white;
}

/* 输入框包装器（输入框隐藏后，标签容器占据全部空间） */
.input-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1;
    min-height: 0;
}

/* 隐藏的输入框 */
.chat-input-hidden {
    display: none !important;
}

/* 输入框标签容器（显示所有选择标签，替代输入框） */
.drama-type-tags {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    flex-wrap: wrap;
    min-height: 56px;
    align-items: center;
    width: 100%;
    flex: 1;
}

.drama-type-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

/* 临时动画标签 */
.drama-type-tag-temp {
    pointer-events: none;
}

/* 通用选择标签样式（音色、原片占比、背景音乐） */
.selection-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 12px;
    /* background: rgba(102, 126, 234, 0.2); */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

.selection-tag-close {
    cursor: pointer;
    padding: 2px;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.selection-tag-close:hover {
    opacity: 1;
}

.drama-type-tag-close {
    cursor: pointer;
    padding: 2px;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.drama-type-tag-close:hover {
    opacity: 1;
}

/* 背景音乐标签（与短剧类型标签样式一致） */
.background-music-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 12px;
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 4px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    min-width: fit-content;
    max-width: 300px; /* 设置最大宽度，超出时截断 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.background-music-tag > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0; /* 允许收缩 */
}

.background-music-tag-close {
    cursor: pointer;
    padding: 2px;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.background-music-tag-close:hover {
    opacity: 1;
}

/* 输入框底部功能区 */
.input-bottom-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    /* border-top: 1px solid rgba(255, 255, 255, 0.1); */
    flex-wrap: nowrap; /* 不换行，确保布局稳定 */
    justify-content: space-between; /* 左侧元素靠左，右侧按钮靠右 */
    position: relative;
}

/* 左侧图标容器（固定在左边第一个位置） */
.input-bottom-actions > .input-left-icons {
    flex-shrink: 0; /* 不收缩 */
    order: -1; /* 确保在最左边 */
}

/* 动态添加的元素容器（左对齐排列） */
.input-bottom-actions > .voice-selector-wrapper,
.input-bottom-actions > .original-ratio-selector,
.input-bottom-actions > .background-music-upload-wrapper {
    flex-shrink: 0;
}

/* 音色选择器 */
.voice-selector-wrapper {
    position: relative;
}

.voice-selector-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.voice-selector-btn:hover {
    background: var(--background-hover);
    border-color: var(--border-hover);
}

.selected-voice-name {
    color: var(--color-primary);
    font-weight: 500;
}

/* 免费会员提示文字 */
.voice-selector-free {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.voice-selector-panel {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    width: 400px;
    max-height: 400px;
    background: var(--background-card);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    overflow: hidden;
}

.voice-gender-tabs {
    display: flex;
    border-bottom: 1px solid var(--divider-color);
}

.voice-gender-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.voice-gender-tab:hover {
    background: var(--background-hover);
}

.voice-gender-tab.active {
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
    background: rgba(102, 126, 234, 0.08);
}

.voice-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}

.voice-list::-webkit-scrollbar {
    width: 8px;
}
.voice-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}
.voice-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.voice-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

body.theme-light .voice-list {
    scrollbar-color: rgba(0, 0, 0, 0.2) rgba(0, 0, 0, 0.05);
}
body.theme-light .voice-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}
body.theme-light .voice-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}
body.theme-light .voice-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.voice-card {
    padding: 10px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--background-hover);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.voice-card:hover {
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(102, 126, 234, 0.1);
}

.voice-card.selected {
    border-color: var(--color-primary);
    background: rgba(102, 126, 234, 0.15);
}

/* 左侧头像 */
.voice-card-avatar-wrap {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
}
.voice-card-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.voice-card-avatar-placeholder {
    width: 100%;
    height: 100%;
    background: var(--border-primary);
}

/* 右侧播放/停止按钮 */
.voice-card-play-btn {
    position: relative;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 50%;
    background: var(--background-active);
    display: flex;
    align-items: center;
    justify-content: center;
}
.voice-card-play-btn::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-30%, -50%);
    width: 0;
    height: 0;
    border-left: 12px solid var(--text-primary);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    pointer-events: none;
}
.voice-card-play-btn::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--text-primary);
    border-radius: 2px;
    pointer-events: none;
    display: none;
}
.voice-card-play-btn.playing::after {
    display: none;
}
.voice-card-play-btn.playing::before {
    display: block;
}
.voice-card-play-btn:hover {
    background: var(--border-hover);
}

/* 确认对话框内音色/背景音乐试听按钮（与上移下移按钮同风格，兼容亮色/暗色主题） */
.btn-confirmation-audio {
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border-primary);
    background: var(--background-hover);
    color: var(--text-primary);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.btn-confirmation-audio:hover {
    background: var(--background-active);
    border-color: var(--border-hover);
}
.btn-confirmation-audio.playing {
    background: rgba(102, 126, 234, 0.15);
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.btn-confirmation-audio.playing:hover {
    background: rgba(102, 126, 234, 0.25);
}

.voice-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.voice-card-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.voice-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 原片占比选择 */
.original-ratio-selector {
    display: flex;
    align-items: center;
}

.original-ratio-selector select {
    padding: 6px 12px;
    padding-right: 28px; /* 为下拉箭头留出空间 */
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--background-card);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 400;
    transition: all 0.2s ease;
    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='%23999999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    min-width: 120px;
}

/* 下拉选项样式 */
.original-ratio-selector select option {
    background: var(--background-card);
    color: var(--text-primary);
    padding: 8px 12px;
}

/* 占位符选项样式 */
.original-ratio-selector select option[value=""] {
    color: var(--text-tertiary);
}

/* 已选中的选项样式 */
.original-ratio-selector select option:checked {
    background: var(--color-primary);
    color: #ffffff;
}

/* 下拉框悬停状态 */
.original-ratio-selector select:hover {
    background-color: var(--background-hover);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
    /* 保持背景图片（箭头）不变 */
    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='%23999999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

/* 下拉框聚焦状态 */
.original-ratio-selector select:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: var(--background-card);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
    /* 保持背景图片（箭头）不变 */
    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='%23999999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

/* 下拉框激活状态（打开时） */
.original-ratio-selector select:active {
    border-color: var(--color-primary);
    /* 保持背景图片（箭头）不变 */
    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='%23999999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

/* 背景音乐上传按钮 */
.background-music-upload-wrapper {
    position: relative;
}

.background-music-upload-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    min-width: fit-content;
    max-width: 200px; /* 设置最大宽度，超出时截断 */
    white-space: nowrap;
}

.background-music-upload-btn > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0; /* 允许收缩 */
}

.background-music-upload-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.background-music-upload-btn:active {
    transform: scale(0.98);
}

/* 亮色主题适配 */
body.theme-light .drama-type-btn {
    border-color: rgba(0, 0, 0, 0.2);
    color: rgba(0, 0, 0, 0.8);
}

body.theme-light .drama-type-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.3);
}

body.theme-light .drama-type-tag {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
    color: rgba(0, 0, 0, 0.9);
}

body.theme-light .background-music-tag {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
    color: rgba(0, 0, 0, 0.9);
}

/* voice-selector 已通过 CSS 变量兼容亮/暗色主题 */

/* 亮色主题下原片占比选择器的下拉箭头颜色 */
body.theme-light .original-ratio-selector select {
    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='%23666666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* 亮色主题下hover、focus、active状态的箭头颜色 */
body.theme-light .original-ratio-selector select:hover,
body.theme-light .original-ratio-selector select:focus,
body.theme-light .original-ratio-selector select:active {
    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='%23666666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

/* 暗色主题下原片占比选择器的下拉箭头颜色（确保可见） */
body.theme-dark .original-ratio-selector select {
    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='%23999999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* 暗色主题下hover、focus、active状态的箭头颜色 */
body.theme-dark .original-ratio-selector select:hover,
body.theme-dark .original-ratio-selector select:focus,
body.theme-dark .original-ratio-selector select:active {
    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='%23999999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

