/* ============================================================
   HNNP — Single Post Layout
   File: child-theme/assets/css/single-post.css
   ============================================================ */

:root {
    --hnnp-blue: #1E70B5;
    --hnnp-toc-bg: #F2F3F7;
}

/* ── Body / Layout ── */
.hnnp-body {
    padding-top: 20px;
    padding-bottom: 48px;
}

.hnnp-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: start;
}

.hnnp-row.full-width {
    max-width: 900px;
    margin: 0 auto;
}

.hnnp-main { min-width: 0; }

/* ── Hero image — tách riêng, trên card ── */
.hnnp-hero-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    display: block;
    border-radius: 12px;
    margin-bottom: 16px;
}

.hnnp-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Overlay mobile */
.hnnp-hero-mobile-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.2) 55%, transparent 100%);
    padding: 16px 16px 24px;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
}

.hnnp-hero-title-mobile {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
    overflow-wrap: break-word;
    word-break: normal;
    max-width: 100%;
}

/* ── Article card ── */
.hnnp-article-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px 20px;
    box-shadow: 0 4px 24px rgba(0,0,0,.10);
    position: relative;
    z-index: 2;
}

/* ── Post header ── */
.hnnp-post-header {
    margin-bottom: 24px;
}

/* ── Category badge ── */
.hnnp-cat-badge {
    display: inline-block;
    width: fit-content;
    padding: 5px 12px;
    background: linear-gradient(135deg, #4A79FF 0%, #2F65E8 45%, #2B5ACD 100%);
    color: #fff !important;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .45px;
    border-radius: 5px;
    margin-bottom: 10px;
    text-decoration: none !important;
    box-shadow: 0 6px 14px rgba(43,90,205,.18);
}
.hnnp-cat-badge:hover,
.hnnp-cat-badge:focus {
    color: #fff !important;
    opacity: .95;
}

/* ── Post title ── */
.hnnp-post-title {
    font-size: clamp(24px, 4vw, 34px);
    font-weight: 700;
    line-height: 1.28;
    margin: 0 0 14px;
    color: var(--electron-dark, #161616);
    overflow-wrap: break-word;
    word-break: normal;
}

/* ── Meta ── */
.hnnp-post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--electron-text-soft, #949494);
}
.hnnp-meta-date {
    display: inline-flex;
    align-items: center;
}
.hnnp-meta-sep {
    color: var(--electron-gray, #E1E2E3);
}

/* ── TOC anchor ── */
#hnnp-toc-anchor {
    scroll-margin-top: 90px;
}

/* ── Main TOC ── */
.hnnp-toc {
    background: var(--hnnp-toc-bg) !important;
    border: 0 !important;
    border-radius: 10px !important;
    padding: 16px 20px !important;
    margin: 0 0 28px !important;
    box-shadow: none !important;
}

.hnnp-toc-title {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #1d1d20 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    cursor: pointer !important;
}

.hnnp-toc-title span:first-child {
    margin-right: auto !important;
}

.hnnp-toc-toggle-text {
    background: var(--hnnp-toc-bg) !important;
    color: var(--hnnp-blue) !important;
    border-radius: 3px !important;
    padding: 4px 8px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

.hnnp-toc-title svg {
    color: var(--hnnp-blue) !important;
    margin-left: 4px !important;
    flex-shrink: 0 !important;
    transition: transform .25s ease !important;
}
.hnnp-toc.is-closed .hnnp-toc-title svg {
    transform: rotate(-90deg) !important;
}

.hnnp-toc-list {
    margin-top: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    overflow: hidden !important;
    transition: max-height .25s ease !important;
}
.hnnp-toc.is-closed .hnnp-toc-list {
    max-height: 0 !important;
    margin-top: 0 !important;
}

.hnnp-toc-item,
.hnnp-toc-item:visited {
    display: block !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--hnnp-blue) !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    line-height: 1.55 !important;
    text-decoration: none !important;
}
.hnnp-toc-item:hover,
.hnnp-toc-item.is-active {
    color: var(--hnnp-blue) !important;
    text-decoration: underline !important;
    opacity: 1 !important;
}
.hnnp-toc-item.level-3 {
    padding-left: 16px !important;
}

/* ── Sticky TOC ── */
.hnnp-sticky-toc {
    display: none;
    position: sticky;
    top: 0;
    z-index: 9999;
    width: 100%;
    max-width: 100%;
    margin: 0 0 16px;
}
.hnnp-sticky-toc.is-visible {
    display: block;
}

.hnnp-sticky-toc-inner {
    position: relative;
    width: 100%;
    max-width: 100%;
}

.hnnp-sticky-toc-bar {
    width: 100%;
    min-height: 48px;
    background: #fff !important;
    box-shadow: rgba(0,0,0,.2) 0 5px 5px -5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
}

.hnnp-sticky-toc-current {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1 1 auto;
    min-width: 0;
    color: var(--hnnp-blue) !important;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
    word-break: break-word;
}

.hnnp-sticky-toc-toggle {
    flex-shrink: 0;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px;
    white-space: nowrap;
    align-self: center;
    background: var(--hnnp-toc-bg) !important;
    color: var(--hnnp-blue) !important;
    border: 1px solid #e7e7e7 !important;
    border-radius: 3px !important;
    box-shadow: none !important;
    padding: 6px 9px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    cursor: pointer;
}
.hnnp-sticky-toc-toggle:hover,
.hnnp-sticky-toc-toggle:focus {
    background: var(--hnnp-toc-bg) !important;
    color: var(--hnnp-blue) !important;
    opacity: 1 !important;
}
.hnnp-sticky-toc-toggle svg {
    color: var(--hnnp-blue) !important;
    flex-shrink: 0;
    transition: transform .25s ease;
}
.hnnp-sticky-toc.is-open .hnnp-sticky-toc-toggle svg {
    transform: rotate(180deg);
}

.hnnp-sticky-toc-list {
    display: none;
    position: absolute;
    z-index: 1000;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 500px;
    overflow-y: auto;
    background: var(--hnnp-toc-bg) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    padding: 12px 14px;
}
.hnnp-sticky-toc.is-open .hnnp-sticky-toc-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hnnp-sticky-toc-item,
.hnnp-sticky-toc-item:visited {
    display: block;
    width: 100%;
    background: transparent !important;
    color: var(--hnnp-blue) !important;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    text-decoration: none !important;
}
.hnnp-sticky-toc-item:hover,
.hnnp-sticky-toc-item.is-active {
    color: var(--hnnp-blue) !important;
    text-decoration: underline !important;
}
.hnnp-sticky-toc-item.level-3 {
    padding-left: 15px;
}

/* ── Content ── */
.electron-post-content-wrapper {
    font-size: 15px;
    line-height: 1.85;
    color: var(--electron-text, #4e4e4e);
}
.electron-post-content-wrapper p { margin-bottom: 18px; }
.electron-post-content-wrapper h2,
.electron-post-content-wrapper h3 {
    margin-top: 32px;
    margin-bottom: 10px;
    scroll-margin-top: 90px;
}
.electron-post-content-wrapper h2 { font-size: 24px; line-height: 1.35; font-weight: 700; }
.electron-post-content-wrapper h3 { font-size: 20px; line-height: 1.4; font-weight: 700; }
.electron-post-content-wrapper ul,
.electron-post-content-wrapper ol { margin: 0 0 20px 22px; padding: 0; }
.electron-post-content-wrapper li { margin-bottom: 8px; }
.electron-post-content-wrapper img { border-radius: 6px; max-width: 100%; height: auto; }
.electron-post-content-wrapper .wp-caption { max-width: 100% !important; }

.electron-blog-post-meta-bottom { margin-top: 32px; }

/* ============================================================
   SIDEBAR — Sản phẩm liên quan ACF
   ============================================================ */

.hnnp-sidebar-inner {
    position: static; /* mobile: không sticky */
}

.hnnp-related-products {
    background: #fff;
    border: 1px solid var(--electron-border, #EAEBED);
    border-radius: 10px;
    overflow: hidden;
}

.hnnp-related-title {
    font-size: 16px !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--electron-dark, #161616);
    margin: 0;
    padding: 12px 14px;
    border-bottom: 1px solid var(--electron-border, #EAEBED);
    background: var(--electron-gray-soft, #F7F7F8);
}

.hnnp-related-list {
    display: flex;
    flex-direction: column;
}

.hnnp-rp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    text-decoration: none !important;
    border-bottom: 1px solid var(--electron-border, #EAEBED);
    transition: background .15s;
}
.hnnp-rp-item:last-child { border-bottom: none; }
.hnnp-rp-item:hover { background: var(--electron-gray-soft, #F7F7F8); opacity: 1; }

.hnnp-rp-thumb {
    position: relative;
    flex-shrink: 0;
    width: 68px;
    height: 68px;
    border-radius: 7px;
    overflow: hidden;
    background: var(--electron-gray, #E1E2E3);
}
.hnnp-rp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hnnp-rp-no-thumb { width: 100%; height: 100%; background: var(--electron-gray, #E1E2E3); }

.hnnp-rp-badge {
    position: absolute;
    top: 3px;
    left: 3px;
    background: #e53935;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    line-height: 1.4;
}

.hnnp-rp-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hnnp-rp-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--electron-dark, #161616);
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .15s;
}
.hnnp-rp-item:hover .hnnp-rp-name { color: #2B5ACD; }

.hnnp-rp-price {
    font-size: 13px;
    font-weight: 700;
    color: #2B5ACD;
    line-height: 1.3;
}
.hnnp-rp-price .woocommerce-Price-amount { color: #2B5ACD; }
.hnnp-rp-price ins { text-decoration: none; color: #2B5ACD; }
.hnnp-rp-price del { font-weight: 400; font-size: 11px; color: var(--electron-text-soft, #949494); display: block; margin-bottom: 1px; }
.hnnp-rp-price del .woocommerce-Price-amount { color: var(--electron-text-soft, #949494); }

/* ============================================================
   BREADCRUMB — [hnnp_breadcrumb]
   Chức năng: breadcrumb hiển thị trên single post, trên hero image
   ============================================================ */

.hnnp-breadcrumb-wrap {
    margin-bottom: 12px;
}

.hnnp-breadcrumb {
    padding: 0;
}

.hnnp-breadcrumb-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hnnp-breadcrumb-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    line-height: 1.4;
}

.hnnp-breadcrumb-sep {
    color: #71717a;
    font-size: 13px;
    padding: 0 4px;
    user-select: none;
}

/* Home: icon + text */
.hnnp-breadcrumb-home {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #18181b;
    text-decoration: none !important;
    transition: color .15s;
}
.hnnp-breadcrumb-home:hover {
    color: var(--electron-primary, #2B5ACD);
    text-decoration: none !important;
}
.hnnp-breadcrumb-home svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.hnnp-breadcrumb-home-text {
    font-size: 13px;
    font-weight: 500;
    color: #18181b;
    transition: color .15s;
}
.hnnp-breadcrumb-home:hover .hnnp-breadcrumb-home-text {
    color: var(--electron-primary, #2B5ACD);
}

/* Link thường */
.hnnp-breadcrumb-link {
    color: #18181b;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none !important;
    white-space: nowrap;
    transition: color .15s;
}
.hnnp-breadcrumb-link:hover {
    color: var(--electron-primary, #2B5ACD);
    text-decoration: none !important;
}

/* Item cuối — text xám, không link */
.hnnp-breadcrumb-current {
    color: #71717a;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

/* Mobile */
@media (max-width: 799px) {
    .hnnp-breadcrumb-item {
        font-size: 12px;
    }
    .hnnp-breadcrumb-sep {
        font-size: 12px;
        padding: 0 3px;
    }
    .hnnp-breadcrumb-home-text,
    .hnnp-breadcrumb-link,
    .hnnp-breadcrumb-current {
        font-size: 12px;
    }
    .hnnp-breadcrumb-current {
        max-width: 160px;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 799px) {
    .hnnp-hero-mobile-overlay { display: flex; }

    .hnnp-body { padding-top: 12px; }

    .hnnp-hero-img-wrap {
        border-radius: 12px;
        margin-bottom: 0;
    }

    .hnnp-article-card {
        position: relative;
        z-index: 2;
        margin-top: -14px;
        box-shadow: none;
        border-radius: 16px 16px 0 0;
        padding: 14px 0 0;
    }

    /* Ẩn header desktop — đã có overlay trên ảnh */
    .hnnp-post-header { display: none; }

    .elementor-kit-135 h1.hnnp-hero-title-mobile,
    h1.hnnp-hero-title-mobile {
        font-size: 18px !important;
        line-height: 1.25 !important;
        font-weight: 700;
    }

    .hnnp-cat-badge { margin-bottom: 0; padding: 4px 10px; font-size: 10px; }

    /* Sticky TOC mobile */
    /* Sticky TOC mobile */
.hnnp-sticky-toc {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    z-index: 10020 !important;
}

.hnnp-sticky-toc.is-visible {
    display: block !important;
}

.hnnp-sticky-toc-inner {
    width: calc(100% - 24px) !important;
    max-width: 100% !important;
    margin: 0 auto !important;
}

.hnnp-sticky-toc-bar {
    padding: 8px 10px;
    min-height: 44px;
    gap: 8px;
    border-radius: 8px;
    overflow: hidden;
}

.hnnp-sticky-toc-current {
    font-size: 16px;
    -webkit-line-clamp: 2;
}

.hnnp-sticky-toc-toggle {
    font-size: 14px !important;
    padding: 6px 8px !important;
}

    /* Sidebar xuống dưới content */
    .hnnp-sidebar { order: 2; }
    .hnnp-rp-thumb { width: 60px; height: 60px; }
    .hnnp-rp-name { font-size: 12px; -webkit-line-clamp: 2; }
    .hnnp-rp-price { font-size: 12px; }
}

@media (min-width: 800px) {
    .hnnp-body { padding-top: 24px; }

    .hnnp-hero-img-wrap {
        aspect-ratio: auto;
        height: 360px;
        border-radius: 14px;
        margin-bottom: 0;
    }

    .hnnp-hero-mobile-overlay { display: none !important; }

    /* 2 cột */
    .hnnp-row {
        grid-template-columns: minmax(0, 1fr) 260px;
        gap: 20px;
        align-items: start;
    }
    .hnnp-row.full-width {
        grid-template-columns: 1fr;
        max-width: 900px;
        margin: 0 auto;
    }

    .hnnp-article-card {
        width: 100%;
        padding: 32px;
        border-radius: 12px;
        margin-top: -60px;
        position: relative;
        z-index: 2;
    }

    /* Sidebar sticky — đặt trên grid item trực tiếp */
    .hnnp-sidebar {
        position: sticky;
        top: 160px;
        align-self: start;
    }

    .hnnp-sidebar-inner {
        position: static;
    }

    /* Sticky TOC desktop */
    .hnnp-sticky-toc {
        width: calc(100% + 64px);
        max-width: none;
        margin-left: -32px;
        margin-right: -32px;
    }
    .hnnp-sticky-toc-current { font-size: 18px; }
    .hnnp-sticky-toc-toggle { font-size: 14px !important; padding: 7px 10px !important; }
    .hnnp-sticky-toc-item { font-size: 16px; }
}
@media (min-width: 800px) and (max-width: 1199px) {
    .hnnp-post-title { font-size: clamp(26px, 3.2vw, 30px); }
    .hnnp-post-header { margin-bottom: 20px; }
    .hnnp-article-card { padding: 28px; }
    .hnnp-sticky-toc {
        width: calc(100% + 56px);
        margin-left: -28px;
        margin-right: -28px;
    }
}

@media (min-width: 1200px) {
    .hnnp-row { grid-template-columns: minmax(0, 1fr) 280px; }
    .hnnp-hero-img-wrap { height: 420px; }
}