/* 主布局 */
.main-layout {
    display: grid;
    grid-template-columns: 3fr 7fr;
    gap: 20px;
    align-items: stretch;
    height: calc(100vh - 200px);
    overflow: hidden;
}

/* 作品侧边栏 */
.works-sidebar {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    border: 1px solid #eef0f2;
}

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

.sidebar-header h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a2e;
    letter-spacing: -0.01em;
}

.btn-refresh {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #f5f6f8;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    color: #888;
}

.btn-refresh:hover {
    background: #eef0f4;
    transform: rotate(180deg);
    color: #555;
}

.works-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 2px;
    min-height: 0;
}

.works-list::-webkit-scrollbar {
    width: 4px;
}

.works-list::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 2px;
}

.works-list::-webkit-scrollbar-thumb {
    background: #e0e3e8;
    border-radius: 2px;
}

.works-list::-webkit-scrollbar-thumb:hover {
    background: #c8ccd4;
}

.work-item {
    background: #fafbfc;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.work-item-body {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.work-item-info {
    flex: 1 1 auto;
    min-width: 0;
    padding: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.work-item-info:hover {
    background: #f0f4ff;
}

.work-item-selected {
    background: #eef3ff;
    border-color: #b8c9f7;
}

.work-item-selected .work-item-info {
    background: transparent;
}

.work-item-selected .work-item-info:hover {
    background: transparent;
}

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

.work-item-title {
    font-weight: 600;
    color: #1a1a2e;
    font-size: 0.85rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.work-item-status {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    margin-left: 8px;
}

.work-item-status.status-pending {
    background: #fef7e0;
    color: #947600;
}

.work-item-status.status-processing {
    background: #e0f0ff;
    color: #1a6fb5;
}

.work-item-status.status-completed {
    background: #e0f5e8;
    color: #1a7a3a;
}

.work-item-status.status-failed {
    background: #fde8ea;
    color: #b52030;
}

.work-item-status.status-draft {
    background: #f3f0ff;
    color: #6b4fbf;
}

.work-item-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #aaa;
}

/* 作品列表内联视频播放器 */
.work-video-player {
    flex: 0 0 36%;
    min-width: 0;
    border-radius: 6px;
    overflow: hidden;
}

.work-video-el {
    display: block;
    width: 100%;
    max-height: 110px;
    border-radius: 6px;
    background: #000;
    outline: none;
}

/* 作品列表视频预览 */
.work-video-preview {
    flex: 0 0 36%;
    position: relative;
    min-width: 0;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    min-height: 65px;
    background: #000;
}

.work-video-preview-el {
    display: block;
    width: 100%;
    max-height: 110px;
    object-fit: cover;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.work-video-preview:hover .work-video-preview-el {
    opacity: 1;
}

.work-video-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    transition: background 0.3s;
}

.work-video-preview:hover .work-video-preview-overlay {
    background: rgba(0, 0, 0, 0.5);
}

.work-video-preview-play-icon {
    font-size: 1.3rem;
    color: #fff;
    text-shadow: 0 0 8px rgba(0,0,0,0.5);
    transition: transform 0.2s;
}

.work-video-preview:hover .work-video-preview-play-icon {
    transform: scale(1.1);
}

.work-video-preview-text {
    font-size: 0.7rem;
    color: #fff;
    text-shadow: 0 0 6px rgba(0,0,0,0.5);
}

/* 无视频时的占位（复用原 placeholder 样式） */
.work-video-preview-placeholder {
    width: 100%;
    height: 100%;
    min-height: 65px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: #eef0f3;
    color: #aaa;
    gap: 3px;
}

.work-video-placeholder {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    border-radius: 6px;
    background: #e8e8e8;
    color: #999;
    gap: 4px;
    min-height: 80px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.work-video-placeholder:hover {
    background: #d0d0d0;
    color: #555;
}

.work-video-placeholder-icon {
    font-size: 1.3rem;
    opacity: 0.7;
}

.work-video-placeholder:hover .work-video-placeholder-icon {
    opacity: 1;
}

.work-video-placeholder-text {
    font-size: 0.75rem;
}

/* 加载更多 */
.load-more {
    text-align: center;
    padding: 16px;
    color: #999;
}

.load-more-text {
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.load-more-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #f0f0f0;
    border-top-color: #c4a882;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.storyboard-count {
    flex: 1;
}

.work-item-time {
    white-space: nowrap;
}

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

.btn-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #f5f6f8;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #888;
}

.btn-icon:hover {
    background: #c4a882;
    color: white;
}

.btn-icon.btn-delete:hover {
    background: #e05353;
    color: white;
}

.btn-icon.btn-export:hover {
    background: #3da55d;
    color: white;
}

.work-video-preview-overlay.ffplay-active {
    background: rgba(220, 53, 69, 0.7);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state .text {
    font-size: 0.9rem;
}

/* 表单内容区域 */
.form-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 600px;
}

/* 表单样式 */
.form-section {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.form-label-small {
    display: block;
    font-weight: 500;
    color: #666;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #c4a882;
}

.form-input::placeholder {
    color: #999;
}

.form-textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-textarea:focus {
    outline: none;
    border-color: #c4a882;
}

.form-textarea::placeholder {
    color: #999;
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-select:focus {
    outline: none;
    border-color: #c4a882;
}

/* 时长滑块样式 */
.duration-slider-container {
    position: relative;
    width: 100%;
}

.duration-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #c4a882 0%, #c4a882 50%, #e0e0e0 50%, #e0e0e0 100%);
    outline: none;
    cursor: pointer;
    margin-bottom: 10px;
}

.duration-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #c4a882;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(196, 168, 130, 0.4);
    transition: transform 0.15s;
}

.duration-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.duration-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #c4a882;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(196, 168, 130, 0.4);
}

