/*** Thư viện văn bản – đồng bộ với theme Consalti ***/

.thu_vien_vb,
.vanban-single {
    --vb-primary:  #2969b2;
    --vb-accent: #FD4A36;
    --vb-text: inherit;
    --vb-border: #dee2e6;
    --bs-primary: var(--vb-primary);
    --bs-link-color: var(--vb-primary);
    --bs-link-hover-color: var(--vb-accent);
    font-size: inherit;
    line-height: inherit;
    color: var(--vb-text);
}

.thu_vien_vb .text-primary,
.vanban-single .text-primary {
    color: var(--vb-primary) !important;
}

/* Ô tìm kiếm */
.search_form_vb {
    display: flex;
    align-items: stretch;
    width: 100%;
    gap: 0;
    margin-bottom: 0.75rem;
}

.search_form_vb__input,
.search_form_vb__btn {
    height: auto !important;
    font-size: 1rem !important;
    line-height: 1.5;
    box-sizing: border-box;
}

.search_form_vb__input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    border: 1px solid var(--vb-border);
    border-radius: 8px 0 0 8px;
    padding: 0.8rem 1rem;
    background: #fff;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.search_form_vb__input:focus {
    border-color: var(--vb-primary);
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--vb-primary) 20%, transparent);
}

.search_form_vb__btn {
    flex: 0 0 auto;
    background-color: var(--vb-primary) !important;
    color: #fff !important;
    border: 1px solid var(--vb-primary);
    border-radius: 0 8px 8px 0;
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.search_form_vb__btn:hover {
    background-color: var(--vb-accent) !important;
    border-color: var(--vb-accent);
    color: #fff !important;
}

.thu_vien_vb .search-box__title {
    color: var(--vb-primary);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.35;
}

.thu_vien_vb .search-box__hint {
    font-size: 0.875rem;
    color: #666;
    line-height: 1.6;
}

.thu_vien_vb .search-box__hint span {
    display: inline-block;
    margin-right: 0.35rem;
    white-space: nowrap;
}

@media (max-width: 575px) {
    .search_form_vb {
        flex-direction: column;
        gap: 0.625rem;
    }

    .search_form_vb__input,
    .search_form_vb__btn {
        border-radius: 8px !important;
        width: 100%;
    }

    .search_form_vb__input {
        font-size: 16px !important;
    }

    .search_form_vb__btn {
        padding: 0.85rem 1rem;
    }
}

/* Tiêu đề văn bản */
.tenvb a {
    color: var(--vb-primary);
    text-decoration: none;
    font-weight: 600;
}

.tenvb a:hover {
    color: var(--vb-accent);
    text-decoration: underline;
}

/* Nút Xem / Tải về */
.btnvb {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btnvb > a,
.vb-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-align: center;
    background-color: var(--vb-primary);
    color: #fff;
    text-decoration: none;
    padding: 0.7rem 0.75rem;
    position: relative;
    overflow: hidden;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.btnvb > a:last-child,
.vb-btn--download {
    background-color: var(--vb-accent);
}

.btnvb > a::before,
.vb-btn::before {
    content: "";
    background-color: #fff;
    width: 0;
    height: 100%;
    position: absolute;
    opacity: 0;
    left: 0;
    top: 0;
    transition: 300ms;
}

.btnvb > a:hover::before,
.vb-btn:hover::before {
    opacity: 0.15;
    width: 100%;
}

.btnvb > a:hover,
.vb-btn:hover {
    color: #fff;
}

/* Danh sách văn bản – layout grid */
.vb-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(130px, 200px) minmax(110px, 130px);
    gap: 0.75rem 1.25rem;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--vb-border);
}

.vb-item:last-child {
    border-bottom: none;
}

.vb-item__title {
    min-width: 0;
}

.vb-item__title a {
    display: block;
    word-break: break-word;
}

.vb-item__meta[aria-hidden="true"] {
    display: none;
}

/* Tab layout */
.vb-tabs-wrap {
    gap: 0;
}

.vb-tabs-nav {
    flex: 0 0 25%;
    max-width: 25%;
    margin-right: 1rem;
}

.vb-tabs-content {
    flex: 1;
    min-width: 0;
    padding-left: 1rem;
}

/* Section title */
.list_vb h3.section-title {
    color: #fff;
    border-bottom: 2px solid var(--vb-primary);
    margin-bottom: 0;
}

