:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --font-heading: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --header-height: 64px;
    --toolbar-height: 50px;
}

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

body {
    font-family: var(--font-heading);
    background-color: var(--background-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

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

/* Navbar */
.navbar {
    height: var(--header-height);
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.logo-text {
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-item {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-item:hover {
    color: var(--primary-color);
}

.nav-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
}

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

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Workspace */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.toolbar {
    height: var(--toolbar-height);
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.file-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-right: 12px;
}

.save-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.editor-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.input-pane {
    border-right: 1px solid var(--border-color);
    background-color: var(--surface-color);
}

.preview-pane {
    background-color: #ffffff; /* Use white for preview to simulate paper more accurately if desired, or keep light gray bg */
    background-color: var(--background-color); 
    padding: 24px;
    overflow-y: auto;
}

textarea {
    flex: 1;
    border: none;
    resize: none;
    padding: 24px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    outline: none;
    background-color: var(--surface-color);
}

/* Preview Content Styling (Typography) */
.preview-content {
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    padding: 48px;
    border-radius: 8px; /* Paper look */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-height: 100%;
}

.preview-content h1, .preview-content h2, .preview-content h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    line-height: 1.25;
}

.preview-content h1 { font-size: 2.25rem; }
.preview-content h2 { font-size: 1.75rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.3em; }
.preview-content p { margin-bottom: 1em; line-height: 1.7; }
.preview-content ul, .preview-content ol { margin-bottom: 1em; padding-left: 1.5em; }
.preview-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1em;
    margin-bottom: 1em;
    color: var(--text-secondary);
    font-style: italic;
}
.preview-content code {
    background-color: #f1f5f9;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.875em;
}
.preview-content pre {
    background-color: #1e293b;
    color: #f8fafc;
    padding: 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1em;
}
.preview-content pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}
.preview-content img {
    max-width: 100%;
    border-radius: 6px;
}
.preview-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
}
.preview-content th, .preview-content td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}
.preview-content th {
    background-color: #f8fafc;
}

/* Footer */
.footer {
    height: 48px;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.footer-content {
    display: flex;
    gap: 24px;
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .nav-links, .nav-actions { display: none; } /* Simplify for mobile for now */
    .editor-container { flex-direction: column; }
    .input-pane { border-right: none; border-bottom: 1px solid var(--border-color); height: 50%; }
    .pane { height: 50%; }
}
