/* 记忆控制台 - 样式 */

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

:root {
    --primary: #2563eb;
    --secondary: #64748b;
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

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

/* 顶部栏 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.agent-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.agent-selector select {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.875rem;
}

/* 主内容区 */
main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 1rem;
}

.sidebar h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.file-tree {
    display: flex;
    flex-direction: column;
}

.file-section {
    margin-bottom: 1.5rem;
}

.file-section h4 {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

.file-item {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s;
}

.file-item:hover {
    background: var(--surface-hover);
}

.file-item.active {
    background: var(--primary);
    color: white;
}

.file-item .icon {
    font-size: 1rem;
}

.file-item .name {
    font-size: 0.875rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 内容区 */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-header {
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

#file-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 3rem;
}

.loading {
    color: var(--text-secondary);
    padding: 1rem;
}

.hint {
    font-size: 0.7rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.5rem;
}

/* Markdown 样式 */
.markdown-body {
    line-height: 1.7;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    margin: 1.5rem 0 1rem;
    font-weight: 600;
}

.markdown-body h1 { font-size: 1.75rem; }
.markdown-body h2 { font-size: 1.5rem; }
.markdown-body h3 { font-size: 1.25rem; }

.markdown-body p {
    margin: 1rem 0;
}

.markdown-body code {
    background: var(--surface);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

.markdown-body pre {
    background: var(--surface);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.markdown-body pre code {
    background: none;
    padding: 0;
}

.markdown-body ul,
.markdown-body ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.markdown-body li {
    margin: 0.5rem 0;
}

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

.markdown-body th,
.markdown-body td {
    padding: 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
}

.markdown-body th {
    background: var(--surface);
    font-weight: 600;
}

.markdown-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
}

.markdown-body a {
    color: var(--primary);
    text-decoration: none;
}

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

/* 编辑区 */
.editor-panel {
    width: 400px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.editor-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.editor-header span {
    flex: 1;
    font-size: 0.875rem;
}

#editor {
    flex: 1;
    background: var(--bg);
    color: var(--text);
    border: none;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

/* 按钮 */
.btn-primary,
.btn-secondary {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    transition: opacity 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-secondary {
    background: var(--surface-hover);
    color: var(--text);
}

.btn-primary:hover,
.btn-secondary:hover {
    opacity: 0.9;
}

/* 状态栏 */
footer {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    
    .editor-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        z-index: 100;
    }
}
