/* =====================================================
   HELP CENTER DETAIL - Mobile-first
   Prefix: hc-
   ===================================================== */

/* Breadcrumb */
.hc-breadcrumb {
    background: #DCF2EC;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #e8f0e8;
}

.hc-breadcrumb__list {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    max-width: min(1200px, 90vw);
}

.hc-breadcrumb__item {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #2A2D32;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hc-breadcrumb__item + .hc-breadcrumb__item::before {
    content: '›';
    color: #94a3b8;
    font-weight: 700;
    font-size: 1rem;
}

.hc-breadcrumb__link {
    color: #2A2D32;
    text-decoration: none;
}

.hc-breadcrumb__link:hover {
    text-decoration: underline;
}

.hc-breadcrumb__item--current {
    color: #1e293b;
    font-weight: 600;
}

/* Detail layout */
.hc-detail {
    background: linear-gradient(135deg, #f0f7ec 0%, #e6f2df 100%);
    min-height: 60vh;
    --hc-active: #1AAF86;
    --hc-active-dark: #0f5c42;
}

.hc-detail[data-system="bado-fnb"] {
    --hc-active: #6F8A6B;
    --hc-active-dark: #4f6a4b;
}

.hc-detail[data-system="bado-care"] {
    --hc-active: #ECAB3F;
    --hc-active-dark: #c98725;
}

.hc-detail[data-system="bado-edu"] {
    --hc-active: #477DCA;
    --hc-active-dark: #2f5fa3;
}

.hc-detail__body {
    position: relative;
    max-width: min(1200px, 90vw);
    margin: 0.5rem auto;
    padding: 0;
}

/* Sidebar toggle button (mobile/tablet) */
.hc-sidebar__toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1rem;
    background: #f8faf9;
    border: none;
    border-bottom: 1px solid #e8f0e8;
    color: #187455;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}



/* Sidebar */
.hc-sidebar {
    position: relative;
}

.hc-detail__sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 85vw;
    max-width: 85vw;
    z-index: 1050;
    background: #FFFFFF;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
    /*overflow-y: auto; */
    overflow: scroll;
}

.hc-detail__sidebar.open {
    transform: translateX(0);
}

/* Sidebar overlay */
.hc-sidebar__overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1049;
    display: none;
}

/* Sidebar close button */
.hc-sidebar__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.875rem;
    height: 1.875rem;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: background 0.2s;
    flex-shrink: 0;
    margin-left: 0.375rem;
}

.hc-sidebar__close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* Sidebar search */
.hc-sidebar__search {
    padding: 0.625rem 0.5rem 0.875rem;
    border-bottom: 1px solid #e8f0e8;
    display: flex;
    align-items: center;
}

.hc-sidebar__search-inner {
    position: relative;
    flex: 1;
    min-width: 0;
}

.hc-sidebar__search-input {
    display: block;
    width: 100%;
    padding: 0.625rem 2.125rem 0.625rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #dce5dc;
    background: #f8faf9;
    font-size: 1rem;
    color: #334155;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.hc-sidebar__search-input:focus {
    border-color: #187455;
    background: #fff;
}

.hc-sidebar__search-input::placeholder {
    color: #94a3b8;
}

.hc-sidebar__search-icon {
    position: absolute;
    right: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

/* Sidebar nav */
.hc-sidebar__nav {
    padding: 0.25rem 0;
}

.hc-sidebar__menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hc-sidebar__group {
    margin: 0;
}

.hc-sidebar__node-row {
    display: flex;
    align-items: center;
    gap: 0.0625rem;
    padding-left: var(--hc-level-indent, 0);
}

/* ... sử lí css menu ở đây*/
.hc-sidebar__node-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    min-width: 1rem;
    height: 1rem;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    outline: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}

.hc-sidebar__node-arrow {
    transition: transform 0.2s;
    transform: rotate(90deg);
}

.hc-sidebar__node-toggle:focus,
.hc-sidebar__node-toggle:active,
.hc-sidebar__node-toggle:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.hc-sidebar__node-toggle.collapsed .hc-sidebar__node-arrow {
    transform: rotate(0deg);
}

/* Spacer để căn chỉnh label khi có hoặc không có toggle */
.hc-sidebar__node-spacer {
    display: inline-block;
    width: 0.75rem;
    min-width: 0.75rem;
}

