/* API文档页面样式 - 飞翰品牌色系 */
/* 主色：#1f1570 (深蓝紫色) */
/* 辅色：#0148a4 (蓝色) */
/* 强调色：#ff7200 (橙色) */

/* 页面整体布局 - 左侧导航贴边，右侧内容居中 */
.api-docs-wrapper {
    display: flex;
    min-height: calc(100vh - 60px);
    position: relative;
    z-index: 1;
}

/* 左侧导航栏 - 贴边sticky */
.api-docs-sidebar {
    width: 280px;
    min-width: 280px;
    background: #fff;
    border-right: 1px solid #e8e8e8;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e8e8e8;
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.sidebar-nav {
    padding: 10px 0;
}

.nav-group {
    margin-bottom: 2px;
}

.nav-group-title {
    display: block;
    padding: 12px 20px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease, border-left-color 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-group-title:hover {
    color: #1f1570;
    background: #f5f6fa;
}

.nav-group-title.active {
    color: #1f1570;
    background: #f0f0ff;
    border-left-color: #1f1570;
}

.nav-sub-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-sub-list li a {
    display: block;
    padding: 10px 20px 10px 35px;
    color: #666;
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease, padding-left 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-sub-list li a:hover {
    color: #1f1570;
    background: #f5f6fa;
    padding-left: 38px;
}

.nav-sub-list li a.active {
    color: #1f1570;
    background: #f0f0ff;
    border-left-color: #1f1570;
    padding-left: 38px;
}

/* 右侧内容区 */
.api-docs-content {
    flex: 1;
    padding: 40px 50px;
    background: #fff;
    min-height: calc(100vh - 60px);
}

.content-section {
    margin-bottom: 50px;
    padding-bottom: 30px;
    border-bottom: 1px solid #f0f0f0;
}

.content-section:last-child {
    border-bottom: none;
}

.content-section h1 {
    font-size: 32px;
    font-weight: 600;
    color: #1f1570;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #1f1570;
}

.content-section h2 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 35px 0 20px;
}

.content-section h3 {
    font-size: 20px;
    font-weight: 600;
    color: #0148a4;
    margin: 30px 0 15px;
}

.content-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 25px 0 12px;
}

.content-section p {
    font-size: 14px;
    line-height: 1.8;
    color: #555;
    margin-bottom: 15px;
}

.content-section p.lead {
    font-size: 16px;
    color: #333;
    margin-bottom: 25px;
}

.content-section strong {
    color: #333;
    font-weight: 600;
}

/* 服务卡片 */
.service-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 25px 0;
}

.service-card {
    background: #f8f9fc;
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid #1f1570;
    transition: all 0.3s;
}

.service-card:hover {
    box-shadow: 0 4px 12px rgba(31, 21, 112, 0.1);
}

.service-icon {
    font-size: 28px;
    margin-bottom: 12px;
    display: block;
}

.service-card h4 {
    margin: 0 0 10px;
    font-size: 16px;
    color: #1f1570;
}

.service-card p {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.6;
}

/* 信息框 */
.info-box {
    background: #f8f9fc;
    border-left: 4px solid #0148a4;
    padding: 20px;
    margin: 20px 0;
    border-radius: 0 4px 4px 0;
}

.info-box h4 {
    margin-top: 0;
    color: #333;
}

.info-box ul {
    margin: 10px 0;
    padding-left: 20px;
}

.info-box li {
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
}

/* 警告框 */
.alert {
    padding: 15px 20px;
    border-radius: 4px;
    margin: 20px 0;
    font-size: 14px;
    line-height: 1.6;
}

.alert-warning {
    background: #fff8f3;
    border-left: 4px solid #ff7200;
    color: #333;
}

/* 代码块 */
.code-block {
    background: #f5f6fa;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    margin: 15px 0;
    overflow: hidden;
}

.code-header {
    background: #e8e8e8;
    padding: 10px 15px;
    font-size: 13px;
    color: #666;
    font-weight: 500;
    border-bottom: 1px solid #ddd;
}

.code-block pre {
    padding: 15px;
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #333;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.code-block.xml pre {
    color: #d73a49;
}

.code-block.json pre {
    color: #22863a;
}

/* 环境卡片 */
.env-card {
    background: #f8f9fc;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.env-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #e8e8e8;
}

.env-row:last-child {
    border-bottom: none;
}

.env-label {
    width: 120px;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.env-row code {
    font-family: 'Consolas', monospace;
    font-size: 13px;
    color: #1f1570;
    background: #fff;
    padding: 2px 8px;
    border-radius: 4px;
}

.warning-text {
    color: #ff7200;
    font-size: 13px;
    margin-top: 15px;
}

.notice-box {
    background: #f0f7ff;
    border-left: 4px solid #0148a4;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 0 4px 4px 0;
}

.notice-box p {
    margin: 0;
}

/* 流程时间线 */
.process-timeline {
    margin: 30px 0;
}

.timeline-item {
    display: flex;
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f0;
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-num {
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    background: #1f1570;
    color: #fff;
    border-radius: 50%;
    font-weight: 600;
    font-size: 14px;
    margin-right: 20px;
    flex-shrink: 0;
}

.timeline-content h4 {
    margin: 0 0 8px;
    font-size: 16px;
    color: #333;
}

.timeline-content p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

.timeline-content code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

/* 表格 */
.api-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.api-table thead {
    background: #f5f6fa;
}

.api-table th,
.api-table td {
    padding: 12px 15px;
    text-align: left;
    border: 1px solid #e8e8e8;
}

.api-table th {
    font-weight: 600;
    color: #333;
}

.api-table td {
    color: #555;
}

.api-table tbody tr:hover {
    background: #f8f9fc;
}

.api-table code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', monospace;
    font-size: 12px;
    color: #d73a49;
}

/* API接口项 */
.api-endpoint {
    margin: 40px 0;
    padding: 30px;
    background: #f8f9fc;
    border-radius: 8px;
}

.endpoint-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.endpoint-header h3 {
    margin: 0;
    color: #1f1570;
    font-size: 18px;
}

.endpoint-version {
    background: #1f1570;
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.endpoint-desc {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.endpoint-url {
    background: #fff;
    padding: 12px 15px;
    border-radius: 6px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.endpoint-url .method {
    background: #0148a4;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.endpoint-url code {
    font-family: 'Consolas', monospace;
    font-size: 13px;
    color: #333;
}

/* 错误码表格 */
.error-code-table td:first-child {
    font-family: 'Consolas', monospace;
    font-weight: 600;
    color: #1f1570;
    width: 80px;
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    right: 30px;
    bottom: 30px;
    width: 44px;
    height: 44px;
    background: #1f1570;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #0148a4;
    transform: translateY(-2px);
}

/* 滚动条样式 */
.api-docs-sidebar::-webkit-scrollbar {
    width: 6px;
}

.api-docs-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.api-docs-sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.api-docs-sidebar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 锚点偏移（固定头部补偿） */
.content-section[id]::before {
    content: '';
    display: block;
    height: 80px;
    margin-top: -80px;
    visibility: hidden;
}

/* 响应式 */
@media (max-width: 1200px) {
    .api-docs-sidebar {
        width: 240px;
        min-width: 240px;
    }
    
    .api-docs-content {
        padding: 30px 40px;
    }
}

@media (max-width: 768px) {
    .api-docs-sidebar {
        display: none;
    }
    
    .api-docs-content {
        margin-left: 0;
        padding: 20px;
        max-width: 100%;
    }
    
    .service-cards {
        grid-template-columns: 1fr;
    }
    
    .endpoint-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
