/*
 * Restyles the stock swagger-ui 2.x that ships with Swashbuckle 5.6.
 * Injected via SwaggerConfig -> EnableSwaggerUi -> InjectStylesheet.
 * Embedded Resource: logical name Abtrac6.API.SwaggerExtensions.abtrac-swagger.css
 */

:root {
    --abtrac-ink: #1b2430;
    --abtrac-muted: #5b6b7c;
    --abtrac-line: #e2e8ef;
    --abtrac-bg: #f5f7fa;
    --abtrac-accent: #1f6feb;
    --abtrac-get: #1f6feb;
    --abtrac-post: #1a7f4b;
    --abtrac-put: #b26a00;
    --abtrac-delete: #c0392b;
}

body.swagger-section {
    background: var(--abtrac-bg);
    color: var(--abtrac-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body.swagger-section .swagger-ui-wrap {
    max-width: 1180px;
}

/* ---------- Top bar ---------- */

body.swagger-section #header {
    background: #14202e;
    padding: 18px 0;
    border-bottom: 1px solid #0b1420;
}

body.swagger-section #header .swagger-ui-wrap > a,
body.swagger-section #header #logo,
body.swagger-section #header img {
    display: none;    /* stock swagger.io wordmark */
}

body.swagger-section #header:before {
    content: "Abtrac API";
    display: block;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: .2px;
}

/* Hide the whole discovery form. The spec URL is fixed for a single-version API, and the
   stock api_key box does nothing here - credentials are ordinary query parameters on each
   operation, so there is no securityDefinition for swagger-ui to feed. Leaving the box
   visible would invite users to paste their secret key somewhere it is never sent. */
body.swagger-section #header form#api_selector {
    display: none;
}

/* ---------- Title + description block ---------- */

body.swagger-section .info_title {
    font-size: 30px;
    font-weight: 650;
    color: var(--abtrac-ink);
    padding-bottom: 4px;
}

body.swagger-section .info_description {
    background: #fff;
    border: 1px solid var(--abtrac-line);
    border-radius: 10px;
    padding: 20px 24px;
    margin: 14px 0 26px;
    font-size: 14px;
    line-height: 1.62;
    color: #33414f;
    box-shadow: 0 1px 2px rgba(16, 30, 48, .04);
}

/* Spacing is set explicitly here rather than left to the browser: paragraphs would otherwise
   carry a 1em margin top AND bottom, which stacks against the heading and table margins and
   opens up a large gap between a sentence and the table it introduces. */
body.swagger-section .info_description p {
    margin: 0 0 10px;
}

/* marked can leave empty paragraphs behind between raw HTML blocks. */
body.swagger-section .info_description p:empty {
    display: none;
}

body.swagger-section .info_description > *:first-child {
    margin-top: 0;
}

body.swagger-section .info_description > *:last-child {
    margin-bottom: 0;
}

body.swagger-section .info_description h3 {
    font-size: 15px;
    font-weight: 650;
    color: var(--abtrac-ink);
    margin: 20px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--abtrac-line);
}

body.swagger-section .info_description h3:first-child {
    margin-top: 0;
}

/* A paragraph directly above a table or code block is a lead-in to it - keep them together. */
body.swagger-section .info_description p + table,
body.swagger-section .info_description p + pre {
    margin-top: 0;
}

body.swagger-section .info_description code {
    background: #eef2f7;
    border: 1px solid #dde5ee;
    border-radius: 4px;
    padding: 1px 5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    color: #10305c;
}

body.swagger-section .info_description pre {
    background: #14202e;
    color: #e6edf5;
    border: none;
    border-radius: 8px;
    padding: 14px 16px;
    margin: 0 0 12px;
    overflow-x: auto;
    font-size: 12.5px;
    line-height: 1.55;
}

body.swagger-section .info_description pre code {
    background: none;
    border: none;
    color: inherit;
    padding: 0;
}

body.swagger-section .info_description table {
    border-collapse: collapse;
    margin: 0 0 14px;
    width: 100%;
}

body.swagger-section .info_description th,
body.swagger-section .info_description td {
    border: 1px solid var(--abtrac-line);
    padding: 7px 10px;
    text-align: left;
    font-size: 13px;
}

body.swagger-section .info_description th {
    background: #f2f6fa;
    font-weight: 600;
}

/* ---------- Resource (controller) groups ---------- */

body.swagger-section .resource {
    background: #fff;
    border: 1px solid var(--abtrac-line);
    border-radius: 10px;
    margin-bottom: 14px;
    box-shadow: 0 1px 2px rgba(16, 30, 48, .04);
    overflow: hidden;
}

