/* CSS nền tối thiểu cho các trang WordPress (bài viết, chuyên mục, tìm kiếm, 404).
   CSS giao diện riêng của bạn đặt ở site-style.css (nạp sau, ghi đè được file này). */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 16px/1.65 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: #1e1e1e; }
img { max-width: 100%; height: auto; }
/* Link: không gạch chân ở mọi trạng thái (theme mặc định) */
a { color: #2271b1; text-decoration: none; }
a:hover, a:focus, a:active { text-decoration: none; }

/* Phần bị "Tạm ẩn" trong trình sửa giao diện: không hiện ngoài website */
body:not(.mab-builder-frame) [data-mab-hidden] { display: none !important; }

.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.skip-link:focus { position: fixed !important; top: 8px; left: 8px; z-index: 100000; width: auto; height: auto; clip: auto; padding: 10px 16px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); }

/* Kích thước lấy từ Cài đặt giao diện (biến --mab-container, --mab-sidebar-w) */
.mab-container { width: min(var(--mab-container, 1140px), 100% - 32px); margin-inline: auto; }
.mab-full { width: 100%; }
.mab-full > .mab-main { padding-top: 0; }
.mab-main { padding: 40px 0 60px; min-width: 0; }

/* Bố cục có thanh bên trái/phải; màn hình nhỏ thì thanh bên xuống dưới nội dung */
.mab-layout.has-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) var(--mab-sidebar-w, 300px); gap: 48px; }
.mab-layout.sidebar-left { grid-template-columns: var(--mab-sidebar-w, 300px) minmax(0, 1fr); }
.mab-layout.sidebar-left .mab-sidebar { order: -1; }
.mab-full.has-sidebar { padding-inline: 16px; }
.mab-sidebar { padding: 40px 0 60px; min-width: 0; }
@media (max-width: 900px) {
    .mab-layout.has-sidebar, .mab-layout.sidebar-left { grid-template-columns: 1fr; gap: 0; }
    .mab-layout.sidebar-left .mab-sidebar { order: 0; }
    .mab-sidebar { padding-top: 0; }
}

