
/* ═══ Vibe-Trading Wiki · Documentation Site ═══ */
:root {
    --sidebar-bg: #0f1117;
    --sidebar-fg: #a0a8b8;
    --sidebar-active: #10b981;
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-header: #e8eaf0;
    --content-bg: #ffffff;
    --content-fg: #1a1d2e;
    --content-muted: #6b7280;
    --accent: #059669;
    --accent-light: #ecfdf5;
    --border: #e5e7eb;
    --code-bg: #f8f9fa;
    --code-border: #e5e7eb;
    --max-content: 860px;
    --sidebar-w: 290px;
    --header-h: 56px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: "SF Mono", "Fira Code", "JetBrains Mono", Consolas, monospace;
    --font-serif: "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    color: var(--content-fg);
    background: var(--content-bg);
    line-height: 1.75;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

/* ─── Top Bar ─── */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 200;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    gap: 16px;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.topbar-logo .logo-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--sidebar-active);
    box-shadow: 0 0 12px rgba(16,185,129,0.5);
    flex-shrink: 0;
}

.topbar-search {
    flex: 1;
    max-width: 420px;
    position: relative;
}

.topbar-search input {
    width: 100%;
    height: 34px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    padding: 0 12px 0 36px;
    font-family: var(--font-sans);
    transition: border-color 0.2s;
}

.topbar-search input::placeholder { color: rgba(255,255,255,0.3); }
.topbar-search input:focus {
    outline: none;
    border-color: var(--sidebar-active);
    background: rgba(255,255,255,0.09);
}

.topbar-search .search-icon {
    position: absolute;
    left: 11px; top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.3);
    font-size: 14px;
}

.search-results {
    position: absolute;
    top: 42px; left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 300;
}

.search-results.active { display: block; }

.search-result-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.search-result-item:hover { background: var(--accent-light); }
.search-result-item:last-child { border-bottom: none; }

.search-result-item .sr-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--content-fg);
    margin-bottom: 2px;
}

.search-result-item .sr-path {
    font-size: 11px;
    color: var(--content-muted);
}

.topbar-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}

/* ─── Sidebar ─── */
.sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    padding: 12px 0 40px;
    transition: transform 0.25s ease;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

.nav-section {
    margin-bottom: 4px;
}

.nav-section-header {
    padding: 10px 20px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 5px 20px 5px 0;
    color: var(--sidebar-fg);
    text-decoration: none;
    font-size: 13.5px;
    line-height: 1.5;
    transition: all 0.15s;
    cursor: pointer;
    border-left: 3px solid transparent;
    user-select: none;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-item.active {
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
    background: rgba(16,185,129,0.06);
    font-weight: 600;
}

.nav-item .nav-toggle {
    width: 16px;
    flex-shrink: 0;
    text-align: center;
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    transition: transform 0.2s;
}

.nav-item.expanded .nav-toggle { transform: rotate(90deg); }

.nav-item .nav-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-children {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.nav-children.expanded { max-height: 9999px; }

/* ─── Main Content ─── */
.main {
    margin-left: var(--sidebar-w);
    margin-top: var(--header-h);
    min-height: calc(100vh - var(--header-h));
}

.content {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 40px 48px 80px;
}

.content h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: #0f1117;
}

.content h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 40px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
    letter-spacing: -0.01em;
    color: #1a1d2e;
}

.content h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 28px 0 12px;
    color: #1a1d2e;
}

.content h4 {
    font-size: 15px;
    font-weight: 700;
    margin: 20px 0 8px;
    color: #374151;
}

.content p {
    margin-bottom: 14px;
    color: #374151;
}

.content ul, .content ol {
    margin: 8px 0 16px 4px;
    padding-left: 22px;
}

.content li {
    margin-bottom: 4px;
    color: #374151;
}

.content li > ul, .content li > ol {
    margin: 4px 0 4px;
}

.content strong { color: #1a1d2e; font-weight: 700; }

.content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(5,150,105,0.2);
    transition: border-color 0.2s;
}

