:root {
    --primary: #0783c1;
    --primary-hover: #0649ad;
    --bg: #fff;
    --bg-secondary: #fafafa;
    --bg-editor: #f8f9fa;
    --border: #e0e0e0;
    --text: #333;
    --text-secondary: #666;
    --text-muted: #999;
}

[data-theme="dark"] {
    --primary: #10b981;
    --primary-hover: #34d399;
    --bg: #1f2937;
    --bg-secondary: #111827;
    --bg-editor: #1f2937;
    --border: #374151;
    --text: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text);
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 主体区域 */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 面板通用样式 - 统一高度 */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

/* 编辑面板 */
.editor-panel {
    display: flex;
    flex-direction: column;
    width: 50%;
    min-width: 300px;
    background: var(--bg);
    border-right: 1px solid var(--border);
}

#editor {
    flex: 1;
    padding: 20px;
    font: 15px/1.8 "SF Mono", Monaco, "Cascadia Code", Consolas, monospace;
    background: var(--bg-editor);
    color: var(--text);
    border: none;
    outline: none;
    resize: none;
    overflow-y: auto;
    tab-size: 4;
}

#editor::placeholder {
    color: var(--text-muted);
}

/* 分隔线 */
.resizer {
    width: 6px;
    background: var(--border);
    cursor: col-resize;
    flex-shrink: 0;
    margin: 0 2px;
}

.resizer:hover {
    background: var(--primary);
}

/* 预览面板 */
.preview-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    background: var(--bg);
    min-width: 300px;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn {
    padding: 4px 8px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.action-item input {
    cursor: pointer;
}

.btn-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-icon:hover {
    background: var(--primary-hover);
}

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

/* 赫蹏样式 */
#preview {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px;
    background: var(--bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    min-height: 100%;
}

#preview:empty::before {
    content: "预览区域";
    display: block;
    text-align: center;
    color: var(--text-muted);
    padding: 100px 0;
}

/* 深色模式下的赫蹏调整 */
[data-theme="dark"] #preview {
    color: var(--text);
}

[data-theme="dark"] #preview h1,
[data-theme="dark"] #preview h2,
[data-theme="dark"] #preview h3,
[data-theme="dark"] #preview h4,
[data-theme="dark"] #preview h5,
[data-theme="dark"] #preview h6 {
    color: var(--text);
}

[data-theme="dark"] #preview code {
    background: #374151;
    color: #e5e7eb;
}

[data-theme="dark"] #preview pre {
    background: #111827;
}

[data-theme="dark"] #preview blockquote {
    border-left-color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
}

/* 提示消息 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 10px 20px;
    background: #333;
    color: #fff;
    font-size: 14px;
    border-radius: 20px;
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
    pointer-events: none;
}

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

/* 响应式 */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    .editor-panel {
        width: 100% !important;
        height: 50%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .resizer {
        width: 100%;
        height: 6px;
        cursor: row-resize;
    }

    .preview-panel {
        height: 50%;
    }

    #preview {
        padding: 20px;
    }

    .panel-actions {
        gap: 8px;
    }

    .action-item span {
        display: none;
    }
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

::selection {
    background: rgba(7, 193, 96, 0.2);
}
