/* ===================== */
/* Post detail V2 */
/* ===================== */
.post-detail-v2 {
    --post-text: #1f2937;
    --post-muted: #6b7280;
    --post-border: #e5e9f2;
    --post-soft: #f3f7ff;
    --post-radius: 16px;
    --post-shadow: 0 1px 2px rgba(15, 31, 61, 0.04), 0 8px 24px rgba(15, 31, 61, 0.06);
}

.post-detail-v2 .breadcrumb-item.active {
    max-width: 60vw;
}

/* ---------- Article card ---------- */
.post-article {
    background: #fff;
    border: 1px solid var(--post-border);
    border-radius: var(--post-radius);
    box-shadow: var(--post-shadow);
    padding: 40px 48px;
}

.post-header {
    margin-bottom: 28px;
}

.post-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.post-category-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--post-soft);
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    transition: background-color 0.2s, color 0.2s;
}

.post-category-chip:hover {
    background: var(--primary-color);
    color: #fff;
}

.post-title {
    font-size: clamp(1.625rem, 1.2rem + 1.4vw, 2.25rem);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.015em;
    color: #0f172a;
    margin: 0 0 16px;
    text-wrap: balance;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    list-style: none;
    margin: 0;
    padding: 0 0 20px;
    border-bottom: 1px solid var(--post-border);
    color: var(--post-muted);
    font-size: 13px;
}

.post-meta li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.post-meta i {
    color: #9aa8c3;
}

/* ---------- Hero image ---------- */
.post-hero {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    max-height: 480px;
    width: 100%;
    margin: 0 0 32px;
    border-radius: 12px;
    background: #0f172a;
}

.post-hero-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(28px) brightness(0.75);
    transform: scale(1.15);
}

.post-hero-image {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ---------- Content typography ---------- */
.post-content {
    font-size: 16px;
    line-height: 1.8;
    color: var(--post-text);
    overflow-wrap: break-word;
}

.post-content > :first-child {
    margin-top: 0;
}

.post-content p {
    margin: 0 0 1.15em;
}

.post-content p:empty {
    display: none;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    color: #0f172a;
    font-weight: 700;
    line-height: 1.35;
    scroll-margin-top: 90px;
}

.post-content h2 {
    position: relative;
    font-size: 1.5rem;
    margin: 2em 0 0.75em;
    padding-left: 16px;
}

.post-content h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.2em;
    bottom: 0.2em;
    width: 4px;
    border-radius: 4px;
    background: var(--gradient-blue);
}

.post-content h3 {
    font-size: 1.25rem;
    margin: 1.6em 0 0.6em;
}

.post-content h4 {
    font-size: 1.075rem;
    margin: 1.4em 0 0.5em;
}

.post-content a {
    color: var(--primary-color);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.post-content a:hover {
    color: var(--accent-blue);
}

.post-content strong,
.post-content b {
    color: #0f172a;
    font-weight: 700;
}

.post-content ul,
.post-content ol {
    margin: 0 0 1.25em;
    padding-left: 1.4em;
}

.post-content li {
    margin-bottom: 0.5em;
    padding-left: 4px;
}

.post-content ul li::marker {
    color: var(--primary-color);
}

.post-content ol li::marker {
    color: var(--primary-color);
    font-weight: 700;
}

.post-content blockquote {
    position: relative;
    margin: 1.75em 0;
    padding: 20px 24px 20px 60px;
    border-left: 4px solid var(--primary-color);
    border-radius: 0 12px 12px 0;
    background: var(--post-soft);
    color: #1e3a8a;
    font-size: 1.05em;
    font-style: italic;
}

.post-content blockquote::before {
    content: "\201C";
    position: absolute;
    left: 18px;
    top: 6px;
    font-family: Georgia, serif;
    font-size: 3.5rem;
    line-height: 1;
    color: var(--primary-color);
    opacity: 0.35;
}

.post-content blockquote p:last-child {
    margin-bottom: 0;
}

.post-content img {
    display: block;
    max-width: 100%;
    max-height: 720px;
    width: auto;
    height: auto;
    margin: 1.75em auto;
    border-radius: 12px;
}

.post-content figure {
    margin: 1.75em 0;
}

.post-content figure img {
    margin: 0 auto;
}

.post-content figcaption {
    margin-top: 8px;
    text-align: center;
    font-size: 13px;
    color: var(--post-muted);
}

.post-content iframe,
.post-content video {
    display: block;
    max-width: 100%;
    margin: 1.75em auto;
    border-radius: 12px;
}

.post-content iframe[src*="youtube"] {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
}

.post-content hr {
    margin: 2.5em 0;
    border: 0;
    border-top: 1px solid var(--post-border);
    opacity: 1;
}

/* Tables: wrapped in .post-table-wrap by JS so wide tables scroll on mobile */
.post-table-wrap {
    margin: 1.75em 0;
    overflow-x: auto;
    border: 1px solid var(--post-border);
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}

.post-content table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 15px;
    line-height: 1.5;
}

.post-content > table {
    margin: 1.75em 0;
}

.post-content th,
.post-content td {
    padding: 12px 16px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--post-border);
    min-width: 7.5rem;
}

.post-content th {
    background: var(--post-soft);
    color: #0f172a;
    font-weight: 700;
    white-space: nowrap;
}

