/*
Theme Name: Xây Nhà Mới
Theme URI: https://xaynhamoi.com
Author: XayNhaMoi
Author URI: https://xaynhamoi.com
Description: Theme chia sẻ kiến thức xây dựng & kiến trúc - tin tức, hướng dẫn, kỹ thuật, mẫu nhà đẹp
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: xaynhamoi
Tags: blog, news, construction, architecture
*/

/* ========================================
   CSS VARIABLES
======================================== */
:root {
    --primary: #E8A020;
    --primary-dark: #C8880A;
    --primary-light: #FFF3DC;
    --dark: #1A1A1A;
    --dark-2: #2D2D2D;
    --dark-3: #3D3D3D;
    --text: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --border: #E5E5E5;
    --border-light: #F0F0F0;
    --bg: #FFFFFF;
    --bg-light: #F8F8F8;
    --bg-gray: #F3F3F3;
    --topbar-bg: #1A1A1A;
    --font-main: 'Be Vietnam Pro', 'Segoe UI', sans-serif;
    --radius: 6px;
    --radius-sm: 4px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 6px 24px rgba(0,0,0,0.14);
    --transition: 0.2s ease;
}

/* ========================================
   DARK MODE — CSS VARIABLES
   Áp dụng khi: [data-theme="dark"] trên <html>
   Fallback: @media prefers-color-scheme: dark
======================================== */
[data-theme="dark"],
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) {
    --primary: #F0A830;
    --primary-dark: #D08818;
    --primary-light: #3A2A00;
    --dark: #F0F0F0;
    --dark-2: #D8D8D8;
    --dark-3: #B8B8B8;
    --text: #E2E2E2;
    --text-light: #AAAAAA;
    --text-muted: #777777;
    --border: #2D2D2D;
    --border-light: #232323;
    --bg: #141414;
    --bg-light: #1C1C1C;
    --bg-gray: #202020;
    --topbar-bg: #0E0E0E;
    --shadow: 0 2px 12px rgba(0,0,0,0.4);
    --shadow-hover: 0 6px 24px rgba(0,0,0,0.55);
}}

[data-theme="dark"] {
    --primary: #F0A830;
    --primary-dark: #D08818;
    --primary-light: #3A2A00;
    --dark: #F0F0F0;
    --dark-2: #D8D8D8;
    --dark-3: #B8B8B8;
    --text: #E2E2E2;
    --text-light: #AAAAAA;
    --text-muted: #777777;
    --border: #2D2D2D;
    --border-light: #232323;
    --bg: #141414;
    --bg-light: #1C1C1C;
    --bg-gray: #202020;
    --topbar-bg: #0E0E0E;
    --shadow: 0 2px 12px rgba(0,0,0,0.4);
    --shadow-hover: 0 6px 24px rgba(0,0,0,0.55);
}