.dynamic-posts-list { list-style: none; margin: 0; padding: 0; }
.dynamic-posts-list li { padding: 10px 0; border-bottom: 1px solid #eee; }
.dynamic-posts-list li:last-child { border-bottom: 0; }
.dynamic-posts-list a { display: block; color: inherit; font-weight: 500; line-height: 1.4; text-decoration: none; }
.dynamic-posts-list a:hover { color: #2271b1; }
.dynamic-posts-list time { font-size: 13px; color: #757575; }
.dynamic-posts-list li.has-thumb { display: flex; align-items: flex-start; gap: 12px; }
.dynamic-posts-list .mab-list-thumb { flex: 0 0 80px; }
.dynamic-posts-list .mab-list-thumb img { display: block; width: 80px; height: 80px; object-fit: cover; border-radius: 6px; }
.dynamic-posts-list .mab-list-text { flex: 1; min-width: 0; }
/* Tiêu đề dài quá 3 dòng thì cắt bằng dấu … */
.dynamic-posts-list a:not(.mab-list-thumb) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.mab-page-header { margin-bottom: 28px; }
.mab-page-title, .mab-entry-title { line-height: 1.25; margin: 0 0 12px; }
/* Có #site-content: tiêu đề bài viết, chuyên mục không bị quy tắc h1 của khối lớn (hero, banner) phóng to */
#site-content .mab-page-title, #site-content .mab-entry-title { font-size: clamp(26px, calc(2.2vw + 8px), 36px); line-height: 1.25; }
.mab-entry-meta { color: #757575; font-size: 14px; margin-bottom: 20px; }
.mab-entry-thumb { margin: 0 0 24px; }
.mab-entry-meta a { color: inherit; }
/* Mục lục tự động (Cài đặt giao diện web › Bài viết) */
.mab-toc { margin: 0 0 24px; padding: 14px 18px; background: #f6f7f9; border: 1px solid #e5e7eb; border-radius: 10px; }
.mab-toc summary { cursor: pointer; font-weight: 700; }
.mab-toc ol { margin: 10px 0 0; padding-left: 20px; }
.mab-toc li { margin: 4px 0; }
.mab-toc li.lv-3 { margin-left: 16px; list-style-type: circle; }
.mab-toc a { text-decoration: none; }
.mab-toc a:hover { color: #1d4ed8; }
.mab-entry-content :is(h2, h3)[id] { scroll-margin-top: 90px; }
/* Cột đọc 760px; trang chọn "Rộng hết khung" hoặc "Tràn toàn màn hình" (Cài đặt giao diện web › Trang) thì bỏ giới hạn */
.mab-entry-content { max-width: 760px; }
.mab-main.is-wide .mab-entry-content { max-width: none; }
.mab-entry-tags-label { margin-right: 4px; font-weight: 600; }
.mab-entry-tags a { display: inline-block; margin: 4px 4px 0 0; padding: 2px 10px; background: #f0f0f1; border-radius: 99px; font-size: 13px; text-decoration: none; }

.dynamic-posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; }
.dynamic-posts-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dynamic-posts-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dynamic-posts-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1023px) { .dynamic-posts-grid.cols-3, .dynamic-posts-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Điện thoại: số cột theo Cài đặt giao diện web (mặc định 1 bài / hàng) */
@media (max-width: 767px) {
    .dynamic-posts-grid[class*="cols-"] { grid-template-columns: 1fr; gap: 20px; }
    .dynamic-posts-grid.m-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .m-cols-2 .post-item h2 { font-size: 15px; }
    .m-cols-2 .post-item p { font-size: 13px; }
}

/* Kiểu danh sách: ảnh bên trái, chữ bên phải */
.dynamic-posts-grid.is-list { grid-template-columns: 1fr; gap: 20px; }
.is-list .post-item.has-thumb { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.is-list .post-item { padding-bottom: 20px; border-bottom: 1px solid #eee; }
.is-list .post-item h2 { margin-top: 0; }
@media (max-width: 600px) { .is-list .post-item.has-thumb { grid-template-columns: 1fr; } }

/* Bài viết liên quan */
/* Bài viết liên quan: khung nền nhạt, thẻ trắng. Mỗi website đổi màu nhấn bằng biến --mab-accent trong CSS bổ sung */
.mab-related { margin: 48px 0 30px; padding: 24px; background: #f7f8fa; border: 1px solid #eceef1; border-radius: 14px; }
.mab-related .post-item { overflow: hidden; background: #fff; border: 1px solid #eceef1; border-radius: 10px; transition: transform .2s, box-shadow .2s; }
.mab-related .post-item:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(15, 23, 42, .1); }
.mab-related .post-item > a { display: block; }
.mab-related .post-item img { border-radius: 0; }
.mab-related .post-item h4 a:hover { color: var(--mab-accent, #2271b1); }
/* Tiêu đề dài quá 3 dòng thì cắt bằng dấu … */
.mab-related .post-item h4 a { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; color: inherit; text-decoration: none; }
@media (max-width: 767px) { .mab-related { padding: 16px; } }
@media (prefers-reduced-motion: reduce) { .mab-related .post-item { transition: none; } .mab-related .post-item:hover { transform: none; } }
.post-item img { display: block; width: 100%; height: auto; aspect-ratio: var(--mab-ratio, var(--mab-post-ratio, 5 / 3)); object-fit: cover; border-radius: 6px; }
/* Có thêm #site-content: tiêu đề thẻ bài không bị quy tắc tiêu đề chung của website (h2, #site-content h2…) phóng to */
.post-item h2, .post-item h3, .post-item h4, #site-content .post-item h2, #site-content .post-item h3, #site-content .post-item h4 { font-size: 18px; line-height: 1.35; margin: 12px 0 6px; }
#site-content .cols-2 .post-item h2, #site-content .cols-2 .post-item h3, #site-content .cols-2 .post-item h4 { font-size: 20px; }
#site-content .is-list .post-item h2 { margin-top: 0; }
#site-content .mab-related .post-item h4 { font-size: 16px; line-height: 1.4; margin: 0; padding: 12px 14px 14px; }
.mab-related > h3, #site-content .mab-related > h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; font-size: 20px; line-height: 1.3; }
.mab-related > h3::before { content: ""; flex: 0 0 4px; height: 1.1em; background: var(--mab-accent, #2271b1); border-radius: 4px; }
@media (max-width: 767px) { #site-content .m-cols-2 .post-item h2 { font-size: 15px; } }
.post-item h2 a, .post-item h3 a, .post-item h4 a { color: inherit; text-decoration: none; }
.post-item p { margin: 0; color: #555; font-size: 15px; }

/* Chuyên mục, thẻ, tìm kiếm, danh sách bài viết: thẻ có khung, đồng bộ với thẻ sản phẩm */
.mab-page-header .search-form { margin: 16px 0 0; }
.mab-archive-desc { color: #444; }
.mab-archive-count { margin: 8px 0 0; color: #666; font-size: 14px; }
.mab-archive .post-item { overflow: hidden; background: #fff; border: 1px solid #e6e8eb; border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
.mab-archive .post-item:hover { border-color: #d3d7dc; box-shadow: 0 6px 18px rgba(0, 0, 0, .08); }
.mab-archive .post-item > a { display: block; }
.mab-archive .post-item img { border-radius: 0; }
.mab-archive .post-item-body { padding: 14px 16px 16px; }
#site-content .mab-archive .post-item h2 { margin: 0 0 6px; }
.mab-archive .post-item h2 a { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.mab-archive .post-item h2 a:hover { color: var(--mab-accent, #2271b1); }
.mab-archive.is-list .post-item { padding-bottom: 0; border-bottom: 1px solid #e6e8eb; }
.mab-archive.is-list .post-item.has-thumb { gap: 0; }
@media (max-width: 767px) { .mab-archive.m-cols-2 .post-item-body { padding: 10px 12px 12px; } }
@media (prefers-reduced-motion: reduce) { .mab-archive .post-item { transition: none; } }

.pagination { margin-top: 36px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.pagination .nav-links { justify-content: center; }.page-numbers { display: inline-block; min-width: 38px; box-sizing: border-box; padding: 7px 10px; border: 1px solid #ddd; border-radius: 6px; line-height: 1.4; text-align: center; text-decoration: none; }
.page-numbers.current { background: var(--mab-accent, #2271b1); border-color: var(--mab-accent, #2271b1); color: #fff; }

.mab-none { text-align: center; padding: 60px 0; }
/* Ô tìm kiếm: bo tròn, nút kính lúp nằm trong ô (searchform.php) */
.search-form { position: relative; display: flex; align-items: center; width: 100%; max-width: 420px; }
.mab-none .search-form { margin: 0 auto; }
.search-field { flex: 1; min-width: 0; height: 46px; padding: 0 52px 0 20px; border: 1px solid #e2e8f0; border-radius: 999px; background: #f1f5f9; color: #0f172a; font: inherit; font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; -webkit-appearance: none; appearance: none; }
.search-field::placeholder { color: #64748b; opacity: 1; }
.search-field:focus { border-color: #93c5fd; background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.search-field::-webkit-search-cancel-button { display: none; }
.search-submit { position: absolute; top: 50%; right: 5px; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #334155; cursor: pointer; transform: translateY(-50%); transition: background .15s, color .15s; }
.search-submit:hover, .search-submit:focus-visible { background: #e2e8f0; color: #0f172a; outline: none; }

.mab-comments { max-width: 760px; margin-top: 48px; }
.comment-list { padding-left: 0; list-style: none; }
.comment-list .children { list-style: none; padding-left: 24px; }
.comment-body { padding: 16px 0; border-bottom: 1px solid #eee; }
.comment-form input:not([type="submit"]):not([type="checkbox"]), .comment-form textarea { width: 100%; padding: 8px 12px; border: 1px solid #ccc; border-radius: 4px; font: inherit; }

.alignleft { float: left; margin: 0 1.5em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.5em; }
.aligncenter { display: block; margin-inline: auto; }
.wp-caption-text { font-size: 14px; color: #757575; }

/* Trang bảo trì (Sửa giao diện web › Sửa trang bảo trì): căn giữa màn hình */
body.mab-maintenance { margin: 0; }
.mab-maint { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.mab-maint > * { width: 100%; }

/* Dòng cuối trang của giao diện (© … Được thiết kế bởi Manhan.ai.vn) — đổi màu trong CSS bổ sung qua .mab-credit */
.mab-credit { padding: 12px 16px; background: #14181b; color: #a7aaad; font-size: 13px; line-height: 1.5; text-align: center; }
.mab-credit p { margin: 0; }
.mab-credit a { color: #fff; font-weight: 600; text-decoration: none; }
.mab-credit a:hover { color: #93c5fd; }
