/* 基础重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #333;
  background-color: #f8f9fa;
}

/* 主容器 */
.root {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 侧边栏 */
aside {
  width: 300px;
  position: fixed;
  left: -300px;
  top: 0;
  bottom: 0;
  background-color: #fff;
  border-right: 1px solid #e1e4e8;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: left 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 侧边栏显示状态 */
.hasSide aside {
  left: 0;
}

/* 侧边栏头部 */
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  flex-shrink: 0;
}

.sidebar-header .title {
  font-size: 18px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.close-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* 搜索框 */
.search-box {
  position: relative;
  padding: 15px;
  border-bottom: 1px solid #e1e4e8;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  padding: 10px 15px 10px 35px;
  border: 1px solid #e1e4e8;
  border-radius: 20px;
  font-size: 14px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-icon {
  position: absolute;
  left: 25px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
}

/* 文章列表 */
.article-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  list-style: none;
}

.article-item {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  color: #333;
  text-decoration: none;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.2s;
  position: relative;
  white-space: nowrap;
}

.article-item:hover {
  background-color: #f1f3f4;
}

.article-item.active {
  background-color: #e6f0ff;
  border-left-color: #667eea;
  color: #667eea;
  font-weight: 500;
}

/* PC端文章列表优化 */
@media screen and (min-width: 769px) {
  .article-list {
    /* 在PC端显示滚动条 */
    overflow-y: overlay;
  }

  .article-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
  }

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

  .article-item:hover {
    background-color: #f8f9fa;
    transform: translateX(2px);
  }

  .article-item.active {
    background-color: #e6f0ff;
  }
}

.article-item-number {
  color: #6c757d;
  font-size: 12px;
  margin-right: 8px;
  min-width: 20px;
}

.article-item-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.private-tag {
  background-color: #ff6b6b;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 8px;
}

.no-results {
  padding: 20px;
  text-align: center;
  color: #6c757d;
  font-style: italic;
}

/* 主内容区域 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: 0;
  transition: margin-left 0.3s ease;
  min-height: calc(100vh - 60px);
  background-color: #fff;
}

.hasSide .main-content {
  margin-left: 300px;
}

/* 菜单按钮 */
.menu-toggle {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 10;
  background: #667eea;
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: transform 0.2s;
}

.menu-toggle:active {
  transform: scale(0.95);
}

/* PC端菜单按钮样式 */
@media screen and (min-width: 769px) {
  .menu-toggle {
    background: rgba(102, 126, 234, 0.8);
    backdrop-filter: blur(5px);
  }

  .menu-toggle.open {
    background: #ff6b6b;
  }
}

/* 文章样式 */
.article {
  flex: 1;
  padding: 30px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* PC端文章样式优化 */
@media screen and (min-width: 769px) {
  .article {
    padding: 40px 30px;
  }
}

.article-header {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e1e4e8;
}

.article-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 15px;
  line-height: 1.3;
  color: #212529;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  font-size: 14px;
  color: #6c757d;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.meta-item a {
  color: #667eea;
  text-decoration: none;
}

.meta-item a:hover {
  text-decoration: underline;
}

/* 文章内容 */
.article-content {
  font-size: 16px;
  line-height: 1.8;
}

.article-content p {
  margin-bottom: 20px;
}

.article-content a {
  color: #667eea;
  text-decoration: none;
}

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

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 10px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  margin: 24px 0 16px 0;
  font-weight: 600;
  line-height: 1.25;
}

.article-content h1 {
  font-size: 2em;
  border-bottom: 1px solid #e1e4e8;
  padding-bottom: 0.3em;
}

.article-content h2 {
  font-size: 1.5em;
  border-bottom: 1px solid #e1e4e8;
  padding-bottom: 0.3em;
}

.article-content h3 {
  font-size: 1.25em;
}

.article-content ul,
.article-content ol {
  padding-left: 2em;
  margin-bottom: 16px;
}

.article-content li {
  margin-bottom: 5px;
}

.article-content blockquote {
  margin: 0 0 16px 0;
  padding: 0 1em;
  color: #6a737d;
  border-left: 0.25em solid #dfe2e5;
}

.article-content code {
  padding: 0.2em 0.4em;
  margin: 0;
  font-size: 85%;
  background-color: rgba(27, 31, 35, 0.05);
  border-radius: 3px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.article-content pre {
  padding: 16px;
  overflow: auto;
  font-size: 85%;
  line-height: 1.45;
  background-color: #f6f8fa;
  border-radius: 3px;
  margin-bottom: 16px;
}

.article-content pre code {
  display: inline;
  padding: 0;
  margin: 0;
  overflow: visible;
  line-height: inherit;
  word-wrap: normal;
  background-color: transparent;
  border: 0;
}

/* 加载状态 */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: #6c757d;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: #6c757d;
  text-align: center;
}

.empty-state i {
  margin-bottom: 15px;
  color: #a0aec0;
}

/* 底部导航 */
.article-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background-color: #fff;
  border-top: 1px solid #e1e4e8;
  position: sticky;
  bottom: 0;
  z-index: 10;
}
.hasSide .article-navigation {
  margin-left: 300px;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background-color: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.nav-button:hover:not(:disabled) {
  background-color: #5a6fd8;
}

.nav-button:disabled {
  background-color: #a0aec0;
  cursor: not-allowed;
}

.article-counter {
  font-size: 14px;
  color: #6c757d;
  font-weight: 500;
}

/* PC端底部导航优化 */
@media screen and (min-width: 769px) {
  .article-navigation {
    padding: 20px 40px;
  }

  .nav-button {
    padding: 12px 24px;
    font-size: 15px;
  }

  .article-counter {
    font-size: 16px;
  }
}

/* PC端菜单按钮优化 */
@media screen and (min-width: 769px) {
  .menu-toggle {
    display: flex; /* PC端始终显示按钮 */
  }

  .sidebar-header .close-btn {
    display: flex; /* PC端显示关闭按钮 */
  }
}

/* PC端搜索框优化 */
@media screen and (min-width: 769px) {
  .search-box {
    padding: 20px 15px;
  }

  .search-input {
    padding: 12px 20px 12px 40px;
    font-size: 15px;
  }

  .search-icon {
    left: 30px;
    font-size: 16px;
  }
}

/* PC端侧边栏头部优化 */
@media screen and (min-width: 769px) {
  .sidebar-header {
    height: 70px;
    padding: 0 20px;
  }

  .sidebar-header .title {
    font-size: 20px;
  }
}

/* 响应式设计 */
@media screen and (max-width: 1024px) {
  aside {
    width: 280px;
  }

  .hasSide .main-content {
    margin-left: 280px;
  }
}

@media screen and (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  aside {
    width: 100%;
    left: -100%;
  }

  .hasSide aside {
    left: 0;
  }

  .main-content {
    margin-left: 0;
  }

  .hasSide .main-content {
    margin-left: 0;
  }

  .article {
    padding: 20px 15px;
  }

  .article-title {
    font-size: 24px;
  }

  .article-meta {
    flex-direction: column;
    gap: 10px;
  }

  .article-navigation {
    padding: 15px;
  }

  .nav-button span {
    display: none;
  }

  .nav-button {
    padding: 12px;
  }

  .nav-button i {
    font-size: 16px;
  }
}

@media screen and (max-width: 480px) {
  .sidebar-header .title {
    font-size: 16px;
  }

  .article-title {
    font-size: 22px;
  }

  .article-content {
    font-size: 15px;
  }

  .article-item {
    padding: 10px 12px;
  }

  .article-number {
    display: none;
  }
}