.list_vb h3.section-title > span,
.list_vb h3.section-title .section-title__inner {
    background-color: var(--vb-primary);
    padding: 0.5em 1em;
    border-radius: 10px 10px 0 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.list_vb h3.section-title .section-title__inner {
    display: inline-block;
}

.vb-tabs-section__icon {
    display: none;
}

/* Tab navigation */
.tab-content > .tab-pane.show {
    opacity: 1;
}

.list_vb .nav > .nav-link {
    text-transform: capitalize !important;
    text-align: left;
    background-color: transparent;
    padding: 0.5em 0.75em;
    color: inherit;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.list_vb .nav > .nav-link:hover {
    color: var(--vb-primary);
}

.list_vb .nav > .nav-link.active {
    background-color: var(--vb-primary);
    color: #fff;
}

/* Widget sidebar */
.widgetvb_blue {
    border-color: var(--vb-primary) !important;
}

.widgetvb_red {
    border-color: var(--vb-accent) !important;
}

.widgetvb h5.widgetvb-title > b {
    display: flex;
    padding: 0;
    overflow: hidden;
    color: #fff;
    align-items: center;
    justify-content: center;
    margin-top: -16px;
}

.widgetvb h5.widgetvb-title > b > span {
    line-height: 30px;
    font-weight: 600;
}

.widgetvb_blue.widgetvb h5.widgetvb-title > b > span {
    background-color: var(--vb-primary);
}

.widgetvb_red.widgetvb h5.widgetvb-title > b > span {
    background-color: var(--vb-accent);
}

.widgetvb h5.widgetvb-title > b::before,
.widgetvb h5.widgetvb-title > b::after {
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    display: inline-block;
    content: "";
}

.widgetvb_blue.widgetvb h5.widgetvb-title > b::before {
    border-right: 15px solid var(--vb-primary);
}

.widgetvb_blue.widgetvb h5.widgetvb-title > b::after {
    border-left: 15px solid var(--vb-primary);
}

.widgetvb_red.widgetvb h5.widgetvb-title > b::before {
    border-right: 15px solid var(--vb-accent);
}

.widgetvb_red.widgetvb h5.widgetvb-title > b::after {
    border-left: 15px solid var(--vb-accent);
}

.list-01 {
    list-style: none;
    padding-left: 0;
}

.list-01 > li {
    position: relative;
    padding-left: 1.25rem;
}

.list-01 > li::before {
    content: "\f105";
    font-family: "Font Awesome 5 Free", "FontAwesome";
    font-weight: 900;
    position: absolute;
    left: -15px;
    color: var(--vb-primary);
}

.widgetvb .card-body ul > li > a {
    text-decoration: none;
    color: inherit;
}

.widgetvb .card-body ul > li > a:hover {
    color: var(--vb-primary);
}

.bd-sidebar {
    position: -webkit-sticky;
    position: sticky;
    top: 5rem;
    display: block !important;
    height: calc(100vh - 6rem);
    overflow-y: auto;
}

/* Khối tìm kiếm */
.thu_vien_vb .search-box {
    border: 1px solid var(--vb-border);
    border-radius: 1rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
}

.thu_vien_vb .search-box h3,
.thu_vien_vb .search-box__title {
    color: var(--vb-primary);
    font-size: 1.25rem;
    font-weight: 700;
}

/* Danh sách văn bản */
.list_vb .vb-list-panel {
    border: 1px solid var(--vb-border);
    border-radius: 0 0 1rem 1rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
}

.thongtinthem small {
    color: #666;
}

.thongtinthem .text-success {
    color: #198754 !important;
}

/* Single văn bản – layout 2 cột */
.vanban-single__layout {
    align-items: flex-start;
}

.vanban-single__main,
.vanban-single__sidebar {
    min-width: 0;
}

@media (min-width: 992px) {
    .vanban-single .vanban-single__layout > .vanban-single__main {
        flex: 0 0 auto;
        width: 75%;
        max-width: 75%;
    }

    .vanban-single .vanban-single__layout > .vanban-single__sidebar {
        flex: 0 0 auto;
        width: 25%;
        max-width:25%;
    }
}

.vanban-single .card {
    border: 1px solid var(--vb-border);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
}

.vanban-single .card-header {
    background-color: #f8f9fa;
    border-bottom: 2px solid var(--vb-primary);
}

.vanban-single #ContentBody_noi_dung {
    font-size: inherit;
    line-height: 1.8;
}

.vanban-single #ContentBody_noi_dung h1,
.vanban-single #ContentBody_noi_dung h2,
.vanban-single #ContentBody_noi_dung h3,
.vanban-single #ContentBody_noi_dung h4 {
    color: var(--vb-primary);
}

.vanban-single__sidebar-inner {
    position: sticky;
    top: 5rem;
}

/* ── Tablet ── */
@media (max-width: 991px) {
    .vb-item {
        grid-template-columns: minmax(0, 1fr) minmax(120px, 180px);
        grid-template-areas:
            "title title"
            "meta  actions";
    }

    .vb-item__title  { grid-area: title; }
    .vb-item__meta   { grid-area: meta; }
    .vb-item__actions { grid-area: actions; }

    .vb-tabs-nav {
        flex: 0 0 30%;
        max-width: 30%;
    }

    .vanban-single .row.g-5 {
        --bs-gutter-y: 1.5rem;
    }
}

