/* ============================================================
   b24.cn — Blog Platform Stylesheet (Redesigned)
   Warm, readable, with personality. Full dark mode.
   ============================================================ */

/* ----------------------------------------------------------
   0. ROOT VARIABLES
   ---------------------------------------------------------- */
:root {
  /* Core palette */
  --bg: #fafafa;
  --surface: #f3f4f6;
  --fg: #1a1a2e;
  --text-secondary: #6b7280;
  --accent: #2563eb;
  --accent2: #3b82f6;
  --accent-warm: #4f46e5;
  --muted: #9ca3af;
  --border: #e5e7eb;
  --card: #ffffff;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.1);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Code */
  --code-bg: #f3f4f6;
  --code-inline-bg: #eef2ff;

  /* Tags */
  --tag-bg: #e0e7ff;
  --tag-fg: #3730a3;

  /* Nav */
  --nav-bg: rgba(250, 250, 250, 0.85);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1a2332;
    --fg: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent: #60a5fa;
    --accent2: #3b82f6;
    --accent-warm: #818cf8;
    --muted: #64748b;
    --border: #1e293b;
    --card: #1e293b;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.45);

    --code-bg: #1a2332;
    --code-inline-bg: rgba(96, 165, 250, 0.12);

    --tag-bg: #1e3a5f;
    --tag-fg: #93c5fd;

    --nav-bg: rgba(15, 23, 42, 0.85);
  }
}

/* ----------------------------------------------------------
   1. RESET & BASE
   ---------------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.75;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  animation: bodyFadeIn 0.35s ease;
}

::selection {
  background: rgba(37, 99, 235, 0.18);
  color: var(--fg);
}

@media (prefers-color-scheme: dark) {
  ::selection {
    background: rgba(96, 165, 250, 0.28);
    color: var(--fg);
  }
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

img {
  max-width: 100%;
  height: auto;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Body fade-in */
@keyframes bodyFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Card stagger animation */
@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ----------------------------------------------------------
   2. LAYOUT
   ---------------------------------------------------------- */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ----------------------------------------------------------
   3. NAVIGATION (public)
   ---------------------------------------------------------- */
nav {
  position: sticky;
  top: 0;
  padding: 16px 0;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  border-bottom: none;
}

nav::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent2), transparent);
  opacity: 0.5;
}

nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

nav .logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--fg);
  letter-spacing: -0.8px;
  transition: color 0.2s ease;
}

nav .logo:hover {
  text-decoration: none;
  color: var(--accent);
}

nav .logo span {
  color: var(--accent);
}

nav .links {
  display: flex;
  gap: 28px;
}

nav .links a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

nav .links a:hover {
  color: var(--fg);
  text-decoration: none;
  border-bottom-color: var(--accent);
}

nav .links a.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

/* ----------------------------------------------------------
   4. HERO
   ---------------------------------------------------------- */
.hero {
  padding: 80px 0 48px;
  text-align: center;
}

.hero h1 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 16px;
  line-height: 1.2;
}

.hero h1 span {
  color: var(--accent);
}

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.hero .badges {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ----------------------------------------------------------
   5. BADGE / TAG
   ---------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--tag-fg);
  transition: all 0.2s ease;
}

.badge:hover {
  transform: scale(1.05);
  background: var(--accent);
  color: #fff;
}

/* ----------------------------------------------------------
   6. SECTIONS
   ---------------------------------------------------------- */
section {
  padding: 48px 0;
}

section h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

/* ----------------------------------------------------------
   7. CARDS
   ---------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  animation: cardFadeIn 0.4s ease both;
}

.card:nth-child(1)  { animation-delay: 0.03s; }
.card:nth-child(2)  { animation-delay: 0.07s; }
.card:nth-child(3)  { animation-delay: 0.11s; }
.card:nth-child(4)  { animation-delay: 0.15s; }
.card:nth-child(5)  { animation-delay: 0.19s; }
.card:nth-child(6)  { animation-delay: 0.23s; }
.card:nth-child(7)  { animation-delay: 0.27s; }
.card:nth-child(8)  { animation-delay: 0.31s; }

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent2);
}

.card h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
}

.card h3 a {
  color: var(--fg);
  transition: color 0.2s ease;
}

.card h3 a:hover {
  color: var(--accent);
}

.card p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.card .meta {
  font-size: 13px;
  color: var(--muted);
  margin-top: 14px;
}

.card .tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ----------------------------------------------------------
   8. PAGE HEADER
   ---------------------------------------------------------- */
