/* ========== 全局 ========== */
body {
  font-family: "Microsoft YaHei", sans-serif;
  margin: 0; padding: 0;
  background: #f9f9f9; color: #333;
  transition: background 0.3s, color 0.3s;
}
.dark-mode { background:#1e1e1e; color:#ddd; }
a { text-decoration: none; color: inherit; }

/* ========== 顶部导航 ========== */
/* 导航栏整体 */
header { background:#4CAF50; box-shadow:0 2px 5px rgba(0,0,0,0.1); position:sticky; top:0; z-index:1000; }

/* 导航内部居中对齐 */
.navbar {
  display:flex;
  align-items:center;
  gap:15px;
  padding:10px 20px;
  max-width:1200px;
  margin:0 auto;   /* 让导航条居中 */
}

.logo { font-weight:bold; color:#fff; font-size:20px; }
.nav-link { color:#fff; font-size:15px; padding:5px 10px; border-radius:5px; transition:all 0.3s ease; }
.nav-link:hover { background:rgba(255,255,255,0.2); }
.search-box { padding:6px 12px; border-radius:20px; border:1px solid #ccc; outline:none; transition:all 0.3s; }
.search-box:focus { border-color:#4CAF50; box-shadow:0 0 5px rgba(76,175,80,0.5); }
.contact { color:#ddd; position:relative; margin-left:auto; cursor:pointer; font-size:14px; }
.contact .qrcode { display:none; position:absolute; top:25px; right:0; width:120px; border:1px solid #ccc; background:#fff; padding:5px; }
.contact:hover .qrcode { display:block; }

/* 主题切换按钮 */
.switch { position:relative; display:inline-block; width:40px; height:20px; }
.switch input { display:none; }
.slider { position:absolute; cursor:pointer; top:0; left:0; right:0; bottom:0; background:#ccc; transition:.4s; border-radius:20px; }
.slider:before { position:absolute; content:''; height:14px; width:14px; left:3px; bottom:3px; background:white; transition:.4s; border-radius:50%; }
input:checked + .slider { background:#2196F3; }
input:checked + .slider:before { transform:translateX(20px); }

/* ========== 轮播图 ========== */
.carousel { position:relative; overflow:hidden; max-width:1200px; margin:20px auto; border-radius:10px; }
.slides { display:flex; transition:transform 0.5s ease-in-out; }
.slide { min-width:100%; }
.slide img { width:100%; height:420px; object-fit:cover; border-radius:10px; }
.prev,.next { position:absolute; top:50%; transform:translateY(-50%); background:rgba(0,0,0,0.4); color:white; padding:10px; cursor:pointer; border-radius:50%; }
.prev{ left:15px; } .next{ right:15px; }
.dots { text-align:center; margin-top:10px; }
.dot { height:10px; width:10px; margin:0 3px; background:#bbb; border-radius:50%; display:inline-block; cursor:pointer; }
.dot.active { background:#717171; }

/* ========== 主体布局 ========== */
.container { max-width:1200px; margin:20px auto; display:flex; gap:20px; }
.content { flex:3; }
.sidebar { flex:1; background:#fff; padding:15px; border-radius:8px; box-shadow:0 2px 5px rgba(0,0,0,0.05); }

/* ========== 文章卡片 ========== */
/* 文章卡片（左右布局） */
.article-card {
  display: flex;
  gap: 15px;
  background: #fff;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.3s, box-shadow 0.3s;
  margin-bottom: 20px;
}
.article-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.article-card .card-left {
  flex: 0 0 160px;
}
.article-card .card-left img {
  width: 160px;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
}
.article-card .card-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.article-card h3 {
  margin: 0 0 5px;
  font-size: 18px;
  color: #333;
}
.article-card .summary {
  font-size: 14px;
  color: #555;
  margin: 5px 0;
  flex-grow: 1;
}
.article-card .meta {
  font-size: 12px;
  color: #888;
}
.article-card .tag {
  background: #eee;
  border-radius: 4px;
  padding: 2px 5px;
  margin: 0 2px;
  font-size: 12px;
}

.tag { display:inline-block; padding:3px 6px; margin:2px; background:#eee; border-radius:5px; font-size:12px; }

/* ========== 时间线（笔记页） ========== */
#timeline { list-style:none; padding:0; position:relative; }
#timeline li { padding:10px 15px; border-left:3px solid #4CAF50; margin-bottom:10px; background:#fff; border-radius:5px; }
#timeline li a { color:#4CAF50; font-weight:bold; }

/* ========== TOC（目录） ========== */
#toc { padding:15px; background:#fafafa; border:1px solid #ddd; border-radius:5px; font-size:14px; position:sticky; top:80px; height:max-content; }
#toc h3 { margin-top:0; }
#toc ul { list-style:none; padding-left:0; }
#toc li { margin:4px 0; }
.toc-h3 { margin-left:15px; font-size:0.9em; }
.dark-mode #toc { background:#333; border-color:#555; }

/* ========== 评论区 ========== */
#comments { margin-top:30px; padding:15px; background:#fafafa; border:1px solid #ddd; border-radius:5px; }
#comments h3 { margin-top:0; }
#comment-form { display:flex; flex-direction:column; gap:10px; }
#comment-form input, #comment-form textarea { padding:8px; border:1px solid #ccc; border-radius:5px; }
#comment-form button { padding:8px; border:none; background:#4CAF50; color:#fff; cursor:pointer; border-radius:5px; transition:background 0.3s; }
#comment-form button:hover { background:#45a049; }
.comment { padding:10px; border-bottom:1px solid #eee; }
.comment strong { color:#4CAF50; }
.comment span { font-size:12px; color:#999; margin-left:10px; }
.dark-mode #comments { background:#333; border-color:#555; }

/* ========== 底部 ========== */
footer { text-align:center; padding:15px; background:#333; color:white; margin-top:20px; }
#back-to-top { position:fixed; bottom:20px; right:20px; padding:10px; border:none; border-radius:50%; background:#4CAF50; color:#fff; cursor:pointer; }

/* ========== 响应式 ========== */
@media (max-width:768px){
  .container { flex-direction:column; }
  .sidebar { width:100%; order:2; }
  .content { order:1; }
  .slide img { height:220px; }
}

/* 文章详情页布局 */
.article-main {
  flex: 3;
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.article-main h1 {
  font-size: 26px;
  margin-bottom: 15px;
}
.article-meta {
  margin: 10px 0;
  font-size: 13px;
  color: #777;
}
.article-nav {
  margin: 20px 0;
  font-size: 14px;
}
.article-nav a {
  display: block;
  color: #4CAF50;
  margin: 5px 0;
}

/* 侧栏 */
.article-sidebar {
  flex: 1;
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  height: fit-content;
  position: sticky;
  top: 80px;
}
.article-sidebar h3 {
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 16px;
}

/* 标签样式（详情页） */
.tag-box .tag {
  display: inline-block;
  background: #f0f0f0;
  color: #333;
  padding: 5px 8px;
  margin: 4px 4px 0 0;
  border-radius: 5px;
  font-size: 12px;
  transition: background 0.3s, color 0.3s;
}
.tag-box .tag:hover {
  background: #4CAF50;
  color: #fff;
}
/* 文章详情页头图 */
.article-cover {
  width: 100%;
  max-height: 350px;
  object-fit: cover;
  margin: 15px 0;
  border-radius: 8px;
}
#pagination {
  text-align: center;
  margin: 20px 0;
}
#pagination button {
  margin: 0 5px;
  padding: 6px 12px;
  border: 1px solid #4CAF50;
  background: #fff;
  color: #4CAF50;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
}
#pagination button:hover {
  background: #4CAF50;
  color: #fff;
}
.tag.clickable {
  cursor: pointer;
  background: #f0f0f0;
  transition: all 0.3s;
}
.tag.clickable:hover {
  background: #4CAF50;
  color: #fff;
}
