/**
 * Documentation Sidebar — Topic Switcher (Sapo-style)
 * -----------------------------------------------------------------------------
 * Chọn 1 topic lớn ở trên → chỉ hiển thị cây menu của topic đó bên dưới.
 *
 * @author An Cao - Team CloudGO
 */

/* --- Scope: chỉ hiện topic đang chọn --- */
.docs-nav-list.docs-nav--scoped > .docs-nav-item {
    display: none;
}
.docs-nav-list.docs-nav--scoped > .docs-nav-item.is-current-topic {
    display: block;
}

/* --- Switcher --- */
.docs-topic-switcher {
    position: relative;
    padding: 0 1.5rem 0.875rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--docs-border-color, #e2e8f0);
}

.docs-topic-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: #fff;
    border: 1px solid var(--docs-border-color, #e2e8f0);
    border-radius: 8px;
    color: var(--docs-dark-color, #1e293b);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.docs-topic-trigger:hover {
    border-color: var(--docs-primary-color, #3b82f6);
}
.docs-topic-switcher.open .docs-topic-trigger {
    border-color: var(--docs-primary-color, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.docs-topic-trigger-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.docs-topic-chevron {
    flex: 0 0 auto;
    color: var(--docs-text-muted, #64748b);
    transition: transform 0.2s;
}
.docs-topic-switcher.open .docs-topic-chevron {
    transform: rotate(180deg);
}

/* --- Dropdown --- */
.docs-topic-dropdown {
    position: absolute;
    top: calc(100% - 0.375rem);
    left: 1.5rem;
    right: 1.5rem;
    z-index: 200;
    padding: 0.375rem;
    background: #fff;
    border: 1px solid var(--docs-border-color, #e2e8f0);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    max-height: 60vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}
.docs-topic-switcher.open .docs-topic-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.docs-topic-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.docs-topic-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--docs-text-color, #334155);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.docs-topic-option:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--docs-primary-color, #3b82f6);
}
.docs-topic-option-icon {
    display: inline-flex;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
}
.docs-topic-option-icon svg,
.docs-topic-option-icon img {
    width: 16px;
    height: 16px;
}
.docs-topic-option-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.docs-topic-check {
    flex: 0 0 auto;
    color: var(--docs-primary-color, #3b82f6);
    opacity: 0;
}
.docs-topic-option.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--docs-primary-color, #3b82f6);
    font-weight: 600;
}
.docs-topic-option.active .docs-topic-check {
    opacity: 1;
}

/* --- Topic hiện tại: header (root) làm tiêu đề nhóm --- */
.docs-nav-list.docs-nav--scoped > .docs-nav-item.is-current-topic > .docs-nav-link {
    font-weight: 700;
    color: var(--docs-dark-color, #1e293b);
}

/* --- Nhấn mạnh mục đang xem (active) --- */
.docs-nav .docs-nav-link.active,
.docs-nav .docs-nav-sublink.active {
    color: var(--docs-primary-color, #3b82f6);
    font-weight: 600;
}
.docs-nav .docs-nav-subitem.active > .docs-nav-sublink,
.docs-nav .docs-nav-item.active > .docs-nav-link {
    background: rgba(59, 130, 246, 0.1);
    box-shadow: inset 3px 0 0 var(--docs-primary-color, #3b82f6);
}
