/* sphinx-badges — structural styles (colours come from inline style attrs) */

/* ── Single badge ─────────────────────────────────────────────────────────── */
.sphinx-badge {
    display: inline-block;
    padding: 0.2em 0.55em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;   /* rounded (default) */
    margin: 0 0.15em;
    cursor: default;
    user-select: none;
    text-decoration: none;
}

/* ── Style variants ───────────────────────────────────────────────────────── */

/* Square / Material Design — no rounded corners */
.sphinx-badge-square {
    border-radius: 0 !important;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.7em;
    padding: 0.25em 0.6em;
}

/* Pill — fully rounded */
.sphinx-badge-pill {
    border-radius: 9999px !important;
    padding: 0.2em 0.7em;
}

/* ── Badge group (produced by .. badges:: directive) ──────────────────────── */
.sphinx-badge-list {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25em;
    vertical-align: middle;
    margin-left: 0;
}

/* ── Badge-filter widget ──────────────────────────────────────────────────── */
.sphinx-badge-filter {
    margin: 0.75rem 0 1rem;
}

/* Flat layout — single flex row */
.sphinx-badge-filter-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding-bottom: 0.6rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #dee2e6;
}

/* ── Grouped layout rows ──────────────────────────────────────────────────── */

/* Grouped mode overrides the outer controls to a column stack */
[data-grouped="true"] .sphinx-badge-filter-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    border-bottom: none;
    padding-bottom: 0;
}

/* Last tag-group row sits just above the (possibly hidden) reset row */
[data-grouped="true"] .sphinx-badge-filter-row:nth-last-child(2) {
    border-bottom: none;
}

.sphinx-badge-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.sphinx-badge-filter-row:last-child {
    border-bottom: none;
}

.sphinx-badge-filter-group-label {
    font-size: 0.78em;
    font-weight: 600;
    color: #6c757d;
    min-width: 7em;
    white-space: nowrap;
}

/* "Clear filters" button row — right-aligned, minimal */
.sphinx-badge-filter-reset-row {
    justify-content: flex-end;
    padding-top: 0.4rem;
}

.sphinx-badge-filter-clear {
    font-size: 0.75em;
    font-weight: 500;
    color: #6c757d;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.1em 0.3em;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sphinx-badge-filter-clear:hover {
    color: #212529;
}

.sphinx-badge-filter-label {
    font-size: 0.8em;
    font-weight: 600;
    color: #6c757d;
    margin-right: 0.25rem;
    white-space: nowrap;
}

/* Filter buttons — outlined, transparent background */
.sphinx-badge-filter-btn {
    display: inline-block;
    padding: 0.2em 0.65em;
    font-size: 0.78em;
    font-weight: 600;
    line-height: 1.4;
    border-radius: 0.375rem;
    border: 1.5px solid #ced4da;
    cursor: pointer;
    background: transparent;
    color: #495057;
    transition: opacity 0.12s, background 0.12s, border-color 0.12s;
    user-select: none;
}

/* "All" button — neutral, no fill */
.sphinx-badge-filter-btn[data-badge-id="__all__"] {
    background: transparent;
    color: #495057;
    border-color: #ced4da;
}

/* "All" active — subtle fill */
.sphinx-badge-filter-btn[data-badge-id="__all__"][aria-pressed="true"] {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
}

/* Badge buttons inactive — dim to show unselected state */
.sphinx-badge-filter-btn[aria-pressed="false"]:not([data-badge-id="__all__"]) {
    opacity: 0.45;
}

/* Badge buttons active — full opacity, add a subtle inset ring */
.sphinx-badge-filter-btn[aria-pressed="true"]:not([data-badge-id="__all__"]) {
    opacity: 1;
    box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.25);
}

.sphinx-badge-filter-btn:hover {
    opacity: 1;
}

/* ── Items hidden by the filter (toctree li or autosummary tr) ────────────── */
.sphinx-badge-filter-content li.sphinx-badge-hidden,
.sphinx-badge-filter-content tr.sphinx-badge-hidden {
    display: none;
}

/* ── Badges appended to toctree / autosummary entries by JS ──────────────── */
.sphinx-entry-badge {
    margin-left: 0.5em;
    vertical-align: middle;
}

/* First badge immediately after a <p> needs no left margin */
p + .sphinx-entry-badge {
    margin-left: 0;
}

/* Remove the <p> bottom margin in autosummary cells so badges sit flush */
.sphinx-badge-filter-content table.autosummary td p {
    margin-bottom: 0;
}
