/**
 * 全局样式和Markdown编辑器样式
 * 包含基础布局、主题设置和特殊效果
 */

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

/* 全局样式 */
:root {
    --app-bg: rgba(255, 255, 255, 0.8);
    --toolbar-bg: rgba(239, 239, 239, 0.7);
    --editor-bg: rgba(255, 255, 255, 0.6);
    --preview-bg: rgba(255, 255, 255, 0.6);
    --border-color: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    margin: 0;
    backdrop-filter: blur(20px);
}

.container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

.editor-container {
    background: var(--app-bg);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.toolbar {
    padding: 12px 20px;
    background: var(--toolbar-bg);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.toolbar button {
    background: rgba(0, 122, 255, 0.9);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    margin-right: 10px;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.toolbar button:hover {
    background: rgba(0, 122, 255, 1);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.editor-wrapper {
    display: flex;
    min-height: calc(100vh - 120px);
    background: var(--editor-bg);
}

.editor-section, .preview-section {
    flex: 1;
    padding: 20px;
}

.editor-section {
    border-right: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.5);
}

#editor {
    width: 100%;
    height: 100%;
    min-height: 460px;
    border: none;
    resize: none;
    font-family: "SF Mono", Monaco, monospace;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    background: transparent;
    color: #2c3e50;
}

.preview-section {
    flex: 1;
    padding: 20px 40px;
    overflow-y: auto;
    background: var(--preview-bg);
}

#preview {
    height: auto;
    min-height: 460px;
    overflow-y: visible;
    line-height: 1.75;
    color: #2c3e50;
    font-size: 16px;
    max-width: 800px;
    margin: 0 auto;
}

/* 标题样式 */
#preview h1 {
    font-size: 28px;
    font-weight: 600;
    margin: 1.5em 0 1em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #eaecef;
    line-height: 1.25;
}

#preview h2 {
    font-size: 22px;
    font-weight: 600;
    margin: 1.8em 0 1em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #eaecef;
    line-height: 1.25;
}

#preview h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 1.5em 0 1em;
    line-height: 1.25;
}

/* 代码块样式 */
#preview pre {
    background-color: #282c34;
    color: #abb2bf;
    padding: 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5em 0;
    font-family: 'SF Mono', Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 14px;
    line-height: 1.6;
}

#preview pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

#preview code {
    background: rgba(27,31,35,.05);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
    color: #476582;
}

/* 列表样式 */
#preview ul, #preview ol {
    padding-left: 1.2em;
    margin: 1em 0;
    line-height: 1.7;
}

#preview li {
    margin: 0.5em 0;
}

#preview li > p {
    margin: 0.5em 0;
}

/* 引用块样式 */
#preview blockquote {
    margin: 1em 0;
    padding: 0.5em 1.2em;
    border-left: 4px solid #42b983;
    background-color: #f8f8f8;
    color: #666;
}

#preview blockquote p {
    margin: 0.5em 0;
}

/* 链接样式 */
#preview a {
    color: #3eaf7c;
    text-decoration: none;
    font-weight: 500;
}

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

/* 图片样式 */
#preview img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5em auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* 段落样式 */
#preview p {
    margin: 1em 0;
    line-height: 1.75;
}

/* 分隔线样式 */
#preview hr {
    height: 1px;
    background-color: #eaecef;
    border: none;
    margin: 2em 0;
}

.editor-section.drag-over {
    background: rgba(0, 122, 255, 0.1);
    border: 2px dashed rgba(0, 122, 255, 0.5);
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    background: rgba(255, 59, 48, 0.9);
}
/* 增强Markdown样式 */
#preview img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5em auto;
    border-radius: 4px;
}

#preview em {
    color: #888;
    font-style: normal;
    font-size: 14px;
}

#preview h1 {
    font-size: 24px;
    font-weight: bold;
    margin: 1em 0;
    padding-bottom: 0.3em;
    text-align: center;
}

