:root {
    --bg-color: #f8f9fa;
    --sidebar-bg: #ffffff;
    --text-color: #333333;
    --accent-color: #007bff;
    --border-color: #e0e0e0;
    --sidebar-width: 280px;
    --header-height: 60px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.view-toggle {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.toggle-group {
    display: flex;
    background: #eee;
    padding: 4px;
    border-radius: 8px;
}

.toggle-btn {
    flex: 1;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-weight: bold;
}

.file-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.file-item {
    padding: 10px 15px;
    margin-bottom: 5px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.95rem;
    list-style: none;
}

.file-item:hover {
    background-color: #f0f0f0;
}

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

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0 30px;
    display: flex;
    align-items: center;
}

#render-area {
    flex: 1;
    overflow-y: auto;
    padding: 40px 60px;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

/* Markdown Rendering Styles */
#render-area h1 { margin-bottom: 1rem; border-bottom: 2px solid var(--border-color); padding-bottom: 0.5rem; }
#render-area h2 { margin-top: 2rem; margin-bottom: 1rem; }
#render-area h3 { margin-top: 1.5rem; margin-bottom: 0.75rem; }
#render-area p { margin-bottom: 1rem; }
#render-area ul, #render-area ol { margin-bottom: 1rem; padding-left: 2rem; }
#render-area code { background: #f1f1f1; padding: 2px 4px; border-radius: 4px; font-family: monospace; }
#render-area pre { background: #2d2d2d; color: #ccc; padding: 15px; border-radius: 8px; overflow-x: auto; margin-bottom: 1rem; }
#render-area pre code { background: transparent; color: inherit; padding: 0; }
#render-area table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
#render-area th, #render-area td { border: 1px solid var(--border-color); padding: 10px; text-align: left; }
#render-area th { background: #f4f4f4; }
#render-area blockquote { border-left: 4px solid var(--accent-color); padding-left: 15px; font-style: italic; color: #666; margin-bottom: 1rem; }
#render-area img { max-width: 100%; height: auto; border-radius: 8px; }

/* PDF Rendering Styles */
.pdf-container {
    width: 100%;
    height: 100%;
    min-height: calc(100vh - var(--header-height) - 80px); /* Adjust based on padding */
}

.pdf-container iframe {
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: 4px;
}

@media (max-width: 768px) {
    body { flex-direction: column; }
    .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border-color); }
    .sidebar-header { height: auto; }
    #render-area { padding: 20px; }
}
