body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    transition: margin-left 0.3s ease;
    overflow-x: hidden;
}

main {
    max-width: 1000px;
    margin: 20px auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ============================================================
   NEWS ARTICLE
   ============================================================ */
.news-detail {
    padding: 28px 28px 36px;
    background-color: #fff;
    border-radius: 8px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.news-detail h1 {
    font-size: 2em;
    color: #1a1a1a;
    font-weight: 600;
    line-height: 1.3;
    margin: 8px 0 20px;
    text-align: center;
    word-break: break-word;
}

/* Anh chinh (direct child cua .news-detail) — full width banner */
.news-detail > img {
    max-width: 100%;
    width: 100%;
    height: auto;
    max-height: 480px;
    object-fit: cover;
    display: block;
    margin: 24px auto 28px;
    border-radius: 12px;
    box-shadow: 0 10px 26px rgba(0,0,0,.14);
}

/* Anh & noi dung ben trong noi dung bai viet (utext HTML) */
.news-detail > div,
.news-detail .news-body {
    font-size: 16px;
    color: #333;
    line-height: 1.75;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}
/* Khong cho phep BAT KY element nao trong noi dung HTML cua user
   vuot qua chieu rong khung — tranh truong hop content trong DB
   chua thuoc tinh width/inline style lam hong layout */
.news-detail > div *,
.news-detail .news-body * {
    max-width: 100% !important;
    box-sizing: border-box;
}
.news-detail > div img,
.news-detail .news-body img {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    display: block;
    margin: 18px auto;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,.08);
}
.news-detail > div table,
.news-detail .news-body table {
    width: 100% !important;
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
}
.news-detail > div iframe,
.news-detail .news-body iframe {
    max-width: 100% !important;
    width: 100% !important;
    aspect-ratio: 16/9;
    height: auto;
    border: none;
    border-radius: 8px;
}
.news-detail > div p,
.news-detail .news-body p {
    font-size: 16px;
    color: #333;
    margin: 0 0 14px;
    line-height: 1.75;
}
.news-detail > div h2,
.news-detail > div h3,
.news-detail .news-body h2,
.news-detail .news-body h3 {
    color: #1a1a1a;
    margin: 26px 0 12px;
    line-height: 1.35;
}

/* Doan dau ngan (shortContent) */
.news-detail > p {
    font-size: 17px;
    color: #555;
    font-style: italic;
    text-align: center;
    margin: 0 auto 8px;
    line-height: 1.65;
    max-width: 800px;
    padding: 0 6px;
}

/* ============================================================
   RELATED POSTS — MODERN GRID
   ============================================================ */
.related-posts {
    margin: 50px 0 20px;
    padding: 32px 28px;
    background: linear-gradient(180deg, #fafafa 0%, #f4f1ea 100%);
    border-radius: 12px;
    border-top: 3px solid #c9a14a;
    position: relative;
}

.related-posts h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 22px;
    letter-spacing: .3px;
    position: relative;
    padding-left: 16px;
    text-align: left;
}
.related-posts h2::before {
    content: "";
    position: absolute;
    left: 0; top: 6px; bottom: 6px;
    width: 4px;
    background: linear-gradient(180deg, #d32f2f, #c9a14a);
    border-radius: 3px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
/* Neu chi co 1-2 bai lien quan thi can giua thay vi keo dai */
.related-grid:has(> .related-item:only-child) {
    grid-template-columns: minmax(260px, 360px);
    justify-content: center;
}
.related-grid:has(> .related-item:nth-child(2):last-child) {
    grid-template-columns: repeat(2, minmax(260px, 360px));
    justify-content: center;
}

.related-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: transform .3s ease, box-shadow .3s ease;
    min-height: 0;
    max-width: none;
    padding: 0;
    text-align: left;
}
.related-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.16);
}

.related-item .ri-img {
    height: 180px;
    overflow: hidden;
    position: relative;
}
.related-item .ri-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s ease;
    border-radius: 0;
}
.related-item:hover .ri-img img {
    transform: scale(1.08);
}
.related-item .ri-img::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 50%;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,.25));
    pointer-events: none;
}

.related-item .ri-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}
.related-item h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    color: #1a1a1a;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.related-item h3 a {
    color: inherit;
    text-decoration: none;
}
.related-item .ri-cta {
    margin-top: auto;
    font-size: 13px;
    font-weight: 700;
    color: #d32f2f;
    letter-spacing: .3px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: gap .2s ease;
}
.related-item:hover .ri-cta {
    gap: 8px;
}

/* Footer */
footer {
    background-color: #343a40;
    color: #f8f9fa;
    padding: 2em;
    border-top: 1px solid #495057;
}
.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}
.footer-title {
    font-size: 1.5em;
    margin-bottom: 1em;
}
.footer-sections {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
}
.company-info {
    flex: 1;
    text-align: left;
    margin-right: 1em;
}
.company-info p { margin: 0.5em 0; }
.company-info a { color: #17a2b8; text-decoration: none; }
.company-info a:hover { text-decoration: underline; }
.map-container { flex: 1; text-align: right; }
.map-container iframe { max-width: 100%; height: 200px; border: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
    .related-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .related-grid:has(> .related-item:nth-child(2):last-child) {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 760px) {
    main { margin: 12px; max-width: calc(100% - 24px); }
    .news-detail { padding: 20px 16px 28px; }
    .news-detail h1 { font-size: 1.45em; }
    .news-detail > p { font-size: 15px; }
    .news-detail > div p, .news-detail .news-body p { font-size: 15px; line-height: 1.7; }
    .news-detail > img { max-height: 280px; margin: 18px auto 22px; border-radius: 10px; }
    .related-posts { padding: 24px 16px; margin-top: 30px; }
    .related-posts h2 { font-size: 19px; }
    .related-grid,
    .related-grid:has(> .related-item:only-child),
    .related-grid:has(> .related-item:nth-child(2):last-child) {
        grid-template-columns: 1fr; gap: 14px; justify-content: stretch;
    }
    .related-item .ri-img { height: 200px; }
    .footer-sections { flex-direction: column; }
    .company-info, .map-container { text-align: center; margin: 8px 0; flex: none; }
    .map-container iframe { width: 100%; height: 200px; }
}
