/* API documentation page (frontend/api-docs.blade.php). Builds on landing.css tokens. */

:root {
    --code-bg: #17231e;
    --code-ink: #e4ece6;
    --code-muted: #8fa298;
    --ok: #1d7a46;
    --bad: #9a2020;
    --get: #1d6fa8;
    --post: #1d7a46;
}

.docs-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: clamp(32px, 5vw, 64px);
    padding-top: 40px;
    padding-bottom: 80px;
}

/* Sidebar */

.docs-sidebar {
    position: relative;
}

.docs-toc {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

.docs-toc summary {
    display: none;
}

.docs-toc nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 14px;
}

.docs-toc-group {
    margin: 20px 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
}

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

.docs-toc a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    color: var(--muted);
    text-decoration: none;
    line-height: 1.35;
}

.docs-toc a:hover {
    color: var(--ink);
    background: color-mix(in srgb, var(--brand-primary) 5%, transparent);
}

.docs-toc a.is-current {
    border-left-color: var(--brand-primary);
    color: var(--ink);
    font-weight: 600;
    background: color-mix(in srgb, var(--brand-primary) 7%, transparent);
}

.docs-toc .method {
    flex: none;
    min-width: 38px;
    font-size: 9px;
}

/* Content */

.docs-content {
    min-width: 0;
    max-width: 820px;
    font-size: 16px;
    color: #2b3a33;
}

.docs-section {
    padding-bottom: 40px;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--line);
    scroll-margin-top: 24px;
}

.docs-section:last-child {
    border-bottom: 0;
}

.docs-content h1 {
    margin: 0 0 14px;
    font-size: clamp(34px, 4.4vw, 50px);
    line-height: 1.1;
    letter-spacing: -1.6px;
    color: var(--ink);
}

.docs-content h2 {
    margin: 0 0 14px;
    font-size: 28px;
    letter-spacing: -0.6px;
    color: var(--ink);
}

.docs-content h3 {
    margin: 28px 0 10px;
    font-size: 16px;
    color: var(--ink);
}

.docs-content h3 small {
    margin-left: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.docs-content p,
.docs-content ul,
.docs-content ol {
    margin: 0 0 16px;
}

.docs-content li + li {
    margin-top: 6px;
}

.docs-content a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.docs-content .anchor {
    text-decoration: none;
}

.docs-content .anchor:hover::after {
    content: ' #';
    color: var(--muted);
}

.docs-lead {
    font-size: 18px;
    color: var(--muted);
}

.docs-muted {
    font-size: 14px;
    color: var(--muted);
}

.docs-content code {
    padding: 1px 5px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--brand-primary) 8%, var(--white));
    font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
    font-size: 0.86em;
    overflow-wrap: anywhere;
}

/* Base URL box and quick links */

.docs-callout {
    margin: 24px 0;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--white);
}

.docs-callout-label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
}

.copy-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.copy-row code {
    padding: 0;
    background: none;
    font-size: 15px;
}

.docs-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.docs-content .docs-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--white);
    text-decoration: none;
    transition: border-color 0.15s;
}

.docs-card:hover {
    border-color: var(--brand-primary);
}

.docs-card i {
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: color-mix(in srgb, var(--brand-primary) 10%, var(--white));
    font-size: 18px;
}

.docs-card span {
    font-size: 13px;
    color: var(--muted);
}

/* Quick start */

.docs-steps {
    counter-reset: step;
    padding: 0;
    list-style: none;
}

.docs-steps > li {
    position: relative;
    padding-left: 44px;
    counter-increment: step;
}

.docs-steps > li + li {
    margin-top: 20px;
}

.docs-steps > li::before {
    content: counter(step);
    position: absolute;
    top: -2px;
    left: 0;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.docs-steps .code-tabs {
    margin: 14px 0;
}

/* Notes */

.docs-note {
    padding: 14px 16px;
    border-left: 3px solid var(--brand-primary);
    border-radius: 0 8px 8px 0;
    background: color-mix(in srgb, var(--brand-primary) 6%, var(--white));
    font-size: 15px;
}

.docs-note-warning {
    border-left-color: #b7791f;
    background: color-mix(in srgb, #b7791f 9%, var(--white));
}

/* Endpoints */

.endpoint-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--white);
}

.endpoint-line code {
    padding: 0;
    background: none;
    font-size: 15px;
    font-weight: 600;
}

