@import url('common.css');

:root {
    --sidebar-width: 300px;
}

body {
    font-size: 16px;
}

/* 头部导航样式 */
.main-nav {
    display: flex;
    list-style: none;
    gap: 25px;
}

.main-nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 0;
    position: relative;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.main-nav a:hover {
    color: var(--secondary-color);
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--secondary-color);
    transition: width 0.3s ease;
}

.main-nav a:hover::after {
    width: 100%;
}

/* 移动端导航按钮 */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    transition: var(--transition);
}

.mobile-nav-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 面包屑导航 */
.breadcrumb {
    background-color: #f8f9fa;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.breadcrumb ul {
    display: flex;
    list-style: none;
    gap: 10px;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--gray-color);
    font-size: 14px;
}

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

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .separator {
    color: #adb5bd;
}

/* 主体布局 */
.main-layout {
    display: flex;
    padding: 30px 0;
    gap: 30px;
}

/* 左侧导航 */
.left-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
}

.doc-nav-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: sticky;
    top: 110px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.doc-nav-header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.doc-nav {
    padding: 15px 0;
}

.doc-nav-section {
    margin-bottom: 20px;
}

.doc-nav-big-title {
    padding: 10px 10px;
    font-weight: 600;
    color: var(--dark-color);
    background-color: rgba(48, 105, 152, 0.05);
    border-left: 3px solid var(--primary-color);
    margin-bottom: 5px;
    font-size: 16px;
}

.doc-nav-title {
    padding: 10px 15px;
    font-weight: 600;
    color: var(--dark-color);
    background-color: rgba(48, 105, 152, 0.247);
    border-left: 5px solid var(--primary-color);
    margin-bottom: 5px;
    font-size: 15px;
}

.doc-nav-list {
    list-style: none;
}

.doc-nav-list li {
    margin-bottom: 2px;
}

.doc-nav-list a {
    display: block;
    padding: 8px 20px 8px 30px;
    color: var(--gray-color);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.doc-nav-list a:hover {
    color: var(--primary-color);
    background-color: rgba(48, 105, 152, 0.05);
}

.doc-nav-list a.active {
    color: var(--primary-color);
    background-color: rgba(48, 105, 152, 0.1);
    border-left: 7px solid var(--primary-color);
    font-weight: 500;
}

/* 全新设计的导航样式 */
.doc-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.doc-nav-list a {
    display: block;
    padding: 10px 20px;
    text-decoration: none;
    color: var(--gray-color);
    transition: var(--transition);
    border-radius: 4px;
    margin: 2px 0;
}

.doc-nav-list a:hover {
    background-color: var(--primary-color);
    color: white;
}

.doc-nav-list a.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    border-left: 7px solid var(--secondary-color);
}

.doc-nav-big-title {
    padding: 10px 10px;
    font-weight: 600;
    color: var(--dark-color);
    background-color: rgba(48, 105, 152, 0.1);
    border-left: 3px solid var(--primary-color);
    margin-bottom: 5px;
    font-size: 16px;
}

.doc-nav-title {
    padding: 12px 15px;
    font-weight: 600;
    color: var(--dark-color);
    background-color: rgba(48, 105, 152, 0.247);
    border-left: 5px solid var(--primary-color);
    margin-bottom: 5px;
    font-size: 15px;
}

/* 右侧内容区域 */
.content-area {
    flex: 1;
}

/* 文档头部 */
.doc-header {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 30px;
}

.doc-title {
    font-size: 32px;
    color: var(--dark-color);
    margin-bottom: 15px;
    line-height: 1.2;
    font-weight: 700;
}

.doc-subtitle {
    font-size: 18px;
    color: var(--gray-color);
    margin-bottom: 25px;
    font-weight: 400;
}

.doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-color);
    font-size: 14px;
}

.meta-item i {
    color: var(--primary-color);
}

.doc-description {
    font-size: 17px;
    color: #444;
    line-height: 1.7;
}

/* 广告区域 */
.ad-container {
    margin: 30px 0;
}

.ad-header {
    font-size: 12px;
    color: var(--gray-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ad-header i {
    color: var(--secondary-color);
}

.ad-content {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 25px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.ad-content:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.ad-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 10px;
}

.ad-description {
    color: var(--gray-color);
    margin-bottom: 15px;
    font-size: 15px;
    line-height: 1.5;
}

.ad-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    background-color: rgba(48, 105, 152, 0.1);
    border-radius: 4px;
    transition: var(--transition);
}

.ad-link:hover {
    background-color: rgba(48, 105, 152, 0.2);
    text-decoration: none;
}

.ad-badge {
    display: inline-block;
    background-color: var(--secondary-color);
    color: var(--dark-color);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

/* 文档内容区域 */
.doc-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 30px;
}

.section-title {
    font-size: 24px;
    color: var(--dark-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
}

.section-subtitle {
    font-size: 20px;
    color: var(--dark-color);
    margin: 25px 0 15px;
    font-weight: 600;
}

.section-text {
    margin-bottom: 20px;
    line-height: 1.7;
    color: #444;
}

.section-text p {
    margin-bottom: 15px;
}

/* 代码示例 */
.code-example {
    background-color: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
    border: 1px solid var(--border-color);
}

.code-header {
    background-color: #e9ecef;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.code-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark-color);
}

.copy-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
}

.copy-btn:hover {
    background-color: #25527a;
}

.code-block {
    padding: 20px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
}

/* 列表样式 */
.feature-list {
    list-style: none;
    margin: 20px 0;
}

.feature-list li {
    padding: 10px 0 10px 30px;
    position: relative;
    margin-bottom: 5px;
}

.feature-list li::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 18px;
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
}

