/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --brand:        #490E6F;
    --brand-light:  #7c3aed;
    --brand-50:     #f5f0ff;
    --brand-100:    #ede9fe;
    --sidebar-w:    272px;
    --content-max:  760px;
    --text:         #1e293b;
    --text-muted:   #64748b;
    --text-subtle:  #94a3b8;
    --border:       #e2e8f0;
    --bg:           #f8fafc;
    --sidebar-bg:   #ffffff;
    --radius:       .5rem;
    --font:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

.sidebar-inner {
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0 2rem;
    min-height: 100%;
}

/* Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1.25rem 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    text-decoration: none;
}
.logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    border-radius: .5rem;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 1rem;
    flex-shrink: 0;
}
.logo-title { font-weight: 700; font-size: .9rem; color: var(--text); line-height: 1.2; }
.logo-sub   { font-size: .7rem; color: var(--text-subtle); font-weight: 500; }

/* Search */
.search-wrap {
    position: relative;
    padding: 0 1rem .75rem;
}
.search-icon {
    position: absolute; left: 1.6rem; top: 50%;
    transform: translateY(-60%);
    width: 14px; height: 14px; color: var(--text-subtle);
    pointer-events: none;
}
.search-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: .5rem;
    padding: .45rem .75rem .45rem 2.1rem;
    font-size: .8rem;
    color: var(--text);
    font-family: var(--font);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.search-input:focus {
    border-color: var(--brand-light);
    box-shadow: 0 0 0 3px rgba(124,58,237,.1);
}
.search-input::placeholder { color: var(--text-subtle); }

.search-results {
    position: absolute;
    top: calc(100% - .5rem);
    left: 1rem; right: 1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: .5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
    z-index: 200;
    overflow: hidden;
}
.search-result-item {
    display: block;
    padding: .55rem .85rem;
    font-size: .82rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: background .1s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--brand-50); }
.search-result-item mark {
    background: transparent;
    color: var(--brand-light);
    font-weight: 600;
}

/* Nav */
.sidebar-nav { flex: 1; padding: 0 .75rem; }

.nav-section { margin-bottom: 1.5rem; }
.nav-section-title {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-subtle);
    padding: 0 .5rem .4rem;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .42rem .6rem;
    border-radius: .4rem;
    font-size: .84rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: background .12s, color .12s;
    margin-bottom: 1px;
}
.nav-link:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-link.active {
    background: var(--brand-50);
    color: var(--brand);
    font-weight: 600;
}
.nav-icon { font-size: .85rem; flex-shrink: 0; }

/* Sidebar footer */
.sidebar-footer {
    padding: .75rem 1.25rem 0;
    border-top: 1px solid var(--border);
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
.sidebar-footer-link {
    font-size: .75rem;
    color: var(--text-subtle);
    text-decoration: none;
}
.sidebar-footer-link:hover { color: var(--brand-light); text-decoration: none; }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
}
.content-wrap {
    max-width: calc(var(--content-max) + 4rem);
    margin: 0 auto;
    padding: 2.5rem 2rem 4rem;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .78rem;
    color: var(--text-subtle);
    margin-bottom: 1.75rem;
}
.breadcrumb-section { font-weight: 600; }
.breadcrumb-sep { opacity: .5; }
.breadcrumb-page { color: var(--text-muted); }

/* ── Article typography ───────────────────────────────────────────────────── */
.article h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: .5rem;
    letter-spacing: -.02em;
}
.article .page-subtitle {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.article h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin: 2rem 0 .6rem;
    padding-top: .5rem;
}
.article h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 1.5rem 0 .4rem;
}
.article p  { margin-bottom: 1rem; font-size: .95rem; color: #374151; line-height: 1.75; }
.article ul, .article ol {
    margin: 0 0 1rem 1.25rem;
    font-size: .95rem;
    color: #374151;
    line-height: 1.75;
}
.article li { margin-bottom: .3rem; }
.article strong { color: var(--text); font-weight: 600; }
.article hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.article a { color: var(--brand-light); text-decoration: underline; text-underline-offset: 2px; }

/* Callout boxes */
.callout {
    border-radius: .6rem;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
    display: flex;
    gap: .75rem;
    font-size: .9rem;
    line-height: 1.65;
}
.callout-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .05rem; }
.callout-body strong { display: block; margin-bottom: .2rem; font-size: .88rem; }
.callout-body p { margin: 0; }
.callout.info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.callout.warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.callout.success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }
.callout.danger  { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.callout.purple  { background: var(--brand-50); border: 1px solid #c4b5fd; color: var(--brand); }

/* Feature cards */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .85rem;
    margin: 1.25rem 0;
}
.feature-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: .6rem;
    padding: 1rem 1.1rem;
}
.feature-card-icon { font-size: 1.4rem; margin-bottom: .4rem; }
.feature-card-title { font-weight: 600; font-size: .88rem; margin-bottom: .25rem; color: var(--text); }
.feature-card-desc  { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }

