/* rustmax-rustdoc styles
 * Colors and fonts come from rustmax-themes.css
 */
:root {
    --rmx-sidebar-width: 280px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font: var(--rmx-font-text);
    line-height: 1.6;
    background: var(--rmx-color-bg);
    color: var(--rmx-color-fg);
}

body {
    display: flex;
    min-height: 100vh;
}

a { color: var(--rmx-color-links); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Nav toggle button */
.nav-toggle {
    position: sticky;
    top: 0.5rem;
    align-self: flex-start;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin: 0.5rem;
    padding: 0;
    border: 1px solid var(--rmx-color-border);
    border-radius: 4px;
    background: var(--rmx-color-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.nav-toggle::before {
    content: '';
    width: 18px;
    height: 2px;
    background: var(--rmx-color-fg);
    box-shadow: 0 6px 0 var(--rmx-color-fg), 0 -6px 0 var(--rmx-color-fg);
}

.nav-toggle:hover {
    background: var(--rmx-color-bg-alt);
}

/* Sidebar */
.sidebar {
    flex-shrink: 0;
    width: var(--rmx-sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--rmx-color-bg-alt);
    border-right: 1px solid var(--rmx-color-border);
    padding: 1rem;
    transition: width 0.2s ease, padding 0.2s ease;
}

.nav-collapsed .sidebar {
    width: 0;
    padding: 0;
    border-right: none;
}

.sidebar-title {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--rmx-color-border);
    white-space: nowrap;
}

.sidebar-title a { color: var(--rmx-color-fg); }

.module-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.module-tree ul {
    list-style: none;
    padding-left: 1rem;
    margin: 0;
}

.module-tree li {
    margin: 0.2rem 0;
    white-space: nowrap;
}

.module-tree .current > a { font-weight: bold; }

/* Main content */
main {
    flex: 1;
    min-width: 0;
    max-width: 50rem;
    margin: 0 auto;
    padding: 2rem 3rem;
}

header { margin-bottom: 2rem; }

.breadcrumbs {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 1.8rem;
    margin: 0;
}

h1 code {
    font-size: inherit;
    background: none;
    padding: 0;
}

h2 {
    font-size: 1.3rem;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--rmx-color-border);
    padding-bottom: 0.3rem;
}

/* Code */
code {
    font: var(--rmx-font-code);
    font-size: 0.9em;
    background: var(--rmx-color-bg-alt);
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

pre {
    background: var(--rmx-color-bg-alt);
    padding: 1rem;
    overflow-x: auto;
    border-radius: 4px;
    border: 1px solid var(--rmx-color-border);
}

pre code {
    background: none;
    padding: 0;
}

.signature pre {
    margin: 0;
}

/* Item lists */
.item-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.item-list li {
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--rmx-color-border);
}

.item-list li:last-child { border-bottom: none; }

.short-doc {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.2rem;
}

/* Fields */
.fields dl {
    margin: 0;
}

.fields dt {
    margin-top: 1rem;
    font-weight: bold;
}

.fields dd {
    margin-left: 1rem;
    margin-top: 0.3rem;
}

/* Docs section */
.docs {
    margin-top: 1.5rem;
}

.docs p:first-child { margin-top: 0; }

/* Tables */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

th, td {
    border: 1px solid var(--rmx-color-border);
    padding: 0.5rem;
    text-align: left;
}

th { background: var(--rmx-color-bg-alt); }

/* Blockquotes */
blockquote {
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    border-left: 4px solid var(--rmx-color-border);
    background: var(--rmx-color-bg-alt);
}

/* Syntax highlighting is in rustmax-syntax.css (shared with www and rmxbook) */

/* Mobile */
@media (max-width: 768px) {
    body { flex-direction: column; }

    .nav-toggle {
        position: relative;
        width: 100%;
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        max-height: 60vh;
        border-right: none;
        border-bottom: 1px solid var(--rmx-color-border);
        transition: max-height 0.2s ease, padding 0.2s ease;
    }

    .nav-collapsed .sidebar {
        width: 100%;
        max-height: 0;
        overflow: hidden;
        border-bottom: none;
    }

    .module-tree li {
        white-space: normal;
    }

    main { padding: 1rem; }
}
