/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部 */
.header {
    background: white;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 24px;
    color: #333;
    font-weight: 600;
}

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

.theme-select {
    padding: 8px 15px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s;
}

.theme-select:hover {
    border-color: #3b82f6;
}

.btn {
    padding: 8px 20px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* 主要内容区 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex: 1;
}

.editor-section,
.preview-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.section-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 16px;
    color: #666;
    font-weight: 600;
}

.word-count {
    font-size: 13px;
    color: #999;
}

/* 编辑器样式 */
.EasyMDEContainer {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.EasyMDEContainer .CodeMirror {
    flex: 1;
    border: none;
    font-size: 15px;
    line-height: 1.6;
}

.EasyMDEContainer .editor-toolbar {
    border: none;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
}

/* 预览样式 - 不添加额外样式，完全依赖内联样式 */
.preview-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: auto;
    background-color: white;
}

.preview-content .placeholder {
    color: #999;
    text-align: center;
    padding: 100px 20px;
    font-size: 14px;
}

/* 表格容器支持横向滚动 */
.preview-content table {
    display: table;
    width: 100%;
}

/* 底部 */
.footer {
    margin-top: 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .preview-section {
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header h1 {
        font-size: 20px;
    }

    .controls {
        width: 100%;
        justify-content: center;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 成功提示 */
.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 回到顶部按钮 */
.back-to-top-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3b82f6;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    z-index: 10;
}

.back-to-top-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.back-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

.preview-section {
    position: relative;
}
