/* Blog + SEO pages — matches RVL soft dark-red theme */

.blog-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.blog-hero {
  margin-bottom: 1.6rem;
  padding: 1.4rem 1.2rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--hero-bg);
}
.blog-hero h1 {
  font-family: 'Outfit', 'Noto Sans Thai', sans-serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0.2rem 0 0.35rem;
}
.blog-hero-sub { color: var(--muted); margin: 0; font-size: 0.95rem; }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.blog-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: border-color .15s ease, transform .15s ease;
}
.blog-card:hover {
  border-color: color-mix(in srgb, var(--red) 40%, var(--line));
  transform: translateY(-2px);
}
.blog-card-cover {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--bg2);
  overflow: hidden;
}
.blog-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.blog-card-cover-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-family: Outfit, sans-serif;
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--red-soft);
  background: var(--red-dim);
}
.blog-card-body {
  padding: 0.95rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}
.blog-card-body time {
  font-size: 0.78rem;
  color: var(--muted);
}
.blog-card-body h2 {
  font-size: 1.05rem;
  line-height: 1.35;
  margin: 0;
  font-family: 'Outfit', 'Noto Sans Thai', sans-serif;
}
.blog-card-body h2 a {
  text-decoration: none;
  color: var(--text);
}
.blog-card-body h2 a:hover { color: var(--red-soft); }
.blog-card-body p {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
  flex: 1;
}
.blog-readmore {
  color: var(--red-soft);
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  margin-top: 0.4rem;
}

.blog-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  color: var(--muted);
}
.blog-pager a {
  color: var(--red-soft);
  font-weight: 700;
  text-decoration: none;
}

.blog-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
}
.blog-empty a { color: var(--red-soft); }
.muted { color: var(--muted); }

/* Article */
.blog-article-wrap { max-width: 760px; }
.blog-back { margin-bottom: 0.75rem; }
.blog-back a { color: var(--red-soft); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.blog-article-head time { color: var(--muted); font-size: 0.86rem; }
.blog-article-head h1 {
  font-family: 'Outfit', 'Noto Sans Thai', sans-serif;
  font-size: clamp(1.55rem, 3.2vw, 2.15rem);
  line-height: 1.25;
  margin: 0.35rem 0 0.6rem;
}
.blog-lead {
  color: var(--muted);
  font-size: 1.02rem;
  margin: 0 0 1rem;
}
.blog-cover {
  margin: 0 0 1.25rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.blog-cover img { width: 100%; display: block; max-height: 420px; object-fit: cover; }

.blog-content {
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--text);
}
.blog-content h2, .blog-content h3 {
  font-family: 'Outfit', 'Noto Sans Thai', sans-serif;
  margin: 1.4rem 0 0.55rem;
  line-height: 1.3;
}
.blog-content p { margin: 0 0 0.95rem; }
.blog-content a { color: var(--red-soft); }
.blog-content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin: 0.6rem 0;
}
.blog-content ul, .blog-content ol { margin: 0 0 1rem 1.2rem; }
.blog-content blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--red);
  background: var(--red-dim);
  border-radius: 0 10px 10px 0;
  color: var(--muted);
}
.blog-content pre, .blog-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.blog-content pre {
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  margin: 0 0 1rem;
}
.blog-content code { color: var(--code); }
.blog-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
  font-size: 0.92rem;
}
.blog-content th, .blog-content td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.55rem;
}
.blog-content th { background: var(--map-head); color: var(--red-soft); }

.blog-cta-box {
  margin-top: 2rem;
  padding: 1.15rem 1.1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  text-align: center;
}
.blog-cta-box p { color: var(--muted); margin: 0.35rem 0 0.85rem; }
.blog-cta-box .hero-cta { display: inline-block; }

