/* ============================================================
   Post View — giao diện bài viết chi tiết
   Độc lập, không phụ thuộc stylesheet khác.
   ============================================================ */
.pv {
    --pv-brand: #DB1F1F;
    --pv-brand2: #9D0B0F;
    --pv-ink: #1a1a1a;
    --pv-muted: #707070;
    --pv-link: #195298;
    --pv-line: #ececec;
    --pv-soft: #ffe3e3;
    --pv-ease: cubic-bezier(.4, 0, .2, 1);
    background: #f5f6f8;
    padding: 18px 0 56px;
    font-family: 'Reddit Sans', 'Inter', system-ui, sans-serif;
}

.pv__shell {
    width: min(1230px, 92%);
    margin: 0 auto;
}

.pv__breadcrumb {
    margin: 4px 0 18px;
    font-size: 13px;
    color: var(--pv-muted);
}
.pv__breadcrumb a { color: var(--pv-muted); text-decoration: none; }
.pv__breadcrumb a:hover { color: var(--pv-brand); }

.pv__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 372px;
    gap: 28px;
    align-items: start;
}

/* ============================================================
   Cột trái — bài viết
   ============================================================ */
.pv-article {
    background: #fff;
    border-radius: 16px;
    box-shadow: 3px 4px 30px 0 rgba(58, 22, 22, .1);
    padding: 32px 38px 30px;
}

.pv-article__title {
    margin: 0 0 16px;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--pv-ink);
}
.pv-article__title span { display: inline; }

.pv-metabar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--pv-line);
}
.pv-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
    font-size: 14px;
    color: var(--pv-muted);
}
.pv-meta__item { display: inline-flex; align-items: center; gap: 7px; }
.pv-meta__item i { color: var(--pv-brand); }

