/* =============================================
   BestAppHome Theme — Main Stylesheet
   ============================================= */

:root {
  --color-wp:   #2271b1;
  --color-seo:  #00a32a;
  --color-n8n:  #e69820;
  --color-tech: #8b5cf6;
  --color-news: #6b7280;

  --bg:         #0f172a;
  --bg-card:    #1e293b;
  --bg-hover:   #273349;
  --border:     #334155;
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
  --accent:     #38bdf8;

  --radius:     8px;
  --shadow:     0 2px 12px rgba(0,0,0,.35);
  --font:       'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
  --max-width:  1200px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* ---- Layout ---- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }
.site-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.site-content { flex: 1; }

/* ---- Header ---- */
.site-header {
  background: #0a1628;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; max-width: var(--max-width); margin: 0 auto;
}
.site-branding a {
  font-size: 1.4rem; font-weight: 800; color: #fff;
  letter-spacing: -.5px; text-decoration: none;
}
.site-branding span { color: var(--accent); }
.site-description { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }

/* Nav */
.main-nav ul { list-style: none; display: flex; gap: 6px; flex-wrap: wrap; }
.main-nav a {
  color: var(--text-muted); font-size: .85rem; font-weight: 500;
  padding: 5px 12px; border-radius: 20px; transition: all .2s;
  text-decoration: none;
}
.main-nav a:hover, .main-nav .current-menu-item a {
  background: var(--bg-hover); color: var(--text);
}
.nav-cat--wp    a { color: var(--color-wp); }
.nav-cat--seo   a { color: var(--color-seo); }
.nav-cat--n8n   a { color: var(--color-n8n); }
.nav-cat--tech  a { color: var(--color-tech); }

.menu-toggle {
  display: none; background: none; border: 1px solid var(--border);
  color: var(--text); padding: 6px 10px; border-radius: var(--radius); cursor: pointer;
}

