/* retoor <retoor@molodetz.nl> */

.docs-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: 1.5rem;
    align-items: start;
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.docs-main {
    min-width: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
}

.docs-content {
    line-height: 1.65;
}

.docs-content h1 {
    margin-top: 0;
}

.docs-content h2 {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Restore list indentation lost to the global `* { padding: 0 }` reset in base.css
   (mirrors markdown.css's .rendered-content rules) so bullets/numbers sit correctly. */
.docs-content ul,
.docs-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.docs-content li {
    margin-bottom: 0.25rem;
}

@media (max-width: 480px) {
    .docs-content ul,
    .docs-content ol {
        padding-left: 1.125rem;
    }
}

.docs-content pre {
    overflow-x: auto;
}

.docs-content pre {
    position: relative;
}

.docs-content table {
    width: 100%;
    max-width: 100%;
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.875rem;
    -webkit-overflow-scrolling: touch;
}

.docs-content th,
.docs-content td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: top;
}

.docs-content th {
    background: var(--bg-card-hover);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.docs-content td {
    color: var(--text-secondary);
}

.docs-content tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

.docs-content td code,
.docs-content th code {
    white-space: nowrap;
}

.code-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.docs-content pre:hover .code-copy-btn,
.code-block pre:hover .code-copy-btn,
.code-copy-btn:focus {
    opacity: 1;
}

.endpoint-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.endpoint-head {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.endpoint-title {
    margin: 0.75rem 0 0.25rem;
    font-size: 1.0625rem;
}

.endpoint-summary {
    margin: 0 0 0.75rem;
    color: var(--text-secondary);
}

.endpoint-path {
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-input);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.method-badge,
.auth-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
}

.method-badge {
    color: var(--white);
}

.method-get { background: var(--info); }
.method-post { background: var(--success); }
.method-delete { background: var(--danger); }
.method-put { background: var(--warning); }

.auth-badge {
    border: 1px solid var(--border-light);
}

.auth-public { color: var(--text-muted); }
.auth-user { color: var(--accent); border-color: var(--accent); }
.auth-admin { color: var(--danger); border-color: var(--danger); }

.api-tester {
    margin-top: 0.75rem;
}

.param-table {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-bottom: 1rem;
}

.param-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 0.75rem;
    align-items: start;
}

.param-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
    padding-top: 0.4rem;
}

