/* ============================================================
   Blog Public — style.css
   Thiết kế blog hiện đại, responsive, tối giản
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --primary:       #3b82f6;
  --primary-dark:  #1d4ed8;
  --primary-light: #eff6ff;
  --accent:        #f59e0b;
  --text-dark:     #1e293b;
  --text-body:     #334155;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;
  --bg:            #f8fafc;
  --bg-card:       #ffffff;
  --border:        #e2e8f0;
  --border-light:  #f1f5f9;
  --success:       #22c55e;
  --danger:        #ef4444;
  --warning:       #f59e0b;
  --radius:        10px;
  --radius-sm:     6px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:        0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:     0 10px 30px rgba(0,0,0,.12);
  --sidebar-w:     260px;
  --max-w:         1320px;
  --transition:    .2s ease;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

h1,h2,h3,h4,h5,h6 {
  color: var(--text-dark);
  line-height: 1.3;
  font-weight: 700;
}

/* ── Layout ────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
  gap: 2rem;
  align-items: start;
  padding: 2.5rem 0;
}

.layout-full {
  padding: 2.5rem 0;
}

/* ── Header / Navbar ───────────────────────────────────────── */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 64px;
}

.nav-logo {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-logo span { color: var(--text-dark); }

.nav-links {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.nav-links a {
  padding: .45rem .85rem;
  border-radius: var(--radius-sm);
  font-size: .925rem;
  font-weight: 500;
  color: var(--text-body);
  transition: background var(--transition), color var(--transition);
}
.nav-links a:hover, .nav-links a.active {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-search {
  flex: 1;
  max-width: 360px;
  position: relative;
  margin-left: auto;
}
.nav-search input {
  width: 100%;
  padding: .5rem 2.6rem .5rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  font-size: .9rem;
  background: var(--bg);
  color: var(--text-dark);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.nav-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.nav-search .search-icon {
  position: absolute;
  left: .85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.nav-search-submit {
  position: absolute;
  right: .4rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--transition);
}
.nav-search-submit:hover { background: var(--primary-dark); }

.nav-auth {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-shrink: 0;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59,130,246,.35);
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary-light);
}
.btn-ghost {
  background: transparent;
  color: var(--text-body);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); }

.btn-sm { padding: .35rem .9rem; font-size: .83rem; }
.btn-lg { padding: .75rem 1.75rem; font-size: 1rem; }

/* ── User dropdown ─────────────────────────────────────────── */
.user-menu { position: relative; }
.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .75rem .35rem .35rem;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  background: var(--bg-card);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
  transition: border-color var(--transition);
}
.user-avatar-btn:hover { border-color: var(--primary); }
.user-avatar-img {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-light);
}
.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + .5rem);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  overflow: hidden;
  z-index: 200;
}
.user-dropdown.open { display: block; }
.user-dropdown a, .user-dropdown button {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .65rem 1rem;
  font-size: .875rem;
  color: var(--text-body);
  background: none;
  border: none;
  text-align: left;
  transition: background var(--transition);
}
.user-dropdown a:hover, .user-dropdown button:hover {
  background: var(--bg);
  color: var(--text-dark);
}
.user-dropdown-status {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .65rem 1rem;
  font-size: .875rem;
  color: #15803d;
  background: #f0fdf4;
}
.user-dropdown-status-pending {
  color: #a16207;
  background: #fffbeb;
}
[data-theme="dark"] .user-dropdown-status {
  background: rgba(34, 197, 94, .12);
  color: #86efac;
}
[data-theme="dark"] .user-dropdown-status-pending {
  background: rgba(250, 204, 21, .12);
  color: #fde68a;
}
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: .25rem 0; }

