/* Markdown编辑器专用样式 */
.markdown-editor-tool {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* 编辑器样式 */
#markdownInput {
    resize: none;
    min-height: 500px;
    font-size: 14px;
    line-height: 1.6;
    border: none !important;
    padding: 1rem;
    background-color: #fafafa;
}

#markdownInput:focus {
    background-color: #ffffff;
    box-shadow: none;
    outline: none;
}

/* 预览区域样式 */
.markdown-content {
    min-height: 500px;
    font-size: 14px;
    line-height: 1.7;
    color: #333;
    word-wrap: break-word;
}

/* Markdown内容样式 */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.25;
    color: #24292e;
}

.markdown-content h1 {
    font-size: 2em;
    border-bottom: 1px solid #e1e4e8;
    padding-bottom: 0.3em;
}

.markdown-content h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #e1e4e8;
    padding-bottom: 0.3em;
}

.markdown-content h3 {
    font-size: 1.25em;
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.markdown-content li {
    margin-bottom: 0.25rem;
}

.markdown-content blockquote {
    padding: 0 1rem;
    color: #6a737d;
    border-left: 0.25rem solid #dfe2e5;
    margin-bottom: 1rem;
}

.markdown-content code {
    padding: 0.2rem 0.4rem;
    margin: 0;
    font-size: 85%;
    background-color: rgba(27, 31, 35, 0.05);
    border-radius: 3px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.markdown-content pre {
    padding: 1rem;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background-color: #f6f8fa;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.markdown-content pre code {
    background-color: transparent;
    border: 0;
    display: inline;
    max-width: auto;
    overflow: visible;
    padding: 0;
    margin: 0;
    font-size: 100%;
    white-space: pre;
    word-wrap: normal;
}

.markdown-content table {
    border-spacing: 0;
    border-collapse: collapse;
    margin-bottom: 1rem;
    width: 100%;
}

.markdown-content table th,
.markdown-content table td {
    padding: 6px 13px;
    border: 1px solid #dfe2e5;
}

.markdown-content table th {
    font-weight: 600;
    background-color: #f6f8fa;
}

.markdown-content table tr:nth-child(2n) {
    background-color: #f6f8fa;
}

.markdown-content a {
    color: #0366d6;
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid #e1e4e8;
    margin: 2rem 0;
}

/* 工具栏样式 */
.btn-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-toolbar .btn-group {
    margin-bottom: 0.5rem;
}

.btn-toolbar .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    min-width: 2.5rem;
}

.btn-toolbar .btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 编辑器容器样式 */
#editorContainer {
    min-height: 600px;
}

#editorColumn .card,
#previewColumn .card {
    height: 100%;
    min-height: 600px;
}

#markdownPreview {
    padding: 1rem;
    overflow-y: auto;
    height: calc(100% - 57px); /* 减去header高度 */
}

/* 全屏模式 */
.fullscreen-editor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

.fullscreen-editor #editorContainer {
    flex: 1;
    margin: 0;
    min-height: 100vh;
}

.fullscreen-editor .oidn-hero,
.fullscreen-editor .oidn-footer,
.fullscreen-editor .card:not(.h-100) {
    display: none;
}

