/* ============================================================
   NGZ Ads – Documentation stylesheet
   Palette : sidebar #1e293b · accent #0d6efd · warm bg #f8fafc
   ============================================================ */

/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --sidebar-w:     272px;
    --topbar-h:      54px;
    --accent:        #0d6efd;
    --accent-hover:  #0b5ed7;
    --sidebar-bg:    #1e293b;
    --sidebar-text:  rgba(255,255,255,.75);
    --sidebar-hover: rgba(255,255,255,.08);
    --sidebar-active-bg: rgba(13,110,253,.18);
    --sidebar-active: #60a5fa;
    --body-bg:       #f1f5f9;
    --article-bg:    #ffffff;
    --text:          #1e293b;
    --text-muted:    #64748b;
    --border:        #e2e8f0;
    --code-bg:       #f1f5f9;
    --code-text:     #c0392b;
    --pre-bg:        #0f172a;
    --radius:        .6rem;
    --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.75;
    color: var(--text);
    background: var(--body-bg);
}

/* ── Sidebar ──────────────────────────────────────────────── */
.doc-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 200;
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}
.doc-sidebar::-webkit-scrollbar { width: 4px; }
.doc-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

/* Brand block */
.doc-sidebar-brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1.35rem 1.25rem 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}
.doc-brand-mark {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: .45rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: #fff;
}
.doc-brand-mark svg { width: 20px; height: 20px; }
.doc-sidebar-brand strong { display: block; color: #fff; font-size: .95rem; letter-spacing: -.01em; }
.doc-sidebar-brand small  { display: block; color: rgba(255,255,255,.45); font-size: .72rem; margin-top: .05rem; }

/* Nav */
.doc-nav { flex: 1; padding: 1rem 0 .5rem; }
.doc-nav-section {
    padding: .65rem 1.25rem .2rem;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
}
.doc-nav ul { list-style: none; }

.doc-nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem 1.25rem .55rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    line-height: 1.4;
}
.doc-nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: rgba(255,255,255,.25);
}
.doc-nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
    border-left-color: var(--accent);
    font-weight: 600;
}
.doc-nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .75; }
.doc-nav-link.active .doc-nav-icon { opacity: 1; }

/* Footer */
.doc-sidebar-footer {
    padding: .85rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.doc-back-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: rgba(255,255,255,.45);
    text-decoration: none;
    font-size: .78rem;
    transition: color .15s;
}
.doc-back-link:hover { color: rgba(255,255,255,.8); }
.doc-version { font-size: .72rem; color: rgba(255,255,255,.25); }

/* ── Mobile top bar ───────────────────────────────────────── */
.doc-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--sidebar-bg);
    align-items: center;
    gap: .75rem;
    padding: 0 1rem;
    z-index: 300;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.doc-menu-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.8);
    cursor: pointer;
    padding: .3rem;
    border-radius: .35rem;
    display: flex; align-items: center;
    transition: background .15s, color .15s;
}
.doc-menu-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.doc-topbar-title {
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doc-topbar-title span { color: rgba(255,255,255,.5); font-weight: 400; }

/* Overlay */
.doc-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 150;
    backdrop-filter: blur(2px);
}
.doc-overlay.show { display: block; }

/* ── Main layout ──────────────────────────────────────────── */
.doc-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}
.doc-content-wrap {
    max-width: 860px;
    padding: 2.5rem 2.5rem 3rem;
}

/* ── Article ──────────────────────────────────────────────── */
.doc-article {
    background: var(--article-bg);
    border-radius: var(--radius);
    padding: 2.75rem 3rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

/* Typography */
.doc-article h1 {
    font-size: 1.9rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: .85rem;
    padding-bottom: .75rem;
    border-bottom: 2px solid var(--border);
    line-height: 1.25;
    letter-spacing: -.02em;
}
.doc-article h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
    margin: 2.25rem 0 .6rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid var(--border);
    letter-spacing: -.01em;
}
.doc-article h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #334155;
    margin: 1.6rem 0 .45rem;
}
.doc-article h4 {
    font-size: .95rem;
    font-weight: 700;
    color: #475569;
    margin: 1.25rem 0 .35rem;
}
.doc-article h2:first-child,
.doc-article h3:first-child { margin-top: 0; }

.doc-article p {
    margin-bottom: 1rem;
    color: #334155;
}
.doc-article a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.doc-article a:hover { text-decoration: underline; }

