/* 全局变量 */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --accent: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;

    --sidebar-width: 260px;
    --transition: all 0.3s ease;
}

/* ==================== RH 任务队列状态栏 ==================== */

.queue-status-bar {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.queue-status-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
}

.queue-status-main:hover {
    background: var(--bg-tertiary);
}

.queue-status-left {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.queue-status-left > i:first-child {
    color: var(--primary);
    font-size: 16px;
}

.queue-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.queue-progress-bar {
    position: relative;
    width: 80px;
    height: 18px;
    background: var(--bg-primary);
    border-radius: 9px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.queue-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), #34d399);
    border-radius: 9px;
    transition: width 0.5s ease;
    width: 0%;
}

.queue-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

.queue-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.queue-stat i {
    font-size: 11px;
    color: var(--text-muted);
}

.queue-stat strong {
    color: var(--text-primary);
    font-weight: 600;
}

.queue-stat-failed {
    color: var(--danger);
}

.queue-stat-failed i {
    color: var(--danger);
}

.queue-stat-failed strong {
    color: var(--danger);
}

.queue-status-right {
    display: flex;
    align-items: center;
}

.queue-toggle-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.queue-toggle-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.queue-toggle-btn.expanded i {
    transform: rotate(180deg);
}

.queue-toggle-btn i {
    transition: transform 0.3s ease;
}

/* 任务列表 */
.queue-task-list {
    border-top: 1px solid var(--border);
    padding: 8px 12px;
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg-primary);
}

.queue-task-list:empty {
    padding: 0;
}

.queue-task-group-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 4px 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.queue-task-group-title i {
    font-size: 10px;
}

.queue-task-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    transition: var(--transition);
}

.queue-task-item:hover {
    background: var(--bg-secondary);
}

.queue-task-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 600;
    white-space: nowrap;
}

