/* ============================================
 * 百度地图 JSAPI 文档 — 自定义主题样式
 *
 * 修改指南：
 * - 变量定义: :root 区域修改颜色/尺寸
 * - 左侧栏: .bmap-sidebar 相关
 * - 右侧内容: .bmap-content 相关
 * - 导航项: .bmap-nav 相关
 * - 签名块: .tsd-signature
 * - 暗色模式: [data-theme="dark"] 区域
 * ============================================ */

/* === 变量 === */
:root {
    --sidebar-w: 260px;
    --lbs-header-height: 0px;
    --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
    --font-mono: "SF Mono", "Menlo", "Consolas", monospace;
    --color-bg: #fff;
    --color-sidebar-bg: #fff;
    --color-border: #eee;
    --color-text: #333;
    --color-text-light: #666;
    --color-text-muted: #999;
    --color-primary: #3385ff;
    --color-hover-bg: #f7f8fa;
    --color-active-bg: #f0f7ff;
    --color-cat-title: #1a1a1a;
    --color-code-bg: #f8f9fb;
    --color-code-border: #e8ecf0;
}

[data-theme="dark"] {
    --color-bg: #0d1117;
    --color-sidebar-bg: #111318;
    --color-border: #222;
    --color-text: #c9d1dc;
    --color-text-light: #a0aec0;
    --color-text-muted: #666;
    --color-hover-bg: #1a2035;
    --color-active-bg: #1e3a5f;
    --color-cat-title: #e2e8f0;
    --color-code-bg: #161b27;
    --color-code-border: #2d3748;
}

/* === 基础 === */
html {
    font-size: 14px;
    scroll-padding-top: var(--lbs-header-height);
}

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
}

/* === 布局 === */
#lbs_header_container {
    position: sticky;
    top: 0;
    z-index: 200;
}

.bmap-layout {
    display: flex;
    min-height: calc(100vh - var(--lbs-header-height));
}

/* === 左侧 sidebar === */
.bmap-sidebar {
    position: fixed;
    top: var(--lbs-header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--color-sidebar-bg);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

/* === 侧边栏头部 === */
.bmap-sidebar-head {
    padding: 20px 16px 14px;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--color-sidebar-bg);
    z-index: 10;
}

.bmap-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.bmap-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-cat-title);
}

#tsd-search {
    position: relative;
}

#tsd-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
    outline: none;
    transition: border-color 0.15s;
}

#tsd-search-input:focus {
    border-color: var(--color-primary);
}

#tsd-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 400px;
    overflow-y: auto;
    background: var(--color-bg);
    border-radius: 6px;
    margin-top: 4px;
    padding: 0;
    list-style: none;
    z-index: 1000;
}

#tsd-search-results:empty {
    display: none;
}

#tsd-search-results:not(:empty) {
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#tsd-search-results li {
    padding: 0;
}

#tsd-search-results a {
    display: block;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--color-text);
    text-decoration: none;
}

#tsd-search-results a:hover {
    background: var(--color-hover-bg);
}

#tsd-search-status {
    font-size: 11px;
    color: var(--color-text-muted);
    padding: 4px 0 0;
}

#tsd-search-input::placeholder {
    color: var(--color-text-muted);
}

.bmap-theme-btn {
    font-size: 14px;
    padding: 0;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg);
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.bmap-theme-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* === 导航 === */
.bmap-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

/* 分类标题 */
.bmap-nav-cat-title {
    padding: 10px 16px 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-cat-title);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.bmap-nav-arrow {
    color: var(--color-text-muted);
    font-size: 14px;
    font-weight: 300;
    transition: transform 0.2s;
}

.bmap-nav-category.collapsed .bmap-nav-arrow {
    transform: rotate(-90deg);
}

.bmap-nav-category.collapsed .bmap-nav-list {
    display: none;
}

/* 类列表 */
.bmap-nav-all {
    display: block;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    border-bottom: 1px solid var(--color-border);
}

.bmap-nav-all:hover {
    background: var(--color-hover-bg);
}

.bmap-nav-all.current {
    color: var(--color-primary);
    background: var(--color-active-bg);
}

.bmap-nav-list {
    padding: 0;
}

