/* xCRUD Nova Pro docs site - layout + typography.
   Deliberately self-contained (no reuse of assets/app.css's own classes)
   since that file's flex/fixed-rail model was built for the logged-in
   admin dashboard shell, which has no 3rd (TOC) pane - but the same
   design tokens are used throughout (see docs/DocsShell.php's own header
   comment): Inter/JetBrains Mono, the `brand` blue scale, slate
   neutrals, 8px radius, soft shadow. */

:root {
    --docs-header-h: 64px;
    --docs-border: #e2e8f0;
    --docs-ink: #1e293b;
    --docs-ink-soft: #64748b;
    --docs-bg: #f8fafc;
    --docs-radius: 8px;
    --docs-shadow: 0 1px 2px rgba(30, 41, 59, .04), 0 8px 24px -12px rgba(30, 41, 59, .10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.docs-body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    color: var(--docs-ink);
    background: var(--docs-bg);
}

a { color: #3654b8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */

.docs-header {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--docs-header-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
    background: #fff;
    border-bottom: 1px solid var(--docs-border);
}

.docs-logo { display: flex; align-items: center; flex-shrink: 0; }
.docs-logo img { height: 32px; object-fit: contain; }

.docs-mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--docs-border);
    border-radius: var(--docs-radius);
    background: #fff;
    color: var(--docs-ink-soft);
    cursor: pointer;
    flex-shrink: 0;
}

.docs-search-wrap {
    position: relative;
    flex: 1 1 auto;
    max-width: 460px;
}

.docs-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--docs-ink-soft);
    pointer-events: none;
}

.docs-search-input {
    width: 100%;
    height: 38px;
    padding: 0 36px 0 36px;
    border: 1px solid var(--docs-border);
    border-radius: var(--docs-radius);
    background: var(--docs-bg);
    font-size: 14px;
    color: var(--docs-ink);
    outline: none;
}

.docs-search-input:focus {
    border-color: #7a9cff;
    box-shadow: 0 0 0 3px rgba(91, 130, 247, .18);
    background: #fff;
}

.docs-search-kbd {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11px;
    color: var(--docs-ink-soft);
    background: #fff;
    border: 1px solid var(--docs-border);
    border-radius: 4px;
    padding: 1px 6px;
    pointer-events: none;
}

.docs-search-input:focus ~ .docs-search-kbd { display: none; }

.docs-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--docs-border);
    border-radius: var(--docs-radius);
    box-shadow: var(--docs-shadow);
    max-height: 60vh;
    overflow-y: auto;
    z-index: 50;
}

.docs-search-result {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--docs-ink);
}

.docs-search-result .docs-result-title { font-weight: 600; font-size: 13.5px; }
.docs-search-result .docs-result-meta { font-size: 12px; color: var(--docs-ink-soft); margin-top: 2px; }
.docs-search-result mark { background: #fef08a; color: inherit; border-radius: 2px; }
.docs-search-result.docs-result-active,
.docs-search-result:hover { background: #f2f6ff; text-decoration: none; }
.docs-search-empty { padding: 14px 10px; font-size: 13px; color: var(--docs-ink-soft); }

.docs-header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.docs-header-nav-link {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--docs-ink-soft);
    padding: 6px 10px;
    border-radius: 6px;
}
.docs-header-nav-link:hover { background: #f1f5f9; color: var(--docs-ink); text-decoration: none; }

/* ---------- Language switcher ---------- */

.docs-lang-switcher { position: relative; flex-shrink: 0; }

.docs-lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--docs-border);
    border-radius: var(--docs-radius);
    background: #fff;
    color: var(--docs-ink-soft);
    font-size: 13px;
    cursor: pointer;
}

.docs-lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background: #fff;
    border: 1px solid var(--docs-border);
    border-radius: var(--docs-radius);
    box-shadow: var(--docs-shadow);
    padding: 6px;
    z-index: 50;
}

