/* ====================================================
   ci4-news-detail.css — M09a chi tiết bài viết (tbl_dmtin)
   Scoped: không override global CSS. Chỉ thêm style
   cho các class dùng riêng trang chi tiết bài viết.
   ==================================================== */

/* ── Header bài viết — spacing title / meta ──────────────────
   .desc h1 từ news.css: text-align:center; font-size:30px; margin:0 0 10px
   ul.article-info-more từ news_detail.css: text-align:center
   Chỉ bổ sung padding-top cho khu vực header và margin bottom.  */

/* Khoảng trống phía trên H1 (sau breadcrumb) */
.desc-onenews .the-content.desc > h1 {
    margin-top: 24px;
    margin-bottom: 14px;    /* override news.css margin:0 0 10px */
}

/* Meta "Tác giả | Cập nhật" — cách content phía dưới */
.desc-onenews .the-content.desc > ul.article-info-more {
    margin-bottom: 28px;
}

@media (max-width: 767px) {
    .desc-onenews .the-content.desc > h1 {
        margin-top: 16px;
        margin-bottom: 10px;
    }
    .desc-onenews .the-content.desc > ul.article-info-more {
        margin-bottom: 20px;
    }
}

/* ── Ảnh & bảng trong nội dung bài ── */
.post_news_detail img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
}

.post_news_detail table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
    border-collapse: collapse;
}

.post_news_detail table td,
.post_news_detail table th {
    padding: 6px 10px;
    border: 1px solid #ddd;
}

/* ── TOC (news.js inject vào .toc-sidebar) ── */
.toc {
    background: #fff;
    border: 1px solid rgba(0,0,0,.07);
    border-left: 4px solid #138e0b;
    border-radius: 6px;
    padding: 14px 18px;
    margin: 0 0 18px;
}

.toc-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 10px;
    color: #222;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: toc;
}

.toc-item {
    counter-increment: toc;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0;
}

.toc-item::before {
    content: counter(toc);
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #138e0b;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Indentation theo level heading */
.toc-item.level-3 { padding-left: 18px; }
.toc-item.level-4 { padding-left: 36px; }
.toc-item.level-5 { padding-left: 54px; }

.toc-item a {
    color: #138e0b;
    text-decoration: underline;
    font-size: 14px;
    line-height: 1.5;
}

.toc-item a:hover {
    text-decoration: none;
}

/* Nút xem thêm/thu gọn (mobile) */
.toc-toggle {
    display: block;
    margin: 10px auto 0;
    padding: 6px 10px;
    background: none;
    border: 0;
    color: #222;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.3;
}

.toc-toggle:hover { text-decoration: none; }

@media (min-width: 768px) {
    .toc-toggle { display: none; }
}

/* ── Overflow visible trên tất cả ancestor của sticky ──────────
   CI3 cũng làm điều này (#vnt-container, .mod-content, .box_mid...).
   Đảm bảo không ancestor nào tình cờ có overflow != visible
   từ Bootstrap hoặc CSS nào khác, vì sẽ phá position:sticky.  */
#vnt-containerfull,
.the-content.desc,
.ci4-news-detail-layout,
.ci4-news-detail-sidebar {
    overflow: visible;
}

/* ── Layout 2 cột (desktop): CSS Grid ─────────────────────────
   Col 1: main content. Col 2: sidebar = products (không sticky) + TOC (sticky).
   Sidebar stretch to row height (= article height) → TOC sticky suốt bài.  */

@media (min-width: 992px) {
    .ci4-news-detail-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 320px;
        gap: 30px;
        align-items: start;
        overflow: visible;
    }

    .ci4-news-detail-main {
        min-width: 0;
    }

    /* Sidebar stretch = row height (= article height): containing block cho TOC sticky */
    .ci4-news-detail-sidebar {
        align-self: stretch;
        overflow: visible;
    }

    /* TOC sticky trong sidebar cao = bài, dừng khi hết bài */
    .ci4-news-toc-inner {
        position: sticky;
        top: 10px;
        max-height: none;
        overflow: visible;
    }
}

/* Mobile: single column, sidebar ẩn — news.js đặt TOC inline trong content */
@media (max-width: 991px) {
    .ci4-news-detail-layout {
        display: block;
    }

    .ci4-news-detail-sidebar {
        display: none;
        position: static;
    }

    /* Desktop products box ẩn trên mobile — mobile dùng .ci4-mnp-mobile-only */
    .ci4-mnp-desktop-only {
        display: none;
    }

    .ci4-news-toc-inner {
        position: static;
        max-height: none;
        overflow: visible;
    }
}

