
/* 技术文档页面样式 */

.docs-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    min-height: calc(100vh - 70px); /* 减去导航栏高度 */
    position: relative; /* 确保容器有正确的定位上下文 */
}

/* 侧边栏样式 */
.docs-sidebar {
    position: sticky;
    top: 90px;
    height: fit-content;
    background: #f8fafc;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 10; /* 确保侧边栏在正确层级 */
    overflow: visible; /* 确保内容不会被裁剪 */
    /* 添加宽度限制以防止重叠 */
    max-width: 280px;
    /* 确保侧边栏不会超出容器 */
    box-sizing: border-box;
}

.sidebar-content {
    padding: 25px;
}

.sidebar-content h3 {
    margin: 0 0 20px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

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

.docs-nav li {
    margin-bottom: 5px;
}

.docs-nav .nav-item {
    display: block;
    padding: 10px 15px;
    color: #64748b;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.docs-nav .nav-item:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.docs-nav .nav-item.active {
    background: #dbeafe;
    color: #2563eb;
    border-left-color: #2563eb;
    font-weight: 500;
}

.sub-nav {
    list-style: none;
    margin: 8px 0 0 0;
    padding: 0;
    display: none; /* 默认隐藏子菜单 */
    transition: all 0.3s ease; /* 添加过渡效果 */
    background: #f1f5f9;
    border-radius: 6px;
    padding: 10px;
    position: relative; /* 确保子菜单有正确的定位上下文 */
    z-index: 5; /* 确保子菜单在正确层级 */
}

.sub-nav.active {
    display: block; /* 当父菜单项激活时显示子菜单 */
}

.sub-nav li {
    margin-bottom: 3px;
}

/* 为包含子菜单的父项添加指示器 */
.docs-nav > li > a.nav-item.has-submenu::after {
    content: '▸';
    float: right;
    transition: transform 0.3s ease;
    font-size: 12px;
    line-height: 1.5;
}

.docs-nav > li > a.nav-item.has-submenu.active::after {
    transform: rotate(90deg);
}

.sub-nav .nav-item {
    padding: 6px 15px 6px 30px;
    font-size: 0.85rem;
    color: #94a3b8;
}

.sub-nav .nav-item:hover {
    color: #64748b;
}

.sub-nav .nav-item.active {
    color: #2563eb;
    background: #eff6ff;
}

/* 文档内容样式 */
.docs-content {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    min-height: 600px;
    position: relative; /* 确保内容区域有正确的定位上下文 */
    z-index: 1; /* 确保内容区域在正确层级 */
    /* 确保内容区域不会与侧边栏重叠 */
    box-sizing: border-box;
}

.docs-section {
    margin-bottom: 60px;
    scroll-margin-top: 100px; /* 为固定导航栏留出空间 */
}

.docs-section:last-child {
    margin-bottom: 0;
}

.docs-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 25px 0;
    border-bottom: 3px solid #e2e8f0;
    padding-bottom: 15px;
}

.docs-section h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #1e293b;
    margin: 40px 0 20px 0;
    position: relative;
}

.docs-section h2::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: #2563eb;
    border-radius: 2px;
}

.docs-section h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #374151;
    margin: 30px 0 15px 0;
}

.docs-section h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4b5563;
    margin: 25px 0 10px 0;
}

.docs-section p {
    line-height: 1.7;
    color: #4b5563;
    margin-bottom: 15px;
}

.docs-section ul,
.docs-section ol {
    margin: 15px 0;
    padding-left: 25px;
}

.docs-section li {
    line-height: 1.6;
    color: #4b5563;
    margin-bottom: 8px;
}

/* 信息框样式 */
.info-box {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-left: 4px solid #0ea5e9;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.info-box h3 {
    margin: 0 0 10px 0;
    color: #0c4a6e;
    font-size: 1.1rem;
}

.info-box p {
    margin: 0;
    color: #0c4a6e;
}