/* ── Hero Section ──────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #60a5fa 100%);
  color: white;
  padding: 5rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(255,255,255,.08) 0%, transparent 60%);
  pointer-events: none;
}
.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.25);
  color: white;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .5px;
  padding: .35rem 1rem;
  border-radius: 99px;
  margin-bottom: 1.25rem;
  text-transform: uppercase;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); color: white; margin-bottom: 1rem; line-height: 1.2; }
.hero p { font-size: 1.1rem; opacity: .88; max-width: 520px; margin: 0 auto 2rem; }
.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.btn-hero-primary {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .75rem 1.75rem;
  border-radius: 99px;
  font-size: 1rem;
  font-weight: 700;
  background: white;
  color: #2563eb;
  border: none;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  transition: all .25s ease;
}
.btn-hero-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,.25);
  color: #1d4ed8;
}
.btn-hero-outline {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .75rem 1.75rem;
  border-radius: 99px;
  font-size: 1rem;
  font-weight: 700;
  background: transparent;
  color: white;
  border: 2px solid rgba(255,255,255,.6);
  transition: all .25s ease;
}
.btn-hero-outline:hover {
  background: rgba(255,255,255,.15);
  border-color: white;
  color: white;
  transform: translateY(-2px);
}
.hero-search {
  display: flex;
  max-width: 480px;
  margin: 0 auto;
  background: white;
  border-radius: 99px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.hero-search input {
  flex: 1;
  padding: .85rem 1.25rem;
  border: none;
  font-size: 1rem;
  outline: none;
  color: var(--text-dark);
}
.hero-search button {
  padding: .85rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  transition: background var(--transition);
}
.hero-search button:hover { background: var(--primary-dark); }

/* ── Newsletter Widget ─────────────────────────────────────── */
.newsletter-widget { background: linear-gradient(135deg, #eff6ff, #f0fdf4); }
.newsletter-desc {
  font-size: .875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.6;
}
.newsletter-form { display: flex; flex-direction: column; gap: .6rem; }
.newsletter-input {
  width: 100%;
  padding: .6rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  outline: none;
  background: white;
  transition: border-color var(--transition);
}
.newsletter-input:focus { border-color: var(--primary); }

/* ── CTA Section ───────────────────────────────────────────── */
.cta-section {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  padding: 4rem 0;
  margin-top: 4rem;
}
.cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.cta-inner h2 { font-size: 1.65rem; color: white; margin-bottom: .5rem; }
.cta-inner p { color: rgba(255,255,255,.8); font-size: .975rem; max-width: 520px; }
.cta-btns { display: flex; gap: 1rem; flex-shrink: 0; flex-wrap: wrap; }

/* ── Reading time badge ────────────────────────────────────── */
.read-time { color: var(--text-light); font-size: .78rem; }

/* ── Section Heading ───────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-dark);
  position: relative;
  padding-left: .9rem;
}
.section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: .15em;
  bottom: .15em;
  width: 4px;
  background: var(--primary);
  border-radius: 4px;
}
.view-all {
  font-size: .875rem;
  font-weight: 500;
  color: var(--primary);
}
.view-all:hover { color: var(--primary-dark); }

/* ── Post Card ─────────────────────────────────────────────── */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.post-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}
.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.post-card-thumb {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--border-light);
}
.post-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.post-card:hover .post-card-thumb img { transform: scale(1.05); }
.post-card-no-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--primary-light), #dbeafe);
  font-size: 2.5rem;
}

.post-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.post-card-cats {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.tag-chip {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
  transition: background var(--transition);
}
.tag-chip:hover { background: #dbeafe; color: var(--primary-dark); }
.tag-chip.tag { background: #fef3c7; color: #92400e; }
.tag-chip.tag:hover { background: #fde68a; }

.post-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
}
.post-card-title a { color: var(--text-dark); }
.post-card-title a:hover { color: var(--primary); }

.post-card-excerpt {
  font-size: .9rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .8rem;
  color: var(--text-light);
  margin-top: auto;
  padding-top: .5rem;
  border-top: 1px solid var(--border-light);
}
.post-card-meta .avatar-xs {
  width: 22px; height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
}
.post-card-meta span { display: flex; align-items: center; gap: .3rem; }

/* ── Featured Post (large card) ────────────────────────────── */
.featured-post {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 340px;
  transition: box-shadow var(--transition);
}
.featured-post:hover { box-shadow: var(--shadow-lg); }
.featured-post-thumb {
  overflow: hidden;
  background: var(--border-light);
}
.featured-post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.featured-post:hover .featured-post-thumb img { transform: scale(1.04); }
.featured-post-body {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .85rem;
}
.featured-label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.featured-post .post-card-title { font-size: 1.45rem; }
.featured-post .post-card-excerpt { -webkit-line-clamp: 4; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }

.sidebar-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.sidebar-widget-title {
  font-size: .875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--border-light);
}
.sidebar-widget-body { padding: 1rem 1.25rem; }

/* Category list */
.cat-list,
.cat-children {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.cat-item { list-style: none; }
.cat-row {
  display: flex;
  align-items: center;
  gap: .2rem;
  padding-left: calc(var(--cat-depth, 0) * 1rem);
}
.cat-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .5rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text-body);
  transition: background var(--transition), color var(--transition);
}
.cat-link:hover { background: var(--primary-light); color: var(--primary); }
.cat-toggle,
.cat-toggle-spacer {
  flex: 0 0 1.4rem;
  width: 1.4rem;
  height: 1.4rem;
}
.cat-toggle {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  position: relative;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.cat-toggle::before {
  content: '▸';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: .85rem;
}
.cat-toggle:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.cat-item.open > .cat-row .cat-toggle::before {
  transform: rotate(90deg);
}
.cat-children {
  margin-top: .15rem;
  margin-left: 1rem;
  padding-left: .5rem;
  border-left: 1px solid var(--border-light);
}
.cat-item.has-children > .cat-children {
  display: none;
}
.cat-item.has-children.open > .cat-children {
  display: flex;
}
.cat-count {
  font-size: .75rem;
  background: var(--bg);
  color: var(--text-muted);
  padding: .1rem .45rem;
  border-radius: 99px;
  font-weight: 600;
}

/* Tag cloud */
.tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Recent posts */
.recent-list { display: flex; flex-direction: column; gap: .1rem; }
.recent-item {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .6rem .5rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.recent-item:hover { background: var(--bg); }
.recent-thumb {
  width: 60px;
  height: 50px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--border-light);
}
.recent-thumb img { width: 100%; height: 100%; object-fit: cover; }
.recent-info { flex: 1; min-width: 0; }
.recent-info a {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.recent-info a:hover { color: var(--primary); }
.recent-date { font-size: .75rem; color: var(--text-light); margin-top: .2rem; }

/* ── Post Detail ───────────────────────────────────────────── */
.post-hero {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 2.5rem 0 0;
}
.post-hero-inner { max-width: 780px; }
.post-breadcrumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .83rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.post-breadcrumb a { color: var(--text-muted); }
.post-breadcrumb a:hover { color: var(--primary); }
.post-breadcrumb .sep { color: var(--border); }

.post-title { font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.25; margin-bottom: 1rem; }
.post-summary {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  font-style: italic;
}
.post-author-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border-light);
}
.author-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border-light);
  flex-shrink: 0;
}
.author-info .author-name { font-weight: 600; font-size: .925rem; }
.author-info .author-name a { color: var(--text-dark); }
.author-info .author-name a:hover { color: var(--primary); }
.author-info .post-meta-row {
  font-size: .8rem;
  color: var(--text-light);
  display: flex;
  gap: .75rem;
  align-items: center;
  margin-top: .15rem;
}