.bmap-nav-item {
    display: block;
    padding: 7px 16px 7px 20px;
    font-size: 13px;
    color: var(--color-text);
    text-decoration: none;
    transition: background 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bmap-nav-category {
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0;
}

.bmap-nav-item:hover {
    background: var(--color-hover-bg);
    text-decoration: none;
}

.bmap-nav-item.current {
    background: var(--color-active-bg);
    color: var(--color-primary);
    font-weight: 500;
}

/* === 右侧内容 === */
.bmap-content {
    margin-left: var(--sidebar-w);
    padding: 24px 32px;
    flex: 1;
    min-width: 0;
}

.bmap-content a {
    color: var(--color-primary);
    text-decoration: none;
}

.bmap-content a:visited {
    color: var(--color-primary);
}

.bmap-content a:hover {
    text-decoration: underline;
}

/* === 隐藏 TypeDoc 默认图标 === */
.tsd-kind-icon,
.tsd-anchor-icon svg,
.bmap-content svg[viewBox="0 0 24 24"]:not(.bmap-copy-btn svg) {
    display: none !important;
}

.bmap-copy-btn svg {
    display: inline-block !important;
}

.tsd-anchor-icon {
    display: none !important;
}

/* === 方法签名块 === */
.tsd-signature {
    position: relative;
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 0;
    border: none;
    border-left: 3px solid var(--color-primary);
    background: var(--color-code-bg);
    line-height: 1.5;
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow-x: auto;
    margin: 0 0 8px;
}

.tsd-signature .tsd-signature-type {
    color: #0b7285;
}

[data-theme="dark"] .tsd-signature .tsd-signature-type {
    color: #66d9e8;
}

.tsd-signature::-webkit-scrollbar {
    height: 4px;
}

.tsd-signature::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* 锚记链接 */

.bmap-anchor-link {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--color-text-muted);
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.15s;
}

.tsd-signature:hover .bmap-anchor-link {
    opacity: 1;
}

.bmap-anchor-link:hover {
    color: var(--color-primary);
}

/* 方法描述 */
.tsd-description {
    padding: 0;
}

.tsd-description .tsd-comment {
    font-size: 13px;
    color: var(--color-text-light);
    margin-bottom: 8px;
}

/* 返回值 - 小字内联样式 */
.tsd-returns-title {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--color-text-light) !important;
    margin: 12px 0 6px !important;
    padding: 0 !important;
}

.tsd-returns-title span {
    font-family: var(--font-mono);
    color: #0b7285;
    font-size: 12px;
}

/* 每个方法块 */
.bmap-content section.tsd-panel.tsd-member {
    padding: 16px 0;
    margin: 0;
    border-bottom: 1px solid var(--color-border);
}

.bmap-content ul.tsd-signatures {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bmap-content .tsd-signatures > li {
    padding: 0;
}

.bmap-content section.tsd-panel.tsd-member:last-child {
    border-bottom: none;
}

/* === 内容排版 === */
h1 {
    font-size: 1.3rem;
    margin: 0 0 0.6rem;
    font-weight: 700;
}

h2 {
    font-size: 1.05rem;
    margin: 1.2rem 0 0.4rem;
    font-weight: 600;
}

h3 {
    font-size: 0.92rem;
    margin: 0.8rem 0 0.3rem;
    font-weight: 600;
}

h4 {
    font-size: 0.8rem;
    margin: 0.4rem 0 0.2rem;
    font-weight: 400;
}

.bmap-group-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-cat-title);
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
    display: inline-block;
}

.tsd-page-title {
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--color-border);
}

.tsd-comment p {
    margin: 0.2rem 0;
    font-size: 13px;
    line-height: 1.6;
}

.tsd-comment ul {
    margin: 0.4rem 0;
    padding-left: 1.2em;
    font-size: 13px;
    line-height: 1.8;
    list-style: disc;
}

.tsd-comment ul li {
    margin: 0.15rem 0;
    color: var(--color-text-light);
}

.tsd-parameters {
    padding-left: 0;
}

/* 面包屑隐藏 */
.tsd-breadcrumb {
    display: none;
}

/* === Index 方法列表 === */
.tsd-index-panel {
    margin: 0.6rem 0;
}

.tsd-index-panel h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.tsd-index-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 2px 16px;
    padding: 0;
    list-style: none;
}

.tsd-index-link {
    font-size: 12.5px;
    padding: 3px 6px;
    border-radius: 3px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.6;
    color: var(--color-primary);
}

.tsd-index-link:hover {
    background: var(--color-hover-bg);
    text-decoration: none;
}

/* === 参数表格 === */
.bmap-params {
    border-collapse: collapse !important;
    border-spacing: 0;
    font-size: 13px;
    margin: 8px 0;
}

.bmap-params th {
    text-align: left;
    padding: 6px 12px;
    background: var(--color-hover-bg);
    border: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 12px;
    color: var(--color-text-light);
}

.bmap-params td {
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    vertical-align: top;
}

.bmap-params td:first-child {
    font-family: var(--font-mono);
    color: var(--color-text);
    font-weight: 500;
    white-space: nowrap;
}

.bmap-params td:nth-child(2) {
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: nowrap;
}

