/* =========================================================
   Giao diện kiểu tạp chí - Thế Giới Số
   ========================================================= */
:root {
    --tgs-accent: #f26522;
    --tgs-accent-2: #f26522;
    --tgs-accent-dark: #d4501a;
    --tgs-dark: #111;
    --tgs-text: #222;
    --tgs-muted: #767676;
    --tgs-line: #e9e9e9;
    --tgs-font: 'Roboto', -apple-system, 'Segoe UI', Arial, sans-serif;
}

/* ---------- Thanh trên cùng ---------- */
.tgs-topbar {
    background: var(--tgs-dark);
    color: #fff;
    font: 500 12px/32px var(--tgs-font);
}
.tgs-topbar-in {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.tgs-topbar-left, .tgs-topbar-right { display: flex; align-items: center; gap: 18px; min-width: 0; }
.tgs-topbar a { color: #fff; opacity: .9; }
.tgs-topbar a:hover { color: var(--tgs-accent-2); opacity: 1; }
.tgs-date i { margin-right: 6px; }
.tgs-topbar-right a { font-size: 13px; }
@media (max-width: 849px) {
    .tgs-topbar-left a { display: none; }
}

/* ---------- Header: nền trắng, logo đen, menu trắng ---------- */
#header div#masthead {
    background: #fff !important;
    background-image: none !important;
}
#header #logo img {
    width: auto;
    max-height: 72px;
}
#header .header-search-form-wrapper { width: 300px; }
#header .header-search-form .search-field {
    border: 1px solid var(--tgs-line);
    box-shadow: none;
    border-radius: 0;
    font-family: var(--tgs-font);
}
#header .header-search-form .ux-search-submit {
    background: var(--tgs-dark);
    border-radius: 0;
}
#header .top-divider { display: none; }

#header div#wide-nav {
    background: #fff !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 48px;
    border-top: 1px solid var(--tgs-line);
    box-shadow: 0 3px 8px -4px rgba(0, 0, 0, .15);
}
#header #wide-nav .nav > li {
    margin: 0 !important;
    height: auto !important;
    background: none !important;
    padding: 0 !important;
}
#header #wide-nav .nav > li > a,
#header .nav-dark .nav > li > a {
    color: var(--tgs-dark) !important;
    font: 700 14px/48px var(--tgs-font);
    text-transform: uppercase;
    padding: 0 14px !important;
    height: 48px !important;
    background: none !important;
    position: relative;
}
#header #wide-nav .nav > li > a::after {
    content: '';
    position: absolute;
    left: 14px; right: 14px; bottom: 0;
    height: 3px;
    background: var(--tgs-accent-2);
    transform: scaleX(0);
    transition: transform .2s;
}
#header #wide-nav .nav > li.active > a::after,
#header #wide-nav .nav > li:hover > a::after { transform: scaleX(1); }
#header #wide-nav .nav > li.active > a { line-height: 48px !important; }
#header #wide-nav .sub-menu { border-top: 3px solid var(--tgs-accent-2); }
#header #wide-nav .sub-menu a { font-family: var(--tgs-font); }

/* ---------- Trang chủ ---------- */
.home #content, .home #main { background: #fff; }
.tgs-mag {
    font-family: var(--tgs-font);
    color: var(--tgs-text);
    padding: 20px 0 40px;
}
.tgs-mag a { color: inherit; }
.tgs-mag a:hover { color: var(--tgs-accent-2); }
.tgs-mag h2, .tgs-mag h3, .tgs-mag h4 { font-family: var(--tgs-font); margin: 0; }

/* Nhãn chuyên mục */
.tgs-cat {
    display: inline-block;
    background: var(--tgs-dark);
    color: #fff !important;
    font: 500 10px/1 var(--tgs-font);
    text-transform: uppercase;
    padding: 4px 6px;
    margin-bottom: 8px;
}
a.tgs-cat:hover { background: var(--tgs-accent-2); }
.tgs-meta { font-size: 11px; color: var(--tgs-muted); }
.tgs-author { color: var(--tgs-dark); font-weight: 700; }

