* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 密码验证界面样式 */
.password-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.password-form {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    text-align: center;
    min-width: 400px;
}

.password-form h2 {
    margin-bottom: 10px;
    color: #333;
    font-size: 24px;
}

.password-form p {
    margin-bottom: 30px;
    color: #666;
    font-size: 16px;
}

.password-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.password-input-group input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

.password-input-group input:focus {
    border-color: #667eea;
}

.password-input-group button {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.password-input-group button:hover {
    background: #5a6fd8;
}

.password-error {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 10px;
}

.main-container {
    width: 100%;
    margin: 0;
    background: white;
    min-height: 100vh;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    margin-bottom: 20px;
    font-size: 2.5em;
    font-weight: 300;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.file-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    position: relative;
}

button {
    padding: 12px 24px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

button:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

/* 特殊按钮样式覆盖 */
#upload-btn,
#download-btn,
#export-btn,
#fullscreen-preview-btn,
#share-btn,
#editor-fullscreen,
#font-decrease,
#font-increase {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
}

/* 快捷键提示样式 */
.shortcut-hint {
    font-size: 11px;
    opacity: 0.7;
    margin-left: 5px;
    vertical-align: super;
}



.file-browser {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 500px;
    overflow-y: auto;
    min-width: 600px;
    z-index: 1000;
    display: none;
}

.file-browser.active {
    display: block;
}

.file-search {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-search input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
}

.file-search input:focus {
    border-color: #007bff;
}

.file-search button {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    padding: 0;
    margin: 0;
}

.file-search button:hover {
    background: #e9ecef;
    transform: none;
}

.file-tree {
    list-style: none;
    padding: 10px;
}

.file-tree li {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
    color: #333;
}

.file-tree li:hover {
    background: #f0f0f0;
}

.file-tree li.folder {
    font-weight: bold;
    color: #666;
    border-bottom: 1px solid #eee;
    margin-bottom: 5px;
}

.file-tree li.file {
    padding-left: 20px;
    color: #007bff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-tree li.file:hover {
    background: #e3f2fd;
}

.file-tree li.file .file-content {
    flex: 1;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.file-tree li.file .edit-btn,
.file-tree li.file .delete-btn {
    background: #ff4444;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
    transition: opacity 0.2s;
}

.file-tree li.file .edit-btn {
    background: #007bff;
}

.file-tree li.file .edit-btn:hover {
    background: #0056b3;
}

.file-tree li.file .delete-btn {
    background: #ff4444;
}

.file-tree li.file .delete-btn:hover {
    background: #cc0000;
}

.file-tree li.empty {
    color: #999;
    font-style: italic;
    padding-left: 20px;
    cursor: default;
}

.file-tree li.empty:hover {
    background: transparent;
}

.file-tree .file-name {
    display: inline-block;
    margin-right: 8px;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.file-tree .file-info {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

.status-message {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    z-index: 100;
    max-width: 300px;
    text-align: center;
}

.status-message.success {
    background: rgba(76, 175, 80, 0.8);
    border: 1px solid rgba(76, 175, 80, 0.9);
}

.status-message.error {
    background: rgba(244, 67, 54, 0.8);
    border: 1px solid rgba(244, 67, 54, 0.9);
}

.status-message.loading {
    background: rgba(255, 193, 7, 0.8);
    border: 1px solid rgba(255, 193, 7, 0.9);
    color: #333;
}

.editor-container {
    display: flex;
    height: calc(100vh - 200px);
}

#editor {
    flex: 1;
    padding: 20px;
    border: none;
    border-right: 2px solid #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    background: #fafafa;
    overflow-y: auto;
}

#preview {
    flex: 1;
    padding: 20px;
    background: white;
    overflow-y: auto;
    border-left: 2px solid #e0e0e0;
}

#preview h1, #preview h2, #preview h3, #preview h4, #preview h5, #preview h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
}

#preview h1 {
    font-size: 2em;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

#preview h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

#preview h3 {
    font-size: 1.25em;
}

#preview p {
    margin-bottom: 16px;
}

#preview code {
    background: #f6f8fa;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 85%;
}

#preview pre {
    background: #f6f8fa;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 16px;
}

#preview pre code {
    background: none;
    padding: 0;
}

#preview blockquote {
    border-left: 4px solid #ddd;
    padding-left: 16px;
    margin: 16px 0;
    color: #666;
}

#preview table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 16px;
}

#preview th, #preview td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

#preview th {
    background: #f6f8fa;
    font-weight: 600;
}

#preview ul, #preview ol {
    padding-left: 30px;
    margin-bottom: 16px;
}

#preview li {
    margin-bottom: 4px;
}

#preview a {
    color: #0366d6;
    text-decoration: none;
}

#preview a:hover {
    text-decoration: underline;
}

#preview img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Mermaid 图表样式 */
.mermaid {
    text-align: center;
    margin: 20px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .editor-container {
        flex-direction: column;
        height: auto;
    }
    
    #editor, #preview {
        flex: none;
        height: 50vh;
        border: none;
        border-top: 2px solid #e0e0e0;
    }
    
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .file-browser {
        min-width: 300px; /* 移动端缩小宽度 */
        left: 10px;
        right: 10px;
        margin: 0 auto;
    }
    
    .font-size-controls {
        display: none; /* 移动端隐藏字体控制 */
    }
    
    /* 移动端优化 */
    .controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .file-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    button {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .password-form {
        min-width: 90%;
        padding: 30px 20px;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
}

/* 拖拽上传区域样式 */
.drop-zone {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(102, 126, 234, 0.1);
    border: 2px dashed #667eea;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.drop-zone.active {
    display: flex;
}

.drop-zone-content {
    text-align: center;
    color: #667eea;
}

.drop-zone-hint {
    font-size: 14px;
    opacity: 0.7;
}

/* 文件浏览器动画效果 */
.file-browser {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.file-browser.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* 字体大小控制 */
.font-size-controls {
    display: flex;
    gap: 5px;
}

.font-size-controls button {
    padding: 8px 12px;
    min-width: 36px;
    font-weight: bold;
}

/* 导出按钮样式 */
#export-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 25px;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#export-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

#export-btn:active {
    transform: translateY(0);
}

/* 导出菜单样式 */
#export-menu {
    position: absolute;
    top: 100px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 150px;
    overflow: hidden;
}

.export-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}

.export-menu-item:hover {
    background: #f5f5f5;
}

.export-menu-item:last-child {
    border-bottom: none;
}

/* 编辑器全屏模式已移除 */

/* 键盘快捷键提示 */
.shortcut-hint {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 5px;
}

/* 全局加载指示器 */
.global-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 快捷键提示面板 */
.shortcut-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.shortcut-panel-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
}

.shortcut-panel-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
}

.shortcut-panel-content ul {
    list-style: none;
    padding: 0;
}

.shortcut-panel-content li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

.shortcut-panel-content kbd {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

#close-shortcut-panel {
    margin-top: 20px;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
}

/* 自动保存指示器 */
.autosave-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 13px;
}

.autosave-dot {
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.autosave-text {
    color: white;
}

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