/* 统计信息样式 */
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #495057;
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.stat-item {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.stat-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

/* 状态栏样式 */
.badge {
    font-size: 0.75rem;
    margin-right: 0.5rem;
}

/* 卡片增强 */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

/* 滚动同步 */
.scroll-sync {
    scroll-behavior: smooth;
}

/* 代码高亮主题 */
.markdown-content .hljs {
    background: #f6f8fa;
    color: #24292e;
}

/* 数学公式样式 */
.math-formula {
    font-family: 'Cambria Math', 'Latin Modern Math', 'STIX Two Math', serif;
    font-size: 1.1em;
    background-color: #f8f9fa;
    padding: 0.5rem;
    border-radius: 4px;
    margin: 1rem 0;
    text-align: center;
    overflow-x: auto;
}

/* 任务列表样式 */
.task-list-item {
    list-style: none;
    margin-left: -1.5rem;
}

.task-list-item input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* 键盘快捷键提示 */
.keyboard-shortcut {
    font-size: 0.75rem;
    color: #6c757d;
    background: #f8f9fa;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    border: 1px solid #dee2e6;
    margin-left: 0.25rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    #editorContainer {
        flex-direction: column;
    }

    #editorColumn,
    #previewColumn {
        width: 100%;
        margin-bottom: 1rem;
    }

    .btn-toolbar {
        justify-content: center;
    }

    .btn-toolbar .btn-group {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-item {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    #markdownInput,
    .markdown-content {
        min-height: 300px;
    }
}

@media (max-width: 576px) {
    .hero-actions .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .btn-toolbar .btn-group {
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
    }

    .badge {
        display: block;
        margin-bottom: 0.25rem;
        margin-right: 0;
    }
}

/* 加载状态 */
.loading-preview {
    position: relative;
}

.loading-preview::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .markdown-content {
        color: #000;
    }

    .markdown-content a {
        color: #0000ff;
    }

    .markdown-content code {
        background-color: #000;
        color: #fff;
    }

    .markdown-content pre {
        background-color: #f0f0f0;
        border: 2px solid #000;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    #markdownInput {
        background-color: #2d3748;
        color: #e2e8f0;
    }

    #markdownInput:focus {
        background-color: #1a202c;
    }

    .markdown-content {
        color: #e2e8f0;
    }

    .markdown-content h1,
    .markdown-content h2,
    .markdown-content h3,
    .markdown-content h4,
    .markdown-content h5,
    .markdown-content h6 {
        color: #e2e8f0;
    }

    .markdown-content h1,
    .markdown-content h2 {
        border-bottom-color: #4a5568;
    }

    .markdown-content blockquote {
        color: #a0aec0;
        border-left-color: #4a5568;
    }

    .markdown-content code {
        background-color: rgba(255, 255, 255, 0.1);
        color: #e2e8f0;
    }

    .markdown-content pre {
        background-color: #2d3748;
    }

    .markdown-content table th,
    .markdown-content table td {
        border-color: #4a5568;
    }

    .markdown-content table th {
        background-color: #4a5568;
    }

    .markdown-content table tr:nth-child(2n) {
        background-color: #2d3748;
    }

    .markdown-content a {
        color: #63b3ed;
    }

    .markdown-content hr {
        border-top-color: #4a5568;
    }

    .card {
        background-color: #2d3748;
        color: #e2e8f0;
    }

    .card-header {
        background-color: #4a5568;
        border-bottom-color: #718096;
    }

    .stat-item {
        background: #4a5568;
        border-color: #718096;
    }
}

/* 打印样式 */
@media print {
    .oidn-header,
    .oidn-footer,
    .oidn-hero,
    .card-header,
    .btn-toolbar,
    .status-bar {
        display: none !important;
    }

    #editorContainer {
        display: flex !important;
        flex-direction: column !important;
    }

    #editorColumn {
        display: none !important;
    }

    #previewColumn {
        width: 100% !important;
    }

    .markdown-content {
        font-size: 12pt;
        line-height: 1.5;
    }

    .markdown-content a {
        color: #000 !important;
        text-decoration: underline !important;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.markdown-content {
    animation: fadeIn 0.3s ease-out;
}

/* 拖拽上传样式 */
.drag-over {
    border: 2px dashed #0d6efd !important;
    background-color: #f8f9ff !important;
}

/* 语法检查样式 */
.grammar-error {
    background-color: #ffebee;
    border-bottom: 2px wavy #f44336;
    position: relative;
}

.spelling-error {
    background-color: #fff8e1;
    border-bottom: 2px wavy #ff9800;
    position: relative;
}

/* 自动保存指示器 */
.auto-save-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #28a745;
    border-radius: 50%;
    margin-right: 0.5rem;
    animation: pulse 2s infinite;
}

.auto-save-indicator.saving {
    background-color: #ffc107;
    animation: pulse 0.5s infinite;
}

.auto-save-indicator.error {
    background-color: #dc3545;
    animation: none;
}

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