.post-content tbody tr:last-child td {
    border-bottom: 0;
}

.post-content tbody tr:nth-child(even) td {
    background: #fafbfd;
}

.post-content tbody tr:hover td {
    background: #f0f6ff;
}

.post-content tbody td:first-child {
    font-weight: 600;
    color: #0f172a;
}

/* ---------- Footer: share + back ---------- */
.post-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--post-border);
}

.post-share-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--post-muted);
}

.post-share {
    display: flex;
    gap: 8px;
}

.post-share-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--post-border);
    border-radius: 50%;
    background: #fff;
    color: #475569;
    transition: all 0.2s ease;
}

.post-share-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.post-share-btn.is-facebook:hover {
    border-color: #1877f2;
    background: #1877f2;
    color: #fff;
}

.post-share-copied {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 4px 10px;
    border-radius: 6px;
    background: #0f172a;
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}

.post-share-btn.is-copied {
    border-color: #16a34a;
    color: #16a34a;
}

.post-share-btn.is-copied .post-share-copied {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.post-back-link {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
}

.post-back-link i {
    transition: transform 0.2s;
}

.post-back-link:hover i {
    transform: translateX(-3px);
}

/* ---------- Related posts ---------- */
.post-related {
    margin-top: 32px;
}

.post-section-title {
    position: relative;
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 16px;
    padding-left: 14px;
}

.post-section-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.15em;
    bottom: 0.15em;
    width: 4px;
    border-radius: 4px;
    background: var(--gradient-blue);
}

.post-related-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--post-border);
    border-radius: 14px;
    box-shadow: var(--post-shadow);
    color: inherit;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.post-related-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px rgba(15, 31, 61, 0.12);
}

.post-related-thumb {
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: #eef2f8;
}

.post-related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-related-card:hover .post-related-thumb img {
    transform: scale(1.05);
}

.post-related-body {
    padding: 14px 16px 16px;
}

.post-related-body time {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--post-muted);
}

.post-related-body h3 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
    color: #0f172a;
    transition: color 0.2s;
}

.post-related-card:hover h3 {
    color: var(--primary-color);
}

/* ---------- Sidebar ---------- */
.post-sidebar {
    position: sticky;
    top: 84px;
}

.post-sidebar > div {
    padding: 20px;
    margin-top: 0 !important;
    background: #fff;
    border: 1px solid var(--post-border);
    border-radius: var(--post-radius);
    box-shadow: var(--post-shadow);
}

@media (min-width: 992px) {
    .post-sidebar > .ps-lg-4 {
        padding-left: 20px !important;
    }
}

.post-sidebar .sidebar-title {
    position: relative;
    margin-bottom: 16px;
    padding: 0 0 12px 14px;
    border-bottom: 1px solid var(--post-border);
    color: #0f172a;
    font-size: 17px;
    font-weight: 800;
}

.post-sidebar .sidebar-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.2em;
    height: 1.1em;
    width: 4px;
    border-radius: 4px;
    background: var(--gradient-blue);
}

.post-sidebar .latest-news-item {
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    padding: 10px 0;
    border-bottom: 1px dashed var(--post-border);
}

.post-sidebar .latest-news-item:last-of-type {
    border-bottom: 0;
}

.post-sidebar .latest-news-item > a {
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 8px;
}

.post-sidebar .latest-news-item img {
    display: block;
    width: 88px;
    height: 64px;
    margin: 0;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.post-sidebar .latest-news-item:hover img {
    transform: scale(1.06);
}

.post-sidebar .latest-news-item-title {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    font-size: 13.5px;
    line-height: 1.45;
}

.post-sidebar .latest-news-item-title a {
    color: #1f2937;
    font-weight: 600;
}

.post-sidebar .latest-news-item-title a:hover {
    color: var(--primary-color);
}

.post-sidebar .mt-4 img {
    width: 100%;
    border-radius: 12px !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 767.98px) {
    .post-related-card {
        flex-direction: row;
        align-items: center;
    }

    .post-related-thumb {
        flex: 0 0 120px;
        align-self: stretch;
        aspect-ratio: auto;
        min-height: 84px;
    }

    .post-related-body {
        padding: 10px 14px;
    }

    .post-related-body h3 {
        font-size: 14px;
    }
}

@media (max-width: 991.98px) {
    .post-article {
        padding: 28px 28px;
    }

    .post-sidebar {
        position: static;
    }
}

@media (max-width: 575.98px) {
    .post-detail-v2 .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .post-article {
        padding: 20px 16px;
        border-radius: 12px;
    }

    .post-hero {
        margin-left: -16px;
        margin-right: -16px;
        width: calc(100% + 32px);
        border-radius: 0;
    }

    .post-content {
        font-size: 15.5px;
        line-height: 1.75;
    }

    .post-content h2 {
        font-size: 1.3rem;
    }

    .post-content h3 {
        font-size: 1.15rem;
    }

    .post-content blockquote {
        padding: 16px 16px 16px 48px;
    }

    .post-content blockquote::before {
        left: 12px;
        font-size: 2.75rem;
    }

    .post-content img {
        border-radius: 8px;
    }

    .post-back-link {
        margin-left: 0;
        width: 100%;
    }
}
