/* jsondiffpatch html formatter, themed. Base layout comes from its own stylesheet. */
.sh-json-diff-panel.mud-paper {
    padding: 12px 16px;
    overflow: auto;
    max-height: 60vh;
}

.sh-json-diff .jsondiffpatch-delta,
.sh-json-diff .jsondiffpatch-delta pre {
    font-family: var(--sh-font-mono);
    font-size: 13px;
    line-height: 1.6;
    padding-left: 0;
}

.sh-json-diff ul.jsondiffpatch-delta,
.sh-json-diff .jsondiffpatch-delta ul {
    padding-left: 20px;
}

.sh-json-diff .jsondiffpatch-added .jsondiffpatch-property-name,
.sh-json-diff .jsondiffpatch-added .jsondiffpatch-value pre,
.sh-json-diff .jsondiffpatch-modified .jsondiffpatch-right-value pre,
.sh-json-diff .jsondiffpatch-textdiff-added {
    background: color-mix(in srgb, var(--mud-palette-success) 22%, transparent);
    color: var(--mud-palette-text-primary);
    border-radius: 4px;
}

.sh-json-diff .jsondiffpatch-deleted .jsondiffpatch-property-name,
.sh-json-diff .jsondiffpatch-deleted pre,
.sh-json-diff .jsondiffpatch-modified .jsondiffpatch-left-value pre,
.sh-json-diff .jsondiffpatch-textdiff-deleted {
    background: color-mix(in srgb, var(--mud-palette-error) 22%, transparent);
    color: var(--mud-palette-text-secondary);
    border-radius: 4px;
}

.sh-json-diff .jsondiffpatch-unchanged,
.sh-json-diff .jsondiffpatch-movedestination {
    color: var(--mud-palette-text-disabled);
}

.sh-json-diff .jsondiffpatch-moved .jsondiffpatch-moved-destination {
    background: color-mix(in srgb, var(--mud-palette-warning) 22%, transparent);
    color: var(--mud-palette-text-secondary);
}

/* History dialog: version list beside the diff */
.sh-history {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.sh-history-list.mud-paper {
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
}

/* Text compared line by line, as in the legal documents' history */
.sh-text-diff {
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-family: var(--sh-font-mono);
    font-size: 13px;
    line-height: 1.6;
}

.sh-text-diff-line {
    display: flex;
    gap: 10px;
    padding: 0 6px;
    border-radius: 4px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.sh-text-diff-mark {
    flex: none;
    width: 10px;
    color: var(--mud-palette-text-disabled);
}

.sh-text-diff-same {
    color: var(--mud-palette-text-disabled);
}

.sh-text-diff-added {
    background: color-mix(in srgb, var(--mud-palette-success) 22%, transparent);
    color: var(--mud-palette-text-primary);
}

.sh-text-diff-added .sh-text-diff-mark {
    color: var(--mud-palette-success);
}

.sh-text-diff-removed {
    background: color-mix(in srgb, var(--mud-palette-error) 22%, transparent);
    color: var(--mud-palette-text-secondary);
}

.sh-text-diff-removed .sh-text-diff-mark {
    color: var(--mud-palette-error);
}

.sh-text-diff-removed > span:last-child {
    text-decoration: line-through;
}

.sh-text-diff-skipped {
    padding: 4px 6px;
    color: var(--mud-palette-text-disabled);
    font-family: var(--mud-typography-default-family);
    font-size: 12px;
}

.sh-legal-history-note {
    flex-wrap: wrap;
    min-height: 28px;
}

@media (max-width: 599.98px) {
    .sh-history {
        grid-template-columns: minmax(0, 1fr);
    }

    .sh-history-list.mud-paper {
        max-height: 180px;
    }
}