#preview h2 {
    font-size: 20px;
    font-weight: bold;
    margin: 1.5em 0 1em;
    padding-bottom: 0.3em;
}

#preview blockquote {
    padding: 15px 20px;
    margin: 1em 0;
    background-color: #f7f7f7;
    border-left: 4px solid #42b983;
    color: #666;
    font-size: 15px;
}

#preview pre {
    background: #f8f8f8;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5em 0;
}

#preview pre code {
    background: transparent;
    padding: 0;
    font-size: 14px;
    line-height: 1.6;
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}

#preview p {
    margin: 1.5em 0;
    line-height: 1.8;
}

/* 调整列表样式 */
#preview ul, #preview ol {
    padding-left: 2em;
    margin: 1em 0;
}

#preview li {
    margin: 0.5em 0;
    line-height: 1.8;
}

/* 添加链接样式 */
#preview a {
    color: #42b983;
    text-decoration: none;
}

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

/* 添加代码块容器样式 */
.code-block-wrapper {
    position: relative;
    margin: 1.5em 0;
}

/* 代码块工具栏 */
.code-block-toolbar {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.5em;
    opacity: 0;
    transition: opacity 0.3s;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 0 6px 0 6px;
}

.code-block-wrapper:hover .code-block-toolbar {
    opacity: 1;
}

.code-block-toolbar button {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 8px;
    font-size: 14px;
    transition: color 0.2s;
}

.code-block-toolbar button:hover {
    color: #42b983;
}

/* 修改代码块样式 */
#preview pre {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 2em 1em 1em;
    border-radius: 6px;
    overflow: hidden;
    margin: 0;
    position: relative;
}

#preview pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: 14px;
    line-height: 1.6;
    font-family: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
}

/* 全屏模式样式 */
.code-block-wrapper.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    margin: 0;
    padding: 20px;
    background: #1e1e1e;
    overflow: auto;
}

.code-block-wrapper.fullscreen pre {
    height: 100%;
    margin: 0;
    border-radius: 0;
}

/* Terminal-style Code Block 样式 */
.terminal-block {
    background: rgba(30, 30, 46, 0.95);
    border-radius: 12px;
    margin: 1.5em 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.terminal-header {
    background: rgba(43, 43, 59, 0.95);
    padding: 10px 16px;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.terminal-title {
    color: #a6adc8;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.terminal-controls {
    display: flex;
    gap: 8px;
}

.terminal-button {
    background: transparent;
    border: none;
    color: #cdd6f4;
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.terminal-button:hover {
    opacity: 1;
}

.terminal-content {
    padding: 16px;
    color: #cdd6f4;
    font-family: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: auto;
}

/* 代码中的特殊标记样式 */
.terminal-content .prompt {
    color: #89b4fa;
}

.terminal-content .comment {
    color: #6c7086;
}

.terminal-content .command {
    color: #a6e3a1;
}

.terminal-content .path {
    color: #f9e2af;
}

/* Terminal 全屏模式样式 */
.terminal-block.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    margin: 0;
    background: #1e1e2e;
    border-radius: 0;
}

.terminal-block.fullscreen .terminal-header {
    border-radius: 0;
}

.terminal-block.fullscreen .terminal-content {
    height: calc(100vh - 40px); /* 减去header高度 */
    padding: 20px;
    overflow: auto;
}

/* 优化终端内容的样式 */
.terminal-content {
    white-space: pre-wrap;
    word-break: break-all;
}

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

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Toast优化 */
.toast {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 导航栏样式 */
.app-header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 600;
    color: #007AFF;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.logo a:hover {
    transform: translateY(-1px);
    color: #0056b3;
}

.logo i {
    font-size: 1.3rem;
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: #007AFF;
}

.nav-button i {
    font-size: 1.1rem;
}/* 调整编辑器容器的上边距 */
.container {
    margin-top: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-container {
        padding: 0.8rem 1rem;
    }
    
    .logo a {
        font-size: 1.2rem;
    }
    
    .nav-button {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
}


