/* General Reset & Body */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: #fff;
    color: #212529;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Main Layout - Sticky Footer Implementation */
.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Use min-height to ensure it fills the viewport but can grow */
}

.main-content-wrapper {
    display: flex;
    flex-grow: 1; /* This makes the content area take up all available space */
    overflow: hidden; /* Important for nested scrollable areas */
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-width: 280px;
    flex-shrink: 0;
    background-color: #f7f7f7;
    border-right: 1px solid #e6e6e6;
    padding: 24px;
    overflow-y: auto;
    box-sizing: border-box;
}

.sidebar-header {
    margin-bottom: 24px;
    padding: 16px 10px;
    transition: background-color 0.2s ease;
    border-radius: 6px;
}

.sidebar-header:hover {
    background-color: #ededed;
}

/* File Tree */
#file-tree ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

#file-tree ul ul {
    padding-left: 18px;
}

#file-tree li {
    margin-bottom: 2px;
}

.folder-summary {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 6px;
    font-weight: 500;
    color: #343a40;
    user-select: none;
}

.folder-summary:hover {
    background-color: #ededed;
}

.folder-summary .icon {
    margin-right: 8px;
    transition: transform 0.15s ease-in-out;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transform-origin: center;
}

.folder-details[open] > .folder-summary .icon {
    transform: rotate(90deg);
}

.file {
    display: block;
    cursor: pointer;
    padding: 8px 10px 8px 10px;
    border-radius: 6px;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
}

.file:hover {
    background-color: #ededed;
}

.file.active {
    background-color: #e1e1e1;
    color: #212529;
    font-weight: 500;
}

/* Content Area */
.content {
    flex-grow: 1;
    padding: 40px 60px;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Footer */
.footer {
  text-align: center;
  padding: 1rem;
  border-top: 1px solid #e6e6e6;
  color: #6c757d;
  font-size: 0.8rem;
  flex-shrink: 0; /* Prevents the footer from shrinking */
  background-color: #f7f7f7;
}

.placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #b3b3b3;
    user-select: none;
    text-align: center;
}

.placeholder-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 16px;
    color: #ccc;
}

/* Markdown content styling */
.content h1, .content h2, .content h3, .content h4 {
    color: #212529;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.4em;
    margin-top: 1.5em;
    margin-bottom: 1em;
}

.content h1 { font-size: 2em; }
.content h2 { font-size: 1.5em; }
.content h3 { font-size: 1.25em; }

.content p {
    line-height: 1.7;
    margin-bottom: 1em;
    color: #333;
}

.content a {
    color: #007bff;
    text-decoration: none;
}

.content a:hover {
    text-decoration: underline;
}

.content code {
    background-color: #f0f0f0;
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 88%;
    border-radius: 4px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

.content pre {
    position: relative;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    line-height: 1.45;
}

.content pre:hover .copy-btn {
    opacity: 1;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.8em;
}

.copy-btn:hover {
    background-color: #5a6268;
}

.copy-btn.copied {
    background-color: #28a745;
}

.content pre code {
    background-color: transparent;
    padding: 0;
    margin: 0;
    font-size: inherit;
    border-radius: 0;
}

.content blockquote {
    border-left: 4px solid #ced4da;
    padding-left: 16px;
    color: #6c757d;
    margin-left: 0;
}

.content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-top: 1em;
    margin-bottom: 1em;
}

.content ul, .content ol {
    padding-left: 2em;
    line-height: 1.8;
}

.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    display: block;
    overflow-x: auto;
}

.content th, .content td {
    border: 1px solid #dee2e6;
    padding: 8px 12px;
}

.content th {
    background-color: #f8f9fa;
    font-weight: 600;
}