.info-box code {
    background: #e0f2fe;
    color: #0c4a6e;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* SDK演示标签页样式 */
.sdk-demo-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.sdk-demo-tabs .tab-button {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #6c757d;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 6px 6px 0 0;
}

.sdk-demo-tabs .tab-button:hover {
    background: #f8f9fa;
    color: #495057;
}

.sdk-demo-tabs .tab-button.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background: #f8f9fa;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 并排显示的API demo样式 */
.parallel-demo .tab-content {
    display: block;
    width: calc(50% - 10px);
    float: left;
    margin-right: 20px;
}

.parallel-demo .tab-content:nth-child(2n) {
    margin-right: 0;
}

.parallel-demo::after {
    content: "";
    display: table;
    clear: both;
}

/* 代码块样式 */
.code-block {
    background: #1e293b;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    overflow-x: auto;
}

.code-block h4 {
    color: #e2e8f0;
    margin: 0 0 15px 0;
    font-size: 1rem;
}

.code-block pre {
    margin: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #e2e8f0;
    overflow-x: auto;
}

.code-block code {
    color: #e2e8f0;
    background: none;
    padding: 0;
}

/* 行内代码样式 */
p code,
li code,
td code {
    background: #f1f5f9;
    color: #1e293b;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

/* API项目样式 */
.api-item {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 30px;
    margin: 30px 0;
    background: #fafbfc;
}

.api-item h2 {
    margin-top: 0;
    color: #1e293b;
}

.api-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.method {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.method.post {
    background: #dcfce7;
    color: #166534;
}

.method.get {
    background: #dbeafe;
    color: #1e40af;
}

.method.put {
    background: #fef3c7;
    color: #92400e;
}

.method.delete {
    background: #fee2e2;
    color: #991b1b;
}

.api-info code {
    font-size: 1rem;
    font-weight: 500;
    color: #1e293b;
}

/* 参数表格样式 */
.params-table,
.error-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.params-table th,
.params-table td,
.error-table th,
.error-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.params-table th,
.error-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.params-table td,
.error-table td {
    color: #4b5563;
    font-size: 0.9rem;
}

.params-table tr:hover,
.error-table tr:hover {
    background: #f8fafc;
}

.params-table td:first-child {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-weight: 500;
    color: #1e293b;
}

/* 错误码表格特殊样式 */
.error-table td:first-child {
    font-weight: bold;
    color: #2563eb;
    font-size: 1rem;
}

/* 为错误码表格添加交替行背景色 */
.error-table tr:nth-child(even) {
    background-color: #f9fafb;
}

.error-table tr:nth-child(even):hover {
    background-color: #f1f5f9;
}

/* 滚动条样式 */
.docs-content::-webkit-scrollbar,
.code-block::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.docs-content::-webkit-scrollbar-track,
.code-block::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.docs-content::-webkit-scrollbar-thumb,
.code-block::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.docs-content::-webkit-scrollbar-thumb:hover,
.code-block::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .docs-container {
        grid-template-columns: 250px 1fr;
        gap: 30px;
    }
    
    .docs-content {
        padding: 30px;
    }
}

@media (max-width: 768px) {
    .docs-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .docs-sidebar {
        position: static;
        order: 2;
    }
    
    .docs-content {
        order: 1;
        padding: 25px;
    }
    
    .docs-section h1 {
        font-size: 2rem;
    }
    
    .docs-section h2 {
        font-size: 1.5rem;
    }
    
    .api-item {
        padding: 20px;
    }
    
    .api-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .params-table,
    .error-table {
        font-size: 0.8rem;
    }
    
    .params-table th,
    .params-table td,
    .error-table th,
    .error-table td {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .docs-container {
        padding: 0 15px;
    }
    
    .docs-content {
        padding: 20px;
    }
    
    .docs-section h1 {
        font-size: 1.8rem;
    }
    
    .docs-section h2 {
        font-size: 1.3rem;
    }
    
    .code-block {
        padding: 15px;
    }
    
    .api-item {
        padding: 15px;
    }
    
    .info-box {
        padding: 15px;
    }
}

/* 打印样式 */
@media print {
    .docs-sidebar {
        display: none;
    }
    
    .docs-container {
        grid-template-columns: 1fr;
    }
    
    .docs-content {
        box-shadow: none;
        padding: 0;
    }
    
    .code-block {
        background: #f8fafc;
        color: #1e293b;
        border: 1px solid #e2e8f0;
    }
    
    .code-block pre,
    .code-block code {
        color: #1e293b;
    }
}

/* 添加模态框样式到文件末尾 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: block;
}

.modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideInDown 0.3s ease;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #1e293b;
    font-size: 1.2rem;
}

.close {
    color: #94a3b8;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #64748b;
}

.modal-body {
    padding: 30px 20px;
    text-align: center;
}

.qr-container {
    margin-bottom: 20px;
}

.qr-container img {
    max-width: 200px;
    height: auto;
}

.qr-tip {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0;
}

.login-status {
    padding: 20px;
    text-align: center;
}

.login-status.success {
    color: #10b981;
}

.error-message {
    color: #ef4444;
    text-align: center;
}

.error-message .btn {
    margin-top: 10px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 消息提示样式 */
.message-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    animation: slideInRight 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.message-success {
    background: #f0fdf4;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.message-error {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.message-warning {
    background: #fffbeb;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.message-info {
    background: #eff6ff;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

.message-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.message-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    margin-left: 10px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.message-close:hover {
    opacity: 1;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}