.duration-slider::-moz-range-track {
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
}

.duration-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #999;
    user-select: none;
}

.duration-value {
    color: #c4a882;
    font-weight: 700;
}

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

.form-group:last-child {
    margin-bottom: 0;
}

/* 上传区域样式 */
.upload-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.upload-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
}

.upload-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.upload-section-icon {
    font-size: 1.1rem;
}

.upload-area {
    border: 2px dashed #d0d0d0;
    border-radius: 8px;
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.upload-area:hover {
    border-color: #c4a882;
    background: #f8f9ff;
}

.upload-area.drag-over {
    border-color: #c4a882;
    background: #f0f4ff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.upload-text {
    color: #333;
    font-weight: 500;
    margin-bottom: 4px;
}

.upload-hint {
    color: #999;
    font-size: 0.85rem;
}

/* 预览样式 */
.upload-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.preview-image-container {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.preview-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.remove-image-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #dc3545;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

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

.preview-audio-container {
    position: relative;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #c4a882 0%, #a89070 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-audio-icon {
    font-size: 1.5rem;
}

.preview-info {
    flex: 1;
    min-width: 0;
}

.preview-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-size {
    font-size: 0.85rem;
    color: #999;
}

/* 文本计数器 */
.text-counter {
    text-align: right;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #666;
}

/* 剧本上传 */
.script-upload-area {
    border: 2px dashed #d0d5dd;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: border-color 0.3s, background 0.3s;
    cursor: pointer;
    background: #fafbfc;
    position: relative;
}

.script-upload-area:hover {
    border-color: #c4a882;
    background: #f5f7ff;
}

.script-upload-area.drag-over {
    border-color: #c4a882;
    background: #eef1ff;
}

.script-upload-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.script-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: #c4a882;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    font-weight: 500;
}

.script-upload-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.script-upload-icon {
    flex-shrink: 0;
}

.script-paste-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    background: #fff;
    color: #c4a882;
    border: 2px solid #c4a882;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.script-paste-btn:hover {
    background: #c4a882;
    color: #fff;
    transform: translateY(-1px);
}

.script-upload-hint {
    font-size: 0.8rem;
    color: #999;
    margin: 0;
}

/* 文件预览 */
.script-upload-preview {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
}