.page-header {
  padding: 48px 0 24px;
  position: relative;
}

.page-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 64px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px;
}

.page-header h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.page-header p {
  color: var(--text-secondary);
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.6;
}

/* ----------------------------------------------------------
   9. WIKI CONTENT (shared / article body base)
   ---------------------------------------------------------- */
.wiki-content {
  font-size: 16px;
  line-height: 1.8;
}

.wiki-content h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 36px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.wiki-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 28px 0 8px;
}

.wiki-content p {
  margin-bottom: 18px;
}

.wiki-content ul,
.wiki-content ol {
  margin: 0 0 18px 24px;
}

.wiki-content li {
  margin-bottom: 6px;
}

.wiki-content code {
  background: var(--code-inline-bg);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.875em;
}

.wiki-content pre {
  background: var(--code-bg);
  padding: 20px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
  border-left: 3px solid var(--accent);
}

.wiki-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
}

.wiki-content blockquote {
  position: relative;
  padding: 12px 20px;
  margin: 20px 0;
  background: linear-gradient(to right, var(--surface), transparent);
  color: var(--text-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-left: none;
}

.wiki-content blockquote::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent), var(--accent2));
  border-radius: 2px;
}

.wiki-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.wiki-content th,
.wiki-content td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
  font-size: 15px;
}

.wiki-content thead th {
  background: var(--surface);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.wiki-content tbody tr:nth-child(even) {
  background: var(--surface);
}

.wiki-content img {
  border-radius: var(--radius-sm);
  margin: 28px auto;
  display: block;
  transition: box-shadow 0.3s ease;
}

.wiki-content img:hover {
  box-shadow: var(--shadow-md);
}

/* ----------------------------------------------------------
   10. TOC
   ---------------------------------------------------------- */
.toc {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}

.toc h3 {
  font-size: 13px;
  margin-bottom: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.toc ul {
  list-style: none;
  margin: 0;
}

.toc li {
  margin-bottom: 6px;
}

.toc a {
  font-size: 14px;
  transition: color 0.2s ease;
}

/* ----------------------------------------------------------
   11. FOOTER
   ---------------------------------------------------------- */
footer {
  border-top: none;
  position: relative;
  padding: 48px 0 36px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-top: 64px;
  line-height: 1.7;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent2), transparent);
  opacity: 0.4;
}

footer a {
  color: var(--text-secondary);
}

footer a:hover {
  color: var(--accent);
}

/* ============================================================
   BLOG-SPECIFIC STYLES
   ============================================================ */

/* ----------------------------------------------------------
   12. POST CONTENT (article body)
   ---------------------------------------------------------- */
.post-content {
  font-size: 17px;
  line-height: 1.85;
}

.post-content h2 {
  font-size: 26px;
  font-weight: 700;
  margin: 40px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  position: relative;
  letter-spacing: -0.3px;
}

.post-content h2::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 56px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 1px;
}

.post-content h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 28px 0 10px;
  letter-spacing: -0.2px;
}

.post-content p {
  margin-bottom: 18px;
}

.post-content ul,
.post-content ol {
  margin: 0 0 18px 24px;
}

.post-content li {
  margin-bottom: 8px;
}

.post-content code {
  background: var(--code-inline-bg);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.875em;
  font-weight: 500;
}

.post-content pre {
  background: var(--code-bg);
  padding: 20px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
  border-left: 3px solid var(--accent);
}

.post-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-weight: 400;
  color: inherit;
}

.post-content blockquote {
  position: relative;
  padding: 14px 22px;
  margin: 24px 0;
  background: linear-gradient(to right, var(--surface), transparent);
  color: var(--text-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-left: none;
}

.post-content blockquote::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent), var(--accent2));
  border-radius: 2px;
}

