/*
 * AppCheck NG API Documentation Theme
 * Custom theme for Sphinx-generated API docs.
 *
 * Inherits from Sphinx "basic" theme and provides all visual styling.
 */

/* ── Reset & Base ─────────────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji",
                 "Segoe UI Emoji";
    font-size: 1rem;
    line-height: 1.6;
    color: #2d3748;
    background: #f7f8fa;
}

a {
    color: #2b6cb0;
    text-decoration: none;
}

a:hover {
    color: #1a4971;
    text-decoration: underline;
}

/* ── Header ───────────────────────────────────────────────────── */

.apck-header {
    background: #1a202c;
    color: #fff;
    border-bottom: 3px solid #3182ce;
    position: sticky;
    top: 0;
    z-index: 100;
}

.apck-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.apck-logo {
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    text-decoration: none;
    white-space: nowrap;
}

.apck-logo:hover {
    color: #90cdf4;
    text-decoration: none;
}

.apck-header-title {
    color: #a0aec0;
    font-size: 0.95rem;
    white-space: nowrap;
}

.apck-search {
    margin-left: auto;
}

.apck-search input[type="text"] {
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 4px;
    color: #e2e8f0;
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    width: 220px;
    transition: border-color 0.2s, width 0.2s;
}

.apck-search input[type="text"]:focus {
    outline: none;
    border-color: #3182ce;
    width: 280px;
}

.apck-search input[type="text"]::placeholder {
    color: #718096;
}

/* ── Page Layout ──────────────────────────────────────────────── */

.apck-page {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    min-height: calc(100vh - 120px);
}

/* ── Sidebar ──────────────────────────────────────────────────── */

.apck-sidebar {
    width: 260px;
    flex-shrink: 0;
    padding: 1.5rem 1rem 2rem 1.5rem;
    border-right: 1px solid #e2e8f0;
    background: #fff;
}

.apck-nav h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #718096;
    margin: 0 0 0.75rem 0;
    padding: 0;
}

.apck-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.apck-nav li {
    margin: 0;
    padding: 0;
}

.apck-nav a {
    display: block;
    padding: 0.3rem 0.5rem;
    color: #4a5568;
    font-size: 0.875rem;
    border-radius: 3px;
    transition: background 0.15s;
}

.apck-nav a:hover {
    background: #edf2f7;
    color: #2b6cb0;
    text-decoration: none;
}

.apck-nav a.current {
    background: #ebf4ff;
    color: #2b6cb0;
    font-weight: 600;
}

.apck-nav ul ul {
    padding-left: 0.75rem;
}

.apck-nav ul ul a {
    font-size: 0.8125rem;
}

/* ── Main Content ─────────────────────────────────────────────── */

.apck-content {
    flex: 1;
    min-width: 0;
    padding: 2rem 2.5rem;
    background: #fff;
}

.apck-content h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 1.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.apck-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
    margin: 2rem 0 1rem 0;
}

.apck-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    margin: 1.5rem 0 0.75rem 0;
}

.apck-content h4, .apck-content h5, .apck-content h6 {
    font-size: 1rem;
    font-weight: 600;
    color: #4a5568;
    margin: 1.25rem 0 0.5rem 0;
}

.apck-content p {
    margin: 0 0 1rem 0;
}

.apck-content img {
    max-width: 100%;
}

/* ── Code & Literal Blocks ────────────────────────────────────── */

code, tt {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875em;
    background: #edf2f7;
    padding: 0.15em 0.35em;
    border-radius: 3px;
    color: #c53030;
}

a code, a tt {
    color: inherit;
}

pre {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    background: #1a202c;
    color: #e2e8f0;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0 0 1rem 0;
}

pre code, pre tt {
    background: none;
    padding: 0;
    border-radius: 0;
    color: inherit;
}

div.highlight pre {
    background: #1a202c;
    color: #e2e8f0;
}

/* ── HTTP Domain — Method Badges ──────────────────────────────── */

.operation .descname,
.endpoint .descname {
    font-weight: 600;
}

/* HTTP method request description */
dl.get > dt,
dl.post > dt,
dl.put > dt,
dl.patch > dt,
dl.delete > dt,
dl.head > dt,
dl.options > dt {
    padding: 0.6rem 0.8rem;
    margin: 1.5rem 0 0.5rem 0;
    border-radius: 4px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    border-left: 4px solid;
    background: #f7fafc;
}

