/* Base styles */
* {
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
}

body {
  background-color: #f8f9fa;
  color: #212529;
  line-height: 1.6;
}

/* Header */
.header {
  background-color: #343a40;
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-title a {
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
}

.search-container {
  display: flex;
  align-items: center;
}

.search-input {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px 0 0 4px;
  font-size: 16px;
  width: 200px;
  transition: width 0.3s;
}

.search-input:focus {
  width: 300px;
  outline: none;
}

.search-button {
  background-color: #6c757d;
  border: none;
  color: white;
  padding: 0.5rem;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
}

.search-button:hover {
  background-color: #5a6268;
}

/* Container layout */
.container {
  display: flex;
  margin-top: 60px;
  height: calc(100vh - 60px);
}

/* Content area */
.content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  padding-left: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.breadcrumbs {
  padding: 10px 0;
  margin-bottom: 20px;
  color: #6c757d;
  font-size: 0.9rem;
}

.breadcrumbs a {
  color: #6c757d;
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: #343a40;
  text-decoration: underline;
}

.page-title {
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #dee2e6;
}

.page-title h1 {
  font-size: 2rem;
  font-weight: 600;
  color: #343a40;
}

/* Article container with table of contents */
.article-container {
  display: flex;
  gap: 30px;
}

.table-of-contents {
  flex: 0 0 250px;
  position: sticky;
  top: 20px;
  max-height: 80vh;
  overflow-y: auto;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 20px;
}

.table-of-contents h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid #dee2e6;
}

#toc ul {
  list-style-type: none;
  padding-left: 0;
}

#toc li {
  margin-bottom: 5px;
}

#toc a {
  color: #495057;
  text-decoration: none;
  font-size: 0.9rem;
  display: block;
}

#toc a:hover {
  color: #007bff;
  text-decoration: underline;
}

.toc-level-0 { padding-left: 0; }
.toc-level-1 { padding-left: 10px; }
.toc-level-2 { padding-left: 20px; }

/* Article content */
.article-content {
  flex: 1;
  min-width: 0; /* Prevent flex item from overflowing */
}

.article-content h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #dee2e6;
}

.article-content h3 {
  font-size: 1.4rem;
  font-weight: 500;
  margin-top: 1.2rem;
  margin-bottom: 0.8rem;
}

.article-content h4 {
  font-size: 1.2rem;
  font-weight: 500;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.article-content p, .article-content li {
  font-size: 1rem;
  margin-bottom: 1rem;
  line-height: 1.6;
}

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

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

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1rem 0;
}

.article-content code {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 3px;
  padding: 2px 4px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.875em;
}

.article-content pre {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.article-content pre code {
  border: none;
  padding: 0;
  background-color: transparent;
  display: block;
  font-family: 'Courier New', Courier, monospace;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.article-content table th, .article-content table td {
  border: 1px solid #dee2e6;
  padding: 0.5rem;
  text-align: left;
}

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

.article-content blockquote {
  border-left: 4px solid #dee2e6;
  margin-left: 0;
  margin-right: 0;
  padding-left: 1rem;
  font-style: italic;
  color: #6c757d;
}

/* Footer */
.footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #dee2e6;
  color: #6c757d;
  font-size: 0.9rem;
  text-align: center;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  
  .content {
    padding: 15px;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: none;
  }
  
  .article-container {
    flex-direction: column;
    gap: 15px;
  }
  
  .table-of-contents {
    flex: 0 0 auto;
    position: static;
    max-height: none;
    margin-bottom: 20px;
    width: 100%;
  }
  
  .search-input:focus {
    width: 150px;
  }
  
  /* Improve image handling on mobile */
  .article-content img {
    max-width: 100%;
  }
  
  /* Better spacing for mobile */
  .article-content h2 {
    margin-top: 1.2rem;
    margin-bottom: 0.8rem;
  }
  
  .article-content h3, .article-content h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
  }
  
  .breadcrumbs {
    margin-bottom: 15px;
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 5px;
  }
}

/* Search results page */
.search-results {
  padding: 1rem 0;
}

.search-results h1 {
  margin-bottom: 1rem;
}

.no-results {
  padding: 2rem 0;
  text-align: center;
  color: #6c757d;
}

.results-count {
  color: #6c757d;
  margin-bottom: 1rem;
}

.result-item {
  margin-bottom: 2rem;
  padding: 1rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  background-color: white;
}

.result-item h3 a {
  color: #007bff;
  text-decoration: none;
}

.result-path {
  font-size: 0.85rem;
  color: #6c757d;
  margin: 0.5rem 0;
}

.result-context {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background-color: #f8f9fa;
  border-radius: 4px;
  font-size: 0.9rem;
}

/* Directory listing */
.directory-content h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.files-grid, .folders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.file-item, .folder-item {
  padding: 0.75rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  background-color: white;
  transition: transform 0.2s, box-shadow 0.2s;
}

.file-item:hover, .folder-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.file-item a, .folder-item a {
  color: #212529;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.file-item i, .folder-item i {
  margin-right: 0.5rem;
  color: #6c757d;
}

.folder-item i {
  color: #ffc107;
}

.empty-dir {
  text-align: center;
  padding: 3rem;
  color: #6c757d;
}

/* Indentation classes for navigation */
.indent-0 { padding-left: 0px; }
.indent-1 { padding-left: 10px; }
.indent-2 { padding-left: 20px; }
.indent-3 { padding-left: 30px; }
.indent-4 { padding-left: 40px; }
.indent-5 { padding-left: 50px; }