.queue-task-badge.running {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

.queue-task-badge.queued {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.queue-task-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    animation: none;
}

.queue-task-badge.failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.queue-task-name {
    flex: 1;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.queue-task-name strong {
    color: var(--text-primary);
    font-weight: 500;
}

.queue-task-model {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    font-weight: 600;
}

.queue-task-cancel {
    width: 20px;
    height: 20px;
    background: transparent;
    border: 1px solid var(--danger);
    border-radius: 50%;
    color: var(--danger);
    font-size: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    opacity: 0;
    flex-shrink: 0;
}

.queue-task-item:hover .queue-task-cancel {
    opacity: 1;
}

.queue-task-cancel:hover {
    background: var(--danger);
    color: white;
}

.queue-empty {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 12px;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* 应用容器 */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h1 i {
    color: var(--primary);
}

.sidebar-header p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    text-align: left;
}

.nav-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

.nav-btn i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-btn span {
    flex: 1;
}

.nav-section-title {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 16px 4px;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.badge {
    background: var(--secondary);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* 用户区域 */
.user-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: white;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.btn-switch-user {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
}

.btn-switch-user:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.version {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    overflow-y: auto;
    padding: 24px;
    height: auto;
}

/* 面板 */
.panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.panel.active {
    display: block;
}

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

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

.panel-header h2 {
    font-size: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-header h2 i {
    color: var(--primary);
}

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

/* 表单样式 */
.project-form,
.generate-form,
.speech-form {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
}

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

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.form-group-half {
    flex: 1;
    margin-bottom: 0;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

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

textarea,
select,
input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

textarea:focus,
select:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

select {
    cursor: pointer;
    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='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.prompt-tips {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
}

.tip {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tip i {
    color: var(--warning);
}

.char-count {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* 上传区域 */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.upload-area i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.upload-area p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    margin-top: 12px;
    border: 1px solid var(--border);
}

.file-info i {
    color: var(--primary);
    font-size: 18px;
}

.file-info span {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-remove-file {
    width: 28px;
    height: 28px;
    background: var(--danger);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-file:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* 按钮样式 */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-small {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.btn-success {
    background: var(--success);
    color: white;
}

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

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-small:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 项目信息栏 */
.project-info-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.info-item i {
    color: var(--primary);
}

.info-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.product-preview-item {
    gap: 6px;
}

.product-preview-thumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.product-preview-thumb img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.product-preview-thumb img:hover {
    transform: scale(1.8);
    position: relative;
    z-index: 10;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border-color: var(--primary);
}

#projectProductStatus {
    font-size: 12px;
    color: var(--text-muted);
}

/* 口播文案翻译区 */
.script-translation {
    margin-top: 8px;
    padding: 10px 12px;
    background: rgba(139, 92, 246, 0.08);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
}

.trans-label {
    display: block;
    font-size: 11px;
    color: var(--accent);
    margin-bottom: 4px;
    font-weight: 500;
}

.trans-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.btn-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    margin-left: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
    vertical-align: middle;
}

.btn-inline:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-inline i {
    font-size: 11px;
}

/* 故事板样式 */
.storyboard-container {
    overflow-x: auto;
    padding: 0;
    height: auto;
}

.storyboard {
    display: flex;
    gap: 12px;
    padding: 8px;
    min-width: min-content;
    height: 100%;
    align-items: stretch;
}

.story-card {
    flex: 0 0 300px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.story-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.story-card-header {
    padding: 5px 10px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.story-card-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.story-card-ref-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 4px;
}

.story-card-index {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

.story-card-status {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-muted);
}

.story-card-status.ready {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.story-card-status.generating {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    animation: pulse 1.5s ease-in-out infinite;
}

.story-card-image {
    width: 100%;
    flex: 1;
    min-height: 120px;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 1;
}

.story-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-card-image .placeholder {
    color: var(--text-muted);
    text-align: center;
}

.story-card-image .placeholder i {
    font-size: 48px;
    margin-bottom: 8px;
    display: block;
}

.story-card-content {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.story-card-script {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.story-card-prompt {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    line-height: 1.5;
    margin-bottom: 8px;
}

.story-card-camera {
    font-size: 11px;
    color: var(--primary);
    padding: 6px 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-sm);
    margin-top: 8px;
}

/* 操作按钮置顶 */
.story-card-actions-top {
    padding: 6px 8px;
    display: flex;
    gap: 6px;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.btn-gen {
    flex: 1;
    padding: 5px 8px;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-gen-image {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.btn-gen-image:hover {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.btn-gen-video {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.btn-gen-video:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

/* 内联编辑字段 */
.story-card-fields {
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.field-group label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 1px;
    font-weight: 500;
}

.field-input {
    width: 100%;
    padding: 4px 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 11px;
    font-family: inherit;
    line-height: 1.4;
    resize: none;
    transition: var(--transition);
}

.field-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

select.field-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2394a3b8' d='M5 7L0 2h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

/* 分镜音频 */
.story-card-audio {
    padding: 5px 8px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.story-card-audio label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.story-card-audio label i {
    color: var(--accent);
}

.audio-ok {
    color: var(--success);
    font-weight: 500;
}

.audio-upload-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-micro {
    width: 26px;
    height: 26px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-micro:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-generate-audio {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.btn-generate-audio:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4192 100%);
    transform: scale(1.1);
}

.btn-generate-audio:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-delete-audio {
    background: var(--danger);
    color: white;
    border: none;
}

.btn-delete-audio:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.voice-select-row {
    margin-top: 6px;
}

.voice-select {
    width: 100%;
    padding: 4px 8px;
    font-size: 11px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
}

.voice-select:hover {
    border-color: var(--accent);
}

.voice-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* 音色选择器 */
.voice-selector {
    display: flex;
    align-items: center;
    gap: 4px;
}

.voice-select-global {
    padding: 4px 8px;
    font-size: 11px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
    max-width: 120px;
    transition: var(--transition);
}

.voice-select-global:hover {
    border-color: var(--accent);
}

.voice-select-global:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-tiny {
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-tiny:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-generate-all {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
}

.btn-generate-all:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.audio-player {
    flex: 1;
    height: 28px;
    border-radius: 4px;
}

.audio-none {
    font-size: 10px;
    color: var(--text-muted);
}

/* 拖拽高亮 */
.story-card-audio.dragover {
    background: rgba(139, 92, 246, 0.1);
    border: 1px dashed var(--accent);
    border-radius: 6px;
}

/* 图片预览按钮 */
.story-card-image {
    position: relative;
}

.img-preview-btn {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    z-index: 5;
}

.story-card-image:hover .img-preview-btn {
    opacity: 1;
}

.img-preview-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

/* 登录模态框 */
.login-users {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.login-user-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 24px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.login-user-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.login-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 全屏预览遮罩 */
.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.image-preview-box {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.image-preview-box img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.image-preview-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    background: var(--danger);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.image-preview-close:hover {
    transform: scale(1.1);
}

/* 参考图置底 */
.story-card-refs {
    padding: 5px 8px 6px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.story-card-refs label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.story-card-refs label i {
    color: var(--accent);
}

.refs-mini-row {
    display: flex;
    gap: 4px;
}

.ref-mini-slot {
    flex: 1;
    position: relative;
    text-align: center;
}

.ref-mini-label {
    display: block;
    font-size: 9px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.ref-mini-thumb {
    width: 100%;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.ref-mini-empty {
    width: 100%;
    height: 36px;
    background: var(--bg-primary);
    border: 1px dashed var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: var(--text-muted);
}

.ref-mini-upload {
    cursor: pointer;
}

.ref-mini-upload:hover .ref-mini-empty {
    border-color: var(--primary);
    color: var(--primary);
}

.ref-mini-add {
    cursor: pointer;
    opacity: 0.5;
    transition: var(--transition);
}

.ref-mini-add:hover {
    opacity: 1;
}

/* 快捷参考 */
.quick-ref-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.quick-ref-label {
    font-size: 9px;
    color: var(--text-muted);
}

.btn-quick-ref {
    padding: 2px 6px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 4px;
    color: var(--success);
    font-size: 9px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.btn-quick-ref:hover {
    background: var(--success);
    color: white;
}

.btn-quick-ref i {
    font-size: 8px;
}

/* 全局快捷参考按钮 */
.btn-quick-ref-global {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--primary);
}

.btn-quick-ref-global:hover {
    background: var(--primary);
    color: white;
}

/* 全局快捷参考行 */
.global-quick-ref-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--border);
    flex-wrap: wrap;
}

.global-quick-ref-row:empty {
    display: none;
}

.global-quick-ref-row .quick-ref-label {
    font-size: 9px;
    color: var(--primary);
    font-weight: 500;
}

/* 预设按钮组 */
.preset-btn-group {
    display: inline-flex;
    gap: 4px;
    margin-left: 4px;
}

.btn-preset {
    padding: 4px 10px;
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 4px;
    color: #eab308;
    font-size: 11px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-preset:hover {
    background: #eab308;
    color: white;
}

.btn-preset i {
    font-size: 10px;
}

/* 设置面板 */
.settings-content {
    padding: 0 4px;
}

.settings-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.6;
}

.settings-quick-refs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.settings-quick-ref-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
}

.settings-quick-ref-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.settings-quick-ref-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.settings-quick-ref-label i {
    color: var(--primary);
}

.settings-quick-ref-upload {
    position: relative;
    width: 100%;
    height: 120px;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    border: 2px dashed var(--border);
    transition: var(--transition);
}

.settings-quick-ref-upload:hover {
    border-color: var(--primary);
}

.settings-quick-ref-upload.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.settings-quick-ref-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.settings-quick-ref-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.settings-quick-ref-placeholder i {
    font-size: 24px;
    color: var(--text-muted);
}

.settings-quick-ref-name {
    margin-top: 8px;
}

.settings-quick-ref-name input {
    width: 100%;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
    transition: var(--transition);
}

.settings-quick-ref-name input:focus {
    border-color: var(--primary);
}

.settings-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.btn-sm.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-sm.btn-danger:hover {
    background: #ef4444;
    color: white;
}

.btn-secondary {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

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

/* 设置面板分区 */
.settings-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-of-type {
    border-bottom: none;
    margin-bottom: 16px;
}

.settings-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.settings-section-title i {
    color: var(--primary);
}

/* 设置表单网格 */
.settings-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.settings-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.settings-input,
.settings-select,
.settings-textarea {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.settings-input:focus,
.settings-select:focus,
.settings-textarea:focus {
    border-color: var(--primary);
}

.settings-input::placeholder,
.settings-textarea::placeholder {
    color: var(--text-muted);
}

.settings-select {
    cursor: pointer;
}

.settings-textarea {
    resize: vertical;
    min-height: 50px;
    font-family: inherit;
}

.settings-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* 范围滑块 */
.settings-range {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.settings-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.settings-range-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    min-width: 30px;
}

/* 按钮禁用状态 */
.btn-gen:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-gen:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

.ref-mini-remove {
    position: absolute;
    top: 12px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: var(--danger);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.ref-mini-slot:hover .ref-mini-remove {
    opacity: 1;
}

.story-card-audio-badge {
    font-size: 11px;
    color: var(--accent);
}

/* 视频预览 */
.story-card-video {
    padding: 6px 8px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.story-card-video label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.story-card-video label i {
    color: var(--success);
}

.video-player-wrap {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}

.video-player-wrap video {
    width: 100%;
    display: block;
    border-radius: 6px;
    max-height: 260px;
}

.video-download-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.video-download-row a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--success);
    color: white;
    border-radius: 4px;
    font-size: 10px;
    text-decoration: none;
    transition: var(--transition);
}

.video-download-row a:hover {
    background: #059669;
}

.btn-delete-video {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-delete-video:hover {
    background: var(--danger);
    color: white;
}

.video-status-pending {
    font-size: 10px;
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: 4px;
}

.video-status-pending i {
    animation: pulse 1.5s ease-in-out infinite;
}

.video-status-failed {
    font-size: 10px;
    color: var(--danger);
}

/* 项目列表 */
.project-list {
    display: grid;
    gap: 16px;
}

.project-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.project-item:hover {
    border-color: var(--primary);
    background: var(--bg-tertiary);
}

.project-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.project-item-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.project-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.project-item-date {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-delete-project {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-project:hover {
    background: var(--danger);
    color: white;
}

.project-item-info {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.project-item-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.project-item-info i {
    color: var(--primary);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state span {
    font-size: 14px;
}

/* 产品组列表 */
.group-list-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.btn-new-group,
.btn-back-groups {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-new-group:hover,
.btn-back-groups:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.group-current-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.group-current-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.group-list {
    display: grid;
    gap: 8px;
}

.group-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.group-item:hover {
    border-color: var(--primary);
    background: var(--bg-tertiary);
}

.group-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.group-item-left i {
    font-size: 20px;
    color: #facc15;
}

.group-item-left i.fa-inbox {
    color: var(--text-muted);
}

.group-item-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.group-item-count {
    font-size: 12px;
    color: var(--text-muted);
}

.group-item-actions {
    display: flex;
    gap: 4px;
}

.btn-group-action {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius);
    transition: all 0.2s;
    font-size: 13px;
}

.btn-group-action:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-group-action.btn-delete-group:hover {
    color: #ef4444;
}

.project-list-items {
    display: grid;
    gap: 12px;
}

.btn-move-project {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.btn-move-project:hover {
    color: var(--primary);
    background: var(--bg-tertiary);
}

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

/* 批量操作栏 */
.batch-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    animation: fadeIn 0.15s ease;
}

.batch-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.batch-select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
}

.batch-count {
    font-size: 13px;
    color: var(--text-muted);
}

.batch-count strong {
    color: var(--primary);
}

.btn-batch-move {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-batch-move:hover {
    opacity: 0.85;
}

/* 项目勾选框 */
.project-checkbox-wrap {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

.project-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* 通用 Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.15s ease;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 420px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

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

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

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

/* Modal 内选项列表 */
.modal-option-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
    color: var(--text-primary);
    border: 1px solid transparent;
}

.modal-option:hover {
    background: var(--bg-tertiary);
    border-color: var(--border);
}

.modal-option.selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.modal-option i {
    width: 18px;
    text-align: center;
    font-size: 15px;
}

.modal-option-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}

.modal-option.selected .modal-option-count {
    color: rgba(255, 255, 255, 0.7);
}

.modal-new-input {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.modal-new-input input {
    flex: 1;
    padding: 8px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-input, #1e1e2e);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.modal-new-input input:focus {
    border-color: var(--primary);
}

.modal-new-input button {
    padding: 8px 14px;
    border-radius: var(--radius);
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

/* 产品标签 */
.tag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.tag-chip:hover {
    border-color: var(--primary);
}

.tag-chip.active {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
}

.tag-chip .tag-count {
    font-size: 10px;
    opacity: 0.7;
}

.group-item-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-left: 8px;
}

.group-tag {
    padding: 1px 8px;
    border-radius: 12px;
    font-size: 11px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* 参考图上传区域 */
.ref-images-area {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ref-image-slot {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
}

.ref-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 11px;
    transition: all 0.2s;
}

.ref-image-placeholder i {
    font-size: 18px;
}

.ref-image-placeholder:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.ref-image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
    border: 2px solid var(--border);
}

.ref-image-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    padding: 0;
    transition: background 0.2s;
}

.ref-image-remove:hover {
    background: #ef4444;
}

/* 拖拽样式 */
.ref-image-slot.drag-over {
    transform: scale(1.05);
}

.ref-image-slot.drag-over .ref-image-placeholder {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.ref-images-area.drag-over-area {
    background: rgba(99, 102, 241, 0.05);
    border-radius: var(--radius);
}

.group-item-tag-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.btn-add-tag {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 6px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.btn-add-tag:hover {
    color: var(--primary);
    background: var(--bg-tertiary);
}

/* 结果区域 */
.result-section {
    margin-top: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
}

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

.result-header h3 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-header h3 i {
    color: var(--primary);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.result-image {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.result-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.result-image .img-preview-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    z-index: 5;
}

.result-image:hover .img-preview-btn {
    opacity: 1;
}

.result-image .img-preview-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

/* 生成中占位 */
.loading-placeholder {
    background: var(--bg-secondary);
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
}

.loading-spinner i {
    font-size: 32px;
    color: var(--primary);
}

.loading-spinner span {
    font-size: 13px;
}

/* 生成失败 */
.result-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--danger);
}

.result-error i {
    font-size: 48px;
    margin-bottom: 12px;
}

.result-error p {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.result-error span {
    font-size: 13px;
    color: var(--text-muted);
}

/* 生成按钮禁用状态 */
.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* 历史记录区域 */
.history-section {
    margin-top: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
}

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

.history-header h3 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-header h3 i {
    color: var(--primary);
}

.btn-danger-sm {
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-danger-sm:hover {
    background: var(--danger);
    color: white;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.history-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
    font-size: 14px;
}

.history-item {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.history-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.history-image-wrapper {
    position: relative;
    width: 100%;
    height: 150px;
}

.history-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-image-wrapper .img-preview-btn {
    position: absolute;
    bottom: 6px;
    left: 6px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    z-index: 5;
}

.history-item:hover .img-preview-btn {
    opacity: 1;
}

.history-image-wrapper .img-preview-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.history-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    font-size: 12px;
}

.history-item:hover .history-delete-btn {
    opacity: 1;
}

.history-delete-btn:hover {
    background: var(--danger);
}

.history-info {
    padding: 10px 12px;
}

.history-prompt {
    font-size: 12px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 6px;
}

.history-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

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

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 32px;
}

.modal-body h3 {
    font-size: 20px;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.modal-form {
    margin-bottom: 24px;
}

.modal-preview {
    margin-top: 24px;
}

.preview-image {
    width: 100%;
    height: 300px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-placeholder {
    text-align: center;
    color: var(--text-muted);
}

.preview-placeholder i {
    font-size: 64px;
    margin-bottom: 12px;
    display: block;
}

/* 自定义参考图 */
.reference-images-section {
    margin-top: 20px;
}

.reference-images-section label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.reference-images-section label i {
    color: var(--primary);
}

.ref-count {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 2px 8px;
    border-radius: 10px;
}

.reference-images-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.reference-image-slot {
    min-width: 0;
}

.ref-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding-left: 2px;
}

.ref-thumb {
    width: 100%;
    height: 120px;
    background: var(--bg-primary);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: var(--transition);
}

.ref-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ref-thumb.has-image {
    border-style: solid;
    border-color: var(--primary);
}

.ref-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

.ref-empty i {
    font-size: 24px;
    margin-bottom: 6px;
    display: block;
    opacity: 0.5;
}

.ref-thumb-upload {
    cursor: pointer;
    border-color: var(--border);
    border-style: dashed;
}

.ref-thumb-upload:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.ref-thumb-upload .ref-empty i {
    color: var(--primary);
    opacity: 0.7;
}

.ref-thumb-upload:hover .ref-empty i {
    opacity: 1;
}

.ref-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: var(--danger);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    z-index: 5;
}

.ref-thumb {
    position: relative;
}

.ref-thumb:hover .ref-remove-btn {
    opacity: 1;
}

.ref-remove-btn:hover {
    transform: scale(1.15);
}

.ref-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: var(--radius-sm);
    line-height: 1.5;
    display: none;
}

.ref-hint.visible {
    display: block;
}

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

/* 语音识别样式 */
.transcribe-output textarea {
    width: 100%;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    min-height: 150px;
    font-family: inherit;
}

/* 提示消息 */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-color: var(--success);
}

.toast.success i {
    color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

.toast.error i {
    color: var(--danger);
}

.toast.info {
    border-color: var(--primary);
}

.toast.info i {
    color: var(--primary);
}

.toast.warning {
    border-color: var(--warning, #f59e0b);
}

.toast.warning i {
    color: var(--warning, #f59e0b);
}

.toast i {
    font-size: 18px;
}

.toast span {
    flex: 1;
    font-size: 14px;
}

.toast .toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.toast .toast-close:hover {
    color: var(--text-primary);
}

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

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

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

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

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

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

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }

    .sidebar-header h1 span,
    .sidebar-header p,
    .nav-btn span,
    .badge {
        display: none;
    }

    .sidebar-header {
        padding: 16px;
        text-align: center;
    }

    .sidebar-header h1 {
        justify-content: center;
    }

    .nav-btn {
        justify-content: center;
        padding: 12px;
    }

    .main-content {
        margin-left: 70px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .story-card {
        flex: 0 0 260px;
    }
}

/* 用户徽章 */
.user-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.user-badge-small {
    width: 20px;
    height: 20px;
    font-size: 10px;
}

.user-badge-large {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

/* 项目列表用户icon */
.project-item {
    position: relative;
}

.project-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-item-name {
    flex: 1;
}

.project-item-icons {
    display: flex;
    gap: 4px;
}

.user-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-weight: 600;
    font-size: 11px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 分镜编辑页面协作者区域 */
.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.project-collaborators {
    display: flex;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
}

.collaborator-toggle {
    background: none;
    border: 2px solid var(--border);
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    transition: var(--transition);
}

.collaborator-toggle:hover {
    border-color: var(--text-muted);
}

.collaborator-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 600;
    font-size: 14px;
    color: white;
    opacity: 0.3;
    transition: var(--transition);
}

.collaborator-toggle.selected .collaborator-icon {
    opacity: 1;
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px currentColor;
}

.collaborator-toggle.selected {
    border-color: transparent;
}

/* 视频模型选择器 */
.video-model-group {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

.video-model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-model-select {
    flex: 1;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.video-model-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--accent-color);
    color: white;
    font-weight: 600;
    white-space: nowrap;
}

.model-params {
    margin-top: 6px;
    padding: 6px;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 11px;
}

.param-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.param-row:last-child {
    margin-bottom: 0;
}

.param-row label {
    min-width: 70px;
    color: var(--text-secondary);
    font-size: 11px;
}

.param-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
}

.param-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
}

.param-value {
    min-width: 30px;
    text-align: right;
    font-size: 11px;
    color: var(--text-primary);
    font-weight: 500;
}

/* 重置视频状态按钮 */
.btn-reset-video {
    background: var(--warning-color, #f59e0b) !important;
    color: white !important;
    font-size: 11px;
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset-video:hover {
    background: var(--warning-color-dark, #d97706) !important;
    transform: translateY(-1px);
}

.btn-reset-video i {
    margin-right: 2px;
}