dl.get > dt    { border-left-color: #38a169; background: #f0fff4; }
dl.post > dt   { border-left-color: #3182ce; background: #ebf8ff; }
dl.put > dt    { border-left-color: #d69e2e; background: #fffff0; }
dl.patch > dt  { border-left-color: #dd6b20; background: #fffaf0; }
dl.delete > dt { border-left-color: #e53e3e; background: #fff5f5; }
dl.head > dt   { border-left-color: #805ad5; background: #faf5ff; }
dl.options > dt { border-left-color: #718096; background: #f7fafc; }

dl.get > dt big,
dl.post > dt big,
dl.put > dt big,
dl.patch > dt big,
dl.delete > dt big,
dl.head > dt big,
dl.options > dt big {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15em 0.5em;
    border-radius: 3px;
    margin-right: 0.5em;
    color: #fff;
    display: inline-block;
    vertical-align: middle;
}

dl.get > dt big    { background: #38a169; }
dl.post > dt big   { background: #3182ce; }
dl.put > dt big    { background: #d69e2e; }
dl.patch > dt big  { background: #dd6b20; }
dl.delete > dt big { background: #e53e3e; }
dl.head > dt big   { background: #805ad5; }
dl.options > dt big { background: #718096; }

dl.get > dd,
dl.post > dd,
dl.put > dd,
dl.patch > dd,
dl.delete > dd,
dl.head > dd,
dl.options > dd {
    padding: 0.5rem 0 0.5rem 1.25rem;
    margin: 0;
}

/* HTTP field lists (query params, headers, status codes) */
dl.field-list > dt {
    font-weight: 600;
    color: #2d3748;
    margin-top: 0.75rem;
}

dl.field-list > dd {
    margin-left: 1rem;
    margin-bottom: 0.5rem;
}

dl.field-list > dd > ul {
    padding-left: 1.25rem;
}

dl.field-list > dd > ul > li {
    margin-bottom: 0.25rem;
}

/* ── Literal Include (API examples) ───────────────────────────── */

.literal-block-wrapper {
    margin: 0.75rem 0 1rem 0;
}

.literal-block-wrapper .code-block-caption {
    background: #2d3748;
    color: #a0aec0;
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
    border-radius: 6px 6px 0 0;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.literal-block-wrapper pre {
    margin-top: 0;
    border-radius: 0 0 6px 6px;
}

/* ── Tables ───────────────────────────────────────────────────── */

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

th, td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

th {
    font-weight: 600;
    background: #f7fafc;
    color: #2d3748;
}

/* ── Admonitions (note, warning, etc.) ────────────────────────── */

div.admonition {
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    border-radius: 4px;
    border-left: 4px solid #3182ce;
    background: #ebf8ff;
}

div.admonition.warning {
    border-left-color: #d69e2e;
    background: #fffff0;
}

div.admonition.danger,
div.admonition.error {
    border-left-color: #e53e3e;
    background: #fff5f5;
}

p.admonition-title {
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

/* ── Version Added / Deprecated ───────────────────────────────── */

.versionadded,
.versionchanged,
.deprecated {
    font-size: 0.85rem;
    font-style: italic;
    color: #718096;
    margin: 0.5rem 0;
}

.deprecated {
    color: #c53030;
}

/* ── Toctree ──────────────────────────────────────────────────── */

.toctree-wrapper ul {
    list-style: none;
    padding-left: 0;
}

.toctree-wrapper li {
    margin: 0.25rem 0;
}

.toctree-wrapper a {
    padding: 0.25rem 0;
    display: inline-block;
}

/* ── HTTP Routing Table ───────────────────────────────────────── */

.hlist td {
    vertical-align: top;
    padding: 0.25rem 0.75rem;
}

/* ── Footer ───────────────────────────────────────────────────── */

.apck-footer {
    background: #1a202c;
    color: #a0aec0;
    border-top: 3px solid #3182ce;
    margin-top: 2rem;
}

.apck-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    text-align: center;
}

.apck-footer p {
    margin: 0;
    font-size: 0.8125rem;
}

/* ── Search Page ──────────────────────────────────────────────── */

#search-results h2 {
    font-size: 1.25rem;
}

#search-results .search li {
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: #f7fafc;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

input[type="submit"] {
    background: #3182ce;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    cursor: pointer;
}

input[type="submit"]:hover {
    background: #2b6cb0;
}

/* ── Permalink Anchors ────────────────────────────────────────── */

a.headerlink {
    color: #cbd5e0;
    font-size: 0.8em;
    margin-left: 0.3em;
    visibility: hidden;
}

*:hover > a.headerlink {
    visibility: visible;
}

a.headerlink:hover {
    color: #3182ce;
    text-decoration: none;
}

/* ── Responsive ───────────────────────────────────────────────── */

@media (max-width: 768px) {
    .apck-page {
        flex-direction: column;
    }

    .apck-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        padding: 1rem;
    }

    .apck-content {
        padding: 1.5rem 1rem;
    }

    .apck-header-inner {
        flex-wrap: wrap;
    }

    .apck-search {
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .apck-search input[type="text"] {
        width: 100%;
    }

    .apck-search input[type="text"]:focus {
        width: 100%;
    }
}