/* Nút chia sẻ */
.pv-share { display: inline-flex; align-items: center; gap: 8px; }
.pv-share__label { font-size: 13px; font-weight: 600; color: var(--pv-muted); margin-right: 2px; }
.pv-share__btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: #f1f2f4;
    color: #555;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    transition: transform .15s var(--pv-ease), background .18s var(--pv-ease), color .18s var(--pv-ease);
}
.pv-share__btn:hover { transform: translateY(-2px); color: #fff; }
.pv-share__btn--fb:hover { background: #1877f2; }
.pv-share__btn--x:hover { background: #000; }
.pv-share__btn--in:hover { background: #0a66c2; }
.pv-share__btn--copy:hover { background: var(--pv-brand); }
.pv-share__btn.is-copied { background: #16a34a; color: #fff; }

.pv-article__body { color: #2b2b2b; font-size: 16px; line-height: 1.75; }
.pv-article__body img { max-width: 100%; height: auto; border-radius: 10px; }
.pv-article__body h2,
.pv-article__body h3 { margin: 26px 0 12px; font-weight: 700; line-height: 1.35; color: var(--pv-ink); }
.pv-article__body h2 { font-size: 22px; }
.pv-article__body h3 { font-size: 19px; }
.pv-article__body p { margin: 0 0 16px; }
.pv-article__body a { color: var(--pv-link); text-decoration: none; }
.pv-article__body a:hover { color: #0d3a73; text-decoration: underline; text-underline-offset: 2px; }

/* ===== Mục lục (TOC) ===== */
.pv-toc {
    margin: 0 0 26px;
    padding: 0;
    background: linear-gradient(180deg, #fff 0%, #fdf6f6 100%);
    border: 1px solid #f0dede;
    border-left: 4px solid var(--pv-brand);
    border-radius: 12px;
    font-style: normal;
    color: inherit;
    overflow: hidden;
    box-shadow: 0 6px 18px -10px rgba(219, 31, 31, .25);
}
.pv-toc__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    text-align: left;
}
.pv-toc__heading {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 16px;
    font-weight: 700;
    font-style: normal;
    color: var(--pv-ink);
}
.pv-toc__heading i { color: var(--pv-brand); }
.pv-toc__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--pv-soft);
    color: var(--pv-brand);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s var(--pv-ease);
}
.pv-toc__toggle:hover { filter: brightness(.96); }

.pv-toc .toc-hierarchy {
    padding: 4px 18px 16px 14px;
    font-size: 14.5px;
    counter-reset: pvtoc;
}
.pv-toc .toc-hierarchy ul { list-style: none; margin: 0; padding-left: 18px; }
.pv-toc .toc-hierarchy > ul { padding-left: 0; }
.pv-toc .toc-hierarchy li {
    position: relative;
    margin: 2px 0;
    font-size: 14.5px;
    font-weight: 400;
    line-height: 1.5;
}
.pv-toc .toc-hierarchy li > span {
    display: inline-block;
    padding: 5px 8px 5px 0;
    color: #3a3a3a;
    cursor: pointer;
    transition: color .15s var(--pv-ease);
    border-bottom: 1px dashed transparent;
}
.pv-toc .toc-hierarchy li > span:hover { color: var(--pv-brand); border-bottom-color: rgba(219, 31, 31, .4); }
.pv-toc .toc-hierarchy > ul > li > span::before {
    counter-increment: pvtoc;
    content: counter(pvtoc) ". ";
    font-weight: 700;
    color: var(--pv-brand);
}

/* ===== Nội dung bài viết (port từ new_post.css + bổ sung) ===== */
.pv-article__body iframe,
.pv-article__body img { max-width: 100% !important; height: auto; }
.pv-article__body ul,
.pv-article__body ol { margin: 0 0 16px; padding-left: 24px; }
.pv-article__body li { margin-bottom: 6px; }
.pv-article__body blockquote {
    margin: 0 0 18px;
    padding: 12px 18px;
    border-left: 4px solid var(--pv-brand);
    background: #faf7f7;
    color: #444;
    font-style: italic;
    border-radius: 0 8px 8px 0;
}
.pv-article__body figure { margin: 0 0 18px; max-width: 100%; }
.pv-article__body figure img { display: block; margin: 0 auto; }
.pv-article__body figcaption { margin-top: 6px; font-size: 13px; color: var(--pv-muted); text-align: center; }
.pv-article__body pre {
    margin: 0 0 18px;
    padding: 14px 16px;
    background: #1e1e1e;
    color: #f1f1f1;
    border-radius: 10px;
    overflow: auto;
    font-size: 14px;
}
.pv-article__body code { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* Bảng trong nội dung */
.pv-article__body .table-responsive { overflow-x: auto; margin: 0 0 18px; }
.pv-article__body table {
    width: 100%;
    margin: 0 0 18px;
    border-collapse: collapse;
    font-size: 14.5px;
}
.pv-article__body table th,
.pv-article__body table td {
    border: 1px solid #e2e2e2;
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}
.pv-article__body table th { background: #faf3f3; font-weight: 700; color: var(--pv-ink); }
.pv-article__body table thead th { background: linear-gradient(180deg, var(--pv-brand) 0%, var(--pv-brand2) 100%); color: #fff; border-color: var(--pv-brand2); }
.pv-article__body table tr:nth-child(even) td { background: #fcfafa; }

/* Tags */
.pv-tags { margin-top: 26px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pv-tags > strong { color: var(--pv-ink); }
.pv-tags a {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 999px;
    background: var(--pv-soft);
    color: var(--pv-brand);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: filter .18s var(--pv-ease);
}
.pv-tags a:hover { filter: brightness(.96); }

/* Footer tác giả */
.pv-author {
    margin-top: 30px;
    padding-top: 22px;
    border-top: 1px solid var(--pv-line);
    display: flex;
    align-items: center;
    gap: 14px;
}
.pv-author__avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(180deg, var(--pv-brand), var(--pv-brand2));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}
.pv-author__label { font-size: 13px; color: var(--pv-muted); }
.pv-author__name { font-size: 17px; font-weight: 700; color: var(--pv-ink); }

/* Bài viết liên quan (section riêng, full-width dưới grid) */
.pv-related {
    margin-top: 28px;
    padding: 26px 28px 30px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 3px 4px 30px 0 rgba(58, 22, 22, .1);
}
.pv-related__title {
    margin: 0 0 20px;
    font-size: 22px;
    font-weight: 800;
    color: var(--pv-ink);
    position: relative;
    padding-left: 14px;
}
.pv-related__title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    bottom: 3px;
    width: 4px;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--pv-brand), var(--pv-brand2));
}
.pv-related__grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.pv-related__card {
    display: flex;
    gap: 18px;
    text-decoration: none;
}
.pv-related__media {
    flex-shrink: 0;
    width: 200px;
    height: 124px;
    border-radius: 12px;
    overflow: hidden;
    background: #eee;
}
.pv-related__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-related__body { min-width: 0; }
.pv-related__badge {
    display: inline-block;
    margin-bottom: 8px;
    padding: 4px 12px;
    border-radius: 5px;
    background: linear-gradient(180deg, var(--pv-brand) 0%, var(--pv-brand2) 100%);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
}
.pv-related__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--pv-ink);
    transition: color .15s var(--pv-ease);
}
.pv-related__card:hover .pv-related__name { color: var(--pv-brand); }
.pv-related__desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--pv-muted);
}
.pv-related__card.is-hidden { display: none; }
.pv-related__more-wrap { margin-top: 24px; text-align: center; }
.pv-related__more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    border: 1px solid var(--pv-brand);
    border-radius: 25px;
    background: #fff;
    color: var(--pv-brand);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s var(--pv-ease), color .18s var(--pv-ease);
}
.pv-related__more:hover {
    background: linear-gradient(180deg, var(--pv-brand) 0%, var(--pv-brand2) 100%);
    color: #fff;
}

/* ============================================================
   Cột phải — sidebar
   ============================================================ */
.pv-side { display: flex; flex-direction: column; gap: 24px; position: sticky; top: 86px; }

.pv-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 3px 4px 30px 0 rgba(58, 22, 22, .1);
    padding: 20px;
}
.pv-card__title {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    color: #000;
    text-transform: capitalize;
}