.param-name {
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.param-required {
    color: var(--accent);
    font-weight: 700;
}

.param-loc {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.05rem 0.4rem;
}

.param-meta {
    min-width: 0;
}

.param-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.param-allowed {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    overflow-wrap: anywhere;
}

.param-allowed-label {
    font-weight: 600;
}

.param-allowed-values {
    font-family: var(--font-mono);
}

.param-input {
    width: 100%;
    padding: 0.45rem 0.6rem;
    font-size: 0.8125rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
}

textarea.param-input {
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
    resize: vertical;
}

.param-input:focus {
    outline: none;
    border-color: var(--accent);
}

.auth-picker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.auth-field {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 0.5rem;
    align-items: center;
}

.auth-field label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.auth-field.auth-basic {
    grid-template-columns: 80px 1fr 80px 1fr;
}

.code-block {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.code-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.4rem 0.5rem 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.code-tab {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.code-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.code-panel {
    margin: 0;
    border-radius: 0;
}

.endpoint-notes {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.try-panel {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.try-note {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.response-viewer {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.response-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.response-status {
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius);
    color: var(--white);
}

.response-2xx { background: var(--success); }
.response-3xx { background: var(--info); }
.response-4xx { background: var(--warning); }
.response-5xx { background: var(--danger); }

.response-redirect {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0.25rem 0;
}

.response-body {
    margin: 0.25rem 0 0;
    max-height: 360px;
    overflow: auto;
}

.format-picker {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
}

.format-label {
    color: var(--text-muted);
    font-weight: 600;
}

.format-options {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.format-option {
    padding: 0.3rem 0.85rem;
    font-size: 0.75rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
}

.format-option + .format-option {
    border-left: 1px solid var(--border);
}

.format-option.active {
    background: var(--accent);
    color: var(--on-accent);
}

.format-fixed {
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-weight: 600;
}

.format-note {
    color: var(--text-muted);
}

.response-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.response-pane {
    display: none;
}

.response-pane.active {
    display: block;
}

.response-note {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0 0 0.5rem;
}

.response-placeholder {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}

@media (max-width: 768px) {
    .docs-layout {
        grid-template-columns: 1fr;
    }

    .docs-main {
        padding: 1rem 1.25rem;
    }

    .param-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .auth-field,
    .auth-field.auth-basic {
        grid-template-columns: 1fr;
    }

    .code-copy-btn {
        opacity: 1;
    }

    .content-copy-btn {
        opacity: 1;
    }
}

/* ---- Unified code blocks: highlight + line numbers + copy (widget tabs, response, prose) ---- */
pre.code-pre {
    position: relative;
    display: flex;
    align-items: stretch;
    padding: 0;
    margin: 0 0 0.75rem;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: "SF Mono", Monaco, "Cascadia Code", "JetBrains Mono", monospace;
    font-size: 0.8125rem;
    line-height: 1.55;
}

.code-block pre.code-pre.code-panel {
    border: none;
    border-radius: 0;
    margin: 0;
}

pre.code-pre > code {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    padding: 0.75rem 1rem;
    white-space: pre;
    background: transparent;
    font: inherit;
    line-height: inherit;
}

pre.code-pre > .code-gutter {
    flex: 0 0 auto;
    padding: 0.75rem 0.6rem;
    text-align: right;
    white-space: pre;
    user-select: none;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.22);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    font: inherit;
    line-height: inherit;
    font-variant-numeric: tabular-nums;
}

/* The generic `pre.code-has-copy` copy-button styles moved to markdown.css so they
   apply to backend-rendered content everywhere, not only on docs pages. */

/* ---- Docs search ---- */
.docs-search-form {
    margin: 0.5rem 0 0.75rem;
}

.docs-search-input {
    width: 100%;
    padding: 0.45rem 0.6rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
}

.docs-search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.docs-search-bigform {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem 0 1.25rem;
}

.docs-search-bigform .docs-search-input {
    flex: 1 1 auto;
}

.docs-search-count,
.docs-search-empty,
.docs-search-hint {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.docs-search-results {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.docs-search-result {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.docs-search-result-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--accent);
}

.docs-search-snippet {
    margin: 0.35rem 0 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.55;
}

.docs-search-snippet mark {
    background: var(--accent);
    color: var(--on-accent);
    padding: 0 0.125rem;
    border-radius: 3px;
}

.docs-download-heading {
    margin-top: 1.25rem;
}

.devii-doc-hero {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem 1.75rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.devii-doc-hero-mark {
    font-size: 2.75rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.devii-doc-hero h1 {
    margin: 0 0 0.5rem;
    font-size: 1.7rem;
    color: var(--text-primary);
}

.devii-doc-hero p {
    max-width: 46rem;
    margin: 0 auto 1.25rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.devii-doc-hero-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.devii-doc-hero-note {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.7rem 1.4rem;
    font-size: 1rem;
}

.devii-doc-cta {
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.docs-content h2[id],
.docs-content h3[id] {
    scroll-margin-top: 80px;
}

.docs-heading-anchor {
    margin-left: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 400;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.docs-content h2:hover .docs-heading-anchor,
.docs-content h3:hover .docs-heading-anchor {
    opacity: 1;
}

.docs-heading-anchor:hover {
    color: var(--accent);
}

.docs-toc {
    margin: 0 0 24px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.docs-toc-heading {
    margin: 0 0 14px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.docs-toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.docs-toc-item a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.docs-toc-item a:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.docs-toc-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.92rem;
}

.docs-toc-count {
    flex-shrink: 0;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.docs-toc-summary {
    color: var(--text-secondary);
    font-size: 0.82rem;
}
