@use "variables" as *;

::ng-deep body:has(.ui-draggable-dragging) {
    cursor: grabbing;
}

:host {
    position: relative;
}

.grid-stack-nested {
    flex: 1;
}

.template-builder__container {
    display: flex;
    gap: $spacing-4;
    padding-top: $spacing-3;

    .grid-stack {
        flex: 1;
    }

    .template-builder__sidebar--small {
        width: 16.25rem; // 260px
    }
    .template-builder__sidebar--large {
        width: 21.25rem; // 340px
    }
}

.template-builder__container--right {
    flex-direction: row-reverse;
}

// Class added by the gridstack library when the widget is being dragged
dotcms-add-widget.ui-draggable-dragging {
    transform: rotate(-3.66deg);
    box-shadow: $shadow-l;
}

dotcms-add-widget {
    cursor: grab;
    z-index: 3;
}

p-toolbar {
    position: sticky;
    top: 0;
}

dotcms-template-builder-section {
    margin-top: $spacing-3;
}

dotcms-template-builder-section:last-child {
    margin-bottom: $spacing-3;
}

p-divider {
    height: 48px;
}

::ng-deep {
    .p-toolbar-group-end {
        gap: $spacing-1;
    }

    .p-toolbar {
        border-color: $color-palette-gray-300;
        padding: $spacing-1 $spacing-5;
    }

    .p-divider {
        &.p-component {
            color: $color-palette-gray-300;
        }
    }
}

.template-builder__main {
    padding: 0 $spacing-5 5rem $spacing-5;
    height: 100%;
    overflow-y: auto;
    transition: opacity 0.3s ease-in-out;
}

.grid-stack-item {
    transition: all 0.3s ease-in-out;

    &.template-builder-row--wont-fit {
        cursor: no-drop;

        &:before {
            content: attr(data-wont-fit);
            opacity: 0;
            position: absolute;
            top: 43%;
            left: 35%;
            display: block;
            width: fit-content;
            z-index: 1;
            background-color: $color-palette-gray-200;
            color: $color-palette-gray-700;
            font-size: $font-size-sm;
            transition: opacity 0.3s ease-in-out;
            border-radius: $border-radius-sm;
            padding: 0.25rem $spacing-3;
            text-align: center;
        }

        &:hover:before {
            opacity: 1;
        }

        ::ng-deep .row {
            opacity: 0.4;
            filter: grayscale(100%);
        }
    }
}

::ng-deep dotcms-template-builder-row {
    .row {
        transition: opacity 0.3s ease-in-out;
    }
}