.script-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.script-file-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.script-file-detail {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.script-file-name {
    font-size: 0.9rem;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.script-file-size {
    font-size: 0.75rem;
    color: #999;
}

.script-file-remove {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s;
}

.script-file-remove:hover {
    color: #dc3545;
}

/* 粘贴文本弹窗 */
.script-paste-dialog {
    max-width: 700px;
}

/* 间隔设置 */
.interval-settings {
    display: flex;
    gap: 16px;
}

.interval-hint {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #666;
    border-left: 3px solid #c4a882;
}

/* 视频设置 */
.video-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* 按钮样式 */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
}

.btn {
    padding: 12px 32px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #c4a882 0%, #a89070 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(196, 168, 130, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

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

.progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #c4a882 0%, #a89070 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.progress-step {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.3s;
}

.progress-step .step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.progress-step .step-label {
    font-size: 0.8rem;
    color: #999;
    transition: all 0.3s;
}

.progress-step.active .step-icon {
    background: linear-gradient(135deg, #c4a882 0%, #a89070 100%);
    color: white;
}

.progress-step.active .step-label {
    color: #c4a882;
    font-weight: 500;
}

.progress-step.completed .step-icon {
    background: #28a745;
    color: white;
}

.progress-step.completed .step-label {
    color: #28a745;
}

/* 弹窗内容样式（modal-overlay 基础样式在 base.html 中已定义） */
.modal-btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.create-work-modal {
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
}

/* 预览弹窗样式 */
.preview-modal {
    max-width: 600px;
}

/* 视频播放弹窗 */
.video-play-modal {
    max-width: 850px;
    padding: 20px 24px;
}

.video-play-modal .modal-header {
    position: relative;
    margin-bottom: 16px;
}

.video-play-modal .modal-body {
    margin-bottom: 12px;
    padding: 0;
}

.video-play-modal .modal-actions {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.video-play-container {
    background: #000;
    border-radius: 8px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.video-play-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 40px;
}

.video-play-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: videoSpin 0.8s linear infinite;
}

@keyframes videoSpin {
    to { transform: rotate(360deg); }
}

.video-play-text {
    color: #aaa;
    font-size: 14px;
}

.video-play-modal video {
    display: block;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: #e9ecef;
}

.modal-body {
    margin-bottom: 20px;
}

.preview-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    min-height: 200px;
}

.preview-video {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
}

.preview-placeholder {
    text-align: center;
}

.preview-avatar {
    font-size: 4rem;
    margin-bottom: 16px;
}

.preview-text {
    color: #666;
    font-size: 1rem;
    line-height: 1.6;
    max-width: 400px;
}

/* ==================== 聊天对话框 ==================== */
.container {
    max-width: 100% !important;
    padding: 0 20px;
}

.chat-container {
    min-width: 0;
    height: 100%;
}

.chat-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    border: 1px solid #eef0f2;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid #f2f3f5;
    flex-shrink: 0;
}

.chat-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
    letter-spacing: -0.01em;
}

.chat-model-badge {
    font-size: 0.75rem;
    padding: 2px 10px;
    background: linear-gradient(135deg, #c4a882, #a89070);
    color: white;
    border-radius: 12px;
    font-weight: 500;
}

.chat-selected-work {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 4px 10px 4px 8px;
    background: #eef1ff;
    border: 1px solid #c5cef7;
    border-radius: 20px;
    font-size: 0.8rem;
    animation: fadeIn 0.2s ease;
}

.chat-selected-work-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c4a882;
    flex-shrink: 0;
}

.chat-selected-work-name {
    color: #4a55a2;
    font-weight: 500;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-selected-work-clear {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(196, 168, 130, 0.15);
    color: #c4a882;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    transition: all 0.2s;
}

.chat-selected-work-clear:hover {
    background: rgba(196, 168, 130, 0.3);
    color: #4a55a2;
}

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

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #d0d5dd;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: #999;
    text-align: center;
    padding: 40px 20px;
}

.chat-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.chat-empty-text {
    font-size: 1.05rem;
    font-weight: 500;
    color: #666;
    margin-bottom: 6px;
}

.chat-empty-hint {
    font-size: 0.85rem;
    color: #aaa;
}

.chat-message {
    display: flex;
    gap: 10px;
    animation: chatSlideIn 0.25s ease-out;
}

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

.chat-message-user {
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    background: #f0f2f5;
}

.chat-message-user .chat-message-avatar {
    background: linear-gradient(135deg, #c4a882, #a89070);
}

.chat-message-body {
    max-width: 80%;
}

.chat-message-role {
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 4px;
    padding: 0 4px;
}

.chat-message-context-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    font-size: 0.68rem;
    color: #c4a882;
    background: rgba(196, 168, 130, 0.1);
    border-radius: 10px;
    font-weight: 500;
    vertical-align: middle;
}

.chat-message-user .chat-message-role {
    text-align: right;
}

