/*
 * The relation pages (RelationResource). Every rule is scoped to a class the package sets on its own
 * components, on top of Filament's hook classes, so no other page changes.
 */

.mc-relation-heading {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.mc-relation-subheading {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.mc-relation-subheading-separator {
    color: var(--gray-300);
}

.dark .mc-relation-subheading-separator {
    color: var(--gray-600);
}

/* Side tabs: the list of tabs and the content are two cards with a gap between them. */
.mc-relation-tabs.fi-contained.fi-vertical {
    gap: 1rem;
    align-items: flex-start;
    background: transparent;
    box-shadow: none;
}

.mc-relation-tabs.fi-vertical > .fi-tabs,
.mc-relation-tabs.fi-vertical > .fi-sc-tabs-tab.fi-active {
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05), 0 0 0 1px rgb(3 7 18 / 0.05);
}

.dark .mc-relation-tabs.fi-vertical > .fi-tabs,
.dark .mc-relation-tabs.fi-vertical > .fi-sc-tabs-tab.fi-active {
    background: var(--gray-900);
    box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1);
}

/* The list of tabs stays in view while the content scrolls. */
.mc-relation-tabs.fi-vertical > .fi-tabs {
    position: sticky;
    top: 1rem;
    min-width: 11rem;
    padding: 0.75rem;
}

.mc-relation-tabs.fi-vertical > .fi-sc-tabs-tab.fi-active {
    flex: 1;
    min-width: 0;
}

.mc-relation-tabs.fi-vertical .fi-tabs-item .fi-badge {
    margin-inline-start: auto;
}

.mc-relation-tabs.fi-vertical > .fi-sc-tabs-tab.fi-active {
    margin-inline-start: 0;
}

/* A tab whose content runs to the card's edges, such as a table or a list of blocks with their own padding. */
.mc-relation-tabs.fi-contained > .fi-sc-tabs-tab.mc-relation-tab-flush.fi-active {
    padding: 0;
}

/* Sections of the details tab: a bold heading with a line under it, no box. */
.mc-relation-section .fi-section-not-contained .fi-section-header {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.dark .mc-relation-section .fi-section-not-contained .fi-section-header {
    border-color: rgb(255 255 255 / 0.1);
}

.mc-relation-section .fi-section-header-heading {
    font-weight: 700;
}

/* Labels beside the fields, in a fixed column, so the fields run the full width. */
@media (min-width: 640px) {
    .mc-relation-section .fi-fo-field.fi-fo-field-has-inline-label {
        grid-template-columns: 11rem minmax(0, 1fr);
        align-items: start;
    }

    .mc-relation-section .fi-fo-field.fi-fo-field-has-inline-label .fi-fo-field-content-col {
        grid-column: auto;
    }

    .mc-relation-section .fi-fo-field.fi-fo-field-has-inline-label .fi-fo-field-label-col {
        display: flex;
        align-items: center;
        min-height: 2.25rem;
        /* Beside the input, also when a note sits under the field. */
        height: auto;
        padding-top: 0;
    }

    /* A help icon sits at the end of the label column, so the icons line up whatever the label's length. */
    .mc-relation-section .fi-fo-field.fi-fo-field-has-inline-label .fi-fo-field-label-ctn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding-inline-end: 1rem;
    }
}

.mc-relation-section .fi-fo-field-label-content {
    font-weight: 400;
    color: var(--gray-600);
}

.dark .mc-relation-section .fi-fo-field-label-content {
    color: var(--gray-400);
}

/*
 * The upload field of the documents tab. Files that upload normally are not listed, because each gets a row
 * in the details table below; a file FilePond rejects stays listed as a quiet red row with its error.
 */
.mc-relation-documents-upload .filepond--item:not([data-filepond-item-state*='error'], [data-filepond-item-state*='invalid']) {
    display: none;
}

.mc-relation-documents-upload .filepond--item-panel {
    background-color: var(--danger-50);
}

.dark .mc-relation-documents-upload .filepond--item-panel {
    background-color: color-mix(in oklab, var(--danger-500) 15%, var(--gray-900));
}

.mc-relation-documents-upload .filepond--file {
    color: var(--gray-950);
}

.dark .mc-relation-documents-upload .filepond--file {
    color: #fff;
}

.mc-relation-documents-upload .filepond--file-info-sub {
    color: var(--gray-500);
}

.dark .mc-relation-documents-upload .filepond--file-info-sub {
    color: var(--gray-400);
}

.mc-relation-documents-upload .filepond--file-status-main {
    color: var(--danger-600);
}

.dark .mc-relation-documents-upload .filepond--file-status-main {
    color: var(--danger-400);
}

.mc-relation-documents-upload .filepond--file-status-sub {
    display: none;
}

.mc-relation-documents-upload .filepond--file-action-button {
    background: transparent;
    box-shadow: none;
    color: var(--gray-400);
}

.mc-relation-documents-upload .filepond--file-action-button:hover {
    color: var(--gray-600);
}

.dark .mc-relation-documents-upload .filepond--file-action-button {
    color: var(--gray-500);
}

.dark .mc-relation-documents-upload .filepond--file-action-button:hover {
    color: var(--gray-300);
}