.post-cover {
  margin-top: 1.5rem;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  max-height: 320px;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}
.post-cover img { width: 100%; height: 320px; object-fit: cover; border-radius: var(--radius-sm); }

/* Post main layout: TOC (left) + content */
.post-main-layout {
  display: grid;
  grid-template-columns: 195px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

/* TOC sidebar (left, sticky) */
.post-toc-sidebar {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.post-toc-sidebar:empty { display: none; }
.post-toc-sidebar:empty + div { grid-column: 1 / -1; }
.post-toc-sidebar.collapsed .toc-list { display: none; }

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .65rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border-light);
}
.toc-title { font-weight: 700; font-size: .875rem; }
.toc-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1rem .4rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .8rem;
  line-height: 1.5;
}
.toc-toggle:hover { border-color: var(--primary); color: var(--primary); }

.toc-list { padding-left: 1.1rem; margin: 0; list-style: decimal; }
.toc-list li { margin-bottom: .3rem; }
.toc-list a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: .82rem;
  line-height: 1.4;
  display: block;
  padding: .1rem 0;
  transition: color .15s;
}
.toc-list a:hover,
.toc-list a.active { color: var(--primary); font-weight: 600; }
.toc-list .toc-h3 { padding-left: .75rem; }
.toc-list .toc-h3 a { font-size: .78rem; }

/* Post content typography */
.post-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow-sm);
}
.post-body {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text-body);
}
.post-body h2 { margin: 2rem 0 .75rem; font-size: 1.5rem; }
.post-body h3 { margin: 1.75rem 0 .6rem; font-size: 1.25rem; }
.post-body p { margin-bottom: 1.25rem; }
.post-body ul, .post-body ol { margin: 1rem 0 1rem 1.5rem; }
.post-body li { margin-bottom: .4rem; }
.post-body blockquote {
  border-left: 4px solid var(--primary);
  padding: .75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-muted);
}
.post-body pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: .9rem;
  line-height: 1.6;
  margin: 1.25rem 0;
}
.post-body code {
  font-family: 'Fira Code', 'Courier New', monospace;
  background: var(--bg);
  padding: .15rem .4rem;
  border-radius: 4px;
  font-size: .875em;
  color: #e11d48;
}
.post-body pre code { background: none; color: inherit; padding: 0; }
.post-body img { border-radius: var(--radius-sm); margin: 1.25rem 0; }
.post-body a { text-decoration: underline; }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* Post tags footer */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

/* ── Comments ──────────────────────────────────────────────── */
.comments-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  margin-top: 1.5rem;
}
.comments-count { font-size: 1.15rem; font-weight: 700; margin-bottom: 1.5rem; }