.doc-article ul,
.doc-article ol {
    margin: 0 0 1rem 1.4rem;
    padding: 0;
    color: #334155;
}
.doc-article li { margin-bottom: .35rem; }
.doc-article li + li { margin-top: .1rem; }

/* Code */
.doc-article code {
    background: var(--code-bg);
    color: var(--code-text);
    padding: .15em .4em;
    border-radius: .3rem;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: .85em;
    border: 1px solid #cbd5e1;
}
.doc-article pre {
    background: var(--pre-bg);
    color: #e2e8f0;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 0 0 1.25rem;
    font-size: .83rem;
    line-height: 1.65;
    border: 1px solid #1e3a5f;
}
.doc-article pre code {
    background: none;
    color: inherit;
    border: none;
    padding: 0;
    font-size: inherit;
}

/* Blockquote */
.doc-article blockquote {
    display: flex;
    gap: .9rem;
    background: #eff6ff;
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: .85rem 1.1rem;
    margin: 1rem 0 1.25rem;
    color: #1e40af;
}
.doc-article blockquote::before {
    content: '💡';
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: .05rem;
}
.doc-article blockquote p { margin: 0; color: inherit; font-size: .9rem; }

/* HR */
.doc-article hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.25rem 0;
}

/* Tables */
.doc-table-wrap {
    overflow-x: auto;
    margin-bottom: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.doc-article table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.doc-article th {
    background: #f8fafc;
    padding: .6rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #475569;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.doc-article td {
    padding: .6rem 1rem;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}
.doc-article tr:last-child td { border-bottom: none; }
.doc-article tr:hover td { background: #f8fafc; }

/* Images */
.doc-img {
    max-width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

/* Checklist items */
.doc-article li:has(input[type="checkbox"]) { list-style: none; margin-left: -1rem; }

/* ── Pager (prev / next) ──────────────────────────────────── */
.doc-pager {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.doc-pager-btn {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .85rem 1.1rem;
    background: var(--article-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    min-width: 160px;
    max-width: 46%;
    transition: border-color .15s, box-shadow .15s, background .15s;
    box-shadow: var(--shadow);
}
.doc-pager-btn:hover {
    border-color: var(--accent);
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(13,110,253,.1);
    color: var(--text);
    text-decoration: none;
}
.doc-pager-btn svg { flex-shrink: 0; color: var(--text-muted); }
.doc-pager-btn span { display: flex; flex-direction: column; }
.doc-pager-btn em   { font-style: normal; font-size: .72rem; color: var(--text-muted); margin-bottom: .1rem; }
.doc-pager-btn strong,
.doc-pager-next span > *:last-child,
.doc-pager-prev span > *:last-child { font-size: .875rem; font-weight: 600; color: var(--accent); }
.doc-pager-next { margin-left: auto; text-align: right; }
.doc-pager-next svg { order: 2; }
.doc-pager-next span { align-items: flex-end; }

/* ── Footer ───────────────────────────────────────────────── */
.doc-footer {
    text-align: center;
    padding: .5rem 0 1rem;
    font-size: .78rem;
    color: var(--text-muted);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
    .doc-content-wrap { padding: 2rem 1.75rem 3rem; }
    .doc-article { padding: 2rem 2rem; }
}

@media (max-width: 720px) {
    .doc-topbar { display: flex; }

    .doc-sidebar {
        top: var(--topbar-h);
        transform: translateX(-100%);
    }
    .doc-sidebar.open { transform: translateX(0); }

    .doc-main { margin-left: 0; }
    .doc-content-wrap { padding: calc(var(--topbar-h) + 1.5rem) 1.1rem 2.5rem; max-width: 100%; }
    .doc-article { padding: 1.5rem 1.25rem; border-radius: .45rem; }
    .doc-article h1 { font-size: 1.45rem; }
    .doc-article h2 { font-size: 1.15rem; }

    .doc-pager { flex-direction: column; }
    .doc-pager-btn { max-width: 100%; min-width: 0; }
    .doc-pager-next { margin-left: 0; text-align: left; flex-direction: row-reverse; }
    .doc-pager-next span { align-items: flex-start; }
    .doc-pager-next svg { order: 0; }
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
    .doc-sidebar, .doc-topbar, .doc-pager, .doc-footer { display: none !important; }
    .doc-main { margin-left: 0; }
    .doc-content-wrap { padding: 0; max-width: 100%; }
    .doc-article { box-shadow: none; border: none; padding: 0; }
}
