/* ============================================================
   CODVERGE — Blog Frontend Styles
   Matches existing design system: --primary: #7c3aed, --accent: #06b6d4
   Font-size minimum 16px, line-height 1.7, max content width 800px
   ============================================================ */

/* ── Blog Post Page Layout ───────────────────────────────────────────────── */
.blog-post-wrap {
  max-width: 800px;
  margin: 0 auto;
}

.blog-post-body {
  font-size: 1.0625rem; /* 17px — above 16px minimum */
  line-height: 1.8;
  color: var(--text);
}

.blog-post-body p {
  color: var(--text-muted);
  margin-bottom: 1.4rem;
  font-size: 1.0625rem;
  line-height: 1.8;
}

.blog-post-body h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: #fff;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.blog-post-body h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  margin: 2rem 0 0.75rem;
}

.blog-post-body h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin: 1.5rem 0 0.6rem;
}

.blog-post-body ul,
.blog-post-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.4rem;
  color: var(--text-muted);
}

.blog-post-body ul li,
.blog-post-body ol li {
  margin-bottom: 0.5rem;
  line-height: 1.75;
}

.blog-post-body a {
  color: var(--primary-lt, #9d60f8);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.blog-post-body a:hover {
  color: var(--accent, #06b6d4);
}

.blog-post-body blockquote {
  border-left: 4px solid var(--primary, #7c3aed);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--dark-card, #111120);
  border-radius: 0 var(--radius-sm, 10px) var(--radius-sm, 10px) 0;
  font-style: italic;
  color: var(--text-muted);
}

.blog-post-body code {
  background: var(--dark-card, #111120);
  color: var(--accent, #06b6d4);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.9em;
  font-family: 'Courier New', monospace;
}

.blog-post-body pre {
  background: var(--dark-card-2, #161628);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 10px);
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.blog-post-body pre code {
  background: transparent;
  padding: 0;
  color: var(--text);
}

.blog-post-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm, 10px);
  margin: 1.5rem 0;
  loading: lazy;
}

.blog-post-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.blog-post-body table th,
.blog-post-body table td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
}

.blog-post-body table th {
  background: var(--dark-card, #111120);
  color: #fff;
  font-weight: 600;
}

.blog-post-body table tr:nth-child(even) td {
  background: rgba(255,255,255,0.02);
}

/* ── Post Header ──────────────────────────────────────────────────────────── */
.post-hero {
  background: var(--dark-2, #0c0c1a);
  padding: 4rem 0 3rem;
  position: relative;
  overflow: hidden;
}

.post-hero::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124,58,237,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.post-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(124,58,237,0.15);
  color: var(--primary-lt, #9d60f8);
  border: 1px solid rgba(124,58,237,0.3);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none !important;
  margin-bottom: 1rem;
  transition: all 0.2s;
}

.post-category-badge:hover {
  background: rgba(124,58,237,0.25);
  color: var(--primary-lt, #9d60f8);
}

.post-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 1.25rem;
}

.post-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  color: var(--text-faint, #475569);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

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

.post-meta-row i {
  color: var(--primary-lt, #9d60f8);
  font-size: 0.85rem;
}

.post-featured-image {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: var(--radius, 16px);
  margin-bottom: 2.5rem;
  display: block;
}

/* ── Table of Contents ────────────────────────────────────────────────────── */
.toc-box {
  background: var(--dark-card, #111120);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary, #7c3aed);
  border-radius: var(--radius-sm, 10px);
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
}

.toc-box h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toc-box h4 i {
  color: var(--primary-lt, #9d60f8);
}

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

.toc-list li {
  margin-bottom: 0.4rem;
}

.toc-list a {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.toc-list a::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary, #7c3aed);
  flex-shrink: 0;
}

.toc-list a:hover {
  color: var(--primary-lt, #9d60f8);
}

.toc-list .toc-h3 {
  padding-left: 1.25rem;
}

.toc-list .toc-h3 a::before {
  background: var(--accent, #06b6d4);
  width: 5px; height: 5px;
}

/* ── Affiliate Disclosure ─────────────────────────────────────────────────── */
.affiliate-disclosure {
  background: rgba(6,182,212,0.08);
  border: 1px solid rgba(6,182,212,0.25);
  border-radius: var(--radius-sm, 10px);
  padding: 0.875rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.affiliate-disclosure i {
  color: var(--accent, #06b6d4);
  margin-top: 2px;
  flex-shrink: 0;
}

/* ── Social Share Buttons ─────────────────────────────────────────────────── */
.share-section {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
  margin: 2.5rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.share-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.share-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: var(--dark-card, #111120);
  color: var(--text-muted);
}

.share-btn:hover { transform: translateY(-2px); color: #fff; }
.share-btn.share-twitter:hover  { background: #1da1f2; border-color: #1da1f2; }
.share-btn.share-linkedin:hover { background: #0077b5; border-color: #0077b5; }
.share-btn.share-whatsapp:hover { background: #25d366; border-color: #25d366; }
.share-btn.share-facebook:hover { background: #1877f2; border-color: #1877f2; }

/* ── Author Bio Card ──────────────────────────────────────────────────────── */
.author-card {
  background: var(--dark-card, #111120);
  border: 1px solid var(--border);
  border-radius: var(--radius, 16px);
  padding: 2rem;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin: 3rem 0;
}

.author-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(124,58,237,0.4);
  flex-shrink: 0;
}

.author-avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary, #7c3aed), var(--accent, #06b6d4));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  flex-shrink: 0;
}

.author-info h5 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.author-info .author-title {
  font-size: 0.82rem;
  color: var(--primary-lt, #9d60f8);
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.author-info p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.author-info a {
  font-size: 0.85rem;
  color: var(--primary-lt, #9d60f8);
  font-weight: 600;
  text-decoration: none;
}

.author-info a:hover { text-decoration: underline; }

@media (max-width: 576px) {
  .author-card { flex-direction: column; align-items: center; text-align: center; }
}

/* ── Related Posts ────────────────────────────────────────────────────────── */
.related-posts-section {
  margin-top: 3rem;
}

.related-posts-section h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.related-posts-section h3 i {
  color: var(--accent, #06b6d4);
}

/* ── Newsletter Sidebar / Inline Form ─────────────────────────────────────── */
.newsletter-box {
  background: var(--grad-card, linear-gradient(135deg, rgba(124,58,237,0.12) 0%, rgba(6,182,212,0.06) 100%));
  border: 1px solid rgba(124,58,237,0.25);
  border-radius: var(--radius, 16px);
  padding: 1.75rem;
}

.newsletter-box h5 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.newsletter-box p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.newsletter-form input[type="email"] {
  width: 100%;
  background: var(--dark-card, #111120);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
  outline: none;
  transition: border-color 0.2s;
}

.newsletter-form input[type="email"]:focus {
  border-color: var(--primary, #7c3aed);
}

.newsletter-form button {
  width: 100%;
}

/* ── Blog Listing Cards (enhanced) ───────────────────────────────────────── */
.blog-card {
  background: var(--dark-card, #111120);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 10px);
  overflow: hidden;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.blog-card:hover {
  transform: translateY(-6px);
  border-color: rgba(124,58,237,0.4);
  box-shadow: 0 12px 40px rgba(124,58,237,0.12);
}

.blog-card-thumb {
  position: relative;
  overflow: hidden;
  height: 210px;
  background: var(--dark-card-2, #161628);
}

.blog-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

.blog-card:hover .blog-card-thumb img {
  transform: scale(1.04);
}

.blog-card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(6,182,212,0.08));
}

.blog-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.blog-cat {
  display: inline-block;
  background: rgba(124,58,237,0.15);
  color: var(--primary-lt, #9d60f8);
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.2s;
}

.blog-cat:hover {
  background: rgba(124,58,237,0.25);
  color: var(--primary-lt, #9d60f8);
}

.blog-card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
  margin: 0;
  text-decoration: none;
  transition: color 0.2s;
}

.blog-card-title:hover { color: var(--primary-lt, #9d60f8); }

.blog-card-excerpt {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin: 0;
  flex: 1;
}

.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-faint, #475569);
}

/* ── Breadcrumb ───────────────────────────────────────────────────────────── */
.cv-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-faint, #475569);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.cv-breadcrumb a {
  color: var(--text-faint, #475569);
  text-decoration: none;
  transition: color 0.2s;
}

.cv-breadcrumb a:hover { color: var(--primary-lt, #9d60f8); }

.cv-breadcrumb .sep { color: var(--border); }

.cv-breadcrumb .current { color: var(--text-muted); }

/* ── Post Sidebar ─────────────────────────────────────────────────────────── */
.blog-sidebar {
  position: sticky;
  top: 90px;
}

.sidebar-widget {
  background: var(--dark-card, #111120);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 10px);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.sidebar-widget h6 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-widget h6 i { color: var(--accent, #06b6d4); font-size: 0.85rem; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.blog-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--dark-card, #111120);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
}

.page-btn:hover,
.page-btn.active {
  background: var(--primary, #7c3aed);
  border-color: var(--primary, #7c3aed);
  color: #fff;
}

.page-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ── Light mode overrides ─────────────────────────────────────────────────── */
[data-theme="light"] .blog-post-body p     { color: var(--text-muted); }
[data-theme="light"] .blog-post-body h2,
[data-theme="light"] .blog-post-body h3,
[data-theme="light"] .blog-post-body h4   { color: var(--text); }
[data-theme="light"] .toc-box             { background: #fff; }
[data-theme="light"] .author-card         { background: #fff; }
[data-theme="light"] .blog-card           { background: #fff; }
[data-theme="light"] .sidebar-widget      { background: #fff; }
[data-theme="light"] .newsletter-box      { background: rgba(124,58,237,0.04); border-color: rgba(124,58,237,0.15); }
[data-theme="light"] .share-btn           { background: #fff; }
[data-theme="light"] .page-btn            { background: #fff; }
[data-theme="light"] .blog-card-title     { color: var(--text); }
[data-theme="light"] .post-title          { color: var(--text); }
[data-theme="light"] .blog-post-body code { background: #f0f1fc; }
[data-theme="light"] .blog-post-body pre  { background: #f0f1fc; border-color: rgba(0,0,0,0.08); }
[data-theme="light"] .blog-post-body h2   { border-bottom-color: rgba(0,0,0,0.08); }
[data-theme="light"] .affiliate-disclosure { background: rgba(6,182,212,0.05); }

/* ── Cookie Banner ────────────────────────────────────────────────────────── */
.cv-cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  background: var(--dark-card-2, #161628);
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
}

.cv-cookie-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.cv-cookie-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  flex: 1;
  min-width: 200px;
}

.cv-cookie-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

[data-theme="light"] .cv-cookie-banner {
  background: #fff;
  border-top-color: rgba(0,0,0,0.08);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
}

/* ── Search Page ──────────────────────────────────────────────────────────── */
.search-form-wrap {
  max-width: 600px;
  margin: 0 auto 2rem;
}

.cv-search-input {
  background: var(--dark-card, #111120);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.875rem 1.25rem;
  color: var(--text);
  font-size: 1rem;
  width: 100%;
  transition: border-color 0.2s;
  outline: none;
}

.cv-search-input:focus {
  border-color: var(--primary, #7c3aed);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}

[data-theme="light"] .cv-search-input {
  background: #fff;
  border-color: rgba(0,0,0,0.12);
  color: var(--text);
}

/* ── Read time + word count badge ─────────────────────────────────────────── */
.post-stats-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--text-faint, #475569);
}

.stat-badge i { color: var(--primary-lt, #9d60f8); font-size: 0.75rem; }

[data-theme="light"] .stat-badge { background: rgba(0,0,0,0.04); }