.comment-form textarea {
  width: 100%;
  padding: .85rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  resize: vertical;
  min-height: 120px;
  outline: none;
  transition: border-color var(--transition);
  color: var(--text-dark);
  background: var(--bg);
}
.comment-form textarea:focus { border-color: var(--primary); }
.comment-form-footer { display: flex; justify-content: flex-end; margin-top: .75rem; }

.comment-list { display: flex; flex-direction: column; gap: 0; }

.comment-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-light);
}
.comment-item:last-child { border-bottom: none; }
.comment-item.comment-highlight {
  background: #fef9c3;
  border-radius: var(--radius-sm);
  transition: background 2s ease;
}
[data-theme="dark"] .comment-item.comment-highlight { background: #3d3a00; }
.comment-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .6rem;
}
.comment-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border-light);
  flex-shrink: 0;
}
.comment-author { font-weight: 600; font-size: .9rem; color: var(--text-dark); }
.comment-date { font-size: .78rem; color: var(--text-light); }
.comment-body { font-size: .95rem; line-height: 1.65; color: var(--text-body); }
.comment-actions {
  margin-top: .5rem;
  display: flex;
  gap: .75rem;
}
.comment-actions button {
  background: none;
  border: none;
  font-size: .8rem;
  color: var(--text-muted);
  padding: .2rem .4rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.comment-actions button:hover { background: var(--bg); color: var(--primary); }

.comment-replies {
  padding-left: 2.5rem;
  border-left: 2px solid var(--border-light);
  margin-top: .75rem;
}
.reply-form-wrap { padding-left: 2.5rem; margin-top: .5rem; }
.reply-form-wrap textarea {
  min-height: 80px;
  padding: .65rem .85rem;
  font-size: .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  width: 100%;
  outline: none;
  resize: vertical;
  background: var(--bg);
  transition: border-color var(--transition);
}
.reply-form-wrap textarea:focus { border-color: var(--primary); }
.reply-form-footer { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .5rem; }

.no-comments {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-muted);
  font-size: .95rem;
}

/* ── Page Header (category, tag, search, author pages) ──────── */
.page-header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  padding: 3rem 0;
  margin-bottom: 0;
}
.page-header h1 { color: white; font-size: 2rem; margin-bottom: .5rem; }
.page-header p { opacity: .75; font-size: 1rem; }
.page-header .tag-chip { background: rgba(255,255,255,.15); color: white; }

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  margin-top: 2.5rem;
}
.pagination button {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  font-size: .875rem;
  color: var(--text-body);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pagination button:hover, .pagination button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ── Auth Pages ────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  padding: 2rem;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.auth-logo a { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.auth-title { font-size: 1.35rem; text-align: center; margin-bottom: .5rem; }
.auth-subtitle { font-size: .9rem; color: var(--text-muted); text-align: center; margin-bottom: 2rem; }

.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .875rem; font-weight: 600; color: var(--text-dark); margin-bottom: .4rem; }
.form-input {
  width: 100%;
  padding: .65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  outline: none;
  color: var(--text-dark);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-input.error { border-color: var(--danger); }
.form-error { font-size: .8rem; color: var(--danger); margin-top: .3rem; }

.auth-divider {
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
  margin: 1.25rem 0;
  position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.oauth-btns { display: flex; gap: .75rem; }
.oauth-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.oauth-btn:hover { background: var(--bg); border-color: var(--text-light); }

.auth-switch {
  text-align: center;
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

/* ── Toast Notifications ───────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: slideIn .25s ease;
  min-width: 240px;
  max-width: 360px;
}
.toast.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.toast.error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.toast.info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Loading / Skeleton ────────────────────────────────────── */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--text-muted);
  flex-direction: column;
  gap: 1rem;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state h3 { font-size: 1.1rem; margin-bottom: .5rem; color: var(--text-dark); }
.empty-state p { font-size: .9rem; }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-brand { color: white; font-size: 1.35rem; font-weight: 800; margin-bottom: .75rem; display: block; }
.footer-brand span { color: var(--primary); }
.footer-desc { font-size: .875rem; line-height: 1.7; }
.footer-col h4 { color: white; font-size: .875rem; font-weight: 700; margin-bottom: 1rem; }
.footer-links { display: flex; flex-direction: column; gap: .5rem; }
.footer-links a { font-size: .875rem; color: #94a3b8; transition: color var(--transition); }
.footer-links a:hover { color: white; }
.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .8rem;
}

/* ── Profile Page ──────────────────────────────────────────── */
.profile-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  gap: 1.5rem;
  align-items: center;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}
.profile-avatar {
  width: 90px; height: 90px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border-light);
  border: 3px solid var(--border);
  flex-shrink: 0;
}
.profile-info h2 { margin-bottom: .25rem; }
.profile-info .profile-email { font-size: .9rem; color: var(--text-muted); }
.profile-info .profile-roles { margin-top: .5rem; display: flex; gap: .35rem; flex-wrap: wrap; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .home-body { grid-template-columns: 1fr; }
  .home-sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
  .sidebar-widget { flex: 1; min-width: 260px; }
  .layout { grid-template-columns: 1fr; }
  .post-main-layout { grid-template-columns: 1fr; }
  .post-toc-sidebar { display: none; }
  .sidebar { display: grid; grid-template-columns: repeat(2, 1fr); }
  .featured-post { grid-template-columns: 1fr; min-height: auto; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .post-grid { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: 1fr; }
  .post-content { padding: 1.5rem; }
  .comments-section { padding: 1.25rem; }
  .hero { padding: 2.5rem 0; }
  .footer-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 1.75rem; }
  .comment-replies { padding-left: 1.25rem; }
  .reply-form-wrap { padding-left: 1.25rem; }
  .profile-header { flex-direction: column; text-align: center; }
  .profile-info .profile-roles { justify-content: center; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.6rem; }
  .hero-search { flex-direction: column; border-radius: var(--radius); }
  .hero-search button { border-radius: 0 0 var(--radius) var(--radius); }
  .pagination button { width: 34px; height: 34px; }
  .footer-bottom { flex-direction: column; gap: .5rem; text-align: center; }
}

/* ── Hamburger mobile menu ──────────────────────────────────── */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: .4rem;
  cursor: pointer;
  color: var(--text-dark);
}
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0; right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: .75rem 1.25rem 1rem;
    box-shadow: var(--shadow);
  }
}

