/**
 * WP REST API Explorer - Tab "Snapshots" and snapshot mode (plan 09 §10.7, §10.8)
 *
 * @package   JPKCom_Tools
 * @subpackage WP_API
 */

/* Bootstrap's d-flex wins over the hidden attribute; hidden must win here */
#tab-snapshots [hidden],
#wpapi-snapshot[hidden] {
    display: none !important;
}

/* Snapshot mode: no gate, no site bar, no run strip (nothing is loaded from the site) */
body.wpapi-in-snapshot #wpapi-gate,
body.wpapi-in-snapshot #wpapi-site,
body.wpapi-in-snapshot #wpapi-run {
    display: none !important;
}

/* Message under "Check these items": takes no room while empty, reads as such without colour */
.wpapi-sn-check-msg:not(:empty) {
    margin-bottom: .5rem;
    font-weight: 600;
}

/* A file is being dragged over the card */
/* A refused file or a failed save reads as such without colour: the text says it (text-danger of this
   theme has 3.8:1 on the dark background) */
.wpapi-sn-bad {
    font-weight: 600;
}

/* A locked button must look locked; it keeps the focus (aria-disabled, not disabled) */
#wpapi-sn-refresh[aria-disabled="true"],
#wpapi-sn-check[aria-disabled="true"] {
    opacity: .65;
    cursor: not-allowed;
}

/* Compare without both sides: looks locked, a press still says what is missing */
#wpapi-sn-compare.wpapi-sn-locked {
    --bs-btn-bg: var(--bs-secondary);
    --bs-btn-border-color: var(--bs-secondary);
    --bs-btn-hover-bg: var(--bs-secondary);
    --bs-btn-hover-border-color: var(--bs-secondary);
    opacity: .65;
}

.wpapi-sn-drop.is-over {
    outline: 2px dashed var(--bs-link-color);
    outline-offset: -2px;
}

.wpapi-sn-filter {
    flex: 1 1 14rem;
}

.wpapi-sn-warnings {
    padding-left: 1.25rem;
}

/* Field diff under a row: long values wrap in place */
.wpapi-sn-diff {
    margin: .25rem 0 0;
    padding-left: 1rem;
}

.wpapi-sn-diff li {
    overflow-wrap: break-word;
}

/* Finding 10: field names at the text size of the table (they were about 10 px) */
.wpapi-sn-diff code {
    color: var(--bs-secondary-color);
    font-size: 1em;
}

/* Finding 10: result badges of the list at the text size of the table as well */
#wpapi-sn-list .badge {
    font-size: 1em;
}

#wpapi-sn-list td {
    overflow-wrap: break-word;
    min-width: 7rem;
}

@media (max-width: 575.98px) {

    /* Phones: one block per area, the numbers with their names, so nothing needs a sideways scroll */
    #wpapi-sn-overview thead {
        display: none;
    }

    #wpapi-sn-overview tr,
    #wpapi-sn-overview th {
        display: block;
    }

    #wpapi-sn-overview tr {
        border-bottom: 1px solid var(--bs-border-color);
        padding: .25rem 0;
    }

    #wpapi-sn-overview th,
    #wpapi-sn-overview td {
        border-bottom: 0;
        padding: .1rem .25rem;
    }

    #wpapi-sn-overview td.wpapi-num {
        display: inline-block;
        text-align: start;
        margin-right: .5rem;
    }

    #wpapi-sn-overview td::before {
        content: attr(data-label) " ";
        color: var(--bs-secondary-color);
    }

    /* Image review 2026-11-06: a single digit was the whole tap target. A cell with a button
       shows its column name inside the button, which gets a padded box (at least 44 × 32 px) */
    #wpapi-sn-overview td.wpapi-num:has(> .wpapi-linkbtn)::before {
        content: none;
    }

    #wpapi-sn-overview td.wpapi-num > .wpapi-linkbtn {
        min-width: 44px;
        min-height: 2rem;
        padding: .25rem .5rem !important;
        border: 1px solid var(--bs-border-color);
        border-radius: var(--bs-border-radius-sm);
    }

    #wpapi-sn-overview td.wpapi-num > .wpapi-linkbtn::before {
        content: attr(data-label) " ";
        color: var(--bs-secondary-color);
    }

    /* One entry as a block: the result never sits behind a sideways scroll */
    #wpapi-sn-list thead {
        display: none;
    }

    #wpapi-sn-list tr,
    #wpapi-sn-list td {
        display: block;
    }

    #wpapi-sn-list td {
        min-width: 0;
        border-bottom: 0;
        padding-top: .1rem;
        padding-bottom: .1rem;
    }

    #wpapi-sn-list tr {
        border-bottom: 1px solid var(--bs-border-color);
        padding: .25rem 0;
    }

}