/* ---- Hero / Homepage ---- */
.hero {
  background: linear-gradient(135deg, #0a1628 0%, #1a2744 50%, #0f172a 100%);
  border-bottom: 1px solid var(--border);
  padding: 60px 20px;
  text-align: center;
}
.hero h1 { font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 800; color: #fff; }
.hero p   { color: var(--text-muted); font-size: 1.1rem; margin-top: 10px; max-width: 600px; margin-inline: auto; }
.hero-search {
  margin-top: 24px; display: flex; gap: 8px; max-width: 500px; margin-inline: auto;
}
.hero-search input {
  flex: 1; padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text); font-size: 1rem;
}
.hero-search input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.hero-search button {
  padding: 12px 20px; background: var(--accent); color: #0f172a;
  border: none; border-radius: var(--radius); font-weight: 700; cursor: pointer;
}

/* ---- Category hubs ---- */
.category-hubs { padding: 48px 0; }
.category-hubs h2 { font-size: 1.25rem; color: var(--text-muted); margin-bottom: 20px; text-align: center; }
.hubs-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px;
}
.hub-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; transition: transform .2s, box-shadow .2s;
  text-decoration: none; display: block;
}
.hub-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.hub-card .hub-icon { font-size: 2rem; margin-bottom: 12px; }
.hub-card h3 { font-size: 1.1rem; color: #fff; margin-bottom: 6px; }
.hub-card p  { font-size: .85rem; color: var(--text-muted); }
.hub-card.wp   { border-top: 3px solid var(--color-wp); }
.hub-card.seo  { border-top: 3px solid var(--color-seo); }
.hub-card.n8n  { border-top: 3px solid var(--color-n8n); }
.hub-card.tech { border-top: 3px solid var(--color-tech); }

/* ---- Section headings ---- */
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.section-header h2 { font-size: 1.3rem; color: #fff; }
.section-header a  { font-size: .85rem; color: var(--accent); }

/* ---- Post cards ---- */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.post-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.post-card-img { height: 180px; background: var(--bg-hover); overflow: hidden; }
.post-card-img img { width: 100%; height: 100%; object-fit: cover; }
.post-card-body { padding: 18px; }
.post-card-meta {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap;
}
.cat-badge {
  font-size: .7rem; font-weight: 700; padding: 3px 8px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: .5px;
  text-decoration: none;
}
.cat-badge.wp   { background: rgba(34,113,177,.2); color: var(--color-wp); }
.cat-badge.seo  { background: rgba(0,163,42,.2);   color: var(--color-seo); }
.cat-badge.n8n  { background: rgba(230,152,32,.2); color: var(--color-n8n); }
.cat-badge.tech { background: rgba(139,92,246,.2); color: var(--color-tech); }
.cat-badge.news { background: rgba(107,114,128,.2); color: var(--color-news); }

.type-badge {
  font-size: .65rem; padding: 2px 6px; border-radius: 4px;
  background: var(--border); color: var(--text-muted); font-weight: 600;
}

.post-card h3 { font-size: 1rem; line-height: 1.4; margin-bottom: 8px; }
.post-card h3 a { color: var(--text); text-decoration: none; }
.post-card h3 a:hover { color: var(--accent); }
.post-card-excerpt { font-size: .875rem; color: var(--text-muted); margin-bottom: 12px; }
.post-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .75rem; color: var(--text-muted);
}
.reading-time::before { content: '⏱ '; }

/* ---- Content layout (single/page) ---- */
.content-area {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  padding: 48px 0;
  align-items: start;
}
.content-area.no-sidebar { grid-template-columns: 1fr; max-width: 800px; margin-inline: auto; }

/* Article */
.article-header { margin-bottom: 32px; }
.article-header .cat-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.article-header h1 { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.25; color: #fff; }
.article-subtitle { font-size: 1.15rem; color: var(--text-muted); margin-top: 12px; }
.article-meta {
  display: flex; gap: 20px; flex-wrap: wrap; font-size: .85rem;
  color: var(--text-muted); margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.article-meta span::before { margin-right: 4px; }
.article-meta .author::before  { content: '👤'; }
.article-meta .date::before    { content: '📅'; }
.article-meta .updated::before { content: '🔄'; }
.article-meta .read-time::before { content: '⏱'; }

/* ACF info bar */
.article-acf-bar {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 28px;
  display: flex; gap: 24px; flex-wrap: wrap; font-size: .85rem;
}
.acf-item { display: flex; align-items: center; gap: 6px; color: var(--text-muted); }
.acf-item strong { color: var(--text); }
.difficulty--beginner     { color: #22c55e; font-weight: 700; }
.difficulty--intermediate { color: #f59e0b; font-weight: 700; }
.difficulty--advanced     { color: #ef4444; font-weight: 700; }

/* Article body */
.article-body { color: var(--text); }
.article-body h2, .article-body h3, .article-body h4 { color: #fff; margin: 28px 0 12px; line-height: 1.3; }
.article-body h2 { font-size: 1.6rem; }
.article-body h3 { font-size: 1.25rem; }
.article-body h4 { font-size: 1.05rem; }
.article-body p  { margin-bottom: 18px; }
.article-body ul, .article-body ol { margin: 0 0 18px 24px; }
.article-body li { margin-bottom: 6px; }
.article-body a  { color: var(--accent); }
.article-body blockquote {
  border-left: 4px solid var(--accent); padding: 12px 20px;
  background: var(--bg-card); border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0; color: var(--text-muted);
}
.article-body pre, .article-body code {
  font-family: var(--font-mono); background: #0d1117;
  border-radius: 6px; font-size: .875rem;
}
.article-body pre { padding: 20px; overflow-x: auto; margin: 20px 0; border: 1px solid var(--border); }
.article-body code { padding: 2px 6px; }
.article-body pre code { padding: 0; }
.article-body table { width: 100%; border-collapse: collapse; margin: 20px 0; }
.article-body th, .article-body td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; }
.article-body th { background: var(--bg-card); color: #fff; }
.article-body tr:nth-child(even) { background: var(--bg-card); }
.article-body img { border-radius: var(--radius); margin: 20px 0; }

/* Table of contents */
.toc-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin: 28px 0;
}
.toc-box h4 { color: #fff; margin-bottom: 12px; font-size: .95rem; }
.toc-list { list-style: none; }
.toc-list li { padding: 4px 0; border-bottom: 1px solid var(--border); }
.toc-list li:last-child { border-bottom: none; }
.toc-list a { color: var(--text-muted); font-size: .875rem; }
.toc-list a:hover { color: var(--accent); }

/* Related posts */
.related-posts { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }
.related-posts h3 { font-size: 1.2rem; color: #fff; margin-bottom: 20px; }

/* ---- Sidebar ---- */
.sidebar { position: sticky; top: 80px; }
.widget {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.widget h3 { font-size: .95rem; color: #fff; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.widget ul { list-style: none; }
.widget ul li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: .875rem; }
.widget ul li:last-child { border-bottom: none; }
.widget ul a { color: var(--text-muted); }
.widget ul a:hover { color: var(--accent); }

/* Category widget colors */
.cat-list li.cat-wp a   { color: var(--color-wp); }
.cat-list li.cat-seo a  { color: var(--color-seo); }
.cat-list li.cat-n8n a  { color: var(--color-n8n); }
.cat-list li.cat-tech a { color: var(--color-tech); }

/* ---- Archive / Category header ---- */
.archive-header {
  padding: 40px 0 32px; border-bottom: 1px solid var(--border); margin-bottom: 32px;
}
.archive-header .cat-color-bar {
  width: 48px; height: 4px; border-radius: 2px; margin-bottom: 16px;
}
.archive-header h1 { font-size: 2rem; color: #fff; }
.archive-header p  { color: var(--text-muted); margin-top: 8px; }
.archive-count { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }

/* ---- Pagination ---- */
.pagination {
  display: flex; gap: 8px; justify-content: center; margin: 48px 0;
}
.pagination a, .pagination span {
  padding: 8px 14px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: .875rem; color: var(--text-muted);
  text-decoration: none; transition: all .2s;
}
.pagination a:hover { background: var(--bg-card); color: var(--text); }
.pagination .current { background: var(--accent); color: #0f172a; border-color: var(--accent); font-weight: 700; }

/* ---- Search ---- */
.search-header { padding: 32px 0; }
.search-header h1 { font-size: 1.5rem; color: #fff; }
.search-form { display: flex; gap: 8px; margin-top: 16px; max-width: 500px; }
.search-form input {
  flex: 1; padding: 10px 16px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
}
.search-form button {
  padding: 10px 18px; background: var(--accent); color: #0f172a;
  border: none; border-radius: var(--radius); font-weight: 700; cursor: pointer;
}

/* ---- 404 ---- */
.error-404 { text-align: center; padding: 80px 20px; }
.error-404 .error-code { font-size: 6rem; font-weight: 900; color: var(--border); }
.error-404 h2 { font-size: 1.5rem; color: #fff; }
.error-404 p  { color: var(--text-muted); margin-top: 10px; }
.btn {
  display: inline-block; margin-top: 20px; padding: 12px 24px;
  background: var(--accent); color: #0f172a; border-radius: var(--radius);
  font-weight: 700; text-decoration: none;
}

/* ---- Static pages ---- */
.page-header { padding: 48px 0 32px; border-bottom: 1px solid var(--border); margin-bottom: 40px; }
.page-header h1 { font-size: 2rem; color: #fff; }

/* ---- Footer ---- */
.site-footer {
  background: #0a1628; border-top: 1px solid var(--border);
  padding: 48px 0 24px;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 40px;
}
.footer-brand p { color: var(--text-muted); font-size: .875rem; margin-top: 10px; max-width: 280px; }
.footer-col h4  { color: #fff; font-size: .9rem; margin-bottom: 16px; font-weight: 700; }
.footer-col ul  { list-style: none; }
.footer-col li  { margin-bottom: 8px; }
.footer-col a   { color: var(--text-muted); font-size: .875rem; text-decoration: none; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 24px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: .8rem; color: var(--text-muted); flex-wrap: wrap; gap: 12px;
}
.footer-bottom a { color: var(--text-muted); }
.footer-bottom a:hover { color: var(--accent); }

/* ---- ACF Featured Tools ---- */
.featured-tools { margin: 20px 0; }
.featured-tools h4 { color: #fff; margin-bottom: 10px; }
.tools-list { display: flex; gap: 8px; flex-wrap: wrap; }
.tool-tag {
  padding: 4px 10px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; font-size: .78rem; color: var(--text-muted);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .content-area { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .menu-toggle { display: block; }
  .main-nav { display: none; }
  .main-nav.is-open {
    display: block; position: absolute; top: 100%; left: 0; right: 0;
    background: #0a1628; border-top: 1px solid var(--border); padding: 16px;
  }
  .main-nav.is-open ul { flex-direction: column; }
  .header-inner { flex-wrap: wrap; position: relative; }
  .footer-grid { grid-template-columns: 1fr; }
  .posts-grid { grid-template-columns: 1fr; }
  .hubs-grid  { grid-template-columns: 1fr 1fr; }
  .hero-search { flex-direction: column; }
}

/* ---- Utilities ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.mt-32 { margin-top: 32px; }
.mb-32 { margin-bottom: 32px; }
.text-muted { color: var(--text-muted); }
.section-pad { padding: 48px 0; }