.docs-lang-option {
    display: block;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13.5px;
    color: var(--docs-ink);
}
.docs-lang-option:hover { background: #f1f5f9; text-decoration: none; }
.docs-lang-option[aria-current="true"] { color: #3654b8; font-weight: 600; }

/* ---------- 3-pane layout ---------- */

.docs-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr) 220px;
    max-width: 1440px;
    margin: 0 auto;
    align-items: start;
}

.docs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .35);
    z-index: 45;
}

.docs-sidebar {
    position: sticky;
    top: var(--docs-header-h);
    height: calc(100vh - var(--docs-header-h));
    overflow-y: auto;
    border-right: 1px solid var(--docs-border);
    background: #fff;
    padding: 18px 12px;
}

.docs-nav-group { margin-bottom: 4px; }
.docs-nav-group-label {
    list-style: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--docs-ink-soft);
    padding: 8px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.docs-nav-group-label::-webkit-details-marker { display: none; }
.docs-nav-group-label:hover { background: #f1f5f9; }
.docs-nav-group-label::after {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    transition: transform .15s ease;
}
.docs-nav-group[open] > .docs-nav-group-label::after { transform: rotate(45deg); }

.docs-nav-list { list-style: none; margin: 0; padding: 0 0 8px; }
.docs-nav-link {
    display: block;
    padding: 7px 10px 7px 18px;
    font-size: 13.5px;
    color: var(--docs-ink);
    border-radius: 6px;
}
.docs-nav-link:hover { background: #f1f5f9; text-decoration: none; }
.docs-nav-link-active { background: #f2f6ff; color: #3654b8; font-weight: 600; }

.docs-main {
    min-width: 0;
    padding: 32px 40px 80px;
}

.docs-toc {
    position: sticky;
    top: var(--docs-header-h);
    height: fit-content;
    max-height: calc(100vh - var(--docs-header-h));
    overflow-y: auto;
    padding: 24px 16px;
}
.docs-toc-heading {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--docs-ink-soft);
    margin: 0 0 8px;
}
.docs-toc-list { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--docs-border); }
.docs-toc-item a {
    display: block;
    padding: 4px 0 4px 14px;
    margin-left: -2px;
    border-left: 2px solid transparent;
    font-size: 13px;
    color: var(--docs-ink-soft);
}
.docs-toc-item.docs-toc-sub a { padding-left: 26px; font-size: 12.5px; }
.docs-toc-item a:hover { color: var(--docs-ink); text-decoration: none; }
.docs-toc-item a.docs-toc-active { color: #3654b8; border-left-color: #4468e0; font-weight: 600; }

/* ---------- Article typography ---------- */

.docs-article h1 { font-size: 30px; font-weight: 700; margin: 0 0 8px; color: var(--docs-ink); }
.docs-lead { font-size: 16px; color: var(--docs-ink-soft); margin: 0 0 32px; max-width: 68ch; }
.docs-article section { margin-bottom: 36px; scroll-margin-top: calc(var(--docs-header-h) + 16px); }
.docs-article h2 {
    font-size: 21px;
    font-weight: 700;
    margin: 0 0 12px;
    padding-top: 4px;
    scroll-margin-top: calc(var(--docs-header-h) + 16px);
}
.docs-article h3 { font-size: 16.5px; font-weight: 600; margin: 20px 0 8px; scroll-margin-top: calc(var(--docs-header-h) + 16px); }
.docs-article p { line-height: 1.7; font-size: 15px; max-width: 74ch; margin: 0 0 14px; }
.docs-article ul, .docs-article ol { line-height: 1.7; font-size: 15px; max-width: 74ch; padding-left: 22px; margin: 0 0 14px; }
.docs-article li { margin-bottom: 4px; }
.docs-article strong { font-weight: 600; }
.docs-article code:not(pre code) {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 13px;
    background: #f1f5f9;
    border: 1px solid var(--docs-border);
    border-radius: 4px;
    padding: 1px 5px;
}

.docs-code {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--docs-radius);
    padding: 16px 18px;
    overflow-x: auto;
    margin: 0 0 16px;
}
.docs-code code {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 13px;
    line-height: 1.6;
    background: none;
    border: none;
    padding: 0;
}

.docs-article table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 20px;
    font-size: 13.5px;
}
.docs-article th, .docs-article td {
    text-align: left;
    padding: 9px 12px;
    border-bottom: 1px solid var(--docs-border);
    vertical-align: top;
}
.docs-article th { font-weight: 700; color: var(--docs-ink-soft); text-transform: uppercase; font-size: 11.5px; letter-spacing: .03em; }
.docs-article td code { white-space: nowrap; }

