/* ============================================================
   NEWS DETAIL — Trang chi tiết tin tức (desktop + mobile)
   Scope: .box-article-detail (news/news.tpl). Cũng có class
   .page-article nên cần override 1 số rule từ news-category-mobile.
   ============================================================ */

/* ====== GLOBAL (mọi viewport) ====== */
/* Cancel rule Bootstrap col-md-4 wrap quanh .box-article-relay:
   news.tpl đặt <div class="col-md-4"> bọc tin liên quan → desktop
   chỉ chiếm 33% gây lệch. Ép full width container ở mọi breakpoint. */
.box-article-detail > .col-md-4,
.box-article-detail .col-md-4 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding: 0 !important;
}

/* ====== DESKTOP (>= 992px) ====== */
@media (min-width: 992px) {
    .page-article.box-article-detail {
        max-width: 1200px;
        margin: 12px auto;
        padding: 24px;
        background: #fff;
        border-radius: 12px;
    }

    /* Tabs căn giữa, gọn */
    .box-article-detail .tabs-category-article {
        gap: 24px;
        margin-bottom: 16px;
    }

    /* Layout 2 cột: nội dung ~72% + sidebar ~28% */
    .box-article-detail .box-article-home-middle {
        display: flex;
        gap: 24px;
        align-items: flex-start;
    }
    .box-article-detail .col-left-article {
        flex: 1 1 auto;
        min-width: 0;
        width: calc(72% - 12px);
        max-width: calc(72% - 12px);
    }
    .box-article-detail .col-right-article {
        flex: 0 0 28%;
        width: 28%;
        max-width: 320px;
    }

    /* Title bài viết */
    .box-article-detail .box-article-detail-title h1 {
        font-size: 28px;
        line-height: 1.3;
        font-weight: 700;
        color: #222;
        margin: 0 0 12px;
    }
    .box-article-detail .post__user {
        display: flex;
        gap: 14px;
        align-items: center;
        margin: 0 0 4px;
        padding: 8px 0 12px;
        border-bottom: 1px solid #ececec;
    }
    .box-article-detail .post__user .author-name {
        font-weight: 600;
        font-size: 14px;
        color: #222;
        display: inline-flex;
        align-items: center;
    }
    .box-article-detail .post__user .author-name::before {
        content: '';
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #ed7b23;
        margin-right: 8px;
    }
    .box-article-detail .post__user .post-time {
        font-size: 13px;
        color: #888;
    }
    .box-article-detail .post__user .post-time::before {
        content: '·';
        margin-right: 10px;
        color: #ccc;
    }

    /* Nội dung */
    .box-article-detail .box-article-detail-ct {
        font-size: 16px;
        line-height: 1.75;
        color: #333;
        margin: 18px 0 32px;
    }
    .box-article-detail .box-article-detail-ct p {
        margin: 0 0 14px;
    }
    .box-article-detail .box-article-detail-ct img,
    .box-article-detail .box-article-detail-ct video {
        max-width: 100%;
        height: auto;
        display: block;
        margin: 16px auto;
        border-radius: 8px;
    }
    .box-article-detail .box-article-detail-ct iframe {
        aspect-ratio: 16 / 9;
        width: 100%;
        max-width: 100%;
        margin: 16px auto;
        border-radius: 8px;
    }
    .box-article-detail .box-article-detail-ct blockquote {
        margin: 16px 0;
        padding: 14px 20px;
        border-left: 4px solid #ed7b23;
        background: #fff7ef;
        color: #444;
        font-style: italic;
        border-radius: 0 6px 6px 0;
    }

    /* ===== TIN LIÊN QUAN — Full width, grid 4 cột to ===== */
    .box-article-detail > .col-md-4 {
        margin-top: 36px;
    }
    .box-article-detail .box-article-relay {
        width: 100%;
    }
    .box-article-detail .box-article-relay .title-ar {
        font-size: 22px;
        text-transform: uppercase;
        color: #222;
        font-weight: 700;
        margin: 0 0 20px;
        padding-bottom: 10px;
        border-bottom: 2px solid #ececec;
        position: relative;
        line-height: 1.3;
        float: none;
    }
    .box-article-detail .box-article-relay .title-ar::after {
        content: '';
        width: 80px;
        height: 3px;
        background: #ed7b23;
        position: absolute;
        left: 0;
        bottom: -2px;
        border-radius: 2px;
    }
    .box-article-detail .box-article-relay .article-list {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 20px !important;
        width: 100%;
    }
    .box-article-detail .box-article-relay .article-list .item-article {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        background: #fff;
        border: 1px solid #ececec;
        border-radius: 10px;
        overflow: hidden;
        transition: box-shadow .25s, transform .25s, border-color .25s;
        padding: 0;
        margin: 0;
    }
    .box-article-detail .box-article-relay .article-list .item-article:hover {
        box-shadow: 0 8px 20px rgba(0, 0, 0, .08);
        border-color: #ed7b23;
        transform: translateY(-3px);
    }
    .box-article-detail .box-article-relay .article-list .item-article .img-article {
        width: 100% !important;
        padding-bottom: 62% !important;
        display: block;
        position: relative;
        overflow: hidden;
        border-radius: 10px 10px 0 0;
        margin: 0;
    }
    .box-article-detail .box-article-relay .article-list .item-article .img-article img {
        position: absolute;
        inset: 0;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: 0 !important;
        transition: transform .4s;
    }
    .box-article-detail .box-article-relay .article-list .item-article:hover .img-article img {
        transform: scale(1.05);
    }
    .box-article-detail .box-article-relay .article-list .item-article .content-article {
        padding: 12px 14px 14px;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
    .box-article-detail .box-article-relay .article-list .item-article .title-article {
        text-decoration: none !important;
        color: #222 !important;
    }
    .box-article-detail .box-article-relay .article-list .item-article .title-article h3 {
        font-size: 15px;
        line-height: 1.4;
        font-weight: 600;
        color: #222;
        margin: 0;
        height: auto;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .box-article-detail .box-article-relay .article-list .item-article:hover .title-article h3 {
        color: #ed7b23;
    }
    .box-article-detail .box-article-relay .article-list .item-article .time-article {
        margin: 4px 0 0 !important;
        font-size: 12.5px;
        color: #9e9e9e;
        gap: 4px;
        display: flex !important;
        align-items: center;
    }
    .box-article-detail .box-article-relay .article-list .item-article .time-article i {
        flex: 0 0 13px;
        width: 13px;
        height: 13px;
    }
    .box-article-detail .box-article-relay .article-list .item-article .descreption-article {
        font-size: 13px;
        line-height: 1.5;
        color: #666;
        margin: 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Facebook comments full width */
    .box-article-detail .box-article-detail-cmt,
    .box-article-detail .box-article-detail-cmt iframe,
    .box-article-detail .box-article-detail-cmt .fb-comments,
    .box-article-detail .box-article-detail-cmt .fb-comments > span {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ====== TABLET (768-991px): tin liên quan grid 3 cột ====== */
@media (min-width: 768px) and (max-width: 991px) {
    .box-article-detail .box-article-relay .article-list {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* ====== MOBILE (<= 991px) ====== */
@media (max-width: 991px) {

    /* ============ WRAPPER ============ */
    .page-article.box-article-detail {
        padding: 10px !important;
        background: #fff !important;
        margin: 0 !important;
        max-width: 100% !important;
        border-radius: 0;
    }

    /* ============ RESET LINK (đảm bảo apply trong detail) ============ */
    .box-article-detail a,
    .box-article-detail a:link,
    .box-article-detail a:visited,
    .box-article-detail a:hover,
    .box-article-detail a:active {
        text-decoration: none !important;
        color: inherit;
    }

    /* ============ TABS DANH MỤC (giống category) ============ */
    .box-article-detail .tabs-category-article {
        gap: 8px !important;
        padding: 4px 0 10px !important;
        margin: 0 0 10px !important;
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .box-article-detail .tabs-category-article::-webkit-scrollbar { display: none; }
    .box-article-detail .tabs-category-article .item-tab-article {
        flex: 0 0 auto;
        padding: 6px 12px;
        background: #f8f8f8;
        border: 1px solid #ececec;
        border-radius: 16px;
        text-decoration: none !important;
        white-space: nowrap;
    }
    .box-article-detail .tabs-category-article .item-tab-article h2 {
        font-size: 12.5px !important;
        text-transform: uppercase !important;
        color: #444 !important;
        margin: 0 !important;
        font-weight: 500;
    }
    .box-article-detail .tabs-category-article a.active,
    .box-article-detail .tabs-category-article a:hover {
        background: #ed7b23 !important;
        border-color: #ed7b23 !important;
    }
    .box-article-detail .tabs-category-article a.active .title-cate-article,
    .box-article-detail .tabs-category-article a:hover .title-cate-article {
        color: #fff !important;
        text-decoration: none !important;
    }

    /* ============ LAYOUT 2 CỘT → STACK DỌC ============ */
    .box-article-detail .box-article-home-middle {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    .box-article-detail .col-left-article,
    .box-article-detail .col-right-article {
        width: 100% !important;
        flex: none !important;
    }

    /* ============ TITLE H1 + AUTHOR/POST-TIME ============ */
    .box-article-detail .box-article-tech.col-left-article {
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
    }
    .box-article-detail .box-article-detail-title {
        width: 100%;
        margin: 4px 0 14px !important;
    }
    .box-article-detail .box-article-detail-title h1 {
        font-size: 22px !important;
        line-height: 1.32 !important;
        font-weight: 700 !important;
        color: #222 !important;
        margin: 0 0 10px !important;
        padding: 0;
        word-wrap: break-word;
    }
    .box-article-detail .post__user {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 4px 10px !important;
        margin: 6px 0 0 !important;
        padding: 8px 0 !important;
        border-bottom: 1px solid #ececec !important;
        align-items: center;
    }
    .box-article-detail .post__user .author-name {
        font-weight: 600 !important;
        font-size: 13px !important;
        color: #222 !important;
        display: inline-flex;
        align-items: center;
    }
    .box-article-detail .post__user .author-name::before {
        content: '';
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background: #ed7b23;
        margin-right: 6px;
    }
    .box-article-detail .post__user .post-time {
        font-size: 12.5px !important;
        color: #888 !important;
    }
    .box-article-detail .post__user .post-time::before {
        content: '·';
        margin-right: 8px;
        color: #ccc;
    }
    .box-article-detail .post__user .post-time:first-child::before {
        content: none;
    }

    /* ============ NỘI DUNG BÀI VIẾT ============ */
    .box-article-detail .box-article-detail-ct {
        width: 100% !important;
        margin: 14px 0 24px !important;
        font-size: 15px;
        line-height: 1.65;
        color: #333;
        word-wrap: break-word;
    }
    .box-article-detail .box-article-detail-ct p {
        margin: 0 0 12px;
        font-size: 15px;
        line-height: 1.65;
        color: #333;
    }
    .box-article-detail .box-article-detail-ct img,
    .box-article-detail .box-article-detail-ct iframe,
    .box-article-detail .box-article-detail-ct video {
        max-width: 100% !important;
        height: auto !important;
        display: block;
        margin: 12px auto;
        border-radius: 6px;
    }
    .box-article-detail .box-article-detail-ct iframe {
        aspect-ratio: 16 / 9;
        width: 100% !important;
    }
    .box-article-detail .box-article-detail-ct h2,
    .box-article-detail .box-article-detail-ct h3,
    .box-article-detail .box-article-detail-ct h4 {
        margin: 18px 0 10px;
        font-weight: 700;
        color: #222;
        line-height: 1.35;
    }
    .box-article-detail .box-article-detail-ct h2 { font-size: 18px; }
    .box-article-detail .box-article-detail-ct h3 { font-size: 16px; }
    .box-article-detail .box-article-detail-ct h4 { font-size: 15px; }
    .box-article-detail .box-article-detail-ct ul,
    .box-article-detail .box-article-detail-ct ol {
        padding-left: 22px;
        margin: 8px 0 12px;
    }
    .box-article-detail .box-article-detail-ct ul li,
    .box-article-detail .box-article-detail-ct ol li {
        margin-bottom: 6px;
        font-size: 15px;
        line-height: 1.6;
    }
    .box-article-detail .box-article-detail-ct table {
        max-width: 100%;
        display: block;
        overflow-x: auto;
        margin: 10px 0;
    }
    .box-article-detail .box-article-detail-ct blockquote {
        margin: 12px 0;
        padding: 10px 14px;
        border-left: 3px solid #ed7b23;
        background: #fff7ef;
        color: #444;
        font-style: italic;
    }
    .box-article-detail .box-article-detail-ct a {
        color: #0f5b9a !important;
        text-decoration: none !important;
    }
    .box-article-detail .box-article-detail-ct a:hover {
        color: #ed7b23 !important;
    }

    /* ============ FACEBOOK COMMENTS ============ */
    .box-article-detail .box-article-detail-cmt {
        margin: 0 0 16px !important;
        width: 100% !important;
    }
    .box-article-detail .box-article-detail-cmt iframe,
    .box-article-detail .box-article-detail-cmt .fb-comments,
    .box-article-detail .box-article-detail-cmt .fb-comments > span {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* ============ BÀI LIÊN QUAN (.box-article-relay) ============ */
    /* .col-md-4 đã ép full width ở global section trên */
    .box-article-detail > .col-md-4 {
        margin-top: 16px;
    }
    .box-article-detail .box-article-relay {
        margin: 0;
    }
    .box-article-detail .box-article-relay .title-ar {
        font-size: 16px !important;
        line-height: 22px !important;
        text-transform: uppercase !important;
        color: #222 !important;
        font-weight: 700 !important;
        margin: 0 0 12px !important;
        padding-bottom: 6px;
        border-bottom: 1px solid #e1e1e1;
        position: relative;
        width: 100%;
        float: none !important;
    }
    .box-article-detail .box-article-relay .title-ar::after {
        content: '';
        width: 40px;
        height: 2px;
        background: #ed7b23;
        position: absolute;
        left: 0;
        bottom: -1px;
    }
    .box-article-detail .box-article-relay .article-list {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
        width: 100%;
    }
    .box-article-detail .box-article-relay .article-list .item-article {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        margin: 0 !important;
    }
    .box-article-detail .box-article-relay .article-list .item-article .img-article {
        width: 100% !important;
        padding-bottom: 60% !important;
        display: block;
        position: relative;
        overflow: hidden;
        border-radius: 8px;
    }
    .box-article-detail .box-article-relay .article-list .item-article .img-article img {
        position: absolute;
        inset: 0;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: 8px;
    }
    .box-article-detail .box-article-relay .article-list .item-article .content-article {
        padding: 0;
    }
    .box-article-detail .box-article-relay .article-list .item-article .title-article {
        display: block;
        text-decoration: none !important;
    }
    .box-article-detail .box-article-relay .article-list .item-article .title-article h3 {
        font-size: 12.5px !important;
        line-height: 1.4 !important;
        font-weight: 600 !important;
        color: #222 !important;
        margin: 4px 0 2px !important;
        height: auto !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .box-article-detail .box-article-relay .article-list .item-article .title-article:hover h3 {
        color: #ed7b23 !important;
    }
    .box-article-detail .box-article-relay .article-list .item-article .time-article {
        margin: 2px 0 0 !important;
        font-size: 11px !important;
        color: #9e9e9e !important;
        gap: 4px !important;
    }
    .box-article-detail .box-article-relay .article-list .item-article .time-article i {
        flex: 0 0 12px;
        width: 12px;
        height: 12px;
    }
    .box-article-detail .box-article-relay .article-list .item-article .descreption-article {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .box-article-detail .box-article-detail-title h1 {
        font-size: 19px !important;
        line-height: 1.3 !important;
    }
    .box-article-detail .box-article-detail-ct,
    .box-article-detail .box-article-detail-ct p {
        font-size: 14.5px;
        line-height: 1.6;
    }
    .box-article-detail .box-article-detail-ct h2 { font-size: 17px; }
    .box-article-detail .box-article-detail-ct h3 { font-size: 15px; }
    .box-article-detail .box-article-relay .title-ar {
        font-size: 15px !important;
    }
    .box-article-detail .box-article-relay .article-list .item-article .title-article h3 {
        font-size: 12px !important;
    }
}