/* Label cho mục cha */
.hc-sidebar__label {
    display: block;
    flex: 1;
    padding: 0.5625rem 0.25rem 0.5625rem 0.3125rem;
    font-size: 1rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03125rem;
}

.hc-sidebar__group-title {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.25rem;
    font-size: 1rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03125rem;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.hc-sidebar__group-title:hover {
    color: #187455;
}

.hc-sidebar__group-arrow {
    flex-shrink: 0;
    transition: transform 0.2s;
    color: #94a3b8;
    transform: rotate(90deg);
}

.hc-sidebar__group-title.collapsed .hc-sidebar__group-arrow {
    transform: rotate(0deg);
}

.hc-sidebar__submenu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hc-sidebar__submenu.collapsed {
    display: none;
}

.hc-sidebar__item {
    margin: 0;
}

/* Link cho mục con */
.hc-sidebar__link {
    display: block;
    flex: 1;
    padding: 0.5625rem 0.25rem 0.5625rem 0.3125rem;
    font-size: 1rem;
    color: #64748b;
    text-decoration: none;
    transition: all 0.15s;
    border-left: 0.1875rem solid transparent;
}

.hc-sidebar__item.has-children > .hc-sidebar__node-row > .hc-sidebar__label {
    cursor: pointer;
}

.hc-sidebar__link:hover {
    color: #187455;
}

.hc-sidebar__item.active > .hc-sidebar__link,
.hc-sidebar__item.active > .hc-sidebar__node-row > .hc-sidebar__link {
    background: var(--hc-active);
    color: #fff;
    font-weight: 600;
}

.hc-sidebar__item--level-1 > .hc-sidebar__node-row > .hc-sidebar__link,
.hc-sidebar__item--level-1 > .hc-sidebar__node-row > .hc-sidebar__label {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03125rem;
}

.hc-sidebar__submenu .hc-sidebar__item > .hc-sidebar__node-row > .hc-sidebar__link,
.hc-sidebar__submenu .hc-sidebar__item > .hc-sidebar__node-row > .hc-sidebar__label {
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
}

.hc-sidebar__item--level-1 {
    --hc-level-indent: 0;
}

.hc-sidebar__item--level-2 {
    --hc-level-indent: 0.875rem;
}

.hc-sidebar__item--level-3 {
    --hc-level-indent: 1.75rem;
}

.hc-sidebar__item--level-4 {
    --hc-level-indent: 2.625rem;
}

.hc-sidebar__item--level-5 {
    --hc-level-indent: 3.5rem;
}

/* TOC cho mục cha */
.hc-sidebar__item.has-toc > .hc-sidebar__toc {
    margin: 0.25rem 0 0.375rem 0.875rem;
}

.hc-sidebar__item--level-2.has-toc > .hc-sidebar__toc {
    margin-left: 0.875rem;
}

.hc-sidebar__item--level-3.has-toc > .hc-sidebar__toc {
    margin-left: 1.75rem;
}

.hc-sidebar__item--level-4.has-toc > .hc-sidebar__toc {
    margin-left: 2.625rem;
}

.hc-sidebar__item--level-5.has-toc > .hc-sidebar__toc {
    margin-left: 3.5rem;
}

.hc-sidebar__item.toc-collapsed > .hc-sidebar__toc {
    display: none;
}

.hc-sidebar__toc {
    list-style: none;
    margin: 0;
    padding: 0 0 0 1.25rem;
}

.hc-sidebar__toc .hc-sidebar__toc {
    padding-left: 1rem;
}

.hc-sidebar__toc-item {
    margin: 0;
}

.hc-sidebar__toc-link {
    display: block;
    padding: 0.375rem 0.25rem 0.375rem 0.5rem;
    font-size: 1rem;
    color: #64748b;
    text-decoration: none;
    border-left: 0.125rem solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.hc-sidebar__toc-link:hover {
    color: #187455;
}

.hc-sidebar__toc-link.active {
    color: var(--hc-active);
    font-weight: 600;
    border-left-color: var(--hc-active);
    background: #f0f7ec;
    padding-left: 0.625rem;
    transition: all 0.2s ease;
}

/* Đảm bảo màu sắc thay đổi đúng theo data-system */
.hc-detail[data-system="bado-fnb"] .hc-sidebar__toc-link.active {
    background: #f4f6f4;
}

.hc-detail[data-system="bado-care"] .hc-sidebar__toc-link.active {
    background: #fef7ec;
}

.hc-detail[data-system="bado-edu"] .hc-sidebar__toc-link.active {
    background: #f0f4fa;
}

/* Article content */
.hc-detail__content {
    padding: 1.5rem 1rem 3rem; 
    background: #FFFFFF;
    margin-left: 0.3rem;
}


.hc-article__title {
    font-family: "Nunito", sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #1e293b;
    margin: 0 0 1.25rem;
    line-height: 1.3;
    scroll-margin-top: 7.5rem;
}

.hc-article__body {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: #334155;
}

.hc-article__body h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 1.75rem 0 0.75rem;
    scroll-margin-top: 7.5rem;
}

.hc-article__body h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: #1e293b;
    margin: 1.5rem 0 0.625rem;
    scroll-margin-top: 7.5rem;
}

