/* 全局样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f7fa;
}

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

/* 顶部导航栏 */
.header {
  padding: 1rem 1rem;
  background-color: white;
  color: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: #f6542b;
}

.search-box {
  display: flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 0.5rem;
  width: 300px;
}

#search-input {
  background: transparent;
  border: none;
  color: white;
  width: 100%;
  padding: 0.25rem 0.5rem;
  outline: none;
}

#search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

#search-btn {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
}

/* 主内容区域 */
.main-content {
  display: flex;
  flex: 1;
  margin-top: 60px;
}

/* 左侧目录 */
.sidebar {
  width: 280px;
  background-color: white;
  border-right: 1px solid #e1e4e8;
  overflow-y: hidden;
  padding: 1rem 0;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
  position: sticky; /* 粘性定位，固定在顶部 */
  top: 60px; /* 粘性定位的起始位置 */
}

.group {
  margin-bottom: 1rem;
}

.group-title {
  padding: 0.75rem 1.5rem;
  font-weight: bold;
  color: #000000;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
}

.group-title:hover {
  background-color: #f1f4f9;
}

.group-title .icon {
  transition: transform 0.3s;
}

.group-title.collapsed .icon {
  transform: rotate(-90deg);
}

.group-items {
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
}

.group-items.collapsed {
  max-height: 0;
}

.item {
  padding: 0.5rem 1.5rem 0.5rem 2.5rem;
  cursor: pointer;
  color: #555;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.item:hover {
  background-color: #f1f4f9;
  color: #f6542b;
}

.item.active {
  background-color: #f6542b0d;
  color: #f6542b;
  border-left-color: #f6542b;
  font-weight: 500;
}

/* 右侧内容区域 */
.content {
  flex: 1;
  height: 100vh;
  padding: 2rem;
  overflow-y: auto;
  background-color: white;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
}

.welcome-screen {
  text-align: center;
  padding: 3rem 1rem;
  color: #7f8c8d;
}

.welcome-screen h1 {
  margin-bottom: 1rem;
  color: #2c3e50;
}

/* Markdown 内容样式 */
.content h1,
.content h2,
.content h3,
.content h4,
.content h5,
.content h6 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: #2c3e50;
}

.content h1 {
  font-size: 2rem;
  border-bottom: 2px solid #eaecef;
  padding-bottom: 0.5rem;
}

.content h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid #eaecef;
  padding-bottom: 0.3rem;
}

.content p {
  margin-bottom: 1rem;
}

.content ul,
.content ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

.content blockquote {
  border-left: 4px solid #3498db;
  padding-left: 1rem;
  color: #7f8c8d;
  margin-bottom: 1rem;
  background-color: #f8f9fa;
  padding: 1rem;
}

.content code {
  font-family: 'Courier New', monospace;
  background-color: #f1f1f1;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
}

.content pre {
  background-color: #f6f8fa;
  border-radius: 5px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.content pre code {
  background-color: transparent;
  padding: 0;
  font-size: 0.9rem;
  color: #333;
}

.content a {
  color: #3498db;
  text-decoration: none;
}

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

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

.content table th,
.content table td {
  border: 1px solid #ddd;
  padding: 0.5rem;
}

.content table th {
  background-color: #f2f2f2;
  font-weight: bold;
  text-align: left;
}

.content table tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* 底部版权信息 */
.footer {
  text-align: center;
  padding: 1rem;
  background-color: #ffffff;
  /*color: white;*/
  font-size: 0.9rem;
  position: absolute;
  bottom: 0;
  width: 100%;
  transform: translateY(100%); /* 默认在屏幕之外 */
  transition: transform 0.3s ease; /* 平滑过渡效果 */
}

/* 错误消息样式 */
.error-message {
  padding: 2rem;
  background-color: #fff5f5;
  border-left: 4px solid #e53e3e;
  border-radius: 5px;
  margin-bottom: 1rem;
}

.error-message h2 {
  color: #e53e3e;
  margin-bottom: 1rem;
}

.error-message p {
  margin-bottom: 0.5rem;
}

/* 搜索加载状态 */
.search-loading {
  text-align: center;
  padding: 3rem 1rem;
}

.search-loading h2 {
  color: #3498db;
  margin-bottom: 1rem;
}

/* 搜索结果样式 */
.search-results {
  padding: 1rem 0;
}

.results-list {
  margin-top: 1.5rem;
}

.result-item {
  padding: 1rem;
  border-bottom: 1px solid #eaecef;
  margin-bottom: 1rem;
}

.result-item:last-child {
  border-bottom: none;
}

.result-item h3 {
  margin-bottom: 0.5rem;
}

.result-group {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.result-context {
  background-color: #f8f9fa;
  padding: 0.75rem;
  border-radius: 5px;
  font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e1e4e8;
    max-height: 300px;
  }

  .search-box {
    width: 200px;
  }
}

/* 动画效果 */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}