/* ═══════════════════════════════════════════════════════════════
   个人博客样式表  |  Blog Style Sheet
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --primary:       #6c63ff;
  --primary-dark:  #574fd6;
  --primary-light: #ede9ff;
  --accent:        #ff6584;
  --success:       #28a745;
  --warning:       #ffc107;
  --danger:        #dc3545;
  --info:          #17a2b8;

  --bg:            #f7f8fc;
  --surface:       #ffffff;
  --border:        #e8eaf0;
  --text:          #2d3748;
  --text-muted:    #718096;
  --text-light:    #a0aec0;

  --nav-h:         64px;
  --sidebar-w:     280px;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 2px 16px rgba(0,0,0,.08);
  --shadow-md:     0 8px 32px rgba(0,0,0,.12);
  --transition:    .2s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont,
               'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.page-wrap  { min-height: calc(100vh - var(--nav-h) - 80px); }
.main-layout {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: 2rem;
  padding: 2.5rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar { order: -1; }
}

/* ── Navbar ── */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  height: var(--nav-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}
.nav-container {
  max-width: 1200px; margin: 0 auto;
  height: 100%; padding: 0 1.5rem;
  display: flex; align-items: center; gap: 1rem;
}
.nav-brand {
  display: flex; align-items: center; gap: .5rem;
  font-size: 1.2rem; font-weight: 700;
  color: var(--primary); flex-shrink: 0;
}
.nav-brand i { font-size: 1.4rem; }
.nav-links { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.nav-link {
  padding: .4rem .85rem; border-radius: 8px;
  font-size: .9rem; color: var(--text); font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.nav-link:hover, .nav-link.active { background: var(--primary-light); color: var(--primary); }
.admin-link { color: var(--accent) !important; }
.nav-toggle { display: none; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text); margin-left: auto; }
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; flex-direction: column; align-items: stretch;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: var(--surface); padding: 1rem; border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
}