body.swagger-section .resource h2 {
    padding: 2px 0;
}

body.swagger-section .resource .heading {
    border: none;
    padding: 14px 20px;
    background: #fbfcfe;
    border-bottom: 1px solid var(--abtrac-line);
}

body.swagger-section .resource .heading h2 a {
    color: var(--abtrac-ink);
    font-size: 17px;
    font-weight: 650;
    text-decoration: none;
}

body.swagger-section .resource .heading ul.options {
    padding-top: 3px;
}

body.swagger-section .resource .heading ul.options li a {
    color: var(--abtrac-muted);
    font-size: 12px;
    text-decoration: none;
    border-left: 1px solid var(--abtrac-line);
    padding: 0 9px;
}

body.swagger-section .resource .heading ul.options li a:hover {
    color: var(--abtrac-accent);
}

/* ---------- Individual operations ---------- */

body.swagger-section .endpoint ul.operations {
    padding: 0;
}

body.swagger-section .endpoint ul.operations li.operation {
    border-bottom: 1px solid #eef2f6;
}

body.swagger-section ul.operations li div.heading {
    background: none;
    border: none;
    padding: 9px 20px;
}

body.swagger-section ul.operations li div.heading h3 {
    display: flex;
    align-items: center;
    gap: 12px;
}

body.swagger-section ul.operations li div.heading h3 span.http_method a {
    border-radius: 5px;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .6px;
    padding: 5px 0;
    width: 62px;
    text-align: center;
    display: inline-block;
    text-shadow: none;
    text-decoration: none;
}

body.swagger-section ul.operations li div.heading h3 span.path a {
    color: var(--abtrac-ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

body.swagger-section ul.operations li div.heading h3 span.path a:hover {
    color: var(--abtrac-accent);
}

/* Swagger marks the summary up as .options > li, right-aligned. Let it breathe. */
body.swagger-section ul.operations li div.heading ul.options {
    float: none;
    margin-left: auto;
    padding: 0;
}

body.swagger-section ul.operations li div.heading ul.options li {
    color: var(--abtrac-muted);
    font-size: 12.5px;
    font-style: normal;
    max-width: 560px;
    text-align: right;
    line-height: 1.45;
}

/* Method colours, keyed off swagger-ui's per-verb classes. */
body.swagger-section .http_method a                    { background: var(--abtrac-get); }
body.swagger-section li.get     .http_method a          { background: var(--abtrac-get); }
body.swagger-section li.post    .http_method a          { background: var(--abtrac-post); }
body.swagger-section li.put     .http_method a          { background: var(--abtrac-put); }
body.swagger-section li.patch   .http_method a          { background: var(--abtrac-put); }
body.swagger-section li.delete  .http_method a          { background: var(--abtrac-delete); }

body.swagger-section li.get     { border-left: 3px solid var(--abtrac-get); }
body.swagger-section li.post    { border-left: 3px solid var(--abtrac-post); }
body.swagger-section li.put     { border-left: 3px solid var(--abtrac-put); }
body.swagger-section li.patch   { border-left: 3px solid var(--abtrac-put); }
body.swagger-section li.delete  { border-left: 3px solid var(--abtrac-delete); }

/* ---------- Expanded operation body ---------- */

body.swagger-section .operation div.content {
    background: #fbfcfe;
    border-top: 1px solid var(--abtrac-line);
    border-radius: 0;
    padding: 18px 20px;
}

body.swagger-section .operation h4 {
    font-size: 13px;
    font-weight: 650;
    color: var(--abtrac-ink);
    margin: 16px 0 8px;
}

body.swagger-section .operation table.fullwidth {
    border-collapse: collapse;
    width: 100%;
}

body.swagger-section .operation table thead tr th {
    background: #f2f6fa;
    border: 1px solid var(--abtrac-line);
    color: var(--abtrac-muted);
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 8px 10px;
    text-align: left;
}

body.swagger-section .operation table tbody tr td {
    border: 1px solid var(--abtrac-line);
    padding: 8px 10px;
    font-size: 13px;
    vertical-align: top;
    background: #fff;
}

body.swagger-section .operation table tbody tr td input[type="text"],
body.swagger-section .operation table tbody tr td textarea,
body.swagger-section .operation table tbody tr td select {
    border: 1px solid #cfd9e4;
    border-radius: 5px;
    padding: 6px 8px;
    font-size: 13px;
    font-family: inherit;
}

body.swagger-section .operation table tbody tr td input[type="text"]:focus,
body.swagger-section .operation table tbody tr td textarea:focus {
    outline: none;
    border-color: var(--abtrac-accent);
    box-shadow: 0 0 0 3px rgba(31, 111, 235, .12);
}

body.swagger-section .operation .model-signature,
body.swagger-section .operation pre {
    border-radius: 8px;
    font-size: 12.5px;
}

body.swagger-section .operation .submit input.submit,
body.swagger-section .operation input.submit,
body.swagger-section .operation a.submit {
    background: var(--abtrac-accent);
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 20px;
    text-shadow: none;
}

body.swagger-section .operation .submit input.submit:hover,
body.swagger-section .operation input.submit:hover {
    background: #1a5fd0;
}

body.swagger-section .response_throbber {
    margin-top: 10px;
}

/*
 * These panes (Response Class model, Example Value, response bodies) are rendered by swagger-ui as
 * <pre><code>, and screen.css sets ".swagger-section pre code { color: black }". Because the text
 * sits inside the code element, that black beats any colour inherited from the pre - so giving
 * these blocks a dark background produced black-on-navy at about 1.3:1 contrast, unreadable until
 * hovered (swagger-ui's ".model-signature pre:hover" swaps in a pale yellow background, which is
 * what made the text appear).
 *
 * Rather than fight that in every pane, keep these light so swagger-ui's own black code text
 * stays legible, including on hover. The code samples in the landing description are styled dark
 * instead: that markup is ours, has no nested code element and no hover rule, so it is safe.
 */
body.swagger-section .operation div.content h4.response_title + pre,
body.swagger-section .response-class pre {
    background: #f7f9fc;
    color: var(--abtrac-ink);
    border: 1px solid var(--abtrac-line);
}

/* ---------- Footer / validator badge ---------- */

body.swagger-section #footer,
body.swagger-section .swagger-ui-wrap p#colophon {
    color: var(--abtrac-muted);
    font-size: 12px;
}

body.swagger-section #footer img,
body.swagger-section .swagger-ui-wrap #api_info img {
    display: none;
}

