/* FAQ Documentation Page Styles - Inspired by doc.fastgpt.cn */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-bg: #ffffff;
    --sidebar-bg: #fafafa;
    --header-bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e5e5e5;
    --hover-bg: #f5f5f5;
    --active-bg: #667eea;
    --active-text: #ffffff;
    --accent-purple: #667eea;
    --accent-blue: #4facfe;
    --code-bg: #f6f8fa;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.7;
}

/* Top Header */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

.doc-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-box {
    position: relative;
    width: 280px;
}

.search-box input {
    width: 100%;
    padding: 8px 36px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s;
    background: var(--sidebar-bg);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-purple);
    background: var(--primary-bg);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    pointer-events: none;
}

.btn-home {
    padding: 8px 16px;
    background: var(--accent-purple);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-home:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

/* Main Layout */
.doc-layout {
    display: flex;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    left: 0;
    top: 60px;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #b0b0b0;
}

.sidebar-content {
    padding: 20px 12px;
}

/* Navigation Tree */
.nav-tree {
    list-style: none;
}

.tree-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.category-group {
    margin-bottom: 8px;
}

.category-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    user-select: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.category-header:hover {
    background: var(--hover-bg);
}

.category-icon {
    font-size: 1.1rem;
    margin-right: 8px;
    flex-shrink: 0;
}

.category-name {
    flex: 1;
}

.category-toggle {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.3s;
}

.category-group.expanded .category-toggle {
    transform: rotate(90deg);
}

.category-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 12px;
}

.category-group.expanded .category-children {
    max-height: 1000px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin: 2px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--active-bg);
    color: var(--active-text);
    font-weight: 500;
}

.nav-item-icon {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
    margin-right: 10px;
    flex-shrink: 0;
}

.nav-item.active .nav-item-icon {
    background: var(--active-text);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 40px 60px 60px 60px;
    max-width: 1200px;
    position: relative;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 30px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--accent-purple);
}

.breadcrumb::before {
    content: '›';
    margin: 0 4px;
}

.breadcrumb:first-child::before {
    display: none;
}

/* Article Content */
.article {
    background: var(--primary-bg);
    min-height: 500px;
}

.article h1 {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.article h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 36px 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.article h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 28px 0 14px;
    color: var(--text-primary);
}

.article p {
    margin-bottom: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.article strong {
    font-weight: 600;
    color: var(--text-primary);
}

.article code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: #d63384;
}

.article pre {
    background: var(--code-bg);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--border-color);
}

.article pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
}

.article ul,
.article ol {
    margin: 16px 0;
    padding-left: 28px;
}

.article li {
    margin: 8px 0;
    color: var(--text-secondary);
    line-height: 1.8;
}

.article a {
    color: var(--accent-purple);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}

.article a:hover {
    border-bottom-color: var(--accent-purple);
}

.article img {
    max-width: 100%;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: var(--shadow-md);
}

/* Welcome Page */
.welcome-page .subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.welcome-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.welcome-card {
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s;
    cursor: pointer;
}

.welcome-card:hover {
    border-color: var(--accent-purple);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.welcome-card .card-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.welcome-card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.welcome-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.welcome-tips {
    background: #fffbea;
    border: 1px solid #ffeaa7;
    border-radius: 12px;
    padding: 24px;
    margin-top: 40px;
}

.welcome-tips h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: #856404;
}

.welcome-tips ul {
    list-style: none;
    padding: 0;
}

.welcome-tips li {
    padding: 6px 0;
    color: #856404;
}

.welcome-tips li::before {
    content: '✓';
    color: #28a745;
    font-weight: bold;
    margin-right: 10px;
}

/* Article Links & Documents */
.article-links {
    margin: 24px 0;
    padding: 20px;
    background: var(--sidebar-bg);
    border-radius: 8px;
    border-left: 4px solid var(--accent-blue);
}

.article-links h4 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.link-item {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    margin: 4px 4px 4px 0;
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--accent-purple);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.link-item:hover {
    border-color: var(--accent-purple);
    background: rgba(102, 126, 234, 0.05);
}

.link-item::before {
    content: '🔗';
    margin-right: 6px;
}

/* Article Navigation */
.article-nav {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.nav-prev,
.nav-next {
    flex: 1;
    padding: 16px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: var(--text-primary);
}

.nav-prev:hover,
.nav-next:hover {
    border-color: var(--accent-purple);
    box-shadow: var(--shadow-sm);
}

/* TOC Sidebar */
.toc-sidebar {
    position: fixed;
    right: 20px;
    top: 120px;
    width: 200px;
    display: none;
}

.toc-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.toc-nav {
    list-style: none;
}

.toc-nav a {
    display: block;
    padding: 4px 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    border-left: 2px solid transparent;
    padding-left: 12px;
    transition: all 0.2s;
}

.toc-nav a:hover {
    color: var(--accent-purple);
    border-left-color: var(--accent-purple);
}

.toc-nav a.active {
    color: var(--accent-purple);
    border-left-color: var(--accent-purple);
    font-weight: 500;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--accent-purple);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1001;
    box-shadow: var(--shadow-md);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    background: white;
    transition: all 0.3s;
}

/* Responsive */
@media (max-width: 1200px) {
    .toc-sidebar {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .top-header {
        padding: 0 16px;
    }

    .search-box {
        width: 200px;
    }

    .doc-title {
        display: none;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 999;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 24px 20px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .article h1 {
        font-size: 2rem;
    }

    .article h2 {
        font-size: 1.5rem;
    }
}