/* =====================================================================
   Blog (v6.10.0, danh sách gọn từ v6.10.1) — views/client/blogs.php (danh sách) + blog.php (bài viết)
   Cần pages.css (hero, .pg-prose, .pg-btn). Biến màu theme ⇒ giao diện tối tự khớp.
   ===================================================================== */
.nw-wrap { padding: 24px 0 56px; }
.nw-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.nw-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.nw-tabs::-webkit-scrollbar { display: none; }
.nw-tabs a {
    flex: none; padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
    border: 1px solid var(--border, #e8e8e8); background: var(--surface, #fff); color: var(--text, #555);
}
.nw-tabs a span { font-weight: 400; opacity: .7; margin-left: 4px; }
.nw-tabs a:hover { border-color: var(--primary, #002594); color: var(--primary, #002594); }
.nw-tabs a.is-active, .nw-tabs a.is-active:hover { background: var(--primary, #002594); border-color: var(--primary, #002594); color: #fff; }
html[data-theme="dark"] .nw-tabs a.is-active, html[data-theme="dark"] .nw-tabs a.is-active span { color: #fff; }
.nw-search { display: flex; flex: 0 1 320px; min-width: 220px; }
.nw-search input {
    flex: 1; min-width: 0; height: 44px; padding: 0 14px; font-size: 15px; border-radius: 10px 0 0 10px;
    border: 1px solid var(--border, #e8e8e8); border-right: 0; background: var(--surface, #fff); color: var(--heading, #39404a);
}
.nw-search input:focus { outline: none; border-color: var(--primary, #002594); }
.nw-search button { width: 48px; border: 0; border-radius: 0 10px 10px 0; background: var(--primary, #002594); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.nw-search button svg { width: 18px; height: 18px; }
/* Máy tính: tìm kiếm + chuyên mục ở cột phải; điện thoại (cột phải rơi xuống cuối): hàng tab + tìm kiếm ở đầu. */
@media (min-width: 992px) { .nw-head { display: none; } }
@media (max-width: 991px) { .nw-desk { display: none; } }
.nw-aside .nw-search { flex: none; min-width: 0; }

.nw-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
@media (max-width: 991px) { .nw-layout { grid-template-columns: minmax(0, 1fr); } }

/* ---- Ảnh bài ---- */
.nw-thumb { display: block; position: relative; overflow: hidden; border-radius: 10px; background: var(--surface-2, #f1f3f6); aspect-ratio: 16 / 9; }
.nw-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.nw-thumb:hover img { transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) { .nw-thumb img { transition: none; } .nw-thumb:hover img { transform: none; } }

.nw-cat { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--primary, #002594); text-decoration: none; }
.nw-cat:hover { text-decoration: underline; }
html[data-theme="dark"] .nw-cat { color: #8fb0ff; }
.nw-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--gray, #777); }
.nw-meta > * + *::before { content: "·"; margin-right: 12px; opacity: .6; }

/* ---- Danh sách bài: mỗi bài một hàng (ảnh nhỏ trái nếu có ảnh thật, chữ phải) — ít bài vẫn không trống ---- */
.nw-list { display: flex; flex-direction: column; gap: 16px; }
.nw-row { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: center; padding: 16px; background: var(--surface, #fff); border: 1px solid var(--border, #e8e8e8); border-radius: 14px; }
.nw-row.no-img { grid-template-columns: minmax(0, 1fr); padding: 20px 22px; }
.nw-row .nw-title { font-size: 20px; }
.nw-row .nw-excerpt { -webkit-line-clamp: 2; margin: 0 0 8px; }
.nw-list-sm .nw-row { grid-template-columns: 160px minmax(0, 1fr); gap: 16px; padding: 12px; }
.nw-list-sm .nw-row.no-img { grid-template-columns: minmax(0, 1fr); padding: 16px 18px; }
.nw-list-sm .nw-row .nw-title { font-size: 17px; }
@media (max-width: 575px) {
    .nw-row, .nw-list-sm .nw-row { grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 12px; }
    .nw-row .nw-title, .nw-list-sm .nw-row .nw-title { font-size: 16px; }
    .nw-row .nw-excerpt { display: none; }
}
.nw-title { font-size: 18px; line-height: 1.4; font-weight: 700; margin: 4px 0 6px; color: var(--heading, #39404a); }
.nw-title a { color: inherit; text-decoration: none; }
.nw-title a:hover { color: var(--primary, #002594); }
html[data-theme="dark"] .nw-title a:hover { color: #8fb0ff; }
.nw-excerpt { font-size: 15px; line-height: 1.6; color: var(--text, #555); margin: 0 0 10px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nw-section-title { font-size: 20px; font-weight: 700; color: var(--heading, #39404a); margin: 0 0 18px; padding-left: 12px; border-left: 4px solid var(--primary, #002594); }
.nw-empty { padding: 40px 20px; text-align: center; border: 1px dashed var(--border, #e8e8e8); border-radius: 14px; color: var(--gray, #777); }

/* ---- Phân trang ---- */
.nw-pager { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 34px; }
.nw-pager a, .nw-pager span { min-width: 44px; height: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; font-weight: 600; text-decoration: none; border: 1px solid var(--border, #e8e8e8); background: var(--surface, #fff); color: var(--text, #555); }
.nw-pager a:hover { border-color: var(--primary, #002594); color: var(--primary, #002594); }
.nw-pager .is-current { background: var(--primary, #002594); border-color: var(--primary, #002594); color: #fff; }
html[data-theme="dark"] .nw-pager .is-current { color: #fff; }

/* ---- Cột phải ---- */
.nw-aside { display: flex; flex-direction: column; gap: 22px; }
.nw-box { background: var(--surface, #fff); border: 1px solid var(--border, #e8e8e8); border-radius: 14px; padding: 20px; }
.nw-box-title { font-size: 16px; font-weight: 700; color: var(--heading, #39404a); margin: 0 0 14px; text-transform: uppercase; letter-spacing: .3px; }
.nw-rank { list-style: none; margin: 0; padding: 0; counter-reset: nw; }
.nw-rank li { counter-increment: nw; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 12px 0; border-top: 1px solid var(--border, #e8e8e8); }
.nw-rank li:first-child { border-top: 0; padding-top: 0; }
.nw-rank li::before { content: counter(nw); font-size: 26px; line-height: 1; font-weight: 800; color: var(--primary, #002594); opacity: .35; }
html[data-theme="dark"] .nw-rank li::before { color: #8fb0ff; opacity: .5; }
.nw-rank a { color: var(--heading, #39404a); text-decoration: none; font-weight: 600; font-size: 15px; line-height: 1.45; }
.nw-rank a:hover { color: var(--primary, #002594); }
.nw-rank .nw-meta { margin-top: 4px; }
.nw-cats { list-style: none; margin: 0; padding: 0; }
.nw-cats li { border-top: 1px solid var(--border, #e8e8e8); }
.nw-cats li:first-child { border-top: 0; }
.nw-cats a { display: flex; justify-content: space-between; padding: 10px 0; min-height: 44px; align-items: center; color: var(--text, #555); text-decoration: none; }
.nw-cats a:hover, .nw-cats a.is-active { color: var(--primary, #002594); }
.nw-cats a.is-active { font-weight: 600; }
html[data-theme="dark"] .nw-cats a:hover, html[data-theme="dark"] .nw-cats a.is-active { color: #8fb0ff; }
.nw-cats span { font-size: 13px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2, #f1f3f6); color: var(--gray, #777); }
.nw-cta { background: linear-gradient(135deg, var(--primary, #002594), var(--primary1, #3d65c2)); border: 0; color: #fff; }
.nw-cta .nw-box-title, .nw-cta p { color: #fff; }
.nw-cta p { font-size: 14px; line-height: 1.6; margin: 0 0 14px; opacity: .92; }
.nw-cta a.pg-btn { background: #fff; color: var(--primary, #002594); width: 100%; }
html[data-theme="dark"] .nw-cta .nw-box-title, html[data-theme="dark"] .nw-cta p { color: #fff; }
html[data-theme="dark"] .nw-cta a.pg-btn { color: #002594; }

/* ---- Trang bài viết ---- */
.ar-head { max-width: 860px; }
.ar-head h1 { font-size: 28px; line-height: 1.3; }
@media (max-width: 767px) { .ar-head h1 { font-size: 22px; } }
.ar-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 14px; color: rgba(255, 255, 255, .88); }
.ar-meta > * + *::before { content: "·"; margin-right: 14px; opacity: .7; }
html[data-theme="dark"] .ar-meta, html[data-theme="dark"] .ar-meta span, html[data-theme="dark"] .ar-meta time { color: rgba(255, 255, 255, .88); }
.ar-cover { margin: 0 0 26px; border-radius: 14px; overflow: hidden; background: var(--surface-2, #f1f3f6); aspect-ratio: 16 / 9; }
.ar-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ar-body { font-size: 17px; line-height: 1.8; }
.ar-body h2 { font-size: 24px; }
.ar-share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border, #e8e8e8); }
.ar-share > span { font-weight: 600; color: var(--heading, #39404a); margin-right: 4px; }
.ar-share a, .ar-share button {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
    text-decoration: none; cursor: pointer; border: 1px solid var(--border, #e8e8e8); background: var(--surface, #fff); color: var(--text, #555);
}
.ar-share a:hover, .ar-share button:hover { border-color: var(--primary, #002594); color: var(--primary, #002594); }
.ar-share svg { width: 16px; height: 16px; }
.ar-toc { position: sticky; top: 112px; }
.ar-toc ol { list-style: none; margin: 0; padding: 0; }
.ar-toc a { display: block; padding: 6px 10px; border-left: 3px solid transparent; font-size: 14px; line-height: 1.45; color: var(--text, #555); text-decoration: none; }
.ar-toc a:hover { color: var(--heading, #39404a); }
.ar-toc a.is-active { color: var(--primary, #002594); border-left-color: var(--primary, #002594); font-weight: 600; }
html[data-theme="dark"] .ar-toc a.is-active { color: #8fb0ff; border-left-color: #8fb0ff; }
.ar-related { margin-top: 36px; }
.ar-cta { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; padding: 22px 24px; border-radius: 14px; background: var(--surface-2, #f7f8fa); border: 1px solid var(--border, #e8e8e8); }
.ar-cta h2 { font-size: 18px; margin: 0 0 4px; color: var(--heading, #39404a); }
.ar-cta p { margin: 0; color: var(--text, #555); font-size: 15px; }
/* Mục lục bài viết bám theo khi cuộn: cột phải kéo dài bằng bài, mục lục là phần tử CUỐI của cột (sticky
   không đè lên khối nào phía sau). Điện thoại dùng bản thu gọn .pg-toc-mobile ở đầu bài. */
.ar-layout { align-items: stretch; }
@media (max-width: 991px) { .pg-toc-desktop { display: none; } }
.nw-box-title, .nw-section-title, .ar-cta h2, .nw-title { line-height: 1.4; }