.post-content blockquote p:last-child {
  margin-bottom: 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.post-content th,
.post-content td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
  font-size: 15px;
}

.post-content thead th {
  background: var(--surface);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.post-content tbody tr:nth-child(even) {
  background: var(--surface);
}

.post-content img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 28px auto;
  display: block;
  height: auto;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.post-content img:hover {
  box-shadow: var(--shadow-md);
  transform: scale(1.01);
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* Article-level post title */
article.post h1 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 16px;
}

/* Post metadata */
.post-meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 20px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.post-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ----------------------------------------------------------
   13. FORMS (admin panel)
   ---------------------------------------------------------- */
.form-group {
  margin-bottom: 22px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--fg);
}

input.input,
textarea.textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input.input:focus,
textarea.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

@media (prefers-color-scheme: dark) {
  input.input:focus,
  textarea.textarea:focus {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
  }
}

textarea.textarea {
  min-height: 200px;
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* Custom checkbox */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  vertical-align: middle;
  flex-shrink: 0;
}

input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* ----------------------------------------------------------
   14. BUTTONS
   ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  line-height: 1.4;
}

.btn:hover {
  text-decoration: none;
  background: var(--surface);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border-color: transparent;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  border-color: transparent;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #b91c1c, #dc2626);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-sm {
  padding: 6px 16px;
  font-size: 13px;
  border-radius: 8px;
}

/* ----------------------------------------------------------
   15. TAG CLOUD (homepage)
   ---------------------------------------------------------- */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.tag-cloud a {
  display: inline-block;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--tag-fg);
  transition: all 0.2s ease;
}

.tag-cloud a:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  transform: scale(1.05);
}

/* CSS-only tag cloud variety */
.tag-cloud a:nth-child(3n+1) {
  font-size: 14px;
  opacity: 0.92;
}

.tag-cloud a:nth-child(3n+2) {
  font-size: 12px;
  opacity: 0.75;
}

.tag-cloud a:nth-child(5n+3) {
  opacity: 0.85;
}

.tag-cloud a:nth-child(4n+4) {
  font-size: 13.5px;
  opacity: 0.88;
}

/* ----------------------------------------------------------
   16. PAGINATION
   ---------------------------------------------------------- */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 36px;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--fg);
  transition: all 0.2s ease;
  min-width: 40px;
  text-align: center;
}

.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.pagination .current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pagination .current:hover {
  transform: none;
  box-shadow: none;
}

/* ----------------------------------------------------------
   17. INSTALL PAGE
   ---------------------------------------------------------- */
.install-container {
  max-width: 420px;
  margin: 80px auto;
  padding: 40px;
  text-align: center;
}

.install-container h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.install-container h2 {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 32px;
}

.install-error {
  color: #dc2626;
  background: #fef2f2;
  padding: 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border-left: 4px solid #dc2626;
}

@media (prefers-color-scheme: dark) {
  .install-error {
    background: #450a0a;
    border-left-color: #ef4444;
  }
}

.install-success {
  color: #16a34a;
  background: #f0fdf4;
  padding: 14px;
  border-radius: var(--radius-sm);
  border-left: 4px solid #16a34a;
}

@media (prefers-color-scheme: dark) {
  .install-success {
    background: #052e16;
    border-left-color: #4ade80;
  }
}

.install-done {
  color: var(--muted);
  padding: 24px;
}

/* ----------------------------------------------------------
   18. TABLE (admin)
   ---------------------------------------------------------- */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  transition: background 0.15s ease;
}

.table thead th {
  font-weight: 600;
  color: var(--fg);
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0.02em;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}

.table tbody tr:nth-child(even) td {
  background: var(--surface);
}

.table tr:hover td {
  background: var(--card);
}

.table tbody tr:nth-child(even):hover td {
  background: var(--card);
}

/* ----------------------------------------------------------
   19. STATUS BADGES
   ---------------------------------------------------------- */
.status-published {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
}

.status-draft {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(100, 116, 139, 0.12);
  color: var(--muted);
}

