/* 全局样式 */
:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --border-color: #ddd;
    --text-color: #333;
    --header-height: 60px;
/*    --sidebar-width: 300px;
    --sidebar-min-width: 200px;
    --sidebar-max-width: 500px;*/
    --sidebar-width: 550px;
    --sidebar-min-width: 100px;
    --sidebar-max-width: 1000px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: #f5f7fa;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 顶部导航栏 */
.app-header {
    height: var(--header-height);
    background-color: var(--primary-color);
    color: white;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.app-title {
    display: flex;
    align-items: center;
}

.app-title h1 {
    font-size: 1.5rem;
    margin: 0;
    margin-left: 10px;
}

.logo {
    height: 40px;
    width: auto;
}

/* 主内容区域 */
.app-content {
    display: flex;
    height: calc(100vh - var(--header-height));
    position: relative;
}

/* 目录树区域 */
.directory-container {
    width: var(--sidebar-width);
    min-width: var(--sidebar-min-width);
    max-width: var(--sidebar-max-width);
    height: 100%;
    background-color: white;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
}

.directory-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.directory-header h3 {
    font-size: 1.2rem;
    margin: 0;
}

.directory-tree {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

/* 目录树样式 */
.tree-node {
    margin: 0px 0;
    position: relative;
}

.tree-content {
    display: flex;
    align-items: center;
    padding: 0px 0px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
}

.tree-content:hover {
    background-color: #f0f7ff;
}

.tree-content.active {
    background-color: #e0f0ff;
}

.tree-toggle {
    display: inline-block;
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 20px;
    margin-right: 5px;
    cursor: pointer;
    color: #666;
}

.tree-icon {
    margin-right: 5px;
    color: var(--primary-color);
}

.icon-file {
    color: var(--text-color);
}

.icon-folder {
    color: #f1c40f;
}

.tree-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-actions {
    display: none;
    margin-left: 5px;
}

.tree-content:hover .tree-actions {
    display: flex;
}

.tree-action {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    margin-left: 3px;
    color: #666;
    font-size: 0.8rem;
}

.tree-action:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

.tree-children {
    margin-left: 25px;
    display: none;
}

.tree-node.expanded > .tree-children {
    display: block;
}

/* 分割线拖动调整宽度 */
.resize-handle {
    width: 5px;
    height: 100%;
    position: absolute;
    right: 0;
    top: 0;
    cursor: col-resize;
    background-color: transparent;
}

.resize-handle:hover,
.resize-handle.active {
    background-color: var(--primary-color);
    opacity: 0.3;
}

/* 预览区域 */
.preview-container {
    flex: 1;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background-color: white;
}

.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background-color: #f9f9f9;
}

.placeholder-content {
    text-align: center;
    color: #999;
}

.placeholder-icon {
    font-size: 5rem;
    margin-bottom: 15px;
}

.preview-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.preview-title {
    font-size: 1.2rem;
    font-weight: 500;
}

.preview-path {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
}

.preview-actions {
    display: flex;
    gap: 5px;
}

.preview-body {
    flex: 1;
    overflow: auto;
    padding: 0px;/* 动过原15 */
    position: relative;
}

/* 不同类型的预览面板 */
.preview-panel {
    height: 100%;
    overflow: auto;
}

/* 文本编辑器 */
.text-editor {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border-color);
    padding: 10px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    tab-size: 4;
}

/* Markdown编辑器 */
.markdown-container {
    display: flex;
    height: 100%;
    gap: 15px;
}

.markdown-editor,
.markdown-render {
    flex: 1;
    height: 100%;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.markdown-editor {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    padding: 10px;
    font-size: 14px;
    white-space: pre-wrap;
    tab-size: 4;
}

.markdown-render {
    padding: 15px;
    background-color: #fff;
    line-height: 1.6;
}

.markdown-render h1,
.markdown-render h2,
.markdown-render h3,
.markdown-render h4,
.markdown-render h5,
.markdown-render h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.markdown-render h1 {
    font-size: 1.8em;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3em;
}

.markdown-render h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3em;
}

.markdown-render h3 {
    font-size: 1.3em;
}

.markdown-render p {
    margin: 1em 0;
}

.markdown-render ul,
.markdown-render ol {
    margin: 1em 0;
    padding-left: 2em;
}

.markdown-render code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    padding: 0.2em 0.4em;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    font-size: 0.9em;
}