/* Thanh nổi bật */
.tgs-trending {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    font-size: 13px;
}
.tgs-trending-label {
    background: var(--tgs-dark);
    color: #fff;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 11px;
    padding: 6px 10px;
    flex-shrink: 0;
}
.tgs-trending-items { position: relative; flex: 1; height: 22px; overflow: hidden; min-width: 0; }
.tgs-trending-item {
    position: absolute;
    inset: 0;
    line-height: 22px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity .3s, transform .3s;
    pointer-events: none;
}
.tgs-trending-item.is-active { opacity: 1; transform: none; pointer-events: auto; }
.tgs-trending-nav { display: flex; gap: 4px; flex-shrink: 0; }
.tgs-trending-nav button {
    width: 24px; height: 24px; min-height: 0;
    margin: 0; padding: 0;
    border: 1px solid #ddd;
    background: #fff;
    color: #999;
    line-height: 22px;
    cursor: pointer;
}
.tgs-trending-nav button:hover { background: var(--tgs-accent-2); border-color: var(--tgs-accent-2); color: #fff; }

/* Khối nổi bật (hero) */
.tgs-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    height: 460px;
    margin-bottom: 36px;
}
.tgs-hero-side { display: grid; grid-template-rows: 1fr 1fr; gap: 3px; min-height: 0; }
.tgs-hero-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; min-height: 0; }
.tgs-ov { position: relative; overflow: hidden; background: #222; min-height: 0; }
.tgs-ov-img {
    position: absolute; inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform .4s ease;
}
.tgs-ov-img::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 40%, rgba(0,0,0,.75) 100%);
}
.tgs-ov:hover .tgs-ov-img { transform: scale(1.05); }
.tgs-ov-body {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 20px;
    pointer-events: none;
}
.tgs-ov-body a { pointer-events: auto; }
.tgs-ov-title { color: #fff; font-weight: 500; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.tgs-ov-title a { color: #fff !important; }
.tgs-ov .tgs-meta, .tgs-ov .tgs-author { color: #ddd; }
.tgs-hero-main .tgs-ov-title { font-size: 28px; line-height: 1.25; margin-bottom: 8px; }
.tgs-hero-wide .tgs-ov-title { font-size: 21px; line-height: 1.3; margin-bottom: 6px; }
.tgs-hero-small .tgs-ov-body { padding: 14px; }
.tgs-hero-small .tgs-ov-title { font-size: 14px; line-height: 1.35; }
.tgs-hero-small .tgs-meta { display: none; }

/* Bố cục 2 cột */
.tgs-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 48px;
}

/* Tiêu đề khối */
.tgs-block { margin-bottom: 40px; }
.tgs-block-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    border-bottom: 2px solid var(--tgs-dark);
    margin-bottom: 22px;
}
.tgs-block-title { font-size: 14px !important; line-height: 1; text-transform: uppercase; flex-shrink: 0; }
.tgs-block-title span {
    display: inline-block;
    background: var(--tgs-dark);
    color: #fff;
    padding: 9px 12px 8px;
    font-weight: 700;
}
.tgs-block[data-tgs-tabs] .tgs-block-head { border-color: var(--tgs-accent); }
.tgs-block[data-tgs-tabs] .tgs-block-title span { background: var(--tgs-accent); color: #fff; }

/* Tab */
.tgs-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 2px 16px;
    list-style: none;
    margin: 0 0 6px;
    padding: 0;
}
.tgs-tabs li { margin: 0; list-style: none; }
.tgs-tabs button {
    margin: 0; padding: 0;
    min-height: 0;
    background: none; border: 0;
    font: 400 13px/22px var(--tgs-font);
    text-transform: none;
    letter-spacing: 0;
    color: var(--tgs-muted);
    cursor: pointer;
}
.tgs-tabs button:hover, .tgs-tabs button.is-active { color: var(--tgs-accent-2); }
.tgs-tab-pane { display: none; }
.tgs-tab-pane.is-active { display: block; animation: tgsFade .3s; }
@keyframes tgsFade { from { opacity: 0; } to { opacity: 1; } }

