/* ================================================================== */
/*  HPM Document Features — CSS                                        */
/*  TOC, Related Docs, Revision History                                */
/* ================================================================== */

/* ------------------------------------------------------------------ */
/*  TABLE OF CONTENTS                                                  */
/* ------------------------------------------------------------------ */

.hpm-toc {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0 2rem;
    max-width: 100%;
}

.hpm-toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 0.75rem;
}

.hpm-toc-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    letter-spacing: -0.01em;
}

.hpm-toc-toggle {
    background: none;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    font-size: 1.1rem;
    line-height: 1;
    transition: all 0.2s;
}

.hpm-toc-toggle:hover {
    background: #e2e8f0;
    color: #334155;
}

.hpm-toc-nav {
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.25s ease;
    max-height: 2000px;
    opacity: 1;
}

.hpm-toc-nav.is-collapsed {
    max-height: 0;
    opacity: 0;
}

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

.hpm-toc-item {
    margin: 0;
    padding: 0.3rem 0;
    border-left: 2px solid transparent;
    transition: border-color 0.2s;
}

.hpm-toc-item:hover {
    border-left-color: #1c9dd1;
}

.hpm-toc-level-3 {
    font-size: 0.9em;
}

.hpm-toc-level-4 {
    font-size: 0.85em;
}

.hpm-toc-link {
    color: #475569;
    text-decoration: none;
    transition: color 0.2s;
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.hpm-toc-link:hover {
    color: #1c9dd1;
    background: #e0f2fe;
}

.hpm-toc-link.is-active {
    color: #1c9dd1;
    font-weight: 600;
    background: #e0f2fe;
}

/* ------------------------------------------------------------------ */
/*  RELATED DOCUMENTS                                                  */
/* ------------------------------------------------------------------ */

.hpm-related {
    margin: 3rem 0 0;
    padding: 2rem 0 0;
    border-top: 1px solid #e5e7eb;
}

.hpm-related-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 1.25rem;
    letter-spacing: -0.01em;
}

.hpm-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.hpm-related-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.25rem;
    transition: all 0.25s ease;
}

.hpm-related-card:hover {
    border-color: #1c9dd1;
    box-shadow: 0 4px 12px rgba(28, 157, 209, 0.1);
    transform: translateY(-2px);
}

.hpm-related-cat {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #1c9dd1;
    background: #e0f2fe;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin: 0 0 0.5rem;
}

.hpm-related-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    line-height: 1.4;
}

.hpm-related-card-title a {
    color: #1e293b;
    text-decoration: none;
    transition: color 0.2s;
}

.hpm-related-card-title a:hover {
    color: #1c9dd1;
}

.hpm-related-summary {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0 0 0.75rem;
}

.hpm-related-link {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1c9dd1;
    text-decoration: none;
    transition: all 0.2s;
}

.hpm-related-link:hover {
    color: #0d7aa7;
    text-decoration: underline;
}

/* ------------------------------------------------------------------ */
/*  REVISION HISTORY                                                   */
/* ------------------------------------------------------------------ */

.hpm-revisions {
    margin: 2.5rem 0 0;
    padding: 1.5rem 0 0;
    border-top: 1px solid #e5e7eb;
}

.hpm-revisions-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 1.25rem;
    letter-spacing: -0.01em;
}

.hpm-revision-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    position: relative;
}

.hpm-revision-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 2rem;
    bottom: -0.25rem;
    width: 2px;
    background: #e2e8f0;
}

.hpm-revision-dot {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #cbd5e1;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #e2e8f0;
    margin-top: 0.15rem;
    position: relative;
    z-index: 1;
}

.hpm-revision-item.is-current .hpm-revision-dot {
    background: #1c9dd1;
    box-shadow: 0 0 0 2px #1c9dd1;
}

.hpm-revision-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.hpm-revision-item.is-current .hpm-revision-info strong {
    color: #1e293b;
}

.hpm-revision-label {
    font-weight: 500;
    color: #475569;
}

.hpm-revision-date {
    color: #64748b;
    font-size: 0.85rem;
}

.hpm-revision-author {
    color: #94a3b8;
    font-size: 0.85rem;
}

/* ------------------------------------------------------------------ */
/*  PRINT STYLES                                                       */
/* ------------------------------------------------------------------ */

@media print {
    .hpm-toc,
    .hpm-related,
    .hpm-revisions,
    .hpm-support-sidebar,
    .hpm-support-mobile-toggle,
    .hpm-support-contact,
    header, footer, nav,
    .site-header, .site-footer,
    #wpadminbar {
        display: none !important;
    }

    .hpm-support-layout {
        display: block !important;
    }

    .hpm-support-main {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }

    .hpm-policy-content {
        font-size: 12pt;
        line-height: 1.6;
        color: #000;
    }

    .hpm-policy-content a {
        color: #000;
        text-decoration: underline;
    }

    .hpm-policy-content a::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }

    .hpm-policy-content img {
        max-width: 100%;
    }

    body {
        background: #fff;
    }
}

/* ------------------------------------------------------------------ */
/*  RESPONSIVE                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 768px) {
    .hpm-related-grid {
        grid-template-columns: 1fr;
    }

    .hpm-toc {
        padding: 1rem;
    }

    .hpm-toolbar {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .hpm-toolbar-right {
        flex-wrap: wrap;
    }

    .hpm-recent-list {
        flex-direction: column;
    }
}

/* ------------------------------------------------------------------ */
/*  TOOLBAR — BOOKMARK + SHARE                                         */
/* ------------------------------------------------------------------ */

.hpm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.hpm-toolbar-left,
.hpm-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hpm-bookmark-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: #475569;
    transition: all 0.2s;
    font-family: inherit;
}

.hpm-bookmark-btn:hover {
    border-color: #1c9dd1;
    color: #1c9dd1;
    background: #f0f9ff;
}

.hpm-bookmark-btn.active {
    border-color: #1c9dd1;
    background: #1c9dd1;
    color: #fff;
}

.hpm-bookmark-btn.active .hpm-bookmark-icon {
    fill: #fff;
}

.hpm-bookmark-icon {
    transition: fill 0.2s;
}

.hpm-share-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-right: 0.25rem;
}

.hpm-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 32px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    padding: 0 0.5rem;
}

.hpm-share-fb {
    background: #1877f2;
    color: #fff;
}

.hpm-share-fb:hover { background: #1565c0; }

.hpm-share-zalo {
    background: #0068ff;
    color: #fff;
}

.hpm-share-zalo:hover { background: #0052cc; }

.hpm-share-email {
    background: #64748b;
    color: #fff;
}

.hpm-share-email:hover { background: #475569; }

.hpm-share-copy {
    background: #e2e8f0;
    color: #475569;
}

.hpm-share-copy:hover {
    background: #cbd5e1;
}

/* ------------------------------------------------------------------ */
/*  RECENTLY VIEWED                                                    */
/* ------------------------------------------------------------------ */

.hpm-recently-viewed {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.hpm-recent-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.75rem;
}

.hpm-recent-header svg {
    color: #94a3b8;
}

.hpm-recent-list {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
}

.hpm-recent-list::-webkit-scrollbar {
    height: 4px;
}

.hpm-recent-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.hpm-recent-item {
    flex: 0 0 auto;
    min-width: 180px;
    max-width: 240px;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.hpm-recent-item:hover {
    border-color: #1c9dd1;
    box-shadow: 0 2px 8px rgba(28, 157, 209, 0.12);
}

.hpm-recent-cat {
    font-size: 0.7rem;
    color: #1c9dd1;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.hpm-recent-title {
    font-size: 0.82rem;
    color: #1e293b;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ------------------------------------------------------------------ */
/*  CATEGORY NOTIFICATIONS                                             */
/* ------------------------------------------------------------------ */

.hpm-notification-subscribe {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
    border: 1px solid #bae6fd;
    border-radius: 10px;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.hpm-notification-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: #1c9dd1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.hpm-notification-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.hpm-notification-text strong {
    font-size: 0.88rem;
    color: #1e293b;
}

.hpm-notification-text span {
    font-size: 0.78rem;
    color: #64748b;
}

.hpm-notification-guest {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.hpm-notification-email {
    padding: 0.45rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.82rem;
    width: 200px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.hpm-notification-email:focus {
    outline: none;
    border-color: #1c9dd1;
}

.hpm-notification-btn {
    padding: 0.45rem 1rem;
    background: #1c9dd1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.hpm-notification-btn:hover {
    background: #1789b5;
}

.hpm-notification-btn.active {
    background: #16a34a;
}

.hpm-notification-msg {
    font-size: 0.78rem;
    color: #16a34a;
    font-weight: 500;
    animation: hpm-fade-in 0.3s ease;
}

@keyframes hpm-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
