// /**
//  * Copyright Â© Magento, Inc. All rights reserved.
//  * See COPYING.txt for license details.
//  */

@border-size: 2px; // Deprecated

.pagebuilder-header {
    display: flex;
    justify-content: center;
    opacity: 0;
    position: relative;
    text-align: right;

    > .icon-pagebuilder-fullscreen {
        cursor: pointer;
        display: inline-block;
        padding: 15px 0 15px 15px;
    }

    > .icon-pagebuilder-fullscreen-exit:before {
        padding-left: 0;
    }

    &.visible {
        opacity: 1;
        visibility: visible;
    }

    .template-buttons {
        position: absolute;
        right: 0;
        transform: translate(0, 12%);
    }

    .tooltip {
        margin-left: 0;
        .tooltip-content {
            background: rgba(49, 48, 43, .8);
            font-size: 12px;
            margin-left: -69px;
            padding: 7px 9px;
            text-align: left;

            &:before {
                left: 90px;
                opacity: .65;
            }

            .tooltip-label {
                font-weight: bold;
            }
        }
    }
}

.admin__fieldset > .admin__field > .admin__control-grouped {
    &.pagebuilder-active {
        float: left;
        margin: 3rem 0 0;
        padding-left: 3rem;
        width: 100%;
    }
}

.pagebuilder-stage-wrapper {
    -moz-transition: .35s ease-in-out;
    -webkit-transition: .35s ease-in-out;
    background: @color-white;
    height: 100%;
    position: relative;
    transition: .35s ease-in-out;

    ._disabled & {
        opacity: .5;
        pointer-events: none;
    }

    &.stage-full-screen {
        -moz-transform: translateZ(0);
        -webkit-transform: translateZ(0);
        background: @color-white;
        height: 100%;
        left: 0;
        overflow: scroll;
        overflow-x: hidden;
        padding: 0;
        position: fixed;
        top: 0;
        transform: translateZ(0);
        width: 100%;
        z-index: 800;

        .pagebuilder-header {
            -moz-transition: opacity .75s ease-in-out, visibility .75s ease-in-out;
            -webkit-transition: opacity .75s ease-in-out, visibility .75s ease-in-out;
            background: @color-very-dark-grayish-orange;
            border: none;
            border-bottom: 1px solid @color-brownie-almost;
            left: 150px;
            opacity: 0;
            padding: 0;
            position: fixed;
            position: -webkit-sticky;
            position: sticky;
            right: 0;
            top: 0;
            transition: opacity .75s ease-in-out, visibility .75s ease-in-out;
            width: calc(~'100% - 150px');
            z-index: 106;

            .icon-pagebuilder-fullscreen-exit {
                border: none;
                border-radius: 0;
                box-shadow: none;
                color: @color-ivory;
                cursor: pointer;
                display: inline-block;
                margin: 0;
                padding: 10px 20px;
            }

            &.visible {
                opacity: 1;
                visibility: visible;
            }
        }

        .pagebuilder-canvas {
            padding-top: 30px;
        }

        &.stage-content-snapshot {
            .pagebuilder-canvas {
                padding-bottom: 120px;
            }
        }

        .pagebuilder-panel-wrapper {
            bottom: 0;
            position: fixed;
            position: -webkit-sticky;
            position: sticky;
            top: 0;
            z-index: 102;

            .pagebuilder-panel {
                height: 100vh;
                overflow-y: auto;

                &::-webkit-scrollbar {
                    width: 5px;
                }

                &::-webkit-scrollbar-thumb {
                    background-color: darkgrey;
                }

                .pagebuilder-panel-menu-sections {
                    padding-bottom: 41px;
                }

                .panel-controls {
                    background-color: @color-very-dark-grayish-orange;
                    bottom: 0;
                    position: absolute;
                    width: 100%;
                }
            }
        }

        .pagebuilder-stage {
            margin-left: 150px;
        }
    }
}


.pagebuilder-wysiwyg-overlay {
    display: none;
    height: 0;
    left: -1px;
    position: absolute;
    top: -1px;
    visibility: hidden;
    width: 0;

    &.visible {
        -moz-transition: .175s ease-in-out;
        -webkit-transition: .175s ease-in-out;
        border: 2px solid transparent;
        border-radius: 2px;
        cursor: pointer;
        display: block;
        height: calc(~'100% + 2px');
        transform: translateY(-2px);
        transition: .175s ease-in-out;
        visibility: visible;
        width: calc(~'100% + 2px');
        z-index: @z-index-2;
    }

    &._hover {
        background-color: fade(@color-pagebuilder-blue, 10%);
        border-color: @color-pagebuilder-blue;
        transform: translateY(0);
    }

    ._keyfocus & {
        opacity: 1;
        transform: translateY(0);
    }
}

.pagebuilder-wysiwyg-wrapper {
    position: relative;
}

.pagebuilder-wysiwyg-wrapper.pagebuilder-transition-out .pagebuilder-stage-wrapper {
    .pagebuilder-stage-wrapper.stage-full-screen;

    .pagebuilder-header {
        .pagebuilder-stage-wrapper.stage-full-screen.pagebuilder-header;

        .icon-pagebuilder-fullscreen-exit {
            .pagebuilder-stage-wrapper.stage-full-screen.pagebuilder-header.icon-pagebuilder-fullscreen-exit;
        }
    }
}

.pagebuilder-wysiwyg-wrapper.pagebuilder-transition-in {
    .pagebuilder-stage-wrapper {
        -moz-transition: .175s ease-in-out;
        -webkit-transition: .175s ease-in-out;
        opacity: 0;
        transform: scale(.8) translateZ(0);
        transition: .175s ease-in-out;
        visibility: hidden;
    }

    &.trigger-transition .pagebuilder-stage-wrapper {
        opacity: 1;
        transform: scale(1) translateZ(0);
        visibility: visible;
    }
}