.bmap-params code {
    background: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

.bmap-opt {
    font-size: 10px;
    color: #fff;
    background: var(--color-text-muted);
    border-radius: 3px;
    padding: 1px 4px;
    margin-left: 4px;
    vertical-align: middle;
}

.bmap-params-nested {
    width: 100%;
    border-collapse: collapse !important;
    border-spacing: 0;
    margin-top: 8px;
    font-size: 13px;
}

.bmap-params-nested th,
.bmap-params-nested td {
    border: 1px solid var(--color-border);
    padding: 4px 8px;
    vertical-align: top;
}

.bmap-params td p {
    margin: 0;
}

.bmap-params-nested th {
    background: var(--color-hover-bg);
    text-align: left;
    font-weight: 500;
}

/* === 内容左对齐 === */
.bmap-content section,
.bmap-content .tsd-panel,
.bmap-content .tsd-description,
.bmap-content .tsd-signatures {
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.bmap-content .tsd-member {
    margin-bottom: 0;
    padding-bottom: 0;
}

.bmap-content .tsd-panel.tsd-member {
    margin-bottom: 0;
}

code,
pre {
    font-size: 12px;
    font-family: var(--font-mono);
}

/* === 示例代码区 === */
.bmap-example-title {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--color-text-light);
    margin: 12px 0 6px !important;
}

/* @default 默认值内联样式 */
.bmap-default-inline {
    font-size: inherit;
    color: var(--color-text-light);
}

.tsd-tag-example pre {
    position: relative;
    background: var(--color-code-bg);
    border: 1px solid var(--color-code-border);
    border-radius: 6px;
    padding: 14px 16px;
    overflow-x: auto;
    margin: 0;
}

.tsd-tag-example pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
    line-height: 1.6;
}

.bmap-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 4px;
    cursor: pointer;
    color: var(--color-text-muted);
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tsd-tag-example pre:hover .bmap-copy-btn {
    opacity: 1;
}

.bmap-copy-btn:hover {
    color: var(--color-primary);
    background: var(--color-hover-bg);
    border-color: var(--color-primary);
}

.bmap-copy-btn.copied {
    color: #52c41a;
    border-color: #52c41a;
}

/* === Footer === */
.tsd-generator {
    font-size: 0.7rem;
    opacity: 0.4;
    padding: 1rem 0;
}

/* === 全部类页面 === */
.bmap-all-classes {
    column-count: 4;
    column-gap: 24px;
    padding: 8px 0;
}

@media (max-width: 1200px) {
    .bmap-all-classes {
        column-count: 3;
    }
}

@media (max-width: 900px) {
    .bmap-all-classes {
        column-count: 2;
    }
}

@media (max-width: 600px) {
    .bmap-all-classes {
        column-count: 1;
    }
}

.bmap-class-link {
    display: block;
    padding: 4px 0;
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
    break-inside: avoid;
}

.bmap-class-link:hover {
    text-decoration: underline;
}

/* === 移动端抽屉 === */
.bmap-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.bmap-menu-btn svg {
    display: inline-block !important;
}

.bmap-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
}

@media (max-width: 768px) {
    .bmap-menu-btn {
        display: flex;
    }

    .bmap-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .bmap-sidebar.open {
        transform: translateX(0);
    }

    .bmap-sidebar.open ~ .bmap-menu-btn {
        display: none;
    }

    .bmap-overlay.open {
        display: block;
    }

    .bmap-content {
        margin-left: 0;
        padding: 60px 16px 24px;
    }
}

/* === 右侧页内导航 (TOC) === */
.bmap-toc {
    display: none;
}

@media (min-width: 1280px) {
    .bmap-toc {
        display: block;
        position: fixed;
        top: var(--lbs-header-height);
        right: 0;
        width: 200px;
        max-height: calc(100vh - var(--lbs-header-height));
        overflow-y: auto;
        padding: 16px 12px;
        font-size: 12px;
        border-left: 1px solid var(--color-border);
        background: var(--color-bg);
    }

    .bmap-toc-title {
        font-size: 12px;
        font-weight: 600;
        color: var(--color-text-muted);
        margin-bottom: 8px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .bmap-toc-group {
        margin-bottom: 12px;
    }

    .bmap-toc-group-title {
        font-size: 12px;
        font-weight: 600;
        color: var(--color-cat-title);
        margin-bottom: 4px;
    }

    .bmap-toc-link {
        display: block;
        padding: 2px 0 2px 8px;
        color: var(--color-text-light);
        text-decoration: none;
        border-left: 2px solid transparent;
        line-height: 1.6;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .bmap-toc-link:hover {
        color: var(--color-primary);
    }

    .bmap-toc-link.active {
        color: var(--color-primary);
        border-left-color: var(--color-primary);
    }

    .bmap-content {
        margin-right: 200px;
    }
}

/* 已过时方法/属性签名 */
.tsd-signature.bmap-deprecated {
    text-decoration: line-through;
    opacity: 0.6;
}