/* ── Notification Bell ─────────────────────────────────────── */
.notif-wrap {
  position: relative;
}

.notif-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-body);
  transition: border-color var(--transition), background var(--transition);
}
.notif-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-card);
  line-height: 1;
}

.notif-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + .6rem);
  width: 340px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  overflow: hidden;
}
.notif-dropdown.open { display: block; }

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-dark);
}

.notif-mark-all {
  font-size: .78rem;
  color: var(--primary);
  background: none;
  border: none;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}
.notif-mark-all:hover { color: var(--primary-dark); text-decoration: underline; }

.notif-list {
  max-height: 380px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: #eff6ff; }
.notif-item.unread:hover { background: #dbeafe; }

.notif-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notif-icon.comment { background: #dbeafe; color: var(--primary); }
.notif-icon.reply   { background: #dcfce7; color: #16a34a; }

.notif-content {
  flex: 1;
  min-width: 0;
}
.notif-content p {
  font-size: .855rem;
  color: var(--text-dark);
  line-height: 1.4;
  margin-bottom: .2rem;
  word-break: break-word;
}
.notif-time {
  font-size: .77rem;
  color: var(--text-muted);
}

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 4px;
}

.notif-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
}

/* ── Categories Megamenu ───────────────────────────────────── */
.cat-mega-wrap {
  position: relative;
}

.cat-mega-btn {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .85rem;
  border-radius: var(--radius-sm);
  font-size: .925rem;
  font-weight: 500;
  color: var(--text-body);
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.cat-mega-btn:hover,
.cat-mega-btn.active {
  background: var(--primary-light);
  color: var(--primary);
}
.cat-mega-btn svg {
  transition: transform var(--transition);
}
.cat-mega-wrap:hover .cat-mega-btn svg,
.cat-mega-wrap.open .cat-mega-btn svg {
  transform: rotate(180deg);
}

.cat-megamenu {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 0px);
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}
.cat-mega-wrap:hover .cat-megamenu { display: block; }

/* Simple list (≤6 danh mục) */
.mega-simple {
  padding: .5rem 0;
}
.mega-simple .mega-group {
  margin-bottom: .25rem;
}
.mega-simple .mega-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 1rem;
  margin-bottom: 0;
}
.mega-simple .mega-group-title:hover {
  background: var(--primary-light);
}
.mega-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 1rem;
  font-size: .9rem;
  color: var(--text-body);
  transition: background var(--transition), color var(--transition);
}
.mega-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.mega-count {
  font-size: .75rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: .1rem .4rem;
  border-radius: 99px;
}
.mega-divider { border-top: 1px solid var(--border-light); margin: .25rem 0; }
.mega-all { color: var(--primary); font-weight: 500; }

/* Multi-column grid (>6 danh mục, kiểu CellphoneS) */
.mega-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 1.25rem;
  min-width: 620px;
}
.mega-col {
  padding: 0 .75rem;
  border-right: 1px solid var(--border-light);
}
.mega-col:first-child { padding-left: 0; }
.mega-col:last-child { border-right: none; padding-right: 0; }

