// page builder variables
// ______________________________________________
.flex(){
	display: -webkit-box;      /* OLD - iOS 6-, Safari 3.1-6 */
  display: -moz-box;         /* OLD - Firefox 19- (buggy but mostly works) */
  display: -ms-flexbox;      /* TWEENER - IE 10 */
  display: -webkit-flex;     /* NEW - Chrome */
  display: flex;   
  flex-wrap: wrap;
}
.transition(@transition: all 0.3s ease) {
    .lib-css(transition, @transition, 1);
}

@margin_gobal_value: 6rem;
@margin_gobal_value-mobile: 5rem;
.margin_gobal_value(){
    .lib-css(margin-bottom, @margin_gobal_value);
    //Margin bottom for section
    @media only screen and (max-width: (@screen__m - 1)){
      .lib-css(margin-bottom, @margin_gobal_value-mobile);
    }
}
//  _panel contains less for the left panel
//  _____________________________________________

@pagebuilder-affordance-box-shadow: rgb(255, 255, 255) 0 0 0 1px;
@pagebuilder-affordance-box-shadow-active: rgb(3, 147, 201) 0 0 0 1px;

& when (@media-common = true) { 
    .main-col{
        .root-container-container > .pagebuilder-content-type-wrapper{
            .pagebuilder-content-type-affordance,
            .pagebuilder-tabs,
            .pagebuilder-html [data-content-type="html"]{
                .margin_gobal_value();
                .pagebuilder-content-type{
                    margin-bottom: 0;
                }
            }
        }
    }
    .pagebuilder-draggable-content-type {
        display: block;
        width: 100%;

        a {
            background: @color-white;
            color: #556068;
            cursor: pointer;
            display: block;
            padding: 9px;
            text-decoration: none;
            white-space: nowrap;
            .flex();
            flex-direction: column;
            align-items: center;
            justify-content: center;
            border-radius: 3px;
            font-size: 11px;
            min-height: 8.4rem;
            .transition();
            i {
                font-size: 28px;
                display: block;
            }
            .content-type-icon{
                i{
                    margin-bottom: 1rem;
                    &:before {
                        vertical-align: middle;
                        content: '';
                        display: block;
                        width: 2.4rem;
                        height: 2.4rem;
                        background-color: #222;
                        -webkit-mask-size: contain !important;
                        .transition();
                    }
                    &.icon-pagebuilder-row{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/row.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                        }
                    }
                    &.icon-pagebuilder-column{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/column.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                            width: 2.2rem;
                        }
                    }
                    &.icon-pagebuilder-tabs{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/tabs.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                        }
                    }
                    &.icon-pagebuilder-text{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/text.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                        }
                    }
                    &.icon-pagebuilder-heading{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/heading.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                        }
                    }
                    &.icon-pagebuilder-button{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/button.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                        }
                    }
                    &.icon-pagebuilder-divider{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/diriver.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                        }
                    }
                    &.icon-pagebuilder-code{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/html-code.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                        }
                    }
                    &.icon-pagebuilder-image{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/image.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                        }
                    }
                    &.icon-pagebuilder-video{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/video.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                        }
                    }
                    &.icon-pagebuilder-banner{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/banner.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                        }
                    }
                    &.icon-pagebuilder-slider{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/slider.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                            width: 2.5rem;
                        }
                    }
                    &.icon-pagebuilder-map{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/map.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                        }
                    }
                    &.icon-pagebuilder-block{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/block.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                        }
                    }
                    &.icon-pagebuilder-products{
                        &:before {
                            @mask: url('@{baseDir}Magento_PageBuilder/css/images/product.svg') no-repeat center;
                            .lib-css(mask, @mask, 1);
                        }
                    }
                }
            }
            &:hover {
                @box-shadow: 3px 4px 10px 0px rgba(32, 49, 67, 0.05);
                .lib-css(box-shadow, @box-shadow, 1);
                color: #0393c9;
                .content-type-icon{
                    i{
                        &:before {
                            background-color: #0393c9;
                        }
                    }
                }
            }
        }
    }

    .pagebuilder-panel-wrapper {
        -moz-transition: opacity .75s ease-in-out, visibility .75s ease-in-out;
        -webkit-transition: opacity .75s ease-in-out, visibility .75s ease-in-out;
        float: left;
        opacity: 0;
        position: relative;
        position: -webkit-sticky;
        position: sticky;
        top: 87px;
        transition: opacity .75s ease-in-out, visibility .75s ease-in-out;
        visibility: hidden;
        width: 230px;
        z-index: 106 !important;
        &.no-position-sticky {
            top: 0;
        }

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

            &.sticky-top {
                position: fixed;
                top: 90px;
            }

            &.sticky-bottom {
                bottom: 0;
                position: absolute;
            }
        }

        .expand {
            cursor: pointer;
            position: absolute;
            top: 0;

            a {
                -moz-border-radius-bottomright: 2px;
                -moz-border-radius-topright: 2px;
                -webkit-border-bottom-right-radius: 2px;
                -webkit-border-top-right-radius: 2px;
                background: @color-very-dark-grayish-orange;
                border-bottom-right-radius: 2px;
                border-top-right-radius: 2px;
                color: @color-gray65-lighten;
                display: block;
                font-size: 12px;
                font-weight: bold;
                padding: 4px 6px;
                text-decoration: none;

                &:before {
                    content: @icon-caret-right__content;
                    font-family: @icons-admin__font-name;
                    font-style: normal;
                    font-weight: normal;
                    line-height: 1;
                    speak: none;
                }
            }
        }

        .pagebuilder-panel {
            -moz-transition: .35s ease-in-out opacity, .35s ease-in-out visibility, .35s ease-in-out height;
            -moz-user-select: none;
            -ms-user-select: none;
            -o-user-select: none;
            -webkit-transition: .35s ease-in-out opacity, .35s ease-in-out visibility, .35s ease-in-out height;
            -webkit-user-select: none;
            background: #edf0f2;
            transition: .35s ease-in-out opacity, .35s ease-in-out visibility, .35s ease-in-out height;
            user-select: none;
            &::-webkit-scrollbar-thumb{
                background-color: #c9c9c9 !important;
            }
            .search-results-empty {
                color: @color-darker-gray;
                font-size: 12px;
                padding: 12px;
                text-align: center;
            }

            .search-content-types {
                position: relative;

                label {
                    -webkit-font-smoothing: antialiased;
                    color: @color-gray65-lighten;
                    font-family: @icons-admin__font-name;
                    font-size: 1.5rem;
                    font-style: normal;
                    font-weight: normal;
                    left: 12px;
                    line-height: 1;
                    margin-top: -.8rem;
                    position: absolute;
                    speak: none;
                    top: 50%;
                    z-index: 5;

                    &:before {
                        content: @icon-search__content;
                    }
                }
                input {
                    border: none;
                    background-color: @color-white;
                    color: @color-ivory;
                    font-size: 12px;
                    padding: 12px 36px;
                    width: 100%;
                    min-height: 49px;
                }
                a {
                    color: @color-darker-gray;
                    display: inline-block;
                    font-size: 12px;
                    line-height: 16px;
                    text-decoration: none;
                    vertical-align: top;

                    &:hover {
                        color: @color-gray65-lighten;
                    }

                    &.close {
                        position: absolute;
                        right: 12px;
                        top: 12px;

                        &:before {
                            content: @icon-close-mage__content;
                            font-family: @icons-admin__font-name;
                            font-style: normal;
                            font-weight: normal;
                            line-height: 1;
                            speak: none;
                        }
                    }
                }
            }
            .panel-controls {
                height: 42px;
                padding: 14px 10px;
                a {
                    color: @color-darker-gray;
                    display: inline-block;
                    font-size: 12px;
                    line-height: 16px;
                    text-decoration: none;
                    vertical-align: top;

                    &:hover {
                        color: @color-gray65-lighten;
                    }
                    &.collapse {
                        cursor: pointer;
                        &:before {
                            content: @icon-caret-left__content;
                            font-family: @icons-admin__font-name;
                            font-style: normal;
                            font-weight: normal;
                            line-height: 1;
                            padding-right: 3px;
                            speak: none;
                        }
                    }
                }
            }
        }
        &.collapsed {
            width: 32px;
            .pagebuilder-panel {
                opacity: 0;
                transform: translateX(-100%);
            }
            .collapsed-handle {
                display: block;
            }
        }
        .pagebuilder-panel-menu-sections {
            list-style: none;
            margin: 0;
            padding: 0;
            li {
                display: block;
                width: 100%;
                .menu-section-title {
                    cursor: pointer;
                    padding: 2rem 1rem;
                    position: relative;
                    :before {
                        content: @icon-caret-down__content;
                        font-family: @icons-admin__font-name;
                        font-size: 1.3rem;
                        -webkit-font-smoothing: antialiased;
                        font-style: normal;
                        font-weight: normal;
                        line-height: 1;
                        margin-top: -.8rem;
                        position: absolute;
                        right: 12px;
                        speak: none;
                        top: 50%;
                    }
                    h4 {
                        font-size: 12px;
                        font-weight: 600;
                        margin-bottom: 0;
                        margin-top: 0;
                        text-transform: uppercase;
                        color: #6d7882;
                    }
                }
                .pagebuilder-panel-menu-sections-child {
                    display: none;
                    ul.pagebuilder-panel-menu-sections-blocks {
                        list-style: none;
                        width: 100%;
                    }
                }
                &:not(.active){
                    .menu-section-title {
                        border-bottom: 1px solid #ddd;
                    }
                }
                &.active {
                    .menu-section-title {

                        :before {
                            content: @icon-caret-up__content;
                        }
                    }
                    .pagebuilder-panel-menu-sections-child {
                        display: block;
                    }
                }

                &.hidden {
                    .pagebuilder-panel-menu-sections-child {
                        display: none !important;
                    }
                }
                .pagebuilder-panel-menu-sections-content-types{
                    padding: 1rem;
                    display: grid;
                    gap: 10px;
                    grid-template-columns: repeat(2, calc(~'50% - 5px'));
                    li{
                        list-style: none;
                    }
                }
            }
        }
    }

    .modal-slide .modal-content .pagebuilder-panel-wrapper {
        top: 10px;
    }
    body {  
        // Custom in admin page
        .pagebuilder-stage .pagebuilder-canvas{ 
            box-shadow: rgb(255, 255, 255) 0px 0px 0px 1px;
        }
        .pagebuilder-wysiwyg-snapshot .pagebuilder-stage-wrapper.stage-full-screen .pagebuilder-stage{
            width: calc(~'100% - 230px');
            margin-left: 230px;
        }
        .pagebuilder-stage-wrapper.stage-full-screen .pagebuilder-header{
            left: 230px;
            width: calc(~'100% - 230px');
            .template-buttons{
                .flex();
                flex-wrap: nowrap;
                padding-right: 5px;
                button,
                .icon-pagebuilder-fullscreen-exit{
                    background-color: #4d4d4d;
                    border: 0;
                    padding-top: 1rem;
                    padding-bottom: 1rem;
                    margin-left: 5px;
                    &:hover{
                        background-color: #0393c9;
                        border-color: #0393c9;
                        color: @color-white;
                    }
                }
                button{
                    color: #a8a8a8;
                    padding-right: 20px;
                    padding-left: 20px;
                    
                }
                .icon-pagebuilder-fullscreen-exit{
                    padding: 0;
                    min-width: 3.9rem;
                    display: inline-flex;
                    align-items: center;
                    justify-content: center;
                    &::before{
                        content: '';
                        @mask: url('@{baseDir}Magento_PageBuilder/css/images/zoom.svg') no-repeat center;
                        .lib-css(mask, @mask, 1);
                        -webkit-mask-size: contain;
                        background-color: @color-white;
                        width: 1.5rem;
                        height: 1.5rem;
                    }
                }
            }
        }
    }
}