/* ── Mobile ── */
@media (max-width: 767px) {
    .thu_vien_vb,
    .vanban-single {
        margin-top: 1rem !important;
        margin-bottom: 1.5rem !important;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .thu_vien_vb.container,
    .vanban-single.container {
        max-width: 100%;
    }

    /* Ô tìm kiếm */
    .thu_vien_vb .search-box {
        padding: 1.25rem !important;
        margin-bottom: 1.5rem !important;
    }

    .thu_vien_vb .search-box h3,
    .thu_vien_vb .search-box__title {
        font-size: 1.1rem;
    }

    .thu_vien_vb .search-box__hint span {
        margin-right: 0.5rem;
        margin-bottom: 0.15rem;
    }

    /* Section title */
    .list_vb h3.section-title > span,
    .list_vb h3.section-title .section-title__inner {
        font-size: 0.95rem;
        padding: 0.45em 0.75em;
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .vb-tabs-section__toggle {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .vb-tabs-section__icon {
        display: inline-block;
        font-size: 0.85em;
        opacity: 0.85;
        transition: transform 0.25s ease;
        flex-shrink: 0;
    }

    .vb-tabs-section.is-nav-expanded .vb-tabs-section__icon {
        transform: rotate(180deg);
    }

    /* Tab nav: mặc định chỉ hiện tab active */
    .vb-tabs-section:not(.is-nav-expanded) .vb-tabs-nav {
        overflow: visible;
        flex-wrap: nowrap;
        gap: 0;
        padding-bottom: 0;
        margin-bottom: 0.5rem !important;
    }

    .vb-tabs-section:not(.is-nav-expanded) .vb-tabs-nav .nav-link:not(.active) {
        display: none !important;
    }

    .vb-tabs-section:not(.is-nav-expanded) .vb-tabs-nav .nav-link.active {
        width: 100%;
        flex-shrink: 1;
        text-align: left;
        padding: 0.5rem 0.75rem !important;
    }

    /* Tab nav: xổ đầy đủ khi mở */
    .vb-tabs-section.is-nav-expanded .vb-tabs-nav {
        flex-direction: column !important;
        flex-wrap: nowrap;
        overflow: visible;
        gap: 0.25rem;
        margin-bottom: 0.75rem !important;
        padding-bottom: 0;
    }

    .vb-tabs-section.is-nav-expanded .vb-tabs-nav .nav-link {
        display: block !important;
        width: 100%;
        flex-shrink: 0;
        white-space: normal;
        text-align: left;
        padding: 0.5rem 0.75rem !important;
    }

    /* Tab: layout tổng thể */
    .vb-tabs-wrap {
        flex-direction: column !important;
    }

    .vb-tabs-nav {
        flex: none !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .vb-tabs-nav .nav-link {
        font-size: 0.85rem;
    }

    .vb-tabs-content {
        width: 100% !important;
        padding-left: 0 !important;
        border-left: none !important;
        border-top: 1px solid var(--vb-border);
        padding-top: 0.5rem;
    }

    .list_vb .vb-list-panel {
        padding: 0.75rem !important;
        border-radius: 0 0 0.75rem 0.75rem !important;
    }

    /* Mỗi văn bản = thẻ card */
    .vb-item {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "meta"
            "actions";
        gap: 0.5rem;
        padding: 0.875rem;
        margin-bottom: 0.625rem;
        border: 1px solid var(--vb-border);
        border-radius: 0.625rem;
        background: #fff;
        border-bottom: 1px solid var(--vb-border);
    }

    .vb-item:last-child {
        margin-bottom: 0;
    }

    .vb-item__meta[aria-hidden="true"] {
        display: none;
    }

    .vb-item__meta {
        padding-top: 0.25rem;
        border-top: 1px dashed var(--vb-border);
    }

    .vb-item__actions.btnvb {
        flex-direction: row;
        gap: 0.5rem;
        padding-top: 0.25rem;
    }

    .vb-item__actions .vb-btn,
    .vb-item__actions.btnvb > a {
        flex: 1;
        padding: 0.65rem 0.5rem;
        font-size: 0.85rem;
    }

    /* Trang chi tiết */
    .vanban-single .card-header {
        padding: 0.75rem !important;
    }

    .vanban-single .card-body {
        padding: 1rem;
    }

    .vb-item--single-header {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "meta"
            "actions";
        padding: 0;
        border: none;
        margin: 0;
        background: transparent;
    }

    .vb-item--single-header .vb-item__title h1 {
        font-size: 1.15rem !important;
        line-height: 1.4;
    }

    .vb-item--single-header .vb-item__meta {
        border-top: none;
        padding-top: 0;
    }

    .vanban-single__sidebar-inner {
        position: static;
        top: auto;
        padding-top: 0;
    }

    .vanban-single .widgetvb {
        margin-top: 0 !important;
    }

    .vanban-single #ContentBody_noi_dung {
        font-size: 0.95rem;
        overflow-x: auto;
        word-break: break-word;
    }

    .vanban-single #ContentBody_noi_dung table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .vanban-single #ContentBody_nguon_tham_khao {
        font-size: 0.85rem;
        text-align: left !important;
        word-break: break-word;
    }
}

/* ── Màn hình rất nhỏ ── */
@media (max-width: 380px) {
    .vb-item__actions .vb-btn span,
    .vb-item__actions.btnvb > a span {
        display: none;
    }

    .vb-item__actions .vb-btn,
    .vb-item__actions.btnvb > a {
        padding: 0.7rem;
    }

    .vb-item__actions .vb-btn i,
    .vb-item__actions.btnvb > a i {
        font-size: 1.1rem;
        margin: 0;
    }
}