.mega-group {
  margin-bottom: 1rem;
}
.mega-group-title {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-dark);
  padding: .25rem 0;
  margin-bottom: .3rem;
}
.mega-group-title:hover { color: var(--primary); }

.mega-subtree {
  position: relative;
  margin-left: .35rem;
}
.mega-subnode {
  position: relative;
}
.mega-sub-item {
  position: relative;
  display: block;
  font-size: .82rem;
  color: var(--text-muted);
  padding: .18rem 0 .18rem calc(1.15rem + (var(--mega-depth, 1) * .85rem));
  transition: color var(--transition);
}
.mega-sub-item:hover { color: var(--primary); }
.mega-subnode > .mega-sub-item::before {
  content: '';
  position: absolute;
  left: calc(.8rem + (var(--mega-depth, 1) * .75rem));
  top: 50%;
  width: .55rem;
  height: 1px;
  background: var(--border-light);
}

.mega-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
}
.mega-all-posts {
  font-size: .875rem;
  font-weight: 500;
  color: var(--primary);
}
.mega-all-posts:hover { color: var(--primary-dark); }

.mega-browser {
  display: grid;
  grid-template-columns: 240px minmax(520px, 1fr);
  min-width: 860px;
  max-width: 1040px;
  min-height: 420px;
}
.mega-browser-nav {
  background: var(--bg);
  border-right: 1px solid var(--border-light);
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.mega-browser-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  width: 100%;
  padding: .85rem .95rem;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text-body);
  font-size: .92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.mega-browser-nav-item:hover,
.mega-browser-nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
}
.mega-browser-content {
  background: var(--bg-card);
  padding: 1.25rem 1.35rem;
}
.mega-browser-panel { display: none; }
.mega-browser-panel.active { display: block; }
.mega-browser-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.mega-browser-root-link {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
}
.mega-browser-root-link:hover,
.mega-browser-all-link:hover { color: var(--primary); }
.mega-browser-all-link {
  font-size: .88rem;
  font-weight: 600;
  color: var(--primary);
}
.mega-browser-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}
.mega-browser-section {
  padding: .95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
}
.mega-browser-section-head {
  margin-bottom: .75rem;
}
.mega-browser-section-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-dark);
}
.mega-browser-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}
.mega-browser-chip,
.mega-browser-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: .5rem .8rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-body);
  font-size: .84rem;
  font-weight: 600;
}
.mega-browser-chip:hover,
.mega-browser-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.mega-browser-empty {
  display: flex;
  align-items: center;
}

/* ── Utility ────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.w-full { width: 100%; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }

/* ── Home sections ─────────────────────────────────────────── */
.home-section { padding: 2.5rem 0; }
.home-section + .home-section { padding-top: 0; }

/* ── Featured grid ─────────────────────────────────────────── */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
@media (max-width: 900px) {
  .featured-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .featured-grid { grid-template-columns: 1fr; }
}

/* ── Home body: main + sidebar ─────────────────────────────── */
.home-body {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2.5rem;
  align-items: start;
}
.home-main { min-width: 0; }

/* ── Home Sidebar ──────────────────────────────────────────── */
.home-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: sticky;
  top: 80px;
}
.sidebar-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.sidebar-widget .section-header { margin-bottom: .75rem; }
.sidebar-widget .section-title { font-size: 1rem; }

/* ── Category list in sidebar ──────────────────────────────── */
.home-cat-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-top: .5rem;
}
.home-category-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg) 100%);
  overflow: hidden;
}
.home-category-root {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1rem;
  font-size: .98rem;
  font-weight: 700;
  color: var(--text-dark);
}
.home-category-root:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.home-category-children,
.home-category-empty {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  padding: 0 1rem 1rem;
}
.home-category-child {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: .5rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-body);
  font-size: .84rem;
  font-weight: 600;
}
.home-category-child:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.home-category-child--single {
  font-weight: 500;
}

/* ── Categories Section (old — kept for other pages) ────────── */
.categories-section {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1.75rem 0;
}
/* Wrapper cho phép scroll ngang khi tràn */
.categories-scroll-wrap {
  position: relative;
  overflow: hidden;
  margin-top: 1rem;
}
.categories-scroll-wrap::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 48px; height: 100%;
  background: linear-gradient(to left, var(--bg-card), transparent);
  pointer-events: none;
}
.categories-pills {
  display: flex;
  gap: .65rem;
  overflow-x: auto;
  padding-bottom: .5rem;
  scrollbar-width: none;      /* Firefox */
  -ms-overflow-style: none;   /* IE */
  scroll-snap-type: x mandatory;
}
.categories-pills::-webkit-scrollbar { display: none; } /* Chrome/Safari */
.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .5rem 1.1rem;
  border-radius: 99px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-body);
  white-space: nowrap;
  flex-shrink: 0;
  scroll-snap-align: start;
  transition: all .2s ease;
  cursor: pointer;
}
.cat-pill:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.cat-pill-img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
}