.content a:hover { border-bottom-color: var(--accent); }

.content code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 4px;
    padding: 1px 5px;
    color: #be185d;
}

.content pre {
    background: #1e1e2e;
    border-radius: 10px;
    padding: 18px 20px;
    overflow-x: auto;
    margin: 16px 0;
    font-size: 13px;
    line-height: 1.6;
}

.content pre code {
    background: none;
    border: none;
    color: #cdd6f4;
    padding: 0;
    font-size: 13px;
}

.content blockquote {
    border-left: 4px solid var(--accent);
    background: var(--accent-light);
    padding: 12px 18px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
    color: #374151;
}

.content blockquote p:last-child { margin-bottom: 0; }

.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 13.5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-radius: 8px;
    overflow: hidden;
}

.content th {
    background: #f1f5f9;
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
    color: #1a1d2e;
    border-bottom: 2px solid var(--border);
    font-size: 13px;
}

.content td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    color: #374151;
}

.content tr:last-child td { border-bottom: none; }
.content tr:nth-child(even) td { background: #fafbfc; }

.content hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 32px 0;
}

.content .toc {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 22px;
    margin: 20px 0 32px;
}

.content .toc ul { padding-left: 18px; margin: 4px 0; }
.content .toc > ul { list-style: none; padding-left: 0; }
.content .toc a { border-bottom: none; color: var(--accent); }
.content .toc-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: #1a1d2e; }

.header-permalink {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.7em;
    margin-left: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

h1:hover .header-permalink,
h2:hover .header-permalink,
h3:hover .header-permalink,
h4:hover .header-permalink { opacity: 1; }

/* ─── Mermaid ─── */
.mermaid {
    text-align: center;
    margin: 20px 0;
    padding: 20px;
    background: #fafbfc;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow-x: auto;
}

.mermaid svg { max-width: 100%; height: auto; }

/* ─── Breadcrumb ─── */
.breadcrumb {
    font-size: 12px;
    color: var(--content-muted);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--content-muted);
    text-decoration: none;
    border: none;
}

.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: #cbd5e1; }

/* ─── Prev/Next Nav ─── */
.page-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    gap: 16px;
}

.page-nav a {
    font-size: 13px;
    color: var(--content-muted);
    text-decoration: none;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid var(--border);
    transition: all 0.2s;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-nav a:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
}

.nav-next { margin-left: auto; text-align: right; }

/* ─── Index Page ─── */
.index-hero {
    background: linear-gradient(135deg, #0f1117 0%, #1a1d2e 100%);
    color: #fff;
    padding: 64px 48px 56px;
    border-radius: 16px;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.index-hero::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(16,185,129,0.12), transparent 70%);
    border-radius: 50%;
}

.index-hero h1 {
    color: #fff;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    border: none;
}

.index-hero p {
    color: rgba(255,255,255,0.7);
    font-size: 16px;
    max-width: 580px;
    line-height: 1.7;
}

.index-hero .hero-tags {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.index-hero .hero-tag {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    color: rgba(255,255,255,0.8);
}

.index-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.stat-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--content-muted);
    margin-top: 4px;
}

.section-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 32px;
}

.section-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.section-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(5,150,105,0.1);
    transform: translateY(-2px);
}

.section-card .sc-icon { font-size: 28px; margin-bottom: 10px; }
.section-card h3 { font-size: 17px; margin-bottom: 6px; border: none; }
.section-card p { font-size: 13px; color: var(--content-muted); margin: 0; }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .index-stats { grid-template-columns: repeat(2, 1fr); }
    .section-cards { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    :root { --sidebar-w: 260px; }
    .topbar-toggle { display: block; }
    .sidebar { transform: translateX(-100%); z-index: 250; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .content { padding: 24px 20px 60px; }
    .topbar-search { display: none; }
    .index-hero { padding: 40px 28px; }
    .index-hero h1 { font-size: 26px; }
    .index-stats { grid-template-columns: 1fr 1fr; }
}

/* ─── Scrollbar ─── */
.main::-webkit-scrollbar { width: 8px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