.markdown-render pre {
    margin: 1em 0;
    padding: 1em;
    overflow: auto;
    background-color: #f6f8fa;
    border-radius: 3px;
}

.markdown-render pre code {
    background-color: transparent;
    padding: 0;
}

.markdown-render blockquote {
    margin: 1em 0;
    padding: 0 1em;
    color: #6a737d;
    border-left: 4px solid #dfe2e5;
}

.markdown-render table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.markdown-render table th,
.markdown-render table td {
    padding: 6px 13px;
    border: 1px solid #dfe2e5;
}

.markdown-render table tr:nth-child(2n) {
    background-color: #f6f8fa;
}

/* 图片预览 */
#imageViewer {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* 视频预览 */
#videoPlayer,
#audioPlayer {
    width: 100%;
    max-height: 80vh;
}

/* 不支持的文件类型预览 */
.unsupported-message {
    text-align: center;
    padding: 50px 20px;
    color: #888;
}

.unsupported-message i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #ddd;
}

/* 进度条样式 */
.progress {
    height: 10px;
    margin-top: 10px;
}

/* 加载中样式 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: #999;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .directory-container {
        width: 250px;
    }
    
    .markdown-container {
        flex-direction: column;
    }
    
    .markdown-editor,
    .markdown-render {
        flex: none;
        height: 50%;
    }
}

/* 文件类型颜色 */
.icon-file-code { color: #e74c3c; }
.icon-file-image { color: #3498db; }
.icon-file-video { color: #9b59b6; }
.icon-file-audio { color: #e67e22; }
.icon-file-pdf { color: #e74c3c; }
.icon-file-word { color: #2980b9; }
.icon-file-excel { color: #27ae60; }
.icon-file-powerpoint { color: #d35400; }
.icon-file-archive { color: #8e44ad; }
.icon-file-text { color: #34495e; }

/* 拖放区域 */
.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 5px;
    padding: 25px;
    text-align: center;
    margin: 15px 0;
    color: #999;
}

.drop-zone.active {
    border-color: var(--primary-color);
    background-color: rgba(52, 152, 219, 0.05);
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Office文档预览样式 */
.office-preview-container {
    display: flex;
    flex-direction: column;
    padding: 60px;/* 动过 */
    height: 100%;
    overflow-y: auto;
}

.office-info {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.office-icon {
    transform: scale(0.6); /* 缩小60%，scale值为0.6 */
    font-size: 2rem;
    margin-right: 20px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.office-icon i.fa-file-word {
    color: #2980b9;
}

.office-icon i.fa-file-excel {
    color: #27ae60;
}

.office-icon i.fa-file-powerpoint {
    color: #d35400;
}

.office-details {
    flex: 1;
}

.office-details h4 {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.office-details p {
    margin-bottom: 5px;
    color: #666;
}

/* 新增Office摘要样式 */
.office-summary {
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid var(--primary-color);
}

/* Office在线预览iframe容器 */
.office-online-viewer {
    margin: 20px 0;
    border: 1px solid #eaeaea;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    height: 70vh;
    min-height: 800px;/* 动过原500 */
}

/* 预览器切换容器 */
.viewer-switch-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eaeaea;
}

.viewer-switch {
    font-size: 0.85rem;
    padding: 5px 10px;
}

.viewer-switch.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.office-online-viewer iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.office-summary h5 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.content-summary {
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.9rem;
    line-height: 1.5;
    background-color: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

/* PDF摘要样式 */
.pdf-summary {
    margin-bottom: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #e74c3c;
}

.pdf-summary h5 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #e74c3c;
}

.office-actions {
    margin-top: 20px;
    text-align: center;
} 


/* 文件上传进度列表样式 */
.upload-files-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.upload-file-item {
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
    font-size: 0.9rem;
}

.upload-file-item:last-child {
    border-bottom: none;
}

.upload-file-name {
    display: block;
    margin-bottom: 4px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-file-progress {
    height: 6px;
    background-color: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
}

.upload-file-bar {
    height: 100%;
    background-color: #3498db;
    width: 0%;
    transition: width 0.3s ease; /* 平滑过渡动画 */
}

.upload-file-status {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.8rem;
}

.upload-status-success {
    color: #2ecc71;
}

.upload-status-error {
    color: #e74c3c;
}

/* 增强总进度条样式 */
.progress .progress-bar {
    transition: width 0.3s ease;
    background-color: #3498db;
}