/* Step list */
.steps { counter-reset: step; margin: 1.25rem 0; }
.step {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    position: relative;
}
.step-num {
    counter-increment: step;
    width: 28px; height: 28px;
    background: var(--brand);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 700;
    flex-shrink: 0;
    margin-top: .1rem;
}
.step-num::before { content: counter(step); }
.step-body { flex: 1; }
.step-body strong { display: block; font-size: .92rem; margin-bottom: .2rem; }
.step-body p { margin: 0; font-size: .88rem; color: var(--text-muted); line-height: 1.6; }

/* Table */
.doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
    margin: 1rem 0 1.5rem;
}
.doc-table th {
    background: var(--bg);
    padding: .6rem .85rem;
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    text-align: left;
}
.doc-table td {
    padding: .65rem .85rem;
    border-bottom: 1px solid var(--border);
    color: #374151;
    vertical-align: top;
}
.doc-table tr:last-child td { border-bottom: none; }
.doc-table tbody tr:hover td { background: var(--bg); }

/* Badge */
.badge {
    display: inline-flex; align-items: center;
    border-radius: 999px;
    padding: .15rem .6rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
}
.badge-pro   { background: #f3e8ff; color: var(--brand); }
.badge-basic { background: #f1f5f9; color: #475569; }
.badge-new   { background: #dcfce7; color: #166534; }

/* Code */
.article code {
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: .3rem;
    padding: .1rem .4rem;
    font-size: .82em;
    font-family: 'SF Mono', 'Fira Mono', monospace;
    color: var(--brand);
}

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}
.pagination-btn {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1.1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: .6rem;
    text-decoration: none;
    max-width: 48%;
    transition: border-color .15s, box-shadow .15s;
    flex: 1;
}
.pagination-btn:hover {
    border-color: var(--brand-light);
    box-shadow: 0 2px 8px rgba(124,58,237,.12);
    text-decoration: none;
}
.pagination-btn.next { justify-content: flex-end; text-align: right; }
.pag-arrow { font-size: 1.1rem; color: var(--text-subtle); flex-shrink: 0; }
.pag-label { display: block; font-size: .7rem; color: var(--text-subtle); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.pag-title { display: block; font-size: .88rem; font-weight: 600; color: var(--text); }

/* ── Content footer ───────────────────────────────────────────────────────── */
.content-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: .78rem;
    color: var(--text-subtle);
    text-align: center;
}
.content-footer a { color: var(--text-subtle); }
.content-footer a:hover { color: var(--brand-light); }

/* ── Mobile header ────────────────────────────────────────────────────────── */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 99;
}
.mobile-logo {
    display: flex; align-items: center; gap: .5rem;
    font-weight: 700; font-size: .9rem; color: var(--text);
    text-decoration: none;
}
.logo-pt {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    border-radius: .4rem;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: .85rem;
}
.mobile-menu-btn {
    background: none; border: none; cursor: pointer;
    display: flex; flex-direction: column; gap: 4px;
    padding: 4px; width: 36px;
}
.mobile-menu-btn span {
    display: block; height: 2px; width: 22px;
    background: var(--text); border-radius: 2px; transition: .2s;
}

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .mobile-header { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        top: 0; z-index: 200;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }

    .main { margin-left: 0; }
    .content-wrap { padding: 1.5rem 1.25rem 3rem; }

    .article h1 { font-size: 1.55rem; }
    .feature-grid { grid-template-columns: 1fr 1fr; }

    .pagination { flex-direction: column; }
    .pagination-btn { max-width: 100%; }
}