/* ── Flash ── */
.flash-container { max-width: 1200px; margin: 1rem auto; padding: 0 1.5rem; }
.alert {
  display: flex; align-items: center; gap: .6rem;
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  margin-bottom: .5rem; font-size: .92rem; position: relative;
}
.alert-success  { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning  { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info     { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert-close    { margin-left: auto; background: none; border: none; font-size: 1.1rem; cursor: pointer; opacity: .6; }
.alert-close:hover { opacity: 1; }

/* ── Hero ── */
.hero {
  position: relative;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  background-size: 200% 200%;
  animation: heroGradient 8s ease infinite;
  color: #fff; text-align: center;
  padding: 6rem 2rem 7rem;
  overflow: hidden;
}
@keyframes heroGradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
/* Floating particles */
.hero-particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hero-particles span {
  position: absolute;
  display: block;
  width: 20px; height: 20px;
  background: rgba(255,255,255,.12);
  border-radius: 50%;
  animation: particleFloat linear infinite;
}
.hero-particles span:nth-child(1) { width: 80px; height: 80px; left: 10%; animation-duration: 20s; animation-delay: 0s; }
.hero-particles span:nth-child(2) { width: 20px; height: 20px; left: 20%; animation-duration: 25s; animation-delay: 2s; }
.hero-particles span:nth-child(3) { width: 45px; height: 45px; left: 35%; animation-duration: 18s; animation-delay: 4s; }
.hero-particles span:nth-child(4) { width: 60px; height: 60px; left: 50%; animation-duration: 22s; animation-delay: 0s; }
.hero-particles span:nth-child(5) { width: 15px; height: 15px; left: 65%; animation-duration: 17s; animation-delay: 3s; }
.hero-particles span:nth-child(6) { width: 90px; height: 90px; left: 75%; animation-duration: 28s; animation-delay: 5s; }
.hero-particles span:nth-child(7) { width: 35px; height: 35px; left: 85%; animation-duration: 15s; animation-delay: 1s; }
.hero-particles span:nth-child(8) { width: 25px; height: 25px; left: 55%; animation-duration: 20s; animation-delay: 7s; }
@keyframes particleFloat {
  0%   { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-120vh) rotate(720deg); opacity: 0; }
}
/* Hero inner content */
.hero-inner { position: relative; z-index: 2; }
.hero-avatar { font-size: 5rem; margin-bottom: 1rem; opacity: .9; filter: drop-shadow(0 4px 12px rgba(0,0,0,.2)); }
.hero-title  { font-size: 2.8rem; font-weight: 800; margin-bottom: .5rem; text-shadow: 0 2px 20px rgba(0,0,0,.15); letter-spacing: .02em; }
.hero-subtitle { font-size: 1.2rem; opacity: .92; margin-bottom: 1rem; font-weight: 300; letter-spacing: .08em; }
.hero-desc   { max-width: 560px; margin: 0 auto 1.8rem; opacity: .82; font-size: .95rem; line-height: 1.7; }
.hero-social { display: flex; justify-content: center; gap: 1.2rem; margin-bottom: 2rem; }
.hero-social a {
  color: rgba(255,255,255,.85); font-size: 1.5rem;
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(255,255,255,.12); backdrop-filter: blur(4px);
  transition: all .3s ease;
}
.hero-social a:hover { color: #fff; background: rgba(255,255,255,.25); transform: translateY(-3px) scale(1.1); }
.hero-search {
  display: flex; max-width: 480px; margin: 0 auto;
  background: rgba(255,255,255,.15); backdrop-filter: blur(12px);
  border-radius: 50px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 8px 32px rgba(0,0,0,.1);
  transition: all .3s ease;
}
.hero-search:focus-within { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.4); box-shadow: 0 8px 40px rgba(0,0,0,.15); }
.hero-search .search-input { flex: 1; background: none; border: none; padding: .8rem 1.4rem; color: #fff; font-size: 1rem; outline: none; }
.hero-search .search-input::placeholder { color: rgba(255,255,255,.6); }
.hero-search .search-btn { background: rgba(255,255,255,.18); border: none; padding: 0 1.4rem; color: #fff; cursor: pointer; font-size: 1.05rem; transition: background var(--transition); }
.hero-search .search-btn:hover { background: rgba(255,255,255,.32); }
/* Wave divider */
.hero-wave { position: absolute; bottom: -1px; left: 0; width: 100%; line-height: 0; z-index: 1; }
.hero-wave svg { display: block; width: 100%; height: 60px; }

/* ── Page Header ── */
.page-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%); background-size: 200% 200%; animation: heroGradient 8s ease infinite; color: #fff; padding: 3.5rem 0 2.5rem; text-align: center; position: relative; overflow: hidden; }
.page-header h1 { font-size: 2rem; font-weight: 700; text-shadow: 0 2px 12px rgba(0,0,0,.12); }
.page-header p  { opacity: .85; margin-top: .4rem; }

/* ── Cards ── */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  transition: all .35s cubic-bezier(.4,0,.2,1);
  border: 1px solid var(--border);
  position: relative;
}
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
  opacity: 0; transition: opacity .35s ease;
}
.card:hover { transform: translateY(-6px); box-shadow: 0 12px 40px rgba(102,126,234,.15); border-color: transparent; }
.card:hover::before { opacity: 1; }
.card-cover-link { display: block; aspect-ratio: 16/9; overflow: hidden; }
.card-cover { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.4,0,.2,1); }
.card-cover-link:hover .card-cover { transform: scale(1.08); }
.card-cover-placeholder {
  width: 100%; height: 100%; aspect-ratio: 16/9;
  background: linear-gradient(135deg, #ede9ff 0%, #dbeafe 50%, #fce7f3 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; color: var(--primary); opacity: .4;
}
.card-body { padding: 1.25rem; }
.card-category {
  display: inline-block; font-size: .78rem; font-weight: 600;
  color: #fff; background: linear-gradient(135deg, #667eea, #764ba2);
  padding: .2rem .7rem; border-radius: 50px; margin-bottom: .6rem;
  letter-spacing: .04em;
}
.card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: .6rem; line-height: 1.4; }
.card-title a { color: var(--text); transition: color .2s; }
.card-title a:hover { color: #667eea; }
.card-summary { font-size: .88rem; color: var(--text-muted); line-height: 1.6; margin-bottom: .8rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: .8rem; color: var(--text-light); display: flex; gap: .9rem; flex-wrap: wrap; margin-bottom: .6rem; }
.card-meta i { margin-right: .2rem; }
.card-tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-pill { font-size: .78rem; color: #667eea; background: #ede9ff; padding: .15rem .5rem; border-radius: 50px; transition: all var(--transition); }
.tag-pill:hover { background: #667eea; color: #fff; }

/* ── Sidebar & Widgets ── */
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }
.widget {
  background: rgba(255,255,255,.75); backdrop-filter: blur(12px);
  border-radius: var(--radius); padding: 1.25rem;
  box-shadow: 0 2px 16px rgba(0,0,0,.06);
  border: 1px solid rgba(255,255,255,.8);
  transition: box-shadow .3s ease;
}
.widget:hover { box-shadow: 0 4px 24px rgba(102,126,234,.1); }
.widget-title { font-size: .95rem; font-weight: 700; color: var(--text); margin-bottom: 1rem; padding-bottom: .6rem; border-bottom: 2px solid transparent; border-image: linear-gradient(90deg, #667eea, #764ba2) 1; display: flex; align-items: center; gap: .5rem; }
.widget-title i { color: #667eea; }
.widget-list { list-style: none; }
.widget-list li { display: flex; align-items: center; justify-content: space-between; padding: .5rem 0; border-bottom: 1px dashed rgba(0,0,0,.06); font-size: .9rem; transition: padding-left .2s; }
.widget-list li:last-child { border-bottom: none; }
.widget-list li:hover { padding-left: .3rem; }
.widget-list li a { color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.widget-list li a:hover { color: #667eea; }
.widget-list li a.active { color: #667eea; font-weight: 600; }
.count-badge { font-size: .75rem; color: #fff; background: linear-gradient(135deg, #667eea, #764ba2); padding: .1rem .5rem; border-radius: 50px; flex-shrink: 0; }
.hot-views { font-size: .78rem; color: var(--text-light); flex-shrink: 0; }
.hot-rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 4px; font-size: .72rem; font-weight: 700;
  margin-right: .5rem; flex-shrink: 0; color: #fff;
}
.hot-rank.top1 { background: linear-gradient(135deg, #f97316, #ef4444); }
.hot-rank.top2 { background: linear-gradient(135deg, #f59e0b, #f97316); }
.hot-rank.top3 { background: linear-gradient(135deg, #667eea, #764ba2); }
.hot-rank.normal { background: #cbd5e1; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag-cloud-item { font-size: .82rem; padding: .25rem .65rem; border-radius: 50px; color: #667eea; border: 1px solid #ede9ff; transition: all var(--transition); background: rgba(237,233,255,.5); }
.tag-cloud-item:hover, .tag-cloud-item.active { background: #667eea; color: #fff; border-color: #667eea; }
.tag-cloud.large .tag-cloud-item { font-size: .92rem; padding: .35rem .9rem; }

/* ── List Toolbar ── */
.list-toolbar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.search-form { display: flex; gap: .4rem; }
.search-input.sm { width: 200px; }
.btn-icon { background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm); padding: .45rem .7rem; cursor: pointer; }
.sort-btns { display: flex; gap: .4rem; margin-left: auto; }
.btn-sort { padding: .35rem .85rem; border-radius: 50px; font-size: .85rem; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: all var(--transition); }
.btn-sort.active, .btn-sort:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Pagination ── */
.pagination { display: flex; justify-content: center; align-items: center; gap: .4rem; margin-top: 2rem; flex-wrap: wrap; }
.pg-btn { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: .9rem; transition: all var(--transition); }
.pg-btn:hover, .pg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pg-ellipsis { width: 38px; text-align: center; color: var(--text-muted); }
.pagination-info { text-align: center; margin-top: .6rem; font-size: .82rem; color: var(--text-muted); }

/* ── Filter Bar ── */
.filter-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }

/* ── Category Tabs ── */
.category-tabs { display: flex; flex-wrap: wrap; gap: .5rem; }
.cat-tab { display: inline-flex; align-items: center; gap: .25rem; padding: .4rem .9rem; border-radius: 999px; font-size: .85rem; background: var(--surface); border: 1px solid var(--border); color: var(--text); transition: all .25s ease; }
.cat-tab:hover { border-color: #667eea; color: #667eea; background: rgba(102,126,234,.06); }
.cat-tab.active { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(102,126,234,.3); }
.cat-tab sup { font-size: .7rem; margin-left: 2px; opacity: .7; }

/* ── Page Size Selector ── */
.page-size-bar { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }
.page-size-label { font-size: .82rem; color: var(--text-muted); }
.page-size-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 28px; padding: 0 .5rem; border-radius: var(--radius-sm); font-size: .82rem; background: var(--surface); border: 1px solid var(--border); color: var(--text); transition: all var(--transition); }
.page-size-btn:hover { border-color: #667eea; color: #667eea; }
.page-size-btn.active { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border-color: transparent; }

/* ── Pagination ── */
.pagination { display: flex; justify-content: center; align-items: center; gap: .4rem; margin-top: 2rem; flex-wrap: wrap; }
.pg-btn { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: .9rem; transition: all .25s ease; }
.pg-btn:hover, .pg-btn.active { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(102,126,234,.3); }
.pg-ellipsis { width: 38px; text-align: center; color: var(--text-muted); }
.pagination-info { text-align: center; margin-top: .6rem; font-size: .82rem; color: var(--text-muted); }
.search-result-info { background: linear-gradient(135deg, #ede9ff, #dbeafe); color: #667eea; padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1.5rem; font-size: .92rem; border: 1px solid rgba(102,126,234,.15); }
.clear-search { margin-left: .6rem; font-size: .82rem; text-decoration: underline; color: #764ba2; }

/* ── Article Detail ── */
.article-detail {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 2rem;
  padding: 2.5rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
@media (max-width: 960px) { .article-detail { grid-template-columns: 1fr; } .article-sidebar { display: none; } }
.article-main { background: var(--surface); border-radius: var(--radius); padding: 2.5rem 3rem; box-shadow: var(--shadow); }
@media (max-width: 600px) { .article-main { padding: 1.5rem 1.25rem; } }
.article-cover { border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; aspect-ratio: 16/9; }
.article-cover img { width: 100%; height: 100%; object-fit: cover; }
.article-meta-top { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.draft-badge { font-size: .78rem; background: #ffeeba; color: #856404; padding: .15rem .5rem; border-radius: 50px; }
.article-title { font-size: 2rem; font-weight: 800; line-height: 1.3; margin-bottom: 1rem; }
@media (max-width: 600px) { .article-title { font-size: 1.5rem; } }
.article-info { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: .88rem; color: var(--text-muted); margin-bottom: .8rem; }
.article-info i { margin-right: .2rem; }
.article-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 2rem; }

/* ── Markdown Body ── */
.markdown-body { font-size: 1.02rem; line-height: 1.9; color: var(--text); }
.markdown-body h1,.markdown-body h2,.markdown-body h3,
.markdown-body h4,.markdown-body h5,.markdown-body h6 {
  font-weight: 700; margin: 2rem 0 .8rem; line-height: 1.3; color: var(--text);
}
.markdown-body h1 { font-size: 1.8rem; } .markdown-body h2 { font-size: 1.45rem; border-bottom: 2px solid var(--border); padding-bottom: .4rem; }
.markdown-body h3 { font-size: 1.2rem; } .markdown-body h4 { font-size: 1.05rem; }
.markdown-body p   { margin-bottom: 1.1rem; }
.markdown-body ul,.markdown-body ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.markdown-body li  { margin-bottom: .3rem; }
.markdown-body blockquote { border-left: 4px solid var(--primary); margin: 1.2rem 0; padding: .6rem 1.2rem; background: var(--primary-light); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-muted); }
.markdown-body code { background: #f1f5f9; padding: .15em .4em; border-radius: 4px; font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace; font-size: .88em; color: var(--accent); }
.markdown-body pre { margin: 1.2rem 0; border-radius: var(--radius-sm); overflow-x: auto; }
.markdown-body pre code { background: none; padding: 0; color: inherit; font-size: .9rem; }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 1.2rem 0; }
.markdown-body th,.markdown-body td { border: 1px solid var(--border); padding: .5rem .85rem; text-align: left; }
.markdown-body th { background: var(--bg); font-weight: 600; }
.markdown-body img { border-radius: var(--radius-sm); max-width: 100%; margin: .8rem 0; }
.markdown-body hr { border: none; border-top: 2px solid var(--border); margin: 2rem 0; }
.markdown-body a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }

/* ── Share Bar ── */
.share-bar { display: flex; align-items: center; gap: .75rem; margin: 2rem 0; flex-wrap: wrap; padding: 1.2rem; background: var(--bg); border-radius: var(--radius-sm); }
.share-bar span { font-size: .9rem; color: var(--text-muted); font-weight: 500; }
.share-btn { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .9rem; border-radius: 50px; font-size: .85rem; cursor: pointer; border: none; transition: all var(--transition); }
.share-btn.weibo { background: #e6162d; color: #fff; }
.share-btn.qq    { background: #12b7f5; color: #fff; }
.share-btn.copy  { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.share-btn:hover { opacity: .85; transform: translateY(-1px); }

/* ── Admin bar ── */
.admin-bar { display: flex; gap: .75rem; margin: 1rem 0; }
.btn-admin-edit { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem 1rem; background: var(--primary); color: #fff; border-radius: var(--radius-sm); font-size: .9rem; }
.btn-admin-edit:hover { background: var(--primary-dark); color: #fff; }
.btn-admin-del { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem 1rem; background: var(--danger); color: #fff; border-radius: var(--radius-sm); font-size: .9rem; border: none; cursor: pointer; }
.btn-admin-del:hover { opacity: .85; }

/* ── Related ── */
.related-section { margin-top: 2rem; }
.related-section h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
.related-card { border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); display: flex; flex-direction: column; transition: transform var(--transition); }
.related-card:hover { transform: translateY(-3px); }
.related-card img,.related-placeholder { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.related-placeholder { background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--primary); opacity: .5; }
.related-card span { padding: .4rem .6rem; font-size: .82rem; color: var(--text); line-height: 1.3; }

/* ── Comments ── */
.comments-section { margin-top: 2.5rem; }
.comments-section h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 1.2rem; }
.comment-form textarea { width: 100%; padding: .75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .95rem; resize: vertical; outline: none; font-family: inherit; transition: border var(--transition); }
.comment-form textarea:focus { border-color: var(--primary); }
.comment-form { margin-bottom: 1.5rem; }
.comment-login-hint { background: var(--primary-light); color: var(--primary); padding: .9rem 1.2rem; border-radius: var(--radius-sm); margin-bottom: 1.5rem; font-size: .92rem; }
.comment-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.comment-item { display: flex; gap: 1rem; }
.comment-avatar { font-size: 2.2rem; color: var(--primary); opacity: .7; flex-shrink: 0; }
.comment-content { flex: 1; }
.comment-header { display: flex; align-items: center; gap: .7rem; margin-bottom: .3rem; flex-wrap: wrap; }
.comment-header strong { font-size: .95rem; }
.comment-date { font-size: .8rem; color: var(--text-light); }
.comment-content p { font-size: .95rem; line-height: 1.7; }
.del-comment { background: none; border: none; color: var(--danger); cursor: pointer; font-size: .82rem; }
.no-comments { color: var(--text-muted); font-size: .9rem; text-align: center; padding: 2rem; }

/* ── Article Sidebar / TOC ── */
.article-sidebar { display: flex; flex-direction: column; gap: 1.5rem; position: sticky; top: calc(var(--nav-h) + 1rem); align-self: start; }
.toc-content ul { list-style: none; padding: 0; }
.toc-content li { padding: .2rem 0; }
.toc-content a { font-size: .85rem; color: var(--text-muted); display: block; padding: .15rem 0; border-left: 3px solid transparent; padding-left: .6rem; transition: all var(--transition); }
.toc-content a:hover { color: var(--primary); border-left-color: var(--primary); }
.toc-h2 { padding-left: .2rem; }
.toc-h3 { padding-left: 1rem; }
.toc-h4 { padding-left: 1.8rem; }

/* ── Categories Page ── */
.categories-page { padding: 2.5rem 1.5rem; }
.section-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 1.2rem; display: flex; align-items: center; gap: .5rem; }
.section-title i { color: var(--primary); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.cat-card { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: 1.5rem 1rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform var(--transition), box-shadow var(--transition); text-align: center; }
.cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.cat-icon { font-size: 2rem; color: var(--primary); }
.cat-name { font-weight: 700; color: var(--text); }
.cat-count { font-size: .82rem; color: var(--primary); background: var(--primary-light); padding: .1rem .5rem; border-radius: 50px; }

/* ── About ── */
.about-page { padding: 2.5rem 1.5rem; max-width: 800px; margin: 0 auto; }
.about-card { background: var(--surface); border-radius: var(--radius); padding: 2.5rem; text-align: center; box-shadow: var(--shadow); margin-bottom: 2rem; }
.about-avatar { font-size: 5rem; color: var(--primary); opacity: .8; margin-bottom: 1rem; }
.about-card h2 { font-size: 1.6rem; margin-bottom: .5rem; }
.about-desc { color: var(--text-muted); margin-bottom: 1.2rem; }
.about-social { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.about-social a { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem 1rem; background: var(--primary-light); color: var(--primary); border-radius: 50px; font-size: .9rem; font-weight: 500; }
.about-social a:hover { background: var(--primary); color: #fff; }
.about-content { background: var(--surface); border-radius: var(--radius); padding: 2.5rem; box-shadow: var(--shadow); }

/* ── Friends ── */
.friends-page { padding: 2.5rem 1.5rem; }
.friends-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.2rem; }
.friend-card { display: flex; align-items: center; gap: 1rem; padding: 1.2rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform var(--transition), box-shadow var(--transition); color: var(--text); }
.friend-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.friend-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.friend-avatar-placeholder { width: 56px; height: 56px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: var(--primary); flex-shrink: 0; }
.friend-name { font-weight: 700; display: block; }
.friend-desc { font-size: .82rem; color: var(--text-muted); display: block; margin-top: .2rem; }

/* ── Auth ── */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem; background: linear-gradient(135deg, #ede9ff, #dbeafe); }
.auth-card { background: var(--surface); border-radius: var(--radius); padding: 2.5rem 3rem; box-shadow: var(--shadow-md); width: 100%; max-width: 420px; }
.auth-logo { text-align: center; font-size: 2.5rem; color: var(--primary); margin-bottom: .5rem; }
.auth-card h2 { text-align: center; font-size: 1.5rem; margin-bottom: 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-alt { text-align: center; margin-top: 1.2rem; font-size: .9rem; color: var(--text-muted); }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label { font-size: .88rem; font-weight: 600; color: var(--text-muted); }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group select,
.form-group textarea,
.form-input, .form-select, .form-textarea, .title-input {
  width: 100%; padding: .6rem .9rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .95rem; font-family: inherit; outline: none;
  transition: border var(--transition); background: var(--surface); color: var(--text);
}
.form-group input:focus, .form-input:focus, .form-select:focus, .form-textarea:focus, .title-input:focus { border-color: var(--primary); }
.title-input { font-size: 1.4rem; font-weight: 700; padding: .7rem 1rem; }
.checkbox-label { display: flex; align-items: center; gap: .45rem; font-size: .9rem; cursor: pointer; }
.search-input { padding: .5rem .9rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .9rem; outline: none; transition: border var(--transition); }
.search-input:focus { border-color: var(--primary); }
.mt { margin-top: 1rem; } .mt-sm { margin-top: .5rem; }

/* ── Buttons ── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.4rem; background: var(--primary); color: #fff; font-weight: 600;
  border: none; border-radius: var(--radius-sm); cursor: pointer; font-size: .95rem;
  transition: background var(--transition), transform var(--transition);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); color: #fff; }
.btn-primary.full-width { width: 100%; }
.btn-primary.sm { padding: .35rem .85rem; font-size: .85rem; }
.btn-outline { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.4rem; background: transparent; color: var(--primary); font-weight: 600; border: 1.5px solid var(--primary); border-radius: var(--radius-sm); cursor: pointer; font-size: .95rem; transition: all var(--transition); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-outline.full-width { width: 100%; }
.btn-outline.sm { padding: .35rem .85rem; font-size: .85rem; }

/* ── Errors ── */
.error-page { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }
.error-code  { font-size: 6rem; font-weight: 900; color: var(--primary); opacity: .25; line-height: 1; }
.error-msg   { font-size: 1.2rem; color: var(--text-muted); }

/* ── Empty State ── */
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 4rem; color: var(--text-muted); gap: .8rem; }
.empty-state i { font-size: 3rem; opacity: .3; }
.empty-item { font-size: .88rem; color: var(--text-muted); padding: .5rem 0; }

/* ── Footer ── */
.footer {
  background: linear-gradient(135deg, #1a1d2e 0%, #2d2b55 100%);
  color: rgba(255,255,255,.65); text-align: center;
  padding: 2.5rem 1.5rem; margin-top: 4rem;
  position: relative; overflow: hidden;
}
.footer::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #667eea);
  background-size: 300% 100%;
  animation: footerLine 4s linear infinite;
}
@keyframes footerLine { 0% { background-position: 0% 0; } 100% { background-position: 300% 0; } }
.footer-inner { max-width: 600px; margin: 0 auto; }
.footer-social { display: flex; justify-content: center; gap: 1.2rem; margin-bottom: 1rem; }
.footer-social a {
  color: rgba(255,255,255,.5); font-size: 1.3rem;
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid rgba(255,255,255,.12);
  transition: all .3s ease;
}
.footer-social a:hover { color: #fff; border-color: #667eea; background: rgba(102,126,234,.2); transform: translateY(-2px); }
.footer-copy { font-size: .85rem; opacity: .7; }

/* ═══════════════════════════════════════════════════════════════
   Admin Panel Styles
   ═══════════════════════════════════════════════════════════════ */
.admin-body { background: #f0f2f5; }
.admin-layout { display: flex; min-height: 100vh; }

/* Admin Nav */
.admin-nav {
  width: 220px; flex-shrink: 0; background: #1a1d2e;
  color: rgba(255,255,255,.8); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-nav-brand { padding: 1.4rem 1.2rem; font-size: 1.05rem; font-weight: 700; color: #fff; display: flex; align-items: center; gap: .6rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-nav-brand i { color: var(--primary); font-size: 1.3rem; }
.admin-nav-list { list-style: none; padding: .8rem 0; flex: 1; }
.admin-nav-list li.divider { border-top: 1px solid rgba(255,255,255,.08); margin: .6rem 0; }
.admin-nav-list a { display: flex; align-items: center; gap: .6rem; padding: .7rem 1.4rem; font-size: .9rem; color: rgba(255,255,255,.65); transition: all var(--transition); }
.admin-nav-list a:hover, .admin-nav-list a.active { background: rgba(108,99,255,.25); color: #fff; }
.admin-nav-list a i { font-size: .95rem; width: 16px; text-align: center; }

/* Admin Main */
.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 1.5rem; height: 56px; display: flex; align-items: center; justify-content: space-between; font-size: .9rem; color: var(--text-muted); box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.admin-topbar a { color: var(--primary); }
.admin-content { flex: 1; padding: 1.5rem 2rem; overflow-y: auto; }
@media (max-width: 768px) { .admin-nav { display: none; } .admin-content { padding: 1rem; } }

/* Dash Stats */
.dash-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.2rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--surface); border-radius: var(--radius); padding: 1.4rem; display: flex; align-items: center; gap: 1.1rem; box-shadow: var(--shadow); }
.stat-icon { font-size: 2.2rem; border-radius: var(--radius-sm); padding: .5rem; }
.stat-icon.blue   { color: #3b82f6; background: #dbeafe; }
.stat-icon.green  { color: #22c55e; background: #dcfce7; }
.stat-icon.orange { color: #f97316; background: #ffedd5; }
.stat-icon.purple { color: var(--primary); background: var(--primary-light); }
.stat-num   { font-size: 1.8rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: .82rem; color: var(--text-muted); margin-top: .2rem; }

/* Dash Grid */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-panel { background: var(--surface); border-radius: var(--radius); padding: 1.3rem 1.5rem; box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: center; justify-content: space-between; }
.panel-header h3 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: .4rem; }
.panel-header h3 i { color: var(--primary); }
.mb { margin-bottom: 1.2rem; }

/* Admin Table */
.admin-table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.admin-table th { background: #f8fafc; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding: .8rem 1rem; border-bottom: 2px solid var(--border); text-align: left; white-space: nowrap; }
.admin-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); font-size: .9rem; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafbff; }
.thumb { width: 56px; height: 38px; object-fit: cover; border-radius: 6px; }
.thumb-placeholder { width: 56px; height: 38px; background: var(--primary-light); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: .9rem; }
.empty-td { text-align: center; color: var(--text-muted); padding: 2rem; }
.mini-tag { font-size: .75rem; padding: .1rem .4rem; background: var(--primary-light); color: var(--primary); border-radius: 50px; margin-right: .2rem; }
.action-btns { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.link-btn { background: none; border: none; font-size: .85rem; color: var(--primary); cursor: pointer; padding: .15rem .3rem; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.link-btn.success { color: var(--success); }

/* Badges */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 50px; font-size: .78rem; font-weight: 600; cursor: default; }
.badge.success { background: #dcfce7; color: #15803d; }
.badge.warning { background: #fef9c3; color: #a16207; }
.badge.default { background: #f1f5f9; color: var(--text-muted); }
.toggle-pub { cursor: pointer; }

/* Editor Layout */
.edit-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.5rem; }
@media (max-width: 900px) { .edit-layout { grid-template-columns: 1fr; } }
.edit-main { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.edit-sidebar { display: flex; flex-direction: column; gap: 1.2rem; }
.edit-widget { background: var(--surface); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.edit-widget h4 { font-size: .92rem; font-weight: 700; margin-bottom: .8rem; color: var(--text); display: flex; align-items: center; gap: .4rem; }
.edit-widget h4 i { color: var(--primary); }
.edit-actions { display: flex; flex-direction: column; gap: .5rem; margin-top: .8rem; }
.tags-checkboxes { display: flex; flex-direction: column; gap: .35rem; max-height: 160px; overflow-y: auto; }
.cover-preview { width: 100%; border-radius: var(--radius-sm); margin-bottom: .6rem; aspect-ratio: 16/9; object-fit: cover; }
.cover-preview-placeholder { width: 100%; aspect-ratio: 16/9; background: var(--bg); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--text-light); margin-bottom: .6rem; border: 2px dashed var(--border); }
input[type="file"] { font-size: .85rem; color: var(--text-muted); }

/* Editor Toolbar */
.editor-toolbar { display: flex; flex-wrap: wrap; gap: .35rem; padding: .5rem; background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.editor-toolbar button { padding: .25rem .6rem; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); cursor: pointer; font-size: .82rem; color: var(--text); transition: all var(--transition); }
.editor-toolbar button:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.editor-wrap { border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); overflow: hidden; }
.md-editor { width: 100%; min-height: 380px; font-family: 'Fira Code', Consolas, monospace; font-size: .92rem; padding: .8rem 1rem; border: none; outline: none; resize: vertical; }
.md-preview { min-height: 380px; padding: 1rem 1.2rem; overflow-y: auto; }
.CodeMirror { height: 380px; font-size: .9rem; }

/* Comment Preview */
.comment-preview-list { display: flex; flex-direction: column; gap: .8rem; margin-top: .8rem; }
.comment-preview { padding: .7rem; border-radius: var(--radius-sm); background: var(--bg); }
.cp-meta { display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; flex-wrap: wrap; }
.cp-time { font-size: .78rem; color: var(--text-light); margin-left: auto; }
.cp-content { font-size: .88rem; color: var(--text-muted); line-height: 1.5; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 768px) { .settings-grid { grid-template-columns: 1fr; } }
.font-mono { font-family: 'Fira Code', Consolas, monospace; font-size: .88rem; }

/* Misc */
.muted { color: var(--text-muted); font-size: .9rem; }
.tab-btns { display: flex; gap: .4rem; }

/* ── Scroll Reveal Animation ── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .6s cubic-bezier(.4,0,.2,1), transform .6s cubic-bezier(.4,0,.2,1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: .1s; }
.reveal-delay-2 { transition-delay: .2s; }
.reveal-delay-3 { transition-delay: .3s; }

/* ── Navbar gradient update ── */
.nav-brand { color: #667eea !important; }
.nav-link:hover, .nav-link.active { background: rgba(102,126,234,.08); color: #667eea; }