/* Admin */
.admin-wrap { max-width: 1080px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.admin-top {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 0.75rem; margin-bottom: 1rem;
}
.admin-top h1 {
  font-family: 'Outfit', 'Noto Sans Thai', sans-serif;
  font-size: 1.35rem; margin: 0;
}
.admin-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 0.5rem 0.9rem; border-radius: 999px; font-weight: 700;
  font-size: 0.88rem; text-decoration: none; cursor: pointer;
  font-family: inherit;
}
.btn:hover { border-color: var(--red-soft); color: var(--red-soft); }
.btn-primary {
  background: linear-gradient(135deg, #e11d48, #be123c);
  border-color: transparent; color: #fff !important;
}
.btn-primary:hover { filter: brightness(1.05); color: #fff !important; }
.btn-danger { color: var(--red-soft); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.btn-sm { padding: 0.32rem 0.7rem; font-size: 0.8rem; }

.admin-table {
  width: 100%; border-collapse: collapse; font-size: 0.9rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.admin-table th, .admin-table td {
  border-bottom: 1px solid var(--line); padding: 0.7rem 0.75rem; text-align: left; vertical-align: middle;
}
.admin-table th { background: var(--map-head); color: var(--red-soft); font-size: 0.82rem; }
.admin-table tr:last-child td { border-bottom: none; }
.badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700;
}
.badge-pub { background: rgba(52,211,153,.15); color: var(--ok); }
.badge-draft { background: var(--red-dim); color: var(--red-soft); }

.admin-form label {
  display: block; margin: 0.85rem 0 0.3rem; font-weight: 700; font-size: 0.88rem; color: var(--red-soft);
}
.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form input[type="url"],
.admin-form textarea,
.admin-form select {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
}
.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
  outline: none;
  border-color: var(--red-soft);
  box-shadow: 0 0 0 3px var(--red-dim);
}
.admin-form .hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }
.admin-grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1rem;
}
@media (max-width: 720px) {
  .admin-grid-2 { grid-template-columns: 1fr; }
  .admin-table { display: block; overflow-x: auto; }
}

.login-card {
  max-width: 400px; margin: 3rem auto; padding: 1.4rem 1.2rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: 1.2rem; margin: 0 0 0.3rem; font-family: Outfit, 'Noto Sans Thai', sans-serif; }
.login-card .sub { color: var(--muted); margin-bottom: 1rem; font-size: 0.9rem; }
.alert {
  padding: 0.7rem 0.85rem; border-radius: 10px; margin-bottom: 0.85rem; font-size: 0.9rem;
}
.alert-error { background: var(--red-dim); color: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 30%, transparent); }
.alert-ok { background: rgba(52,211,153,.12); color: var(--ok); border: 1px solid rgba(52,211,153,.3); }

/* Quill dark-ish */
.ql-toolbar.ql-snow {
  border: 1px solid var(--line) !important;
  border-radius: 10px 10px 0 0;
  background: var(--map-head);
}
.ql-container.ql-snow {
  border: 1px solid var(--line) !important;
  border-top: none !important;
  border-radius: 0 0 10px 10px;
  background: var(--input);
  min-height: 280px;
  color: var(--text);
  font-family: 'Noto Sans Thai', Outfit, sans-serif;
  font-size: 1rem;
}
.ql-editor { min-height: 260px; }
.ql-snow .ql-stroke { stroke: var(--muted); }
.ql-snow .ql-fill { fill: var(--muted); }
.ql-snow .ql-picker { color: var(--muted); }
.ql-snow .ql-picker-options { background: var(--card); border-color: var(--line); }
html[data-theme="dark"] .ql-editor.ql-blank::before { color: #6b7280; }

.cover-preview {
  margin-top: 0.5rem; max-width: 320px; border-radius: 10px; border: 1px solid var(--line);
  display: none;
}
.cover-preview.show { display: block; max-height: 160px; object-fit: cover; width: 100%; }

/* Admin multi-user badge */
.admin-user-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .28rem .7rem; border-radius: 999px; font-size: .82rem; font-weight: 700;
  background: var(--red-dim); color: var(--red-soft);
  border: 1px solid color-mix(in srgb, var(--red) 30%, var(--line));
  white-space: nowrap;
}

