/* ======================= Google Fonts ======================= */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Montserrat:wght@600&family=Fira+Code&display=swap');

/* ======================= 主题变量定义 ======================= */
.theme-light {
    --theme-bg: #ffffff;
    --theme-fg: #292929;
    --theme-link: #007acc;
    --theme-sidebar-bg: #f9f9f9;
    --theme-border: #e0e0e0;
    --theme-btn-bg: #007acc;
    --theme-btn-fg: #ffffff;
    --theme-btn-hover: #005a99;
    --theme-code-bg: #f0f0f0;
    --theme-blockquote-bg: #f8f9fa;
}

.theme-dark {
    --theme-bg: #1E1E1E;
    --theme-fg: #D4D4D4;
    --theme-link: #4EC9B0;
    --theme-sidebar-bg: #1E1E1E;
    --theme-border: #3C3C3C;
    --theme-btn-bg: #005a99;
    --theme-btn-fg: #ffffff;
    --theme-btn-hover: #0088cc;
    --theme-code-bg: #2D2D2D;
    --theme-blockquote-bg: #2D2D2D;
}

/* ======================= 全局样式 ======================= */
body, .rst-content, .wy-nav-content {
    font-family: 'Lato', Arial, sans-serif !important;
    font-size: 16px;
    line-height: 1.7;
    color: var(--theme-fg);
    background-color: var(--theme-bg);
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

a {
    color: #0071e3; /* 蓝色链接 */
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ======================= 标题 ======================= */
.rst-content h1,
.rst-content h2,
.rst-content h3,
.rst-content h4,
.rst-content h5,
.rst-content h6 {
    font-family: 'Montserrat', 'Lato', sans-serif !important;
    font-weight: 600;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100%;
    box-sizing: border-box;
    color: var(--theme-fg);
}

.rst-content h2 {
    color: #0071e3 !important; /* 保留蓝色 H2 */
}

/* ======================= 侧边栏 ======================= */
.wy-nav-side {
    background-color: var(--theme-sidebar-bg);
}

.wy-side-nav-search {
    background-color: var(--theme-sidebar-bg) !important; 
    border-bottom-color: var(--theme-border) !important;
}

.wy-side-nav-search > div.version {
    color: white;
}

.wy-side-nav-search .logo img {
    width: 150px;   /* 或根据你 logo 原始尺寸设置 */
    height: auto;
    display: block;
}


.wy-menu a,
.wy-menu a:visited {
    color: var(--theme-fg);
}

.wy-menu a:hover,
.wy-menu-vertical a:hover {
    color: var(--theme-link) !important;
    background-color: rgba(0, 122, 204, 0.1) !important;
}

.wy-menu hr {
    border-top-color: var(--theme-border);
}

/* ======================= 内容区 ======================= */

.wy-nav-content {
    max-width: 1200px; /* 默认宽度 */
  }

/* 让右侧背景跟随主题变化 */
.wy-nav-content-wrap {
    background-color: var(--theme-sidebar-bg) !important;
    transition: background-color 0.3s ease;
}

.wy-nav-content-wrap p,
.wy-nav-content-wrap ul,
.wy-nav-content-wrap ol,
.wy-nav-content-wrap table,
.wy-nav-content-wrap blockquote {
    color: var(--theme-fg);
}

.wy-nav-content-wrap hr {
    border-top-color: var(--theme-border);
}

.wy-nav-content-wrap table {
    border-color: var(--theme-border);
}

.wy-nav-content-wrap table th {
    background-color: var(--theme-sidebar-bg);
    border-color: var(--theme-border);
}

.wy-nav-content-wrap table td {
    border-color: var(--theme-border);
}

.theme-dark .admonition.note {
    background-color: #2D2D2D;
    border-left-color: #4EC9B0;
    color: #D4D4D4;
}



/* ---------- 暗色模式表格样式 ---------- */
.theme-dark .wy-nav-content-wrap table th {
    background-color: #2A2A2A !important;
  }
  
  .theme-dark .wy-nav-content-wrap table td {
    background-color: #242424 !important;
    border-color: #3C3C3C !important;
  }
  
  .theme-dark .wy-nav-content-wrap table {
    border-color: #3C3C3C !important;
  }
  


/* 代码块 */
.wy-nav-content-wrap .highlight,
.wy-nav-content-wrap .highlight pre,
.wy-nav-content-wrap div.literal-block,
.wy-nav-content-wrap code,
pre, code {
    background-color: var(--theme-code-bg);
    color: var(--theme-fg);
    font-family: 'Fira Code', 'JetBrains Mono', 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace !important;
    font-size: 14px;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.05);
}

/* 引用块 */
.wy-nav-content-wrap blockquote {
    background-color: var(--theme-blockquote-bg);
    border-left-color: var(--theme-link);
}

/* ======================= 按钮 ======================= */
.wy-nav-content-wrap .btn,
.wy-nav-content-wrap .viewcode-link,
.wy-nav-content-wrap .headerlink {
    background-color: var(--theme-btn-bg);
    color: var(--theme-btn-fg);
    border-color: var(--theme-btn-bg);
}

.wy-nav-content-wrap .btn:hover,
.wy-nav-content-wrap .viewcode-link:hover,
.wy-nav-content-wrap .headerlink:hover {
    background-color: var(--theme-btn-hover);
    color: var(--theme-btn-fg);
}

/* ======================= 页面目录 TOC ======================= */
.rst-content .toctree-wrapper,
.rst-content .toctree-wrapper ul,
.rst-content .toctree-wrapper li,
.rst-content .toctree-wrapper a {
    font-family: 'Lato', Arial, sans-serif !important;
    font-size: 16px !important;
    color: var(--theme-fg) !important;
    line-height: 1.5 !important;
    text-decoration: none !important;
}

.rst-content .toctree-wrapper > ul > li > a {
    font-weight: 700 !important;
    font-size: 18px !important;
}

.rst-content .toctree-wrapper a:hover {
    color: #0071e3 !important;
}

.rst-content .toctree-wrapper > p {
    font-family: 'Montserrat', 'Lato', sans-serif !important;
    font-weight: 600 !important;
    font-size: 24px !important;
    color: #0071e3 !important;
    margin-bottom: 0.5em !important;
}

/* 隐藏正文中的 toctree caption */
.rst-content .caption,
.rst-content .caption-text {
    display: none !important;
}

/* ======================= 响应式 ======================= */
@media (max-width: 768px) {
    .wy-nav-content {
        max-width: 100% !important;
        padding: 1em !important;
        box-sizing: border-box;
    }

    .rst-content .toctree-wrapper > p { font-size: 18px !important; }
    .rst-content .toctree-wrapper a { font-size: 14px !important; }

    pre {
        overflow-x: auto;
        white-space: pre !important;
        word-break: normal !important;
    }

    .rst-content p,
    .rst-content li,
    .rst-content td,
    .rst-content a,
    .rst-content h1,
    .rst-content h2,
    .rst-content h3,
    .rst-content h4,
    .rst-content h5,
    .rst-content h6 {
        white-space: normal !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }

    .rst-content table-wrapper,
    .rst-content .md-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .rst-content table {
        width: auto;
        min-width: 600px;
        table-layout: auto;
    }

    .rst-content table td,
    .rst-content table th,
    .rst-content table td p,
    .rst-content table th p {
        white-space: normal !important;
        word-break: normal !important;
        padding: 4px 8px;
        line-height: 1.4;
    }

    body, .rst-content, .wy-nav-content {
        line-height: 1.5;
    }
}

@media (max-width: 480px) {
    body, .rst-content, .wy-nav-content {
        font-size: 15px;
    }
}

/* ======================= 页脚社交图标 ======================= */
.forlinx-footer-social a {
    text-decoration: none !important;
}

/* ======================= 下拉主题菜单 ======================= */

/* ======================= 浮动主题切换按钮 ======================= */
#theme-switcher {
    position: fixed;
    z-index: 9999;
    top: 10px;
    right: 10px;
    display: block;
    pointer-events: auto; /* 确保可点击 */
}

/* 按钮样式 */
#theme-switcher-btn {
    padding: 8px 12px;
    background: rgba(0, 122, 204, 0.85); /* 半透明蓝色 */
    color: #fff;
    border: none;
    border-radius: 50px; /* 圆形/胶囊形 */
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transition: all 0.3s ease;
    backdrop-filter: blur(6px); /* 背景轻微模糊 */
}

/* 悬浮效果 */
#theme-switcher-btn:hover {
    background: rgba(0, 122, 204, 1);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

/* ======================= 移动端右下角 ======================= */
@media (max-width: 768px) {
    #theme-switcher {
        top: 42px !important;
        right: 16px !important;
        bottom: auto !important; /* 清除 bottom 定位 */
    }
    #theme-switcher-btn {
        padding: 10px 14px;
        font-size: 15px;
    }
}

  