.docs-try-it {
    display: block;
    margin: 8px 0 32px;
    padding: 14px 16px;
    background: #f2f6ff;
    border: 1px solid #c9d8ff;
    border-radius: var(--docs-radius);
}
.docs-try-it a { font-weight: 600; color: #3654b8; }

.docs-see-also {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--docs-border);
}
.docs-see-also p { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--docs-ink-soft); margin: 0 0 10px; }
.docs-see-also ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.docs-see-also a {
    display: inline-block;
    padding: 7px 12px;
    background: #fff;
    border: 1px solid var(--docs-border);
    border-radius: 999px;
    font-size: 13px;
    color: var(--docs-ink);
}
.docs-see-also a:hover { border-color: #a3bcff; color: #3654b8; text-decoration: none; }

.docs-fallback-banner {
    background: #fef9c3;
    border: 1px solid #fde68a;
    border-radius: var(--docs-radius);
    padding: 12px 16px;
    font-size: 13.5px;
    margin-bottom: 24px;
}

/* ---------- Landing page ---------- */

.docs-hero { padding: 12px 0 40px; }
.docs-hero h1 { font-size: 38px; }
.docs-hero .docs-lead { font-size: 18px; margin-bottom: 24px; }
.docs-hero-actions { display: flex; gap: 12px; margin-bottom: 8px; }
.docs-btn {
    display: inline-flex;
    align-items: center;
    padding: 11px 20px;
    border-radius: var(--docs-radius);
    font-size: 14.5px;
    font-weight: 600;
}
.docs-btn-primary { background: #4468e0; color: #fff; }
.docs-btn-primary:hover { background: #3654b8; text-decoration: none; }
.docs-btn-secondary { background: #fff; border: 1px solid var(--docs-border); color: var(--docs-ink); }
.docs-btn-secondary:hover { border-color: #a3bcff; text-decoration: none; }

.docs-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin: 24px 0 40px;
}
.docs-category-card {
    display: block;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid var(--docs-border);
    border-radius: var(--docs-radius);
    box-shadow: var(--docs-shadow);
}
.docs-category-card:hover { border-color: #a3bcff; text-decoration: none; }
.docs-category-card h3 { margin: 0 0 4px; font-size: 15px; color: var(--docs-ink); }
.docs-category-card p { margin: 0; font-size: 12.5px; color: var(--docs-ink-soft); }

.docs-mobile-callout {
    background: #fff;
    border: 1px solid var(--docs-border);
    border-radius: var(--docs-radius);
    box-shadow: var(--docs-shadow);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
    .docs-layout { grid-template-columns: 260px minmax(0, 1fr); }
    .docs-toc { display: none; }
}

@media (max-width: 900px) {
    .docs-header-nav { display: none; }
}

@media (max-width: 768px) {
    .docs-layout { grid-template-columns: 1fr; }
    .docs-mobile-toggle { display: inline-flex; }
    .docs-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        height: 100vh;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--docs-shadow);
    }
    body.docs-sidebar-open .docs-sidebar { transform: translateX(0); }
    body.docs-sidebar-open .docs-sidebar-overlay { display: block; }
    .docs-main { padding: 24px 18px 60px; }
    .docs-search-wrap { max-width: none; }
    .docs-lang-btn span { display: none; }
    .docs-hero h1 { font-size: 28px; }
}