/* Breadcrumb */
.blog-breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  font-size: 0.84rem; color: var(--muted); margin-bottom: 1rem;
}
.blog-breadcrumb a { color: var(--red-soft); text-decoration: none; font-weight: 600; }
.blog-breadcrumb a:hover { text-decoration: underline; }

.blog-meta-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
  color: var(--muted); font-size: 0.86rem; margin-bottom: 0.35rem;
}
.blog-dot { opacity: 0.55; }

/* TOC */
.blog-toc {
  margin: 0 0 1.25rem; padding: 0.9rem 1rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.blog-toc strong { display: block; margin-bottom: 0.45rem; color: var(--red-soft); font-size: 0.9rem; }
.blog-toc ol { margin: 0 0 0 1.1rem; padding: 0; }
.blog-toc li { margin: 0.25rem 0; font-size: 0.92rem; }
.blog-toc a { color: var(--text); text-decoration: none; }
.blog-toc a:hover { color: var(--red-soft); }

.blog-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1.2rem 0 0.5rem; }
.blog-tag {
  font-size: 0.78rem; font-weight: 700; padding: 0.22rem 0.55rem; border-radius: 999px;
  background: var(--red-dim); color: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 25%, var(--line));
}
.blog-article-foot { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }

/* Prev / next */
.blog-adjacent {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 1.6rem 0 0.5rem;
}
.blog-adj {
  display: flex; flex-direction: column; gap: 0.25rem;
  padding: 0.85rem 0.95rem; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); text-decoration: none; color: var(--text);
  transition: border-color .15s ease;
}
.blog-adj:hover { border-color: var(--red-soft); }
.blog-adj.next { text-align: right; }
.blog-adj strong { font-size: 0.92rem; line-height: 1.35; }
@media (max-width: 640px) {
  .blog-adjacent { grid-template-columns: 1fr; }
  .blog-adj.next { text-align: left; }
}

.blog-related { margin-top: 2rem; }
.blog-related h2 {
  font-family: 'Outfit', 'Noto Sans Thai', sans-serif;
  font-size: 1.15rem; margin: 0 0 0.85rem;
}
.blog-grid-related { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* Admin SEO panel */
.seo-panel {
  padding: 1rem 1rem 1.15rem; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card);
}
.seo-panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
}
.seo-score-badge {
  font-family: Outfit, sans-serif; font-weight: 800; font-size: 0.95rem;
  padding: 0.3rem 0.7rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--muted);
}
.seo-score-badge.good { color: var(--ok); border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.12); }
.seo-score-badge.mid { color: #fbbf24; border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.12); }
.seo-score-badge.low { color: var(--red-soft); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); background: var(--red-dim); }

.seo-checklist {
  list-style: none; margin: 0.75rem 0 1rem; padding: 0;
  display: grid; gap: 0.3rem; font-size: 0.86rem;
}
.seo-checklist li.ok { color: var(--ok); }
.seo-checklist li.bad { color: var(--muted); }