/* Job cards */
.pv-jobs { display: flex; flex-direction: column; gap: 16px; }
.pv-job {
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 4px 12.7px 4px rgba(126, 126, 126, .25);
}
.pv-job__badge span {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    background: var(--pv-soft);
    color: var(--pv-brand);
    font-size: 12px;
    font-weight: 600;
}
.pv-job__title { margin: 10px 0 12px; font-size: 16px; font-weight: 700; line-height: 1.4; }
.pv-job__title a { color: var(--pv-ink); text-decoration: none; }
.pv-job__title a:hover { color: var(--pv-brand); }
.pv-job__meta { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 14px; }
.pv-job__meta li { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #666; }
.pv-job__meta i { color: var(--pv-brand); }
.pv-job__divider { border: none; border-top: 1px solid var(--pv-line); margin: 14px 0; }
.pv-job__foot { display: flex; align-items: center; gap: 12px; }
.pv-job__fav {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border: 1px solid var(--pv-line);
    border-radius: 50%;
    background: #fff;
    color: var(--pv-brand);
    cursor: pointer;
    transition: background .18s var(--pv-ease);
}
.pv-job__fav:hover { background: var(--pv-soft); }
.pv-job__apply {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    border-radius: 20px;
    background: linear-gradient(180deg, var(--pv-brand) 0%, var(--pv-brand2) 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: filter .18s var(--pv-ease);
}
.pv-job__apply:hover { filter: brightness(1.08); }

/* Related posts */
.pv-rels { display: flex; flex-direction: column; gap: 16px; }
.pv-rel { display: flex; gap: 12px; text-decoration: none; }
.pv-rel__media {
    flex-shrink: 0;
    width: 92px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    background: #eee;
}
.pv-rel__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-rel__body { min-width: 0; }
.pv-rel__badge {
    display: inline-block;
    margin-bottom: 5px;
    padding: 3px 10px;
    border-radius: 5px;
    background: linear-gradient(180deg, var(--pv-brand) 0%, var(--pv-brand2) 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}
.pv-rel__title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--pv-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.pv-rel:hover .pv-rel__title { color: var(--pv-brand); }
.pv-rel__desc {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--pv-muted);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 991px) {
    .pv__grid { grid-template-columns: 1fr; }
    .pv-side { position: static; }
    .pv-article { padding: 24px 20px; }
    .pv-article__title { font-size: 24px; }
}

@media (max-width: 767px) {
    .pv__shell { width: 92%; }
    .pv-article { padding: 20px 16px; }
    .pv-article__title { font-size: 22px; }
    .pv-article__body { font-size: 15.5px; }
    .pv-related { padding: 20px 18px 24px; }
    .pv-related__title { font-size: 19px; }
    .pv-related__name { font-size: 16px; }
    .pv-related__media { width: 160px; height: 104px; }
}

@media (max-width: 575px) {
    .pv-metabar { gap: 10px 14px; }
    .pv-share { flex-wrap: wrap; }
    .pv-related__media { width: 120px; height: 84px; }
    .pv-related__name { font-size: 15px; -webkit-line-clamp: 3; }
    .pv-related__desc { -webkit-line-clamp: 2; }
    .pv-related__more { width: 100%; max-width: 320px; justify-content: center; }
}