/*
 * swagger-ui closes the page with "[ BASE URL: {basePath}, API VERSION: {version} ]". Swashbuckle
 * omits basePath from the document entirely when the API is served from the site root rather than
 * from a virtual directory, so that label renders with nothing after it. Requests are unaffected -
 * they resolve against the host - but a blank value reads as broken on a customer-facing page, and
 * the base address is already stated in the description above. Hide the line.
 */
body.swagger-section #resources_container .footer {
    display: none;
}

/* ---------- Specificity overrides ---------- */

/*
 * swagger-ui's screen.css styles the description with selectors of the form
 * ".swagger-section .swagger-ui-wrap .markdown <element>" - three classes, which outranks the
 * ".info_description <element>" rules above no matter that this stylesheet loads later.
 *
 * The visible symptom was unreadable code samples: their rule forced the pale yellow background
 * back onto pre, while the light text colour from this stylesheet still applied, leaving pale
 * text on a pale background. Their rule sets no colour of its own, so the two combined into
 * near-invisible text. Headings were also being coloured olive green by their stylesheet.
 *
 * Adding .swagger-ui-wrap and .markdown here climbs above those rules. Coupling to .markdown is
 * safe: swagger-ui's own rules depend on that class, so it cannot disappear without their
 * styling breaking too.
 */

body.swagger-section .swagger-ui-wrap .info_description.markdown pre {
    background: #14202e;
    color: #e6edf5;
    margin: 0 0 12px;
}

body.swagger-section .swagger-ui-wrap .info_description.markdown code,
body.swagger-section .swagger-ui-wrap .info_description.markdown p code,
body.swagger-section .swagger-ui-wrap .info_description.markdown td code,
body.swagger-section .swagger-ui-wrap .info_description.markdown li code {
    background: #eef2f7;
    border: 1px solid #dde5ee;
    color: #10305c;
}

/* A code element inside pre should not draw its own chip. */
body.swagger-section .swagger-ui-wrap .info_description.markdown pre code {
    background: none;
    border: none;
    color: inherit;
}

body.swagger-section .swagger-ui-wrap .info_description.markdown h3 {
    color: var(--abtrac-ink);
}

body.swagger-section .swagger-ui-wrap .info_description.markdown p,
body.swagger-section .swagger-ui-wrap .info_description.markdown th,
body.swagger-section .swagger-ui-wrap .info_description.markdown td {
    color: #33414f;
}