.hc-article__body h4,
.hc-article__body h5,
.hc-article__body h6 {
    scroll-margin-top: 7.5rem;
}

.hc-article__body p {
    margin: 0 0 0.875rem;
}

.hc-article__body ul,
.hc-article__body ol {
    margin: 0 0 0.875rem;
    padding-left: 1.5rem;
}

.hc-article__body li {
    margin-bottom: 0.375rem;
}

.hc-article__body img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.hc-article__body a {
    color: #187455;
    text-decoration: underline;
}

/* ẩn hiện toc */
/* Ẩn các TOC con mặc định */
.hc-sidebar__toc .hc-sidebar__toc {
    display: none;
    /* Bạn có thể thêm animation sổ xuống mượt mà ở đây nếu cần */
}


/* xử lí ảnh (lightbox)----------------------------------------

//* 1. Ảnh trong bài viết: Đơn giản, tinh tế */
.hc-article__body img {
    cursor: pointer;
    /* Đổi sang bàn tay khi di chuột vào */
    border-radius: 4px;
    transition: box-shadow 0.2s ease;
}

.hc-article__body img:hover {
    /* Đổ bóng đen mờ rất nhẹ để báo hiệu có thể click */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 2. Lớp phủ (Overlay) phóng to ảnh: Nền trắng mờ sạch sẽ */
.hc-image-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(207, 202, 202, 0.9);
    /* Trắng mờ */
    z-index: 99999;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* Click bất cứ đâu để đóng */
    opacity: 0;
    transition: opacity 0.28s ease;
}

.hc-image-lightbox.is-visible {
    opacity: 1;
}

/* 3. Khung ảnh để ghim nút đóng vào góc trên-phải của ảnh */
.hc-image-lightbox__frame {
    position: relative;
    display: inline-block;
    max-width: 90vw;
    max-height: 90vh;
    cursor: default;
    transform: scale(0.92);
    opacity: 0;
    transition: transform 0.28s ease, opacity 0.28s ease;
}

.hc-image-lightbox.is-visible .hc-image-lightbox__frame {
    transform: scale(1);
    opacity: 1;
}

/* 4. Ảnh khi đã phóng to: Chỉ đổ bóng nhẹ */
.hc-image-lightbox__frame img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 5px;
    /* Hiệu ứng đổ bóng viền đen nhẹ nhàng mà bạn cần */
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    background-color: #fff;
}

/* 5. Nút đóng (X) - neo vào góc trên-phải của ảnh */
.hc-image-lightbox__close {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(40%, -40%);
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid #fff;
    border-radius: 50%;
    background: #000;
    color: #fff;
    font-size: 2rem;
    font-weight: normal;
    line-height: 1;
    user-select: none;
    z-index: 1;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    padding: 0;
    pointer-events: auto;
}

.hc-image-lightbox__close:hover {
    background: #111;
}

/* Tablet+ */
@media (min-width: 768px) {
    .hc-detail__content {
        padding: 2rem 1.5rem 3.5rem;
    }

    .hc-article__title {
        font-size: 1.75rem;
    }

    .hc-article__body {
        font-size: 1rem;
    }

   
}

