/* ==========================================================================
   POST DETAIL PAGE STYLING
   Primary Palette:
   - Green (Chủ đạo): var(--color-3, #0e6938), #094826 (dark hover), #eaf5ee, #f0f7f3 (light tints)
   - Yellow (Điểm nhấn): #fcbb01, #fff9e6
   - Red (Điểm nhấn): var(--color-5, #e50308), #fee2e2
   ========================================================================== */

.post-detail-wrapper {
    background: #f8faf9;
    padding: 24px 0 50px;
    color: #333333;
}

/* 1. Layout Structure */
.pd-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.pd-main {
    flex: 1;
    background: #ffffff;
    border-radius: 16px;
    padding: 28px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    min-width: 0;
}

.pd-sidebar {
    width: 340px;
    flex-shrink: 0;
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    position: sticky;
    top: 70px;
}

/* 2. Header & Meta */
.pd-header-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pd-badge {
    background: var(--color-3, #0e6938);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    box-shadow: 0 2px 6px rgba(14, 105, 56, 0.25);
    border: none;
}

.pd-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    color: #6b7280;
    font-weight: 500;
}

.pd-date svg {
    width: 16px;
    height: 16px;
    color: var(--color-3, #0e6938);
    flex-shrink: 0;
}

.pd-title {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    line-height: 1.35;
    margin: 0 0 16px 0;
}

.pd-excerpt {
    background: #f0f7f3;
    border-left: 4px solid var(--color-3, #0e6938);
    padding: 16px 20px;
    border-radius: 8px;
    font-size: 15px;
    color: #374151;
    line-height: 1.7;
    margin-bottom: 25px;
}

/* 3. Table of Contents (Inline) */
.pd-toc {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 35px;
    overflow: hidden;
    background: #ffffff;
}

.pd-toc-header {
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #f8faf9;
    border-bottom: 1px solid #edf2f0;
    user-select: none;
    transition: background-color 0.2s ease;
}

.pd-toc-header:hover {
    background: #f0f7f3;
}

.pd-toc-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--color-3, #0e6938);
    font-size: 13.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pd-toc-title svg {
    width: 18px;
    height: 18px;
    color: var(--color-3, #0e6938);
    flex-shrink: 0;
}

.pd-toc-count {
    background: #eaf5ee;
    color: var(--color-3, #0e6938);
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 5px;
    border: 1px solid rgba(14, 105, 56, 0.15);
}

.pd-toc-chevron {
    color: var(--color-3, #0e6938);
    transition: transform 0.3s ease;
}

.pd-toc-body {
    padding: 12px 20px 20px;
    background: #ffffff;
}

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

.pd-toc-list li {
    margin-bottom: 8px;
}

.pd-toc-list li:last-child {
    margin-bottom: 0;
}

.pd-toc-list a {
    color: #374151;
    text-decoration: none;
    font-size: 14.5px;
    line-height: 1.5;
    display: inline-block;
    transition: color 0.2s ease;
}

.pd-toc-list a:hover {
    color: var(--color-3, #0e6938);
}

.pd-toc-item.pd-toc-h2 {
    margin-top: 10px;
    margin-bottom: 8px;
}

.pd-toc-item.pd-toc-h2:first-child {
    margin-top: 0;
}

.pd-toc-item.pd-toc-h2>a {
    font-weight: 700;
    color: #111827;
    font-size: 14.5px;
}

.pd-toc-item.pd-toc-h2>a:hover {
    color: var(--color-3, #0e6938);
}

.pd-toc-item.pd-toc-h3 {
    padding-left: 20px;
    margin-bottom: 6px;
}

.pd-toc-item.pd-toc-h3>a {
    font-weight: 500;
    color: #4b5563;
    font-size: 14px;
}

.pd-toc-item.pd-toc-h3>a:hover {
    color: var(--color-3, #0e6938);
}

.pd-toc-item.pd-toc-h4 {
    padding-left: 36px;
    margin-bottom: 5px;
}

.pd-toc-item.pd-toc-h4>a {
    font-weight: 400;
    color: #6b7280;
    font-size: 13.5px;
}

.pd-toc-item.pd-toc-h4>a:hover {
    color: var(--color-3, #0e6938);
}

.pd-toc-item.active>a,
.pd-toc-list a.active {
    color: var(--color-3, #0e6938) !important;
    font-weight: 700 !important;
}

/* 4. Article Body Content */
.pd-body {
    text-align: justify;
}

.pd-body h1,
.pd-body h2,
.pd-body h3,
.pd-body h4,
.pd-body h5,
.pd-body h6 {
    text-align: left;
}

.pd-body h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-3, #0e6938);
    margin: 14px 0 14px 0;
    line-height: 1.35;
}

.pd-body h3 {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 22px 0 12px 0;
    line-height: 1.4;
}

.pd-body p {
    font-size: 16px;
    line-height: 1.8;
    color: #27272a;
    margin-bottom: 14px;
}

.pd-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 14px auto;
    display: block;
}

.pd-body figure.wp-caption,
figure.wp-caption {
    margin: 20px auto;
    max-width: 100%;
    text-align: center;
    clear: both;
}

.pd-body figure.wp-caption.aligncenter,
figure.wp-caption.aligncenter {
    display: table;
    margin-left: auto;
    margin-right: auto;
}

.pd-body figure.wp-caption.alignnone,
figure.wp-caption.alignnone {
    display: table;
    margin: 16px auto;
}

.pd-body figure.wp-caption.alignleft,
figure.wp-caption.alignleft {
    float: left;
    margin: 10px 20px 15px 0;
    max-width: 50%;
}

.pd-body figure.wp-caption.alignright,
figure.wp-caption.alignright {
    float: right;
    margin: 10px 0 15px 20px;
    max-width: 50%;
}

.pd-body figure.wp-caption img,
figure.wp-caption img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 8px;
    border-radius: 8px;
}

.pd-body figure.wp-caption figcaption.wp-caption-text,
figure.wp-caption figcaption.wp-caption-text {
    font-size: 14px;
    font-style: italic;
    color: #6b7280;
    line-height: 1.5;
    text-align: center;
    padding: 6px 12px;
}

.pd-body a {
    color: var(--color-3, #0e6938);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.pd-body a:hover {
    color: #094826;
}

.pd-body blockquote {
    margin: 24px 0;
    padding: 18px 22px;
    background: #f0f7f3;
    color: #1f2937;
    border-left: 4px solid var(--color-3, #0e6938);
    border-radius: 8px;
    font-style: italic;
}

.pd-body table thead {
    background: var(--color-3, #0e6938);
    color: #ffffff;
}

/* 5. Tags Section */
.detail-article__tags {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 18px 0;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    margin-top: 30px;
    margin-bottom: 24px;
}

.detail-article__tags-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.detail-article__tags-label svg {
    color: var(--color-3, #0e6938);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.detail-article__tag {
    padding: 6px 14px;
    background: #eaf5ee;
    border: 1px solid rgba(14, 105, 56, 0.2);
    border-radius: 6px;
    color: var(--color-3, #0e6938);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.25s ease;
}

.detail-article__tag:hover {
    background: var(--color-3, #0e6938);
    color: #ffffff;
    border-color: var(--color-3, #0e6938);
    box-shadow: 0 2px 6px rgba(14, 105, 56, 0.25);
}

/* 6. Share Section */
.detail-article__share {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.detail-article__share-label {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.detail-article__share-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #374151;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.25s ease;
}

.detail-article__share-btn svg {
    font-size: 18px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.detail-article__share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.detail-article__share-btn--facebook:hover {
    background: #1877f2;
    border-color: #1877f2;
    color: #ffffff;
}

.detail-article__share-btn--copy:hover {
    background: var(--color-3, #0e6938);
    border-color: var(--color-3, #0e6938);
    color: #ffffff;
}

/* 7. Sidebar Related Posts */
.pd-sidebar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    padding-bottom: 12px;
}

.pd-sidebar-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 45px;
    height: 3px;
    background: var(--color-3, #0e6938);
    border-radius: 3px;
}

.pd-sidebar-title svg {
    width: 20px;
    height: 20px;
    color: var(--color-3, #0e6938);
    flex-shrink: 0;
}

.pd-related-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pd-related-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding-bottom: 14px;
    border-bottom: 1px solid #f3f4f6;
}

.pd-related-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.pd-related-item img {
    width: 80px;
    height: 68px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.pd-related-item:hover img {
    transform: scale(1.05);
}

.pd-related-info {
    flex: 1;
    min-width: 0;
}

.pd-related-info a {
    font-size: 13.5px;
    font-weight: 600;
    color: #1f2937;
    text-decoration: none;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
    transition: color 0.2s ease;
}

.pd-related-info a:hover {
    color: var(--color-3, #0e6938);
}

.pd-related-date {
    font-size: 12px;
    color: #9ca3af;
}

/* 8. Floating TOC */
.pd-floating-toc {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 990;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s ease, transform 0.3s ease;
}

.pd-floating-toc.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.pd-floating-toc__btn {
    display: none;
    align-items: center;
    gap: 8px;
    background: var(--color-3, #0e6938);
    color: #ffffff;
    border: none;
    outline: none;
    border-radius: 30px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(14, 105, 56, 0.35);
    transition: all 0.25s ease;
    user-select: none;
}

.pd-floating-toc__btn:hover {
    background: #094826;
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(14, 105, 56, 0.45);
}

.pd-floating-toc__btn svg {
    flex-shrink: 0;
}

.pd-floating-toc__box {
    width: 320px;
    max-width: calc(100vw - 40px);
    max-height: 70vh;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: pdFloatingSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pdFloatingSlideIn {
    from {
        opacity: 0;
        transform: translateX(-15px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.pd-floating-toc__head {
    padding: 12px 16px;
    background: #f0f7f3;
    border-bottom: 1px solid rgba(14, 105, 56, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.pd-floating-toc__title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--color-3, #0e6938);
    display: flex;
    align-items: center;
    gap: 7px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.pd-floating-toc__title svg {
    color: var(--color-3, #0e6938);
    flex-shrink: 0;
}

.pd-floating-toc__close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(14, 105, 56, 0.12);
    color: var(--color-3, #0e6938);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.pd-floating-toc__close:hover {
    background: var(--color-3, #0e6938);
    color: #ffffff;
    transform: rotate(90deg);
}

.pd-floating-toc__body {
    padding: 10px 14px 16px 16px;
    overflow-y: auto;
    max-height: calc(70vh - 55px);
}

.pd-floating-toc__body::-webkit-scrollbar {
    width: 5px;
}

.pd-floating-toc__body::-webkit-scrollbar-track {
    background: #f8fafc;
}

.pd-floating-toc__body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.pd-floating-toc__list {
    padding-top: 5px !important;
}

.pd-floating-toc__list .pd-toc-item {
    transition: all 0.2s ease;
    border-radius: 6px;
    padding: 3px 6px;
}

.pd-floating-toc__list .pd-toc-item.active {
    background-color: #eaf5ee;
}

.pd-floating-toc__list .pd-toc-item.pd-toc-h2>a {
    font-size: 13.5px;
}

.pd-floating-toc__list .pd-toc-item.pd-toc-h3>a {
    font-size: 13px;
}

.pd-floating-toc.is-collapsed .pd-floating-toc__box {
    display: none;
}

.pd-floating-toc.is-collapsed .pd-floating-toc__btn {
    display: inline-flex;
}

/* 9. Comments Section */
.comment-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid #e2e8f0;
}

.comment-section__title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 24px;
    position: relative;
    padding-bottom: 8px;
}

.comment-section__title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background-color: var(--color-3, #0e6938);
    border-radius: 2px;
}

.comment-form-wrap {
    background-color: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid #edf2f7;
}

.comment-form-inputs {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.comment-form-inputs .form-group {
    flex: 1;
}

.comment-form .form-group {
    margin-bottom: 12px;
}

.comment-form .form-group:last-child {
    margin-bottom: 0;
}

.comment-form input[type="text"],
.comment-form input[type="email"] {
    width: 100%;
    height: 44px;
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 16px;
    font-size: 14px;
    color: #334155;
    outline: none;
    transition: all 0.2s ease-in-out;
}

.comment-form input[type="text"]:focus,
.comment-form input[type="email"]:focus {
    border-color: var(--color-3, #0e6938);
    box-shadow: 0 0 0 3px rgba(14, 105, 56, 0.15);
}

.comment-form textarea {
    width: 100%;
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    color: #334155;
    outline: none;
    resize: vertical;
    transition: all 0.2s ease-in-out;
}

.comment-form textarea:focus {
    border-color: var(--color-3, #0e6938);
    box-shadow: 0 0 0 3px rgba(14, 105, 56, 0.15);
}

.comment-form button[type="submit"] {
    background-color: var(--color-3, #0e6938);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
}

.comment-form button[type="submit"]:hover {
    background-color: #094826;
}

.comment-form-prompt a {
    color: var(--color-3, #0e6938);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.comment-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-3, #0e6938);
    background-color: #eaf5ee;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(14, 105, 56, 0.2);
}

.comment-action-btn:hover {
    color: var(--color-3, #0e6938);
}

/* 10. Responsive */
@media (max-width: 991px) {
    .pd-layout {
        flex-direction: column;
    }

    .pd-sidebar {
        position: unset;
        width: 100%;
    }

    .pd-floating-toc {
        left: 12px;
        top: auto;
        bottom: 80px;
        transform: none;
        display: none;
    }

    .pd-floating-toc__box {
        width: 290px;
        max-height: 55vh;
    }
}

@media (max-width: 575px) {
    .pd-main {
        padding: 16px;
    }

    .pd-sidebar {
        padding: 18px;
    }

    .pd-title {
        font-size: 22px;
    }

    .pd-excerpt {
        padding: 12px 14px;
        font-size: 14px;
    }

    .pd-toc-header {
        padding: 12px 14px;
    }

    .pd-toc-body {
        padding: 10px 14px 14px;
    }
}