@media (prefers-color-scheme: dark) {
  .status-published {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
  }

  .status-draft {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
  }
}

/* ----------------------------------------------------------
   20. NOTIFICATION / ALERT
   ---------------------------------------------------------- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 14px;
  line-height: 1.6;
  border-left: 4px solid var(--border);
}

.alert-info {
  background: #e0e7ff;
  color: #3730a3;
  border-left-color: var(--accent);
}

.alert-success {
  background: #f0fdf4;
  color: #16a34a;
  border-left-color: #16a34a;
}

.alert-error {
  background: #fef2f2;
  color: #dc2626;
  border-left-color: #dc2626;
}

@media (prefers-color-scheme: dark) {
  .alert-info {
    background: #1e3a5f;
    color: #93c5fd;
    border-left-color: var(--accent);
  }

  .alert-success {
    background: #052e16;
    color: #4ade80;
    border-left-color: #4ade80;
  }

  .alert-error {
    background: #450a0a;
    color: #fca5a5;
    border-left-color: #fca5a5;
  }
}

/* ----------------------------------------------------------
   21. ADMIN NAVIGATION
   ---------------------------------------------------------- */
.admin-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}

.admin-nav .nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.3px;
}

.admin-nav .nav-brand span {
  color: var(--accent);
}

.admin-nav .nav-user {
  background: var(--accent);
  color: #fff;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.admin-nav .nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.admin-nav .nav-links a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.admin-nav .nav-links a:hover,
.admin-nav .nav-links a.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.admin-content {
  padding: 32px 28px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

/* ----------------------------------------------------------
   22. ADDITIONAL UTILITY
   ---------------------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* 900px breakpoint */
@media (max-width: 900px) {
  .container {
    padding: 0 20px;
  }

  .page-header h1 {
    font-size: 30px;
  }

  .post-content h2 {
    font-size: 24px;
  }

  .post-content {
    font-size: 16px;
    line-height: 1.8;
  }

  article.post h1 {
    font-size: 34px;
  }

  .admin-content {
    padding: 24px 20px;
  }

  .admin-nav {
    padding: 0 20px;
  }
}

/* 600px breakpoint */
@media (max-width: 600px) {
  /* Navigation wraps */
  nav .container {
    flex-direction: column;
    gap: 12px;
  }

  nav .links {
    gap: 16px;
  }

  nav .links a {
    font-size: 13px;
  }

  nav .logo {
    font-size: 20px;
  }

  /* Hero */
  .hero h1 {
    font-size: 28px;
  }

  .hero {
    padding: 48px 0 32px;
  }

  .hero p {
    font-size: 16px;
  }

  /* Sections */
  section {
    padding: 32px 0;
  }

  /* Page header */
  .page-header {
    padding: 32px 0 20px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .page-header p {
    font-size: 15px;
  }

  /* Cards */
  .card {
    padding: 20px;
  }

  .card h3 {
    font-size: 18px;
  }

  /* Post */
  .post-content {
    font-size: 16px;
  }

  .post-content h2 {
    font-size: 22px;
  }

  .post-content h3 {
    font-size: 18px;
  }

  .post-content img {
    margin: 20px auto;
  }

  article.post h1 {
    font-size: 28px;
  }

  /* Container */
  .container {
    padding: 0 16px;
  }

  /* Pagination */
  .pagination a,
  .pagination span {
    padding: 6px 14px;
    font-size: 13px;
    min-width: 36px;
  }

  /* Install */
  .install-container {
    margin: 40px auto;
    padding: 24px;
  }

  .install-container h1 {
    font-size: 24px;
  }

  /* Table */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table th,
  .table td {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* Post meta */
  .post-meta {
    font-size: 13px;
    gap: 12px;
  }

  /* Forms - prevent iOS zoom */
  input.input,
  textarea.textarea {
    font-size: 16px;
  }

  /* Footer */
  footer {
    padding: 32px 0 28px;
    margin-top: 48px;
    font-size: 13px;
  }

  /* Admin nav wrap */
  .admin-nav {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 16px;
    gap: 8px;
  }

  .admin-nav .nav-links {
    gap: 12px;
    flex-wrap: wrap;
  }

  .admin-nav .nav-links a {
    font-size: 13px;
  }

  .admin-content {
    padding: 20px 16px;
  }

  .tag-cloud {
    gap: 6px;
  }

  .tag-cloud a {
    padding: 4px 12px;
    font-size: 12px;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ----------------------------------------------------------
   24. AI WRITING ASSISTANT (chat interface)
   ---------------------------------------------------------- */
.ai-chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 240px);
  min-height: 400px;
  max-height: 700px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  overflow: hidden;
}

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scroll-behavior: smooth;
}

.ai-messages::-webkit-scrollbar { width: 6px; }
.ai-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.ai-welcome {
  text-align: center;
  padding: 40px 20px;
  max-width: 500px;
  margin: 0 auto;
}

.ai-welcome-icon { font-size: 48px; margin-bottom: 16px; }

.ai-welcome h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  border-bottom: none;
  padding-bottom: 0;
}

.ai-welcome p {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 24px;
}

.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.sugg-btn {
  cursor: pointer !important;
}

/* Chat message bubbles */
.ai-msg {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}

.ai-msg-user {
  align-items: flex-end;
}

.ai-msg-user .ai-msg-content {
  background: var(--accent);
  color: #fff;
  padding: 12px 18px;
  border-radius: 18px 18px 4px 18px;
  max-width: 75%;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
}

.ai-msg-assistant {
  align-items: flex-start;
}

.ai-msg-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
  padding-left: 4px;
}

.ai-msg-assistant .ai-msg-content {
  background: var(--surface);
  padding: 16px 20px;
  border-radius: 18px 18px 18px 4px;
  max-width: 85%;
  font-size: 15px;
  line-height: 1.7;
  color: var(--fg);
  word-wrap: break-word;
}

/* Markdown inside AI messages */
.ai-msg-markdown p { margin-bottom: 12px; }
.ai-msg-markdown p:last-child { margin-bottom: 0; }
.ai-msg-markdown h2 { font-size: 18px; margin: 16px 0 8px; border-bottom: none; padding: 0; }
.ai-msg-markdown h3 { font-size: 16px; margin: 12px 0 6px; font-weight: 600; }
.ai-msg-markdown ul, .ai-msg-markdown ol { margin: 0 0 12px 20px; }
.ai-msg-markdown li { margin-bottom: 4px; }
.ai-msg-markdown code {
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--accent);
}
.ai-msg-markdown pre {
  background: var(--code-bg);
  padding: 12px 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0 12px;
  border-left: 3px solid var(--accent);
}
.ai-msg-markdown pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: var(--fg);
}
.ai-msg-markdown blockquote {
  border-left: 3px solid var(--accent);
  padding: 6px 12px;
  margin: 8px 0 12px;
  color: var(--muted);
  font-style: italic;
}
.ai-msg-markdown table {
  font-size: 14px;
  margin: 8px 0 12px;
  width: 100%;
  border-collapse: collapse;
}
.ai-msg-markdown th, .ai-msg-markdown td {
  padding: 6px 10px;
  border: 1px solid var(--border);
}

/* Input form */
.ai-form {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  background: var(--bg);
}

.ai-form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.ai-input {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  font-size: 15px !important;
  line-height: 1.5;
  padding: 10px 14px !important;
  border-radius: var(--radius-sm) !important;
}

.ai-send-btn {
  height: 44px;
  min-width: 80px;
  justify-content: center;
  border-radius: var(--radius-sm) !important;
}

.ai-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ai-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.ai-info {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

/* Responsive */
@media (max-width: 600px) {
  .ai-chat { height: calc(100vh - 180px); max-height: none; }
  .ai-msg-user .ai-msg-content,
  .ai-msg-assistant .ai-msg-content { max-width: 90%; font-size: 14px; }
  .ai-welcome { padding: 24px 16px; }
  .ai-welcome h2 { font-size: 18px; }
  .ai-suggestions { flex-direction: column; align-items: stretch; }
}
