/*
 * Core, UI-wide tweaks for our Unfold-based interface.
 *
 * Disable the changelist expand-row chevron when a row's expandable section
 * renders no content.
 *
 * Unfold shows the chevron for every row whenever `list_sections` is set, with
 * no per-row hook. It wraps each row's sections in `td > div.grid`; when every
 * section renders empty that wrapper has no element children, so we key off it
 * with `:has()` to keep the chevron in place (no layout gap) but not clickable.
 * Rows that render content are untouched, and changelists without
 * `list_sections` have no chevron cell so they are unaffected.
 *
 * Only the chevron icon is dimmed (not the whole cell), so the row's cell
 * border stays at full opacity and the separating line reaches the edge.
 */
#result_list
    tbody:not(:has(tr > td > div.grid > *))
    tr.data-row
    > td[data-label="Expand row"] {
    cursor: default;
    pointer-events: none;
}

#result_list
    tbody:not(:has(tr > td > div.grid > *))
    tr.data-row
    > td[data-label="Expand row"]
    .material-symbols-outlined {
    opacity: 0.3;
}

/*
 * Make the dialog-action modal overlay cover the full viewport.
 *
 * Unfold's `unfold/helpers/modal.html` ships the overlay with a `mr-1`
 * (margin-right: 4px), which leaves an uncovered strip on the right edge when
 * the page has no visible scrollbar. The id selector outranks the utility class,
 * so no !important is needed.
 */
#modal-overlay {
    margin-right: 0;
}


/*
 * A one-to-one configuration is a section of the integration, not a list of related
 * records. Unfold marks every stacked inline fieldset with a striped gutter and an
 * indent, which makes these read as an embedded object instead of part of the form.
 * Two classes outrank Unfold's single utility classes, so no !important is needed.
 */
.module.flat-config {
    border-left: 0;
    margin-left: 0;
}

.module.flat-config::before {
    display: none;
}

/*
 * An inline wraps its fieldset in a card of its own, so the fields end up inside two
 * nested bordered boxes — which is what reads as "embedded". A plain fieldset has one.
 * Drop the inner card and keep the formset's, so the section matches the rest of the form.
 */
.module.flat-config > .form-rows {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

/*
 * The JSON editor's code mode puts a «powered by ace» link in its menu bar; Unfold styles
 * it but keeps it. The editor's licence notices stay in its bundled files.
 */
.jsoneditor-menu > .jsoneditor-poweredBy {
    display: none;
}

/*
 * djangoql's suggestions end with a link to its syntax page, in English and outside the
 * interface; the placeholder of the box and its error message carry the syntax instead.
 */
.djangoql-completion .syntax-help {
    display: none;
}

/*
 * Keep every import preview one line per row.
 *
 * django-import-export's preview and validation tables carry every column of
 * the resource at full width, so a long name or address wraps into four or
 * five lines and the row becomes a block. The table's container already
 * scrolls horizontally: data cells stay on one line and the row reads like
 * the file it previews. The validation table's error messages sit in a cell
 * that spans the row (colspan): those keep wrapping, so a long message stays
 * readable without widening the table.
 */
.import-preview-table td:not([colspan]),
.import-preview td:not([colspan]) {
    white-space: nowrap;
}