.chat-message-content {
    background: #f5f6f9;
    padding: 10px 14px;
    border-radius: 12px;
    border-top-left-radius: 4px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-message-user .chat-message-content {
    background: #c4a882;
    color: white;
    border-radius: 12px;
    border-top-right-radius: 4px;
}

.chat-cursor {
    display: inline-block;
    animation: blink 1s step-end infinite;
    color: #c4a882;
    font-weight: 700;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* 剪辑操作结果卡片 */
.chat-edit-result {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 12px 0;
    padding: 12px 14px;
    background: linear-gradient(135deg, #f0f4ff, #f8f0ff);
    border: 1px solid #d4c5f9;
    border-radius: 10px;
    animation: editSlideIn 0.3s ease-out;
}

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

.chat-edit-result-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.chat-edit-result-text {
    flex: 1;
    font-size: 0.88rem;
    color: #333;
    line-height: 1.5;
}

.chat-edit-open-btn {
    flex-shrink: 0;
    padding: 6px 12px;
    background: linear-gradient(135deg, #c4a882, #a89070);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.82rem;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
    align-self: center;
}

.chat-edit-open-btn:hover {
    opacity: 0.9;
}

.chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #f2f3f5;
    background: #fafbfc;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    border: 1px solid #e8ebf0;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.95rem;
    line-height: 1.6;
    min-height: 52px;
    resize: none;
    outline: none;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s;
    max-height: 150px;
}

.chat-input:focus {
    border-color: #c4a882;
    box-shadow: 0 0 0 3px rgba(196, 168, 130, 0.08);
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;
    background: #c4a882;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.15s;
}

.chat-send-btn:hover {
    opacity: 0.85;
    transform: scale(1.04);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

.chat-send-btn svg {
    pointer-events: none;
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
    }

    .works-sidebar {
        position: static;
        max-height: 400px;
    }

    .chat-card {
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    .upload-sections {
        grid-template-columns: 1fr;
    }

    .video-settings {
        grid-template-columns: 1fr;
    }

    .interval-settings {
        flex-direction: column;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .progress-steps {
        flex-wrap: wrap;
    }

    .progress-step {
        min-width: calc(50% - 4px);
    }
}

@media (max-width: 480px) {
    .upload-section {
        padding: 12px;
    }

    .upload-area {
        padding: 24px 12px;
    }

    .upload-icon {
        font-size: 2rem;
    }

    .preview-modal {
        max-width: 95%;
        padding: 20px;
    }

    .progress-step {
        min-width: 100%;
    }
}

/* 小尺寸按钮 */
.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
    border-radius: 6px;
}

/* ==================== 作品资产管理弹窗 ==================== */
.asset-modal {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

.asset-list {
    margin-bottom: 20px;
    max-height: 360px;
    overflow-y: auto;
}

.asset-list::-webkit-scrollbar {
    width: 4px;
}

.asset-list::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 2px;
}

.asset-list::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 2px;
}

.asset-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #e8e8e8;
    transition: all 0.2s;
}

.asset-card:hover {
    border-color: #c5cef7;
    background: #f5f7ff;
}

.asset-card-body {
    display: flex;
    gap: 12px;
    align-items: center;
}

.asset-card-image {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #e8e8e8;
}

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

.asset-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #e0e0e0, #d0d0d0);
}

.asset-card-info {
    flex: 1;
    min-width: 0;
}

.asset-card-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.asset-card-desc {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-card-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: #aaa;
}

.asset-card-time {
    color: #bbb;
}

.asset-card-delete {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.asset-card-delete:hover {
    background: #f8d7da;
    border-color: #dc3545;
    color: #dc3545;
}

/* 添加资产区域 */
.asset-add-section {
    border-top: 2px solid #f0f0f0;
    padding-top: 16px;
}

.asset-add-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f0f4ff;
    color: #c4a882;
    border: 1px solid #c5cef7;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s;
    user-select: none;
}

.asset-add-toggle:hover {
    background: #e8ecff;
    border-color: #c4a882;
}

.asset-add-form {
    margin-top: 16px;
    padding: 16px;
    background: #fafbfc;
    border-radius: 10px;
    border: 1px solid #e8e8e8;
}

.asset-add-form .form-section {
    margin-bottom: 16px;
}

.asset-add-form .upload-sections {
    margin-bottom: 16px;
}

.asset-add-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ==================== 积分不足独立弹窗 ==================== */
.credit-insufficient-dialog {
    max-width: 440px;
    text-align: center;
}

.credit-insufficient-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.credit-insufficient-icon {
    font-size: 3rem;
    line-height: 1;
}

.credit-insufficient-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #c62828;
}

.credit-insufficient-details {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #fff5f5, #ffebee);
    border: 1px solid #ffcdd2;
    border-radius: 12px;
}

.credit-insufficient-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.credit-insufficient-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.credit-insufficient-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
}

.credit-insufficient-red {
    color: #c62828;
}

.credit-insufficient-gap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: #ffcdd2;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #b71c1c;
    font-weight: 600;
}

.credit-insufficient-recharge-btn {
    background: linear-gradient(135deg, #ef5350, #d32f2f) !important;
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.35) !important;
}

.credit-insufficient-recharge-btn:hover {
    background: linear-gradient(135deg, #e53935, #c62828) !important;
    box-shadow: 0 4px 16px rgba(229, 57, 53, 0.5) !important;
    transform: translateY(-1px);
}