/* ── Tags Section (Homepage) ───────────────────────────────── */
.tags-section {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1.75rem 0;
}
.home-tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
}
.home-tag-chip {
  display: inline-block;
  padding: .35rem .9rem;
  border-radius: 99px;
  font-size: .85rem;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
  border: 1.5px solid #fde68a;
  transition: all .2s ease;
  white-space: nowrap;
}
.home-tag-chip:hover {
  background: #fde68a;
  color: #78350f;
  border-color: #f59e0b;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* ── Featured post card variant ───────────────────────────── */
.post-card--featured .featured-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: .1rem;
}
.post-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 900px) {
  .post-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 580px) {
  .post-grid-3 { grid-template-columns: 1fr; }
}

/* ── Series / Learning Path Section ───────────────────────── */
.series-section {
  background: var(--bg);
  padding: 3rem 0;
  margin-top: 2rem;
}
.series-subtitle {
  font-size: .9rem;
  color: var(--text-muted);
}
.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.series-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease;
  display: flex;
  flex-direction: column;
}
.series-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}
.series-card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  overflow: hidden;
  flex-shrink: 0;
}
.series-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.series-card:hover .series-card-thumb img { transform: scale(1.06); }
.series-card-no-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.series-badge {
  position: absolute;
  top: .6rem;
  right: .6rem;
  background: rgba(0,0,0,.55);
  color: white;
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 99px;
  backdrop-filter: blur(4px);
}
.series-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.series-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.4;
}
.series-card-desc {
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.series-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: .75rem;
  border-top: 1px solid var(--border-light);
}
.series-card-meta {
  font-size: .8rem;
  color: var(--text-muted);
}
.series-card-link {
  font-size: .85rem;
  font-weight: 600;
  color: var(--primary);
}
.series-card-link:hover { color: var(--primary-dark); }

/* ── Newsletter full-width Section ────────────────────────── */
.newsletter-section {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  padding: 4rem 0;
  margin-top: 2rem;
  text-align: center;
}
.newsletter-full {
  max-width: 560px;
}
.newsletter-full-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}
.newsletter-section h2 {
  font-size: 1.75rem;
  color: white;
  margin-bottom: .5rem;
}
.newsletter-section p {
  color: rgba(255,255,255,.75);
  margin-bottom: 1.75rem;
  font-size: 1rem;
}
.newsletter-full-form {
  display: flex;
  gap: .75rem;
  max-width: 460px;
  margin: 0 auto;
  flex-wrap: wrap;
}
.newsletter-full-input {
  flex: 1;
  min-width: 200px;
  padding: .75rem 1.25rem;
  border: none;
  border-radius: 99px;
  font-size: .95rem;
  outline: none;
  background: white;
  color: var(--text-dark);
}

/* ── CTA → Footer spacing fix ──────────────────────────────── */
.cta-section + .site-footer { margin-top: 0; }
.newsletter-section + .cta-section { margin-top: 0; }

/* ── Responsive: new elements ──────────────────────────────── */
@media (max-width: 768px) {
  .hero { padding: 3rem 0; }
  .hero-cta { gap: .75rem; }
  .btn-hero-primary,
  .btn-hero-outline { padding: .65rem 1.4rem; font-size: .95rem; }
  .cta-section { padding: 2.5rem 0; }
  .cta-inner { flex-direction: column; text-align: center; }
  .cta-inner h2 { font-size: 1.35rem; }
  .cta-btns { justify-content: center; }
  .series-grid { grid-template-columns: 1fr; }
  .newsletter-full-form { flex-direction: column; align-items: center; }
  .newsletter-full-input { width: 100%; border-radius: var(--radius-sm); }
  .newsletter-section h2 { font-size: 1.4rem; }
}
@media (max-width: 480px) {
  .hero-cta { flex-direction: column; align-items: center; }
  .btn-hero-primary,
  .btn-hero-outline { width: 100%; max-width: 260px; justify-content: center; }
  .cta-btns { flex-direction: column; align-items: center; width: 100%; }
  .cta-btns .btn-hero-primary,
  .cta-btns .btn-hero-outline { width: 100%; max-width: 260px; justify-content: center; }
}

