/* Copy-to-clipboard button for JSONFormattedMixin blocks (MINT-1987). */

.json-formatted-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    vertical-align: top;
}

/* Zero the <pre>'s default margin so the wrapper hugs the visible box exactly —
   otherwise the absolutely-positioned button lands in the margin, outside the
   box. The right padding keeps the button from covering the first line. */
.json-formatted-wrapper > pre.json-formatted {
    margin: 0;
    padding-right: 2.5rem;
    overflow: auto;
}

.json-copy-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 1;
    /* Hidden until json_copy.js loads and stamps `json-copy-ready` on <html>.
       If the script never arrives, no inert-but-clickable button is shown. */
    display: none;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 22px;
    padding: 0;
    cursor: pointer;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}

.json-copy-ready .json-copy-btn {
    display: inline-flex;
}

.json-copy-btn:hover {
    background: rgba(0, 0, 0, 0.75);
}

.json-copy-icon {
    display: block;
}

/* Brief success / failure feedback (js toggles these for ~1.2s). */
.json-copy-btn--copied {
    color: #7ee08a;
    border-color: #7ee08a;
}

.json-copy-btn--failed {
    color: #f08a8a;
    border-color: #f08a8a;
}