.pagebuilder-stage {
    -moz-transition: margin-left .35s ease-in-out;
    -moz-user-select: none;
    -ms-user-select: none;
    -o-user-select: none;
    -webkit-transition: margin-left .35s ease-in-out;
    -webkit-user-select: none;
    font-size: 0;
    margin-left: 170px;
    min-height: 200px;
    padding: 0;
    transition: margin-left .35s ease-in-out;
    user-select: none;
    &.stage-full-screen {
        background: @color-black;
    }

    &.pagebuilder-no-user-select {
        * {
            -moz-user-select: none !important;
            -ms-user-select: none !important;
            -o-user-select: none !important;
            -webkit-user-select: none !important;
            user-select: none !important;
        }
    }

    &.panel-collapsed {
        margin-left: 32px;
    }

    .pagebuilder-stage-loading {
        .spinner {
            font-size: 4rem;
            left: 50%;
            margin-left: -2rem;
            margin-top: -2rem;
            position: absolute;
            top: 50%;
        }
    }

    .pagebuilder-canvas {
        -moz-transition: opacity .75s ease-in-out, visibility .75s ease-in-out;
        -webkit-transition: opacity .75s ease-in-out, visibility .75s ease-in-out;
        background-color: @color-white;
        margin: 0 10px;
        min-height: 100%;
        opacity: 0;
        padding-bottom: 120px;
        transition: opacity .75s ease-in-out, visibility .75s ease-in-out;
        visibility: hidden;

        &.active {
            opacity: 1;
            position: relative;
            visibility: visible;
        }
    }

    /* Remove aspects fo the UI when taking a screenshot for templates */
    &.screengrab {
        border: none;
        height: 80%;
        overflow: hidden;
        padding: 0;

        .pagebuilder-add-row-wrapper {
            display: none;
        }
    }
}

.stage-content-snapshot {
    .pagebuilder-stage {
        .pagebuilder-canvas {
            padding-bottom: 0;
            padding-top: 8px;
        }
    }
}

.pagebuilder-wysiwyg-snapshot {
    .pagebuilder-stage {
        -moz-transition: @pagebuilder-transition;
        -webkit-transition: @pagebuilder-transition;
        margin-left: auto;
        transition: @pagebuilder-transition;
    }

    .element-children.content-type-container.root-container-container {
        background-color: @color-white;
    }

    .pagebuilder-stage-wrapper {
        -moz-transition: none;
        -webkit-transition: none;
        background-color: transparent;
        transition: none;

        &.stage-full-screen {
            .keyframes(fade-in; {
                0% {
                    background-color: transparent;
                }
                100% {
                    background-color: @color-gray-middle1;
                }
            });
            .animation(fade-in @pagebuilder-animation);
            background-color: @color-gray-middle1;

            &.transition-out {
                .keyframes(fade-out; {
                    0% {
                        background-color: @color-gray-middle1;
                    }
                    50% {
                        background-color: @color-white;
                    }
                    100% {
                        background-color: transparent;
                    }
                });
                .animation(fade-out @pagebuilder-animation);
            }

            .pagebuilder-stage {
                height: inherit;
                left: 0;
                position: relative;
                top: 0;
                width: calc(~'100% - 150px');
            }
        }
    }

    .pagebuilder-header {
        .keyframes(slide-in-top; {
            0% {
                -moz-transform: translateX(-41px);
                -webkit-transform: translateY(-41px);
                transform: translateY(-41px);
            }
            100% {
                -moz-transform: translateX(0);
                -webkit-transform: translateX(0);
                transform: translateX(0);
            }
        });
        .animation(slide-in-top @pagebuilder-animation);
        opacity: 1;
        transition: none;
        visibility: visible;

        &.transition-out {
            .pagebuilder-stage-wrapper.stage-full-screen.pagebuilder-header;
            .keyframes(slide-out-top; {
                0% {
                    -moz-transform: translateX(0);
                    -webkit-transform: translateX(0);
                    transform: translateX(0);
                }
                100% {
                    -moz-transform: translateX(-41px);
                    -webkit-transform: translateY(-41px);
                    transform: translateY(-41px);
                }
            });
            .animation(slide-out-top @pagebuilder-animation);
            -moz-transition: none;
            -webkit-transition: none;
            transition: none;
            z-index: 801;
        }
    }

    .pagebuilder-panel-wrapper {
        .keyframes(slide-in-left; {
            0% {
                -moz-transform: translateX(-150px);
                -webkit-transform: translateX(-150px);
                transform: translateX(-150px);
            }
            100% {
                -moz-transform: translateX(0);
                -webkit-transform: translateX(0);
                transform: translateX(0);
            }
        });
        .animation(slide-in-left @pagebuilder-animation);
        -moz-transition: none;
        -webkit-transition: none;
        opacity: 1;
        transition: none;
        visibility: visible;

        &.transition-out {
            .pagebuilder-stage-wrapper.stage-full-screen.pagebuilder-panel-wrapper;
            .keyframes(slide-out-left; {
                0% {
                    -moz-transform: translateX(0);
                    -webkit-transform: translateX(0);
                    transform: translateX(0);
                }
                100% {
                    -moz-transform: translateX(-150px);
                    -webkit-transform: translateX(-150px);
                    transform: translateX(-150px);
                }
            });
            .animation(slide-out-left @pagebuilder-animation);
            -moz-transition: none;
            -webkit-transition: none;
            transition: none;
            z-index: 801;
        }
    }
}

.pagebuilder-row-wrapper,
.pagebuilder-structure-wrapper {
    display: inline-block;
    vertical-align: top;
    width: 100%;
}
