/* ============================================
   MBE 客服系统文档站点样式
   ============================================ */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    --bg-color: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    --sidebar-width: 280px;
    --header-height: 60px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --transition: all 0.2s ease;
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
                 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ============================================
   侧边栏导航
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px;
    background: var(--primary-color);
    color: white;
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.sidebar-header .version {
    font-size: 12px;
    opacity: 0.8;
}

.search-box {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.search-box input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.nav-section {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}

.nav-section h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.nav-section ul {
    list-style: none;
}

.nav-section li {
    margin: 2px 0;
}

.nav-section a {
    display: block;
    padding: 8px 12px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
}

.nav-section a:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

.nav-section a.active {
    background: var(--primary-color);
    color: white;
}

/* ============================================
   主内容区
   ============================================ */

.content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    margin-right: 16px;
}

.breadcrumb {
    font-size: 14px;
    color: var(--text-secondary);
    flex: 1;
}

.breadcrumb span {
    color: var(--text-muted);
}

.breadcrumb span:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.github-link {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.github-link:hover {
    color: var(--text-primary);
}

/* ============================================
   文档内容
   ============================================ */

.document {
    flex: 1;
    padding: 32px 48px;
    max-width: 900px;
}

.document h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.document h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 32px;
    margin-bottom: 16px;
}

.document h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 24px;
    margin-bottom: 12px;
}

.document h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 20px;
    margin-bottom: 8px;
}

.document p {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.document ul, .document ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.document li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.document code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 14px;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--primary-dark);
}

.document pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: 16px;
}

.document pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.document blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 12px 16px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.document table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.document th, .document td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
}

.document th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.document tr:hover {
    background: var(--bg-secondary);
}

.document img {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin: 16px 0;
}

.document hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 32px 0;
}

/* ============================================
   欢迎页面
   ============================================ */

.welcome {
    text-align: center;
    padding: 40px 20px;
}

.welcome h1 {
    border: none;
    font-size: 36px;
    margin-bottom: 12px;
}

.welcome > p {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 48px;
}

.quick-link-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.quick-link-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.quick-link-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.quick-link-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.feature-list {
    text-align: left;
    max-width: 800px;
    margin: 0 auto;
}

.feature-list h2 {
    text-align: center;
    margin-bottom: 24px;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.feature {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.feature-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 12px;
}

.feature h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.feature p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* ============================================
   页脚
   ============================================ */

.content-footer {
    padding: 24px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 14px;
}

/* ============================================
   加载状态
   ============================================ */

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
}

.loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   响应式设计
   ============================================ */

@media (max-width: 1024px) {
    .document {
        padding: 24px 32px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .document {
        padding: 20px;
    }
    
    .document h1 {
        font-size: 24px;
    }
    
    .document h2 {
        font-size: 20px;
    }
    
    .welcome h1 {
        font-size: 28px;
    }
    
    .quick-links {
        grid-template-columns: 1fr;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   滚动条样式
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ============================================
   打印样式
   ============================================ */

@media print {
    .sidebar, .content-header, .content-footer {
        display: none;
    }
    
    .content {
        margin-left: 0;
    }
    
    .document {
        padding: 0;
        max-width: none;
    }
}

/* ============================================
   代码高亮增强
   ============================================ */

.hljs {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}

/* ============================================
   目录 (TOC)
   ============================================ */

.toc {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
}

.toc h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toc ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.toc li {
    margin: 6px 0;
}

.toc a {
    font-size: 14px;
    color: var(--text-secondary);
}

.toc a:hover {
    color: var(--primary-color);
}

.toc .toc-h3 {
    padding-left: 16px;
}

.toc .toc-h4 {
    padding-left: 32px;
}

/* ============================================
   通知/警告框
   ============================================ */

.alert {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}