.char-count { color: var(--muted); font-weight: 600; font-size: 0.8rem; margin-left: 0.25rem; }
.seo-bar {
  height: 4px; border-radius: 999px; background: var(--line); margin: 0.35rem 0 0.55rem; overflow: hidden;
}
.seo-bar i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: var(--muted); transition: width .15s ease, background .15s ease;
}
.seo-bar i.ok { background: var(--ok); }
.seo-bar i.warn { background: #fbbf24; }
.seo-bar i.bad { background: var(--red); }
.seo-bar i.muted { background: var(--muted); }

.seo-serp {
  margin-top: 1rem; padding: 0.85rem 0.95rem; border-radius: 10px;
  background: #fff; color: #202124; border: 1px solid #dadce0;
  font-family: Arial, sans-serif;
}
html[data-theme="dark"] .seo-serp { /* keep Google-like light SERP preview */ }
.seo-serp-url { color: #202124; font-size: 0.78rem; margin-bottom: 0.2rem; word-break: break-all; }
.seo-serp-title { color: #1a0dab; font-size: 1.1rem; line-height: 1.3; margin-bottom: 0.2rem; }
.seo-serp-desc { color: #4d5156; font-size: 0.86rem; line-height: 1.45; }

/* ---- Admin bar (front) ---- */
body:has(.rvl-admin-bar) { padding-top: 42px; }
.rvl-admin-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: linear-gradient(90deg, #1a0a10, #2a0f18 40%, #1a0a10);
  border-bottom: 1px solid color-mix(in srgb, var(--red) 45%, transparent);
  color: #fff; font-size: 0.82rem;
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
}
.rvl-admin-bar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0.45rem 0.85rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem 1rem;
  justify-content: space-between;
}
.rvl-admin-bar-brand { font-weight: 800; color: var(--red-soft); font-family: Outfit, sans-serif; }
.rvl-admin-bar-links { display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; }
.rvl-admin-bar a { color: #f8fafc; text-decoration: none; font-weight: 600; opacity: .92; }
.rvl-admin-bar a:hover { color: var(--red-soft); opacity: 1; }

.footer-admin-link {
  color: var(--muted) !important;
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-left: 0.15rem;
}
.footer-admin-link:hover { color: var(--red-soft) !important; }

/* Content image alignment (BlockNote / manual classes) */
.blog-content img.alignleft,
.blog-content .bn-align-left img { float: left; max-width: 46%; margin: 0.25rem 1rem 0.75rem 0; }
.blog-content img.alignright,
.blog-content .bn-align-right img { float: right; max-width: 46%; margin: 0.25rem 0 0.75rem 1rem; }
.blog-content img.aligncenter,
.blog-content .bn-align-center img { display: block; margin: 0.85rem auto; max-width: 100%; }
.blog-content img.alignwide { width: 100%; max-width: 100%; }
.blog-content .rvl-callout {
  border-left: 4px solid var(--red);
  background: var(--red-dim);
  padding: 0.85rem 1rem;
  border-radius: 0 12px 12px 0;
  margin: 1rem 0;
}
.blog-content .rvl-cta a,
.blog-content a.rvl-cta-btn {
  display: inline-flex; align-items: center;
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: #fff !important; text-decoration: none;
  padding: 0.55rem 1.1rem; border-radius: 999px; font-weight: 700;
}
@media (max-width: 640px) {
  .blog-content img.alignleft,
  .blog-content img.alignright {
    float: none; max-width: 100%; margin: 0.6rem 0;
  }
}

/* Featured image panel + BlockNote shell */
.featured-panel {
  margin: 1rem 0 1.25rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.featured-panel h3 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-family: Outfit, 'Noto Sans Thai', sans-serif;
}
.featured-drop {
  border: 1.5px dashed color-mix(in srgb, var(--red) 40%, var(--line));
  border-radius: 12px;
  padding: 1.1rem;
  text-align: center;
  color: var(--muted);
  background: var(--bg2);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.featured-drop:hover, .featured-drop.drag {
  border-color: var(--red-soft);
  background: var(--red-dim);
  color: var(--text);
}
.featured-preview {
  display: none;
  margin-top: 0.75rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  max-width: 420px;
  aspect-ratio: 16/9;
  background: var(--bg2);
}
.featured-preview.show { display: block; }
.featured-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.featured-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.65rem; }

#rvl-blocknote-root {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #0f1117;
}
.rvl-bn-wrap { min-height: 360px; }
.rvl-bn-wrap .bn-container { min-height: 360px; }
/* Quill leftover hide if any */
.ql-toolbar, .ql-container { display: none !important; }