/* ── Dark mode ─────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:            #0f172a;
  --bg-card:       #1e293b;
  --border:        #334155;
  --border-light:  #1e293b;
  --text-dark:     #f1f5f9;
  --text-body:     #cbd5e1;
  --text-muted:    #94a3b8;
  --text-light:    #64748b;
  --primary-light: #1e3a5f;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.3);
  --shadow:        0 4px 12px rgba(0,0,0,.4);
  --shadow-lg:     0 10px 30px rgba(0,0,0,.5);
}
[data-theme="dark"] .site-header { background: #1e293b; }
[data-theme="dark"] .newsletter-widget { background: linear-gradient(135deg, #1e3a5f, #1a3a2a); }
[data-theme="dark"] .newsletter-input { background: #0f172a; color: var(--text-dark); }
[data-theme="dark"] .post-body pre { background: #020617; }
[data-theme="dark"] .nav-search input { background: #0f172a; color: var(--text-dark); }
[data-theme="dark"] .auth-page { background: linear-gradient(135deg, #0f172a, #1e293b); }
[data-theme="dark"] .notif-item.unread { background: #1e3a5f; }
[data-theme="dark"] .notif-item.unread:hover { background: #1e3a8a; }
[data-theme="dark"] .page-header { background: linear-gradient(135deg, #0f172a, #1e293b); }
[data-theme="dark"] .hero { background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #2563eb 100%); }

/* ── Theme toggle button ───────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.theme-toggle:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-color: var(--primary);
}
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ============================================================
   Membership
   ============================================================ */

/* Badge trên post card */
.post-card-member-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  padding: .15rem .65rem;
  margin-bottom: .4rem;
}
[data-theme="dark"] .post-card-member-badge {
  color: #fcd34d;
  background: rgba(252,211,77,.12);
  border-color: rgba(252,211,77,.35);
}

/* Badge trong bài viết */
.member-only-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  font-weight: 600;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  padding: .4rem .85rem;
  margin-bottom: 1.25rem;
}
[data-theme="dark"] .member-only-badge {
  color: #fcd34d;
  background: rgba(252,211,77,.1);
  border-color: rgba(252,211,77,.3);
}

/* Membership gate */
.membership-gate {
  text-align: center;
  padding: 2.5rem 2rem;
  margin: 2rem 0;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}
.membership-gate-icon {
  font-size: 2.5rem;
  margin-bottom: .75rem;
}
.membership-gate-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: .5rem;
  color: var(--text-primary);
}
.membership-gate-desc {
  color: var(--text-muted);
  font-size: .9rem;
  max-width: 480px;
  margin: 0 auto 1.25rem;
}
.membership-gate-btn {
  display: inline-block;
  padding: .55rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  background: var(--primary);
  color: #fff;
  transition: opacity .2s;
}
.membership-gate-btn:hover { opacity: .85; }
.membership-gate-btn.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.membership-gate-pending {
  display: inline-block;
  font-size: .875rem;
  font-weight: 600;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  padding: .35rem 1rem;
}
[data-theme="dark"] .membership-gate-pending {
  color: #fcd34d;
  background: rgba(252,211,77,.1);
  border-color: rgba(252,211,77,.3);
}

/* ── Membership page ─── */
.membership-hero {
  text-align: center;
  padding: 3rem 1rem 2.5rem;
}
.membership-hero-icon { font-size: 3rem; margin-bottom: .75rem; }
.membership-hero-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: .65rem;
  color: var(--text-primary);
}
.membership-hero-desc {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 520px;
  margin: 0 auto;
}

/* Status card */
.membership-status-card {
  margin-bottom: 2.5rem;
}
.membership-status {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.5rem 2rem;
  border-radius: var(--radius-md);
  border: 2px solid;
}
.membership-status--active  { background: #f0fdf4; border-color: #86efac; }
.membership-status--pending { background: #fffbeb; border-color: #fcd34d; }
.membership-status--none    { background: var(--bg-secondary); border-color: var(--border); }
.membership-status--guest   { background: var(--bg-secondary); border-color: var(--border); }
[data-theme="dark"] .membership-status--active  { background: rgba(134,239,172,.08); }
[data-theme="dark"] .membership-status--pending { background: rgba(252,211,77,.08); }
.ms-icon  { font-size: 2rem; flex-shrink: 0; }
.ms-title { font-weight: 700; font-size: 1.1rem; color: var(--text-primary); margin-bottom: .25rem; }
.ms-desc  { color: var(--text-muted); font-size: .9rem; }

/* Benefits */
.membership-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}
.membership-benefits-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.benefit-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.benefit-icon  { font-size: 1.75rem; flex-shrink: 0; }
.benefit-title { font-weight: 600; margin-bottom: .25rem; color: var(--text-primary); }
.benefit-desc  { font-size: .875rem; color: var(--text-muted); }

/* ── Language Switcher ───────────────────────────────────────── */
.lang-toggle {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .2rem .55rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text-primary);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  line-height: 1.5;
}
.lang-toggle:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