/* 表格样式 */
.method-table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    font-size: 15px;
}

.method-table th {
    background-color: rgba(48, 105, 152, 0.1);
    color: var(--dark-color);
    text-align: left;
    padding: 15px;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.method-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.method-table tr:hover {
    background-color: rgba(48, 105, 152, 0.03);
}

.method-name {
    color: var(--primary-color);
    font-weight: 600;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
}

/* 提示框 */
.tip-box {
    background-color: rgba(48, 105, 152, 0.08);
    border-left: 4px solid var(--primary-color);
    padding: 20px;
    margin: 25px 0;
    border-radius: 0 4px 4px 0;
}

.tip-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 警告框 */
.warning-box {
    background-color: rgba(255, 193, 7, 0.1);
    border-left: 4px solid var(--warning-color);
    padding: 20px;
    margin: 25px 0;
    border-radius: 0 4px 4px 0;
}

.warning-title {
    font-weight: 600;
    color: #856404;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 相关文档 */
.related-docs {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 30px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.related-card {
    padding: 20px;
    border-radius: 6px;
    background-color: rgba(48, 105, 152, 0.05);
    transition: var(--transition);
    border: 1px solid transparent;
}

.related-card:hover {
    background-color: rgba(48, 105, 152, 0.1);
    transform: translateY(-3px);
    border-color: rgba(48, 105, 152, 0.2);
}

.related-card h4 {
    color: var(--dark-color);
    margin-bottom: 10px;
    font-size: 17px;
}

.related-card p {
    color: var(--gray-color);
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.related-card a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}

.related-card a:hover {
    text-decoration: underline;
}

/* 页脚 */
footer {
    padding: 60px 0 20px;
    margin-top: 40px;
}

/* 移动端导航浮层 */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 300px;
    height: 100%;
    background-color: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    z-index: 2000;
    transition: left 0.3s ease;
}

.mobile-nav-sidebar.active {
    left: 0;
}

.mobile-nav-header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-nav-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.mobile-nav-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.mobile-nav-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 响应式设计 */
@media (max-width: 992px) {
    .main-layout {
        flex-direction: column;
    }

    .left-sidebar {
        width: 100%;
        display: none;
    }

    .doc-nav-container {
        position: static;
        max-height: none;
    }

    .mobile-nav-toggle {
        display: block;
    }

    .main-nav {
        display: none;
    }

    .search-box {
        order: 2;
        width: 100%;
        max-width: none;
        /* margin-top: 15px; */
    }

    .header-container {
        flex-wrap: wrap;
    }

    .mobile-nav-sidebar .doc-nav-container {
        box-shadow: none;
        border-radius: 0;
        max-height: calc(100vh - 80px);
    }

    nav ul {
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .doc-title {
        font-size: 28px;
    }

    .doc-header,
    .doc-content,
    .related-docs {
        padding: 20px;
    }

    .section-title {
        font-size: 22px;
    }

    .method-table {
        display: block;
        overflow-x: auto;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .mobile-nav-sidebar {
        width: 280px;
    }
}

@media (max-width: 480px) {
    .doc-title {
        font-size: 24px;
    }

    .doc-subtitle {
        font-size: 16px;
    }

    .doc-meta {
        flex-direction: column;
        gap: 10px;
    }

    .mobile-nav-sidebar {
        width: 100%;
    }
}

/* 章节导航样式 */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    margin: 30px 0;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-item {
    flex: 1;
    min-width: 250px;
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.nav-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 20px;
    color: var(--dark-color);
    text-decoration: none;
    transition: var(--transition);
}

.nav-item a:hover {
    background-color: rgba(48, 105, 152, 0.05);
}

.nav-item.prev a {
    justify-content: flex-start;
}

.nav-item.next a {
    justify-content: flex-end;
}

.nav-placeholder {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 20px;
    color: var(--gray-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.nav-item.prev .nav-placeholder {
    justify-content: flex-start;
}

.nav-item.next .nav-placeholder {
    justify-content: flex-end;
}

.nav-label {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    color: var(--primary-color);
}

.nav-title {
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

.nav-item i {
    color: var(--primary-color);
}

.nav-item.prev i {
    margin-right: 5px;
}

.nav-item.next i {
    margin-left: 5px;
}