.schema-field-header {
    $minHeight: 42px;
    position: relative;
    display: flex;
    width: 100%;
    min-height: $minHeight;
    gap: 5px;
    padding: 0 5px;
    align-items: center;
    justify-content: stretch;
    background: var(--baseAlt1Color);
    transition: border-radius var(--baseAnimationSpeed);
    .form-field {
        margin: 0;
        .form-field-addon.prefix {
            left: 10px;
            ~ %input {
                padding-left: 37px;
            }
        }
    }
    .options-trigger {
        padding: 2px;
        margin: 0 3px;
        i {
            transition: transform var(--baseAnimationSpeed);
        }
    }
    .separator {
        flex-shrink: 0;
        width: 1px;
        align-self: stretch;
        background: rgba(#000, 0.05);
    }
    .drag-handle-wrapper {
        position: absolute;
        top: 0;
        left: auto;
        right: 100%;
        height: 100%;
        display: flex;
        align-items: center;
    }
    .drag-handle {
        padding: 0 5px;
        transform: translateX(5px);
        @include hide();
    }
    .form-field-single-multiple-select {
        width: 135px;
        flex-shrink: 0;
        .selected-container {
            padding-left: 10px;
        }
        .dropdown {
            min-width: 0;
        }
    }

    .field-labels {
        position: absolute;
        z-index: 1;
        right: 0px;
        top: 0px;
        gap: 2px;
        display: inline-flex;
        align-items: center;
        transition: opacity var(--baseAnimationSpeed);
        .label {
            min-height: 0;
            font-size: inherit;
            padding: 0px 2px;
            font-size: 0.7rem;
            line-height: 0.75rem;
            border-radius: var(--baseRadius);
        }
        ~ .inline-error-icon {
            margin-top: 4px;
            i {
                font-size: 1rem;
            }
        }
    }
    .form-field:focus-within {
        .field-labels {
            opacity: 0.2;
        }
    }
}

.schema-field-options {
    background: #fff;
    padding: var(--xsSpacing);
    border-bottom-left-radius: var(--baseRadius);
    border-bottom-right-radius: var(--baseRadius);
    border-top: 2px solid transparent;
    transition: border-color var(--baseAnimationSpeed);
}

.schema-field-options-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
    min-width: 0;
    gap: var(--baseSpacing);
    .form-field {
        margin: 0;
        width: auto;
    }
}

.schema-field {
    @extend %block;
    position: relative;
    border-radius: var(--baseRadius);
    background: var(--baseAlt1Color);
    border: 1px solid var(--baseAlt1Color);
    transition: border-radius var(--baseAnimationSpeed),
                margin var(--baseAnimationSpeed);

    &:not(.deleted):hover {
        .drag-handle {
            transform: translateX(0px);
            @include show();
        }
    }
    .dragover &,
    &.dragover {
        opacity: 0.5;
    }
    &.expanded {
        @include shadowize();
        border-color: var(--baseAlt2Color);
        .draggable:first-child & {
            margin-top: 0;
        }
        .schema-field-header {
            border-bottom-left-radius: 0;
            border-bottom-right-radius: 0;
            .options-trigger {
                i {
                    transform: rotate(-60deg);
                }
            }
        }
        .schema-field-options {
            border-top-color: var(--baseAlt2Color);
        }
    }
    &.deleted {
        .schema-field-header {
            background: var(--bodyColor);
        }
        .markers,
        .separator,
        .field-labels {
            opacity: 0.5;
        }
        %input {
            background: none;
            box-shadow: none;
        }
    }
}

.schema-fields {
    margin: 0 0 var(--xsSpacing);
    .schema-field {
        border-radius: 0;
        box-shadow: 0px 0px 0px 1px var(--baseAlt2Color);
    }
    .draggable:has(+ .draggable .schema-field.expanded) .schema-field {
       border-bottom-left-radius: var(--baseRadius);
       border-bottom-right-radius: var(--baseRadius);
    }
    .draggable:has(.schema-field.expanded) + .draggable .schema-field {
        border-top-left-radius: var(--baseRadius);
        border-top-right-radius: var(--baseRadius);
    }
    & > .schema-field.expanded,
    & > .draggable > .schema-field.expanded {
        margin: var(--xsSpacing) 0;
        border-radius: var(--baseRadius);
    }
    & > .schema-field:first-child,
    & > .draggable:first-child > .schema-field {
        margin-top: 0;
        border-top-left-radius: var(--baseRadius);
        border-top-right-radius: var(--baseRadius);
    }
    & > .schema-field:last-child,
    & > .draggable:last-child > .schema-field{
        margin-bottom: 0;
        border-bottom-left-radius: var(--baseRadius);
        border-bottom-right-radius: var(--baseRadius);
    }
}
