/* --------------------------------------------------------------------------------
 * Copyright (c) 2025 Huawei Technologies Co., Ltd.
 * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
 * CANN Open Software License Agreement Version 2.0 (the "License").
 * Please refer to the License for details. You may not use this file except in compliance with the License.
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
 * See LICENSE in the root of the software repository for the full text of the License.
 * -------------------------------------------------------------------------------- */

/**
 * Custom styles for navigation
 * 
 * - Hide +/- buttons in page content (TOC)
 * - Keep +/- buttons in left sidebar navigation
 * - Fix +/- button logic (+ = collapsed, - = expanded)
 */

/* 隐藏页面内容中的 +/- 按钮（目录中的展开/收起按钮） */
.rst-content .toctree-expand,
.document .toctree-expand,
article .toctree-expand,
.section .toctree-expand {
    display: none !important;
}

/* 确保左侧导航栏的 +/- 按钮仍然显示 */
.wy-menu-vertical .toctree-expand {
    display: inline-block !important;
}

/* 如果页面内容中有嵌套的目录列表，也隐藏其展开按钮 */
.rst-content .toctree-wrapper .toctree-expand {
    display: none !important;
}

/* 修正 +/- 按钮的显示逻辑 */
/* 使用 JavaScript 设置的 data-expanded 属性来判断展开/收起状态 */

/* 隐藏按钮的原始内容 */
.wy-menu-vertical button.toctree-expand {
    font-size: 0;
    width: auto;
    min-width: 20px;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    margin-right: 4px;
}

/* 默认状态（收起）：显示 + */
.wy-menu-vertical button.toctree-expand::before {
    content: "+";
    font-size: 14px;
    font-weight: bold;
    display: inline-block;
}

/* 展开状态（data-expanded="true"）：显示 - */
.wy-menu-vertical button.toctree-expand[data-expanded="true"]::before {
    content: "-";
}

/* 备用方案：根据父元素的 current 类来判断 */
.wy-menu-vertical li.toctree-l1.current > a > button.toctree-expand::before {
    content: "-";
}

/* 确保按钮可点击 */
.wy-menu-vertical button.toctree-expand:hover {
    opacity: 0.7;
}