/* Khối chia đôi: 1 bài lớn + danh sách */
.tgs-split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.tgs-big-img { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; margin-bottom: 12px; background: #eee; }
.tgs-big-img img, .tgs-list-img img, .tgs-sm-img img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity .2s;
}
.tgs-big-img:hover img, .tgs-list-img:hover img, .tgs-sm-img:hover img { opacity: .85; }
.tgs-big-img .tgs-cat, .tgs-list-img .tgs-cat { position: absolute; left: 0; bottom: 0; margin: 0; }
.tgs-big-title { font-size: 20px; line-height: 1.35; font-weight: 500; margin-bottom: 6px !important; }
.tgs-excerpt { font-size: 13px; line-height: 1.6; color: #555; margin: 8px 0 0; }

.tgs-sm { display: flex; gap: 12px; margin-bottom: 18px; }
.tgs-sm-img { flex: 0 0 100px; width: 100px; height: 70px; overflow: hidden; background: #eee; display: block; }
.tgs-sm-body { min-width: 0; }
.tgs-sm-title { font-size: 14px; line-height: 1.4; font-weight: 500; margin-bottom: 4px !important; }

/* Danh sách bài mới */
.tgs-list { display: flex; gap: 20px; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px dashed var(--tgs-line); }
.tgs-list:last-of-type { border-bottom: 0; }
.tgs-list-img { position: relative; flex: 0 0 218px; height: 150px; overflow: hidden; background: #eee; display: block; }
.tgs-list-body { min-width: 0; }
.tgs-list-title { font-size: 19px; line-height: 1.35; font-weight: 500; margin-bottom: 6px !important; }

.tgs-more { display: inline-block; margin-top: 6px; font-size: 12px; text-transform: uppercase; font-weight: 700; color: var(--tgs-muted) !important; }
.tgs-more:hover { color: var(--tgs-accent-2) !important; }
.tgs-more-btn {
    display: block;
    text-align: center;
    border: 1px solid var(--tgs-line);
    padding: 10px;
}
.tgs-more-btn:hover { background: var(--tgs-dark); border-color: var(--tgs-dark); color: #fff !important; }
.tgs-empty { color: var(--tgs-muted); }

/* Sidebar */
.tgs-social { display: grid; gap: 8px; }
.tgs-social-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px 6px 6px;
    border: 1px solid var(--tgs-line);
    font-size: 13px;
}
.tgs-social-item i {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; margin: 0;
    font-size: 14px;
}
.tgs-social-item span { flex: 1; font-weight: 500; }
.tgs-social-item b { font-size: 11px; text-transform: uppercase; color: var(--tgs-muted); }
.tgs-social-item.is-fb i { background: #516eab; }
.tgs-social-item.is-group i { background: var(--tgs-accent); }
.tgs-social-item.is-web i { background: var(--tgs-dark); }
.tgs-social-item:hover { border-color: var(--tgs-accent-2); }

.tgs-popular { list-style: none; counter-reset: tgs; margin: 0; padding: 0; }
.tgs-popular li { counter-increment: tgs; position: relative; margin: 0; list-style: none; }
.tgs-popular li::before {
    content: counter(tgs);
    position: absolute;
    left: 0; top: 0;
    z-index: 1;
    width: 22px; height: 22px;
    background: var(--tgs-accent-2);
    color: #fff;
    font-size: 12px; font-weight: 700;
    text-align: center; line-height: 22px;
}

.tgs-catlist { list-style: none; margin: 0; padding: 0; }
.tgs-catlist li { margin: 0; border-bottom: 1px solid var(--tgs-line); list-style: none; }
.tgs-catlist a { display: flex; justify-content: space-between; padding: 9px 0; font-size: 14px; }
.tgs-catlist span { color: var(--tgs-muted); font-size: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .tgs-layout { grid-template-columns: 1fr; gap: 0; }
    .tgs-hero { height: 400px; }
    .tgs-hero-main .tgs-ov-title { font-size: 24px; }
}
@media (max-width: 767px) {
    .tgs-hero { grid-template-columns: 1fr; height: auto; }
    .tgs-hero-main { height: 300px; }
    .tgs-hero-wide { height: 220px; }
    .tgs-hero-pair { height: 170px; }
    .tgs-hero-main .tgs-ov-title { font-size: 21px; }
    .tgs-hero-wide .tgs-ov-title { font-size: 17px; }
    .tgs-split { grid-template-columns: 1fr; }
    .tgs-block-head { flex-direction: column; align-items: flex-start; }
    .tgs-tabs { justify-content: flex-start; }
    .tgs-list { gap: 12px; }
    .tgs-list-img { flex-basis: 120px; height: 90px; }
    .tgs-list-title { font-size: 15px; }
    .tgs-list .tgs-excerpt { display: none; }
}

/* Header mobile trên nền trắng */
#header .mobile-nav > li > a,
#header .mobile-nav .icon-menu { color: var(--tgs-dark) !important; }

/* ---------- Sửa lỗi bố cục ---------- */
.tgs-mag, .tgs-mag * { box-sizing: border-box; }
.tgs-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.tgs-hero-pair, .tgs-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.tgs-block-head > .tgs-tabs { flex: 1 1 auto; min-width: 0; }
.tgs-tabs li { white-space: nowrap; flex: 0 0 auto; }
.tgs-tabs button { width: auto; display: inline-block; }
@media (max-width: 1024px) {
    .tgs-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
    .tgs-hero, .tgs-split { grid-template-columns: minmax(0, 1fr); }
    .tgs-block-head { flex-direction: column; align-items: stretch; }
    .tgs-block-head > .tgs-tabs {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .tgs-block-head > .tgs-tabs::-webkit-scrollbar { display: none; }
    .tgs-big-img { aspect-ratio: 16 / 9; }
}
.tgs-block-head > .tgs-block-title { width: auto !important; flex: 0 0 auto; margin: 0 !important; }
@media (max-width: 767px) {
    .tgs-block-head > .tgs-block-title { align-self: flex-start; }
}

/* =========================================================
   Tông màu chủ đạo: cam (#f26522 - màu logo)
   ========================================================= */
:root { --primary-color: #f26522; }

/* Tiêu đề khối: chữ trắng nền cam, gạch chân cam */
.tgs-block-head { border-bottom-color: var(--tgs-accent); }
.tgs-block-title span { background: var(--tgs-accent); }

/* Nhãn chuyên mục + nhãn "Nổi bật" */
.tgs-cat, .tgs-trending-label { background: var(--tgs-accent); }
a.tgs-cat:hover { background: var(--tgs-dark); }

/* Thanh trên cùng: viền cam mỏng phía dưới */
.tgs-topbar { border-bottom: 3px solid var(--tgs-accent); }

/* Menu: mục đang chọn / hover chữ cam */
#header #wide-nav .nav > li.active > a,
#header #wide-nav .nav > li:hover > a { color: var(--tgs-accent) !important; }
#header .nav-dropdown li a:hover, #header .nav-dropdown li.active > a { color: var(--tgs-accent) !important; }

/* Ô tìm kiếm */
#header .header-search-form .ux-search-submit { background: var(--tgs-accent); }
#header .header-search-form .ux-search-submit:hover { background: var(--tgs-accent-dark); }
#header .header-search-form .search-field:focus { border-color: var(--tgs-accent); }

/* Nút "Xem thêm bài viết" */
.tgs-more-btn:hover { background: var(--tgs-accent); border-color: var(--tgs-accent); }

/* Các thành phần Flatsome toàn site */
.button.primary:not(.is-outline), .primary:not(.is-outline), .button.secondary:not(.is-outline),
input[type="submit"], button[type="submit"], .back-to-top:hover,
.page-numbers.current, .page-number.current, .nav-pagination > li > .current,
.nav-pagination > li > a:hover, .badge-inner, .is-divider {
    background-color: var(--tgs-accent) !important;
    border-color: var(--tgs-accent) !important;
}
.back-to-top { border-color: var(--tgs-accent) !important; color: var(--tgs-accent); }
.back-to-top:hover { color: #fff !important; }
.is-outline.primary, .primary.is-link, .primary.is-underline { color: var(--tgs-accent) !important; }

/* Link trong bài viết, sidebar, chuyên mục */
.entry-content a:not(.button), .entry-meta a, .widget a:hover,
.post-title a:hover, .blog-wrapper a:hover, .entry-category a { color: var(--tgs-accent); }
.entry-content a:not(.button):hover { color: var(--tgs-accent-dark); }
::selection { background: var(--tgs-accent); color: #fff; }

/* Hộp "Bạn đang xem" trong bài viết (style inline viền đỏ) */
.single div[style*="dashed red"] {
    border-color: var(--tgs-accent) !important;
    background: #fff7f2;
}
.single div[style*="dashed red"] a { color: var(--tgs-accent); }
.single div[style*="dashed red"] a:hover { color: var(--tgs-accent-dark); }

/* Flatsome 3.20: tiêu đề bài ở trang chuyên mục bị "..." do white-space: pre-wrap + xuống dòng trong HTML */
.blog-archive .post-title.is-large {
    white-space: normal !important;
    -webkit-line-clamp: 2 !important;
    max-height: none !important;
    line-height: 1.35;
    min-height: 2.7em;
}