/* Transition khi switch theme */
body, .site-header, .sidebar-widget, .article-card, .card-thumb, input, textarea, select {
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

/* Dark mode overrides cho các element hard-coded màu */
[data-theme="dark"] .site-header,
[data-theme="dark"] .main-nav { background: #1a1a1a; }

[data-theme="dark"] .article-card,
[data-theme="dark"] .house-card,
[data-theme="dark"] .sidebar-widget { background: var(--bg-light); border-color: var(--border); }

[data-theme="dark"] .article-card .card-body,
[data-theme="dark"] .card-body { background: var(--bg-light); }

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: var(--bg-gray);
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] .filter-bar select,
[data-theme="dark"] .filter-select { background: var(--bg-gray) !important; color: var(--text) !important; border-color: var(--border) !important; }

[data-theme="dark"] .site-footer { background: #0E0E0E; }

[data-theme="dark"] .page-hero { filter: brightness(0.85); }

[data-theme="dark"] .trust-bar,
[data-theme="dark"] .trust-item { background: var(--bg-light) !important; }

[data-theme="dark"] .cat-tabs,
[data-theme="dark"] .tab-item { border-color: var(--border); }

[data-theme="dark"] .tab-item.active { background: var(--primary-light); color: var(--primary); }

[data-theme="dark"] .search-overlay { background: rgba(0,0,0,0.97); }
[data-theme="dark"] #searchOverlayInput { background: #222; color: #eee; border-color: #333; }

[data-theme="dark"] .compare-bar { background: #1a1a1a; border-color: #333; }
[data-theme="dark"] .compare-modal { background: #1a1a1a; color: #eee; }
[data-theme="dark"] .compare-table th { background: #222; }
[data-theme="dark"] .compare-table td { border-color: #2d2d2d; }

[data-theme="dark"] .single-content img { opacity: 0.9; }
[data-theme="dark"] pre, [data-theme="dark"] code { background: #1a1a1a !important; color: #e2e2e2; }

[data-theme="dark"] .newsletter-section { background: #1a1a1a; }
[data-theme="dark"] .newsletter-form input { background: #252525; color: #eee; }

/* Dark toggle button visible */
.dark-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-light);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}
.dark-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* ========================================
   RESET & BASE
======================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-main);
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ========================================
   TYPOGRAPHY
======================================== */
h1,h2,h3,h4,h5,h6 { line-height: 1.3; color: var(--dark); font-weight: 700; }
h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* ========================================
   LAYOUT
======================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.row { display: flex; gap: 30px; }
.col-main { flex: 1; min-width: 0; }
.col-sidebar { width: 320px; flex-shrink: 0; }

/* ========================================
   TOP BAR
======================================== */
.topbar {
    background: var(--topbar-bg);
    color: #ccc;
    font-size: 13px;
    padding: 8px 0;
}
.topbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar-left { display: flex; gap: 20px; align-items: center; }
.topbar-left a { color: #ccc; transition: color var(--transition); }
.topbar-left a:hover { color: var(--primary); }
.topbar-left .date { color: #888; }
.topbar-left .sep { color: #444; }
.topbar-social { display: flex; gap: 12px; align-items: center; }
.topbar-social a { color: #888; font-size: 14px; transition: color var(--transition); }
.topbar-social a:hover { color: var(--primary); }

/* ========================================
   HEADER
======================================== */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 30px;
    padding: 14px 0;
}
.site-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.logo-icon { width: 48px; height: 48px; }
.logo-text { line-height: 1.1; }
.logo-text .name { font-size: 1.4rem; font-weight: 800; color: var(--dark); letter-spacing: -0.5px; }
.logo-text .name span { color: var(--primary); }
.logo-text .tagline { font-size: 11px; color: var(--text-muted); font-weight: 400; }

/* MAIN NAV */
.main-nav { flex: 1; }
.nav-menu { display: flex; gap: 0; align-items: center; }
.nav-menu > li { position: relative; }
.nav-menu > li > a {
    display: block;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: color var(--transition);
    white-space: nowrap;
}
.nav-menu > li > a:hover,
.nav-menu > li.current-menu-item > a,
.nav-menu > li.current-menu-parent > a { color: var(--primary); }
.nav-menu > li.current-menu-item > a { border-bottom: 2px solid var(--primary); }

/* Dropdown */
.nav-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 220px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all var(--transition);
    z-index: 100;
}
.nav-menu li:hover .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.sub-menu li a { display: block; padding: 10px 18px; font-size: 14px; color: var(--text); border-bottom: 1px solid var(--border-light); }
.sub-menu li:last-child a { border-bottom: none; }
.sub-menu li a:hover { color: var(--primary); background: var(--bg-light); }

.header-search-btn {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-light);
    border-radius: 50%;
    transition: all var(--transition);
    flex-shrink: 0;
}
.header-search-btn:hover { background: var(--bg-light); color: var(--primary); }

/* Search overlay */
.search-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 120px;
    opacity: 0; visibility: hidden; transition: all var(--transition);
}
.search-overlay.active { opacity: 1; visibility: visible; }
.search-overlay-inner { width: 600px; max-width: 90%; }
.search-overlay input {
    width: 100%;
    padding: 16px 20px;
    font-size: 18px;
    border: none;
    border-radius: var(--radius);
    outline: none;
}
.search-overlay-close { position: absolute; top: 20px; right: 30px; color: #fff; font-size: 24px; cursor: pointer; }

/* Live search results dropdown */
.search-live-results {
    background: #fff;
    border-radius: 0 0 var(--radius) var(--radius);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    margin-top: 2px;
    max-height: 420px;
    overflow-y: auto;
}
.search-live-results::-webkit-scrollbar { width: 4px; }
.search-live-results::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }
.search-live-loading {
    padding: 18px 20px;
    font-size: 13px;
    color: #999;
    text-align: center;
}
.search-live-empty {
    padding: 18px 20px;
    font-size: 13px;
    color: #888;
    text-align: center;
}
.search-live-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f0f0f0;
    transition: background .12s;
}
.search-live-item:last-child { border-bottom: none; }
.search-live-item:hover { background: #faf7f2; }
.search-live-thumb {
    width: 54px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    background: #eee;
}
.search-live-thumb-placeholder {
    width: 54px;
    height: 40px;
    border-radius: 4px;
    flex-shrink: 0;
    background: #eee;
}
.search-live-info { flex: 1; min-width: 0; }
.search-live-title {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-live-title mark {
    background: #fff3cd;
    color: inherit;
    font-weight: 700;
    padding: 0 1px;
    border-radius: 2px;
}
.search-live-meta {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}
.search-live-cat {
    font-size: 10px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.search-live-footer {
    padding: 10px 16px;
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    background: #faf7f2;
    border-top: 1px solid #eee;
    transition: background .12s;
}
.search-live-footer:hover { background: #f3ede4; }

/* ========================================
   SECTION TITLES
======================================== */
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
    padding-left: 12px;
    border-left: 4px solid var(--primary);
    margin-bottom: 18px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   ARTICLE CARDS
======================================== */
.article-card {
    background: var(--bg);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}
.article-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.article-card .card-thumb { position: relative; overflow: hidden; aspect-ratio: 16/9; }
.article-card .card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.article-card:hover .card-thumb img { transform: scale(1.04); }
.article-card .card-cat {
    position: absolute; top: 10px; left: 10px;
    background: var(--primary); color: #fff;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    padding: 3px 8px; border-radius: 3px; letter-spacing: 0.5px;
}
.article-card .card-body { padding: 14px; }
.article-card .card-title { font-size: 15px; font-weight: 700; line-height: 1.4; margin-bottom: 8px; color: var(--dark); }
.article-card .card-title a:hover { color: var(--primary); }
.article-card .card-excerpt { font-size: 13px; color: var(--text-light); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 10px; }
.article-card .card-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-muted); }
.article-card .card-meta svg { width: 13px; height: 13px; }

/* Grid layouts */
.articles-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.articles-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.articles-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

/* List card */
.article-list-card { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--border-light); }
.article-list-card:last-child { border-bottom: none; }
.article-list-card .thumb { width: 110px; height: 74px; flex-shrink: 0; border-radius: var(--radius-sm); overflow: hidden; }
.article-list-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.article-list-card .info .title { font-size: 14px; font-weight: 600; line-height: 1.4; margin-bottom: 5px; }
.article-list-card .info .title a:hover { color: var(--primary); }
.article-list-card .info .meta { font-size: 12px; color: var(--text-muted); }

/* ========================================
   SIDEBAR
======================================== */
.sidebar-widget { margin-bottom: 28px; }
.sidebar-widget .widget-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    padding-left: 12px;
    border-left: 4px solid var(--primary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Category list widget */
.cat-list { }
.cat-list li { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border-light); }
.cat-list li:last-child { border-bottom: none; }
.cat-list li a { font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.cat-list li a::before { content: '›'; color: var(--primary); font-size: 16px; font-weight: 700; }
.cat-list li a:hover { color: var(--primary); }
.cat-list .count { font-size: 12px; color: var(--text-muted); background: var(--bg-gray); padding: 2px 8px; border-radius: 20px; }
.cat-list li.active a { color: var(--primary); font-weight: 600; }

/* Popular posts widget */
.popular-posts { }
.popular-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-light); align-items: flex-start; }
.popular-item:last-child { border-bottom: none; }
.popular-num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.popular-num.n1 { background: var(--primary); }
.popular-num.n2 { background: #aaa; }
.popular-num.n3 { background: #c97b3a; }
.popular-item .p-thumb { width: 70px; height: 50px; border-radius: var(--radius-sm); overflow: hidden; flex-shrink: 0; }
.popular-item .p-thumb img { width: 100%; height: 100%; object-fit: cover; }
.popular-item .p-info .p-title { font-size: 13px; font-weight: 600; line-height: 1.4; margin-bottom: 4px; }
.popular-item .p-info .p-title a:hover { color: var(--primary); }
.popular-item .p-info .p-meta { font-size: 11px; color: var(--text-muted); }

/* Tags widget */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
    display: inline-block;
    padding: 5px 12px;
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-light);
    transition: all var(--transition);
}
.tag-cloud a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Newsletter widget */
.newsletter-widget { background: var(--bg-light); padding: 18px; border-radius: var(--radius); }
.newsletter-widget p { font-size: 13px; color: var(--text-light); margin-bottom: 12px; }
.newsletter-form { display: flex; gap: 8px; }
.newsletter-form input {
    flex: 1; padding: 9px 12px; font-size: 13px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    outline: none; transition: border-color var(--transition);
}
.newsletter-form input:focus { border-color: var(--primary); }
.newsletter-form button {
    background: var(--primary); color: #fff;
    padding: 9px 14px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600;
    transition: background var(--transition);
}
.newsletter-form button:hover { background: var(--primary-dark); }
.newsletter-note { font-size: 11px; color: var(--text-muted); margin-top: 8px; }

/* ========================================
   PAGINATION
======================================== */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 30px 0 0; }
.pagination a, .pagination span {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500;
    color: var(--text);
    transition: all var(--transition);
}
.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .next, .pagination .prev { width: auto; padding: 0 14px; gap: 5px; }

/* ========================================
   BREADCRUMB
======================================== */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-bottom: 18px; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: #ccc; }
.breadcrumb .current { color: var(--text); }

/* ========================================
   FOOTER
======================================== */
.site-footer { background: var(--dark); color: #aaa; margin-top: 60px; }
.footer-top { padding: 50px 0 30px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 40px; }
.footer-logo { margin-bottom: 16px; }
.footer-logo .name { font-size: 1.3rem; font-weight: 800; color: #fff; }
.footer-logo .name span { color: var(--primary); }
.footer-logo .tagline { font-size: 12px; color: #777; margin-top: 2px; }
.footer-about p { font-size: 13px; line-height: 1.7; color: #888; }
.footer-social { display: flex; gap: 10px; margin-top: 16px; }
.footer-social a { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.08); color: #aaa; display: flex; align-items: center; justify-content: center; font-size: 14px; transition: all var(--transition); }
.footer-social a:hover { background: var(--primary); color: #fff; }
.footer-col-title { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.footer-links { display: flex; flex-direction: column; gap: 9px; }
.footer-links a { font-size: 13px; color: #888; transition: color var(--transition); }
.footer-links a:hover { color: var(--primary); }
.footer-contact p { font-size: 13px; color: #888; line-height: 2; }
.footer-contact strong { color: #bbb; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.08); padding: 18px 0; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #666; }
.footer-bottom a { color: #666; }
.footer-bottom a:hover { color: var(--primary); }
.footer-bottom-links { display: flex; gap: 20px; }

/* ========================================
   HERO / BANNER (archive pages)
======================================== */
.page-hero {
    position: relative;
    overflow: hidden;
    min-height: 200px;
    display: flex; align-items: center;
    background: var(--dark);
    margin-bottom: 30px;
}
.page-hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0.35; }
.page-hero-content { position: relative; z-index: 1; padding: 40px 0; }
.page-hero h1 { font-size: 2rem; color: #fff; margin-bottom: 8px; }
.page-hero p { color: #ccc; font-size: 15px; max-width: 600px; }

/* ========================================
   CATEGORY ICONS BAR
======================================== */
.cat-icons-bar { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 28px; overflow-x: auto; }
.cat-icon-item {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 14px 20px;
    font-size: 12px; font-weight: 600; color: var(--text-light);
    text-transform: uppercase; letter-spacing: 0.3px;
    cursor: pointer; transition: all var(--transition);
    white-space: nowrap; text-decoration: none;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.cat-icon-item svg { width: 28px; height: 28px; }
.cat-icon-item:hover, .cat-icon-item.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ========================================
   FILTER BAR
======================================== */
.filter-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; flex-wrap: wrap; }
.filter-bar select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 13px; color: var(--text);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none; outline: none; cursor: pointer;
}
.filter-bar label { font-size: 13px; color: var(--text-light); }
.filter-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sort-select { padding: 8px 32px 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; color: var(--text); appearance: none; outline: none; background: #fff; }
.view-toggle button { padding: 7px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-light); transition: all var(--transition); }
.view-toggle button.active, .view-toggle button:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ========================================
   TABS
======================================== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab-item {
    padding: 10px 18px; font-size: 14px; font-weight: 600;
    color: var(--text-light); cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    white-space: nowrap; transition: all var(--transition);
    background: none; border-top: none; border-left: none; border-right: none;
}
.tab-item:hover, .tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-item .count { font-size: 12px; color: var(--text-muted); margin-left: 5px; }
.tab-item.active .count { color: var(--primary); }

/* ========================================
   BADGES
======================================== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.badge-primary { background: var(--primary); color: #fff; }
.badge-dark { background: var(--dark); color: #fff; }
.badge-outline { border: 1px solid var(--border); color: var(--text-light); }

/* ========================================
   RESPONSIVE
======================================== */
@media (max-width: 1024px) {
    .col-sidebar { width: 280px; }
    .articles-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .articles-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    .row { flex-direction: column; }
    .col-sidebar { width: 100%; }
    .articles-grid-3, .articles-grid-4, .articles-grid-2 { grid-template-columns: 1fr; }
    .main-nav {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1500;
    }
    .main-nav.open { display: block; }
    .main-nav .nav-menu {
        position: absolute;
        top: 0; left: 0;
        width: 280px;
        height: 100%;
        background: #fff;
        flex-direction: column;
        overflow-y: auto;
        padding: 16px 0;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }
    .main-nav .nav-menu > li > a { padding: 12px 20px; font-size: 15px; }
    .main-nav .sub-menu {
        position: static;
        opacity: 1; visibility: visible; transform: none;
        box-shadow: none; border: none;
        background: var(--bg-gray);
        border-radius: 0;
    }
    .mobile-menu-btn { display: flex !important; }
    h1 { font-size: 1.5rem; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .topbar { display: none; }
}

/* Mobile menu close overlay */
.main-nav.open::after {
    content: '';
    position: absolute;
    top: 0; left: 280px; right: 0; bottom: 0;
}

/* ========================================
   LOAD MORE BUTTON
======================================== */
.btn-load-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s, transform .1s;
    letter-spacing: .04em;
}
.btn-load-more:hover  { background: #d4911a; }
.btn-load-more:active { transform: scale(.97); }
.btn-load-more:disabled { opacity: .5; cursor: not-allowed; }

@keyframes xnmSpin { to { transform: rotate(360deg); } }

/* ========================================
   STICKY SMART HEADER
======================================== */
.site-header {
    transition: transform .3s ease, box-shadow .3s ease;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.site-header.header-hidden  { transform: translateY(-100%); }
.site-header.header-scrolled { box-shadow: 0 2px 16px rgba(0,0,0,.12); }

/* ========================================
   SHARE BUTTONS
======================================== */
.share-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 24px 0;
}
.share-bar .share-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity .15s;
}
.share-btn:hover { opacity: .85; }
.share-btn.fb   { background: #1877f2; color: #fff; }
.share-btn.zalo { background: #0068ff; color: #fff; }
.share-btn.tw   { background: #000; color: #fff; }
.share-btn.copy { background: #f0f0f0; color: #333; }

/* Toast notification */
.xnm-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #222;
    color: #fff;
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: opacity .25s, transform .25s;
    pointer-events: none;
}
.xnm-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ========================================
   COMPARE HOUSES
======================================== */
.compare-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border: 1.5px solid #ddd;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    margin-top: 8px;
}
.compare-toggle-btn.selected { border-color: var(--primary); background: #fff8ee; color: var(--primary); }
.compare-toggle-btn.selected::before { content: '✓ '; }
.compare-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-top: 2px solid var(--primary);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 1500;
    box-shadow: 0 -4px 20px rgba(0,0,0,.12);
    transform: translateY(100%);
    transition: transform .3s ease;
    flex-wrap: wrap;
}
.compare-bar.visible { transform: translateY(0); }
.compare-bar-items { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.compare-bar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #f8f8f8;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}
.compare-bar-item button { background: none; border: none; cursor: pointer; color: #999; font-size: 15px; line-height: 1; padding: 0; }
.compare-bar-item button:hover { color: #e53e3e; }
.btn-compare-now {
    padding: 10px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.btn-compare-now:hover { background: #d4911a; }

/* Compare modal */
.compare-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0; visibility: hidden;
    transition: opacity .2s;
}
.compare-modal-overlay.open { opacity: 1; visibility: visible; }
.compare-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 860px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
}
.compare-modal h2 { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.compare-table th, .compare-table td { padding: 10px 14px; border: 1px solid #eee; text-align: left; }
.compare-table thead th { background: #f8f8f8; font-weight: 600; }
.compare-table tbody tr:nth-child(even) td { background: #fafafa; }
.compare-table .row-label { font-weight: 600; color: #555; white-space: nowrap; }

/* ========================================
   FAVORITES (localStorage)
======================================== */
.fav-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1.5px solid #ddd;
    border-radius: 5px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    margin-top: 8px;
}
.fav-btn.saved { border-color: #e53e3e; color: #e53e3e; background: #fff5f5; }
.fav-btn .fav-icon { font-size: 14px; }

/* ========================================
   DARK MODE
======================================== */
:root {
    --bg-page:       #f5f5f5;
    --bg-card:       #ffffff;
    --text-main:     #333333;
    --text-muted:    #777777;
    --border-color:  #eeeeee;
    --header-bg:     #ffffff;
    --footer-bg:     #1A1A1A;
}
[data-theme="dark"] {
    --bg-page:       #121212;
    --bg-card:       #1e1e1e;
    --text-main:     #e8e8e8;
    --text-muted:    #a0a0a0;
    --border-color:  #333333;
    --header-bg:     #1a1a1a;
    --footer-bg:     #0a0a0a;
}
[data-theme="dark"] body            { background: var(--bg-page); color: var(--text-main); }
[data-theme="dark"] .site-header   { background: var(--header-bg); border-color: var(--border-color); }
[data-theme="dark"] .article-card  { background: var(--bg-card); border-color: var(--border-color); }
[data-theme="dark"] .card-title a  { color: var(--text-main); }
[data-theme="dark"] .card-meta     { color: var(--text-muted); }
[data-theme="dark"] .sidebar-widget { background: var(--bg-card); border-color: var(--border-color); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
    background: var(--bg-card); color: var(--text-main); border-color: var(--border-color);
}
[data-theme="dark"] .search-overlay input { background: #2a2a2a; color: #fff; }

.dark-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    color: inherit;
    line-height: 1;
    display: flex;
    align-items: center;
}