/* ── Author box ── */
.aboutauthor {
    background: #fff;
    display: flex;
    gap: 16px;
    float: left;
    width: 100%;
    padding: 10px 20px;
    margin: 20px 0;
    border: 2px dashed #ebebeb;
    box-sizing: border-box;
    align-items: flex-start;
}

.aboutauthor img {
    display: block;
    border-radius: 50%;
    border: 4px solid #fff;
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.authorname {
    color: #db2f2f;
    margin: 8px 0 4px;
    font-weight: 700;
    font-size: 17px;
    font-family: sans-serif;
}

.authorname a {
    color: #db2f2f;
    text-decoration: none;
}

.authorname a:hover { text-decoration: underline; }

.authorabout {
    font-size: 14px;
    margin: 8px 0;
    line-height: 1.65;
    color: #444;
    font-family: sans-serif;
}

.soc-icon {
    display: inline-block;
    margin: 6px 0 0;
}

.soc-icon ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.soc-icon li {
    margin: 0 0 0 6px;
    padding: 0;
    display: inline-block;
}

.soc-icon img {
    width: 26px;
    height: 26px;
    vertical-align: middle;
}

/* ── FAQ Accordion ── */
.faq-section {
    margin: 28px 0;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 18px 20px;
    clear: both;
}

.faq-section > h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 14px;
    color: #227e0b;
}

.faq-item {
    border-top: 1px solid #eee;
    padding: 8px 0;
}

.faq-item:first-of-type {
    border-top: none;
}

.faq-question {
    cursor: pointer;
    font-weight: 700;
    padding: 8px 28px 8px 0;
    position: relative;
    font-size: 16px;
    line-height: 1.45;
    color: #222;
}

.faq-question::after {
    content: "+";
    position: absolute;
    right: 0;
    top: 8px;
    font-size: 20px;
    font-weight: 700;
    color: #138e0b;
}

.faq-question.active { color: #138e0b; }
.faq-question.active::after { content: "−"; }

.faq-answer {
    display: none;
    padding: 8px 0 4px;
    line-height: 1.65;
    color: #444;
    font-size: 15px;
}

/* ── Responsive mobile ── */
@media (max-width: 767px) {
    .aboutauthor {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 12px;
    }

    .aboutauthor img {
        margin: 0 auto 8px;
    }

    .faq-question { font-size: 15px; }
    .faq-answer   { font-size: 14px; }
}

/* ── A04.5: Dịch vụ liên quan thủ công (ci4-mnp) ───────────────
   Dùng trong sidebar desktop và inline mobile dưới bài viết.    */

.ci4-mnp {
    background: #fff;
    border: 1px solid rgba(0,0,0,.07);
    border-left: 4px solid #138e0b;
    border-radius: 6px;
    padding: 14px 16px;
    margin: 0 0 16px;
}

.ci4-mnp-title {
    font-weight: 700;
    font-size: 15px;
    margin: 0 0 10px;
    color: #222;
}

.ci4-mnp-card {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid #f0f0f0;
    align-items: flex-start;
}

.ci4-mnp-card:first-of-type {
    border-top: none;
    padding-top: 0;
}

.ci4-mnp-img-wrap {
    flex-shrink: 0;
    display: block;
    width: 72px;
    height: 54px;
    overflow: hidden;
    border-radius: 4px;
}

.ci4-mnp-img {
    width: 72px;
    height: 54px;
    object-fit: cover;
    display: block;
}

.ci4-mnp-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ci4-mnp-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    align-self: flex-start;
    line-height: 1.6;
}

.ci4-mnp-badge--tour { background: #e3f2fd; color: #1565c0; }
.ci4-mnp-badge--ve   { background: #e8f5e9; color: #2e7d32; }
.ci4-mnp-badge--xe   { background: #fff3e0; color: #e65100; }

.ci4-mnp-name {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    text-decoration: none;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ci4-mnp-name:hover { color: #138e0b; text-decoration: underline; }

/* Mobile-only wrapper: hiển thị dưới bài, ẩn trên desktop */
.ci4-mnp-mobile-only {
    margin-top: 24px;
}

@media (min-width: 992px) {
    .ci4-mnp-mobile-only { display: none; }
}

@media (max-width: 991px) {
    .ci4-mnp-img-wrap,
    .ci4-mnp-img {
        width: 88px;
        height: 66px;
    }
}
