/* CSS变量定义 */
:root {
    --primary-color: #4a90e2;
    --secondary-color: #6c757d;
    --success-color: #5cb85c;
    --danger-color: #d9534f;
    --warning-color: #f0ad4e;
    --info-color: #5bc0de;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --border-radius: 4px;
    --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--dark-color);
    background-color: #f5f5f5;
}

/* 应用容器 */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1920px;
    margin: 0 auto;
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* 头部样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--box-shadow);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* 主内容区域 */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 面板通用样式 */
.panel-header {
    padding: 1rem;
    background-color: var(--light-color);
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark-color);
}

/* 左侧面板 */
.left-panel {
    width: 300px;
    background-color: white;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

/* 标签页容器 */
.tab-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 标签页按钮 */
.tab-buttons {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--light-color);
}

.tab-btn {
    padding: 0.75rem 1rem;
    border: none;
    background-color: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--secondary-color);
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    background-color: rgba(74, 144, 226, 0.1);
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: white;
}

/* 标签页内容 */
.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: none;
}

.tab-content.active {
    display: block;
}

/* 对话列表 */
.dialog-list {
    padding: 0.5rem 0;
}

.dialog-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.dialog-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.dialog-item:hover {
    background-color: var(--light-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--box-shadow);
}

.dialog-item.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.dialog-item-id {
    font-weight: 600;
    font-size: 0.9rem;
}

.dialog-item-name {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

/* 角色管理样式 */
.actors-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.actors-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
}

.actors-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.actors-list {
    flex: 1;
    overflow-y: auto;
}

.actor-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.actor-item:hover {
    background-color: var(--light-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--box-shadow);
}

.actor-item.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.actor-item-id {
    font-weight: 600;
    font-size: 0.9rem;
}

.actor-item-name {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

/* 角色编辑样式 */
.actor-editor {
    max-width: 800px;
    margin: 0 auto;
}

.actor-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.actor-field {
    margin-bottom: 1rem;
}

.actor-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

/* 编辑面板 */
.editor-panel {
    flex: 1;
    background-color: white;
    display: flex;
    flex-direction: column;
}

.editor-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--secondary-color);
    font-style: italic;
}

/* 对话编辑器样式 */
.dialog-editor {
    max-width: 800px;
    margin: 0 auto;
}

.editor-section {
    margin-bottom: 1.5rem;
}

.editor-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

/* 表单元素样式 */
.form-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.25);
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-col {
    flex: 1;
}

.form-col.full-width {
    flex: 1 1 100%;
}

.form-col label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.9rem;
}

/* 对话行样式 */
.dialog-lines {
    margin-bottom: 1rem;
}

.dialog-line {
    background-color: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    overflow: hidden;
}

.line-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background-color: white;
    border-bottom: 1px solid var(--border-color);
}

.line-actions {
    display: flex;
    gap: 0.5rem;
}

.line-number {
    font-weight: 600;
    color: var(--primary-color);
}

.line-number {
    font-weight: 600;
    color: var(--primary-color);
}

.line-content {
    padding: 1rem;
}

/* 按钮样式 */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: var(--box-shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

/* 编辑操作区域 */
.editor-actions {
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* 底部样式 */
.footer {
    padding: 1rem;
    background-color: var(--light-color);
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.85rem;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* 转换器页面样式 */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.converter-panel {
    flex: 1;
    background-color: white;
    padding: 1rem;
    overflow-y: auto;
}

.preview-panel {
    width: 400px;
    background-color: white;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.converter-content {
    max-width: 800px;
    margin: 0 auto;
}

.converter-steps {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.step {
    background-color: var(--light-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.step h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.step-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 格式要求信息样式 */
.format-info {
    background-color: rgba(74, 144, 226, 0.1);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
}

.format-info h4 {
    margin-top: 0;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.format-info ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.format-info li {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.sample-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.sample-link:hover {
    text-decoration: underline;
    transform: translateY(-1px);
}

/* 文件上传区域样式 */
.file-upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background-color: white;
}

.file-upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(74, 144, 226, 0.05);
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(74, 144, 226, 0.05);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.file-icon {
    font-size: 3rem;
}

.file-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--dark-color);
}

.file-hint {
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.file-info {
    padding: 1rem;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    color: var(--secondary-color);
}

/* 选项网格样式 */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.option-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-item label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--dark-color);
}

/* 转换按钮样式 */
.convert-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
}

/* 转换结果样式 */
.conversion-result {
    padding: 1rem;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    color: var(--secondary-color);
    min-height: 50px;
}

/* JSON预览样式 */
.preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.json-preview {
    background-color: var(--light-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--dark-color);
    max-height: 100%;
    overflow-y: auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .left-panel {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .form-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .preview-panel {
        width: 100%;
        height: 300px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .convert-actions {
        flex-direction: column;
    }
}