/* Desktop */
@media (min-width: 992px) {
    .hc-sidebar__toggle {
        display: none;
    }

    .hc-detail__body {
        display: flex;
        gap: 0;
        padding: 0;
    }

    .hc-detail__sidebar {
        position: static;
        transform: none;
        width: clamp(16.25rem, 24vw, 23.75rem);
        flex-shrink: 0;
        box-shadow: none;
        border-right: 1px solid #e8f0e8;
        /* overflow-y: auto; */
        overflow: scroll;
        height: 100vh;
        position: sticky;
        top: 0;
        z-index: 1;
    }

    .hc-detail__content {
        flex: 1;
        min-width: 0;
        padding: 2rem 2.5rem 4rem;
    }

    .hc-breadcrumb {
        padding: 0.5rem 0;
    }

    .hc-breadcrumb__list {
        padding: 0.375rem 0.625rem;
    }

    .hc-article__title {
        font-size: 1.875rem;
    }

    .hc-sidebar__close {
        display: none;
    }
}

/* Large desktop */
@media (min-width: 1400px) {
    .hc-detail__body {
        max-width: min(1400px, 88vw);
    }

    .hc-breadcrumb__list {
        max-width: min(1400px, 88vw);
    }

    .hc-detail__content {
        padding: 2.5rem 3rem 4.5rem;
    }

    .hc-article__title {
        font-size: 2.125rem;
    }

    .hc-article__body {
        font-size: 1.0625rem;
    }

    .hc-article__body h2 {
        font-size: 1.375rem;
    }

    .hc-article__body h3 {
        font-size: 1.125rem;
    }
}

/* Extra large desktop */
@media (min-width: 1600px) {
    .hc-detail__body {
        max-width: min(1500px, 86vw);
    }

    .hc-breadcrumb__list {
        max-width: min(1500px, 86vw);
    }
}

/* Hide sidebar scrollbar for cleaner look */
.hc-detail__sidebar::-webkit-scrollbar {
    width: 0.25rem;
}

.hc-detail__sidebar::-webkit-scrollbar-thumb {
    background: #dce5dc;
    border-radius: 0.25rem;
}

.hc-sidebar__toggle {
    outline: none;
    border: none;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
}

.hc-sidebar__toggle:focus,
.hc-sidebar__toggle:active,
.hc-sidebar__toggle:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

/* --- CSS CHO MỤC CHA KHI CÓ MỤC CON ĐANG ACTIVE --- */

/* Màu chữ và font cho mục cha */
.hc-sidebar__toc-link.active-parent {
    color: var(--hc-active) !important;
    font-weight: 700;
    /* Đậm hơn một chút để phân biệt */
    position: relative;
}

/* Đổ màu nền cho mục cha dựa trên hệ thống */
.hc-sidebar__toc-link.active-parent {
    /* Mặc định cho Retail hoặc fallback */
    background: #f0f7ec;
    transition: all 0.2s ease;
}

/* Đổi màu nền của parent theo từng hệ thống giống như bạn đã làm với mục active */
.hc-detail[data-system="bado-fnb"] .hc-sidebar__toc-link.active-parent {
    background: #f4f6f4;
}

.hc-detail[data-system="bado-care"] .hc-sidebar__toc-link.active-parent {
    background: #fef7ec;
}

.hc-detail[data-system="bado-edu"] .hc-sidebar__toc-link.active-parent {
    background: #f0f4fa;
}

/* Tùy chỉnh: Nếu muốn mục cha có một đường kẻ mờ bên trái để tạo cảm giác phân cấp */
/*
.hc-sidebar__toc-link.active-parent {
    border-left: 0.125rem solid rgba(26, 175, 134, 0.3);
}
    /* Màu nhạt của hệ thống */

/* xử lí responsive cho bảng trong bài viết */
.hc-article__body table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
}


/* Back to top button */
.hc-backtop {
    position: fixed;
    right: 1rem;
    bottom: 6rem;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: url("https://media.bado.vn/BadoSite/HDSD/topbackbtn.webp") no-repeat center;
    background-size: contain;
    border: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

/* hiện khi scroll */
.hc-backtop.show {
    opacity: 1;
    visibility: visible;
}

.hc-backtop:focus {
    outline: none;
   
}

/* mobile tối ưu */
@media (max-width: 48rem) {

    /* 768px */
    .hc-backtop {
        right: 0.75rem;
        bottom: 5.625rem;
        width: 3rem;
        height: 3rem;
    }
}