.method {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 5px;
    font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-align: center;
    color: #fff;
}

.method-get {
    background: var(--get);
}

.method-post {
    background: var(--post);
}

/* Tables */

.table-scroll {
    margin: 0 0 16px;
    overflow-x: auto;
}

.params {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.params th,
.params td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.params th {
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--muted);
}

.params td:first-child {
    white-space: nowrap;
}

/* Field names stay whole; the table scrolls sideways if it has to */
.params td:first-child code {
    overflow-wrap: normal;
}

.param-type {
    font-size: 13px;
    color: var(--muted);
}

.required {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    font-weight: 600;
    color: var(--bad);
}

/* Code */

.code-block {
    margin: 0 0 16px;
    padding: 16px 18px;
    overflow-x: auto;
    border-radius: 10px;
    background: var(--code-bg);
    color: var(--code-ink);
    font-size: 13px;
    line-height: 1.6;
    tab-size: 4;
}

.docs-content .code-block code {
    padding: 0;
    background: none;
    color: inherit;
    font-size: inherit;
    overflow-wrap: normal;
}

.code-tabs {
    margin: 0 0 16px;
    overflow: hidden;
    border-radius: 10px;
    background: var(--code-bg);
}

.code-tabs .code-block {
    margin: 0;
    border-radius: 0;
}

.code-tabs-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px 0;
    border-bottom: 1px solid rgb(255 255 255 / 8%);
}

.code-tabs-bar [role='tablist'] {
    display: flex;
    flex-wrap: wrap;
}

.code-tabs-bar [role='tab'] {
    padding: 8px 12px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--code-muted);
    cursor: pointer;
}

.code-tabs-bar [role='tab']:hover {
    color: var(--code-ink);
}

.code-tabs-bar [role='tab'].is-active {
    border-bottom-color: var(--brand-accent);
    color: #fff;
}

.copy-button {
    flex: none;
    padding: 5px 10px;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 6px;
    background: none;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--code-ink);
    cursor: pointer;
}

.copy-button:hover {
    background: rgb(255 255 255 / 8%);
}

.docs-callout .copy-button {
    border-color: var(--line);
    color: var(--ink);
}

.docs-callout .copy-button:hover {
    background: var(--paper);
}

.code-tabs-bar .copy-button {
    margin-bottom: 6px;
}

/* Responses */

.response-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--muted);
}

.status-code {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
    font-size: 12px;
    font-weight: 700;
}

.status-ok {
    background: color-mix(in srgb, var(--ok) 13%, var(--white));
    color: var(--ok);
}

.status-bad {
    background: color-mix(in srgb, var(--bad) 11%, var(--white));
    color: var(--bad);
}

/* Reference sections */

.status-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
    font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
    font-size: 13px;
}

.status-flow span {
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: var(--white);
}

.status-flow i,
.status-flow em {
    color: var(--muted);
    font-style: normal;
}

.status-flow .flow-ok {
    border-color: var(--ok);
    color: var(--ok);
}

.status-flow .flow-bad {
    border-color: var(--bad);
    color: var(--bad);
}

.format-list {
    padding: 0;
    list-style: none;
}

.format-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
}

.format-list span {
    font-size: 14px;
    color: var(--muted);
}

.docs-checklist {
    padding: 0;
    list-style: none;
}

.docs-checklist li {
    position: relative;
    padding-left: 28px;
}

.docs-checklist li::before {
    content: '\F26E';
    position: absolute;
    left: 0;
    font-family: 'bootstrap-icons';
    color: var(--ok);
}

.docs-support {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.docs-content .docs-support .button {
    text-decoration: none;
}

.docs-support .bi {
    margin-right: 6px;
}

/* Small screens: the contents become a collapsible list above the page */

@media (max-width: 900px) {
    .docs-layout {
        /* minmax(0, …): long code lines scroll inside their block instead of widening the page */
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
        padding-top: 20px;
    }

    .docs-toc {
        position: static;
        max-height: none;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--white);
    }

    .docs-toc summary {
        display: block;
        padding: 14px 16px;
        font-weight: 600;
        cursor: pointer;
    }

    .docs-toc nav {
        padding: 0 8px 14px;
    }
}

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

    .docs-steps > li {
        padding-left: 0;
        padding-top: 38px;
    }
}
