/*
 * Header/Footer Builder
 * Admin CSS
 */

body {
    .wp-full-overlay {
        #customize-preview {
            transition: none;
        }
    }

    &.bhfb-active {
        .wp-full-overlay {
            #customize-preview {
                height: calc( 100vh - 290px );
                transition: all 0.2s 600ms;
            }

            &.preview-tablet {
                #customize-preview {
                    margin-top: 0;
                }
            }

            &.preview-mobile {
                #customize-preview {
                    max-height: 480px;
                    top: -260px;
                }
            }

            &.collapsed {
                .botiga-bhfb {
                    width: 100%;
                }
            }
        }

        &.bhfb-active-bottom {
            .wp-full-overlay {
                #customize-preview {
                    height: calc( 100vh - 46px );
                }
            }
        }

        .botiga-bhfb {
            &.show-bottom {
                height: 47px;
                .botiga-bhfb-top {
                    transform: translate3d(0, 120%, 0) !important;
                }
            }
        }
    }
}

#customize-control-botiga_header_row__above_header_row,
#customize-control-botiga_header_row__main_header_row,
#customize-control-botiga_header_row__below_header_row,
#customize-control-botiga_header_row__mobile_above_header_row,
#customize-control-botiga_header_row__mobile_main_header_row,
#customize-control-botiga_header_row__mobile_below_header_row,
#customize-control-botiga_header_row__mobile_offcanvas,
#customize-control-botiga_footer_row__above_footer_row,
#customize-control-botiga_footer_row__main_footer_row,
#customize-control-botiga_footer_row__below_footer_row {
    display: none;
}

#sub-accordion-panel-botiga_panel_header > li.accordion-section[id*="accordion-section-botiga_section_hb"]:not(#accordion-section-botiga_section_hb_wrapper),
#sub-accordion-panel-botiga_panel_footer > li.accordion-section[id*="accordion-section-botiga_section_fb"]:not(#accordion-section-botiga_section_fb_wrapper),
#sub-accordion-panel-botiga_panel_header > li.accordion-section[id*="botiga_header_row__"],
#sub-accordion-panel-botiga_panel_footer > li.accordion-section[id*="botiga_footer_row__"] {
    display: none !important;
}

#customize-control-botiga_section_hb_wrapper__header_builder_goto_presets {
    margin-left: -25px;
    width: calc( 100% + 50px );
    .to-widget-area-link {
        padding-left: 25px;
        padding-right: 25px;
    }
}

#sub-accordion-section-botiga_section_fb_component__footer_menu {
    #customize-control-footer_navigation_menu_link {
        .footer-widget-area-link {
            display: block !important;
        }
    }
}

#customize-control-botiga_section_fb_component__html2_title {
    margin-bottom: 10px;
}

#customize-control-botiga_section_fb_component__html_title,
#customize-control-botiga_section_fb_component__shortcode_title {
    display: none;
}

.bhfb-ui-state-highlight {
    display: inline-flex;
    height: 1.5em;
    line-height: 1.2em;
    width: 100px;
    background: #CCC !important;
}

.botiga-bhfb {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 82%;
    min-width: 300px;
    height: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: #f7f7f7;
    box-sizing: border-box;
    overflow: hidden;
    transition: ease height 200ms;

    @media(max-width: 1699px) {
        width: calc( 100% - 300px );
    }

    &.show {
        height: 290px;
        overflow: visible;
        .botiga-bhfb-top {
            transform: none;
        }
        .botiga-bhfb-bottom {
            display: flex;
        }
    }

    * {
        box-sizing: border-box;
    }

    // Devices
    .botiga-bhfb-devices {
        position: absolute;
        bottom: 0;
        left: 0;
        display: flex;
        max-width: 200px;
        background-color: #f7f7f7;
        z-index: 2;
        .botiga-bhfb-device-link {
            display: flex;
            align-items: center;
            background-color: #dddddd;
            text-decoration: none;
            padding: 12px 20px;
            color: #777;
            span {
                margin-right: 10px;
            }

            &.active {
                color: #212121;
                background-color: #f7f7f7;
            }
        }
    }

    &.botiga-bhfb-footer {
        .botiga-bhfb-devices {
            display: none;
        }
    }

    // Top area
    .botiga-bhfb-top {
        padding: 25px;
        transform: translate3d(0, 120%, 0);
        transition: ease transform 200ms;
        z-index: 0;
        &.show {
            transform: none;
        }
    }

    // Buttons
    .bhfb-button {
        font-size: 13px;
        line-height: 20px;
        padding: 6px 12px;
        color: #1E1E1E;
        background-color: #FFF;
        border: 1px solid #bfbfbf;
        text-decoration: none;
        transition: ease border-color 300ms;
        white-space: nowrap;
        &:hover {
            border-color: #1E1E1E;
        }
    }

    // Elements
    .botiga-bhfb-elements {
        position: fixed;
        top: 0;
        left: 0;
        background-color: #FFF;
        border: 1px solid #CCC;
        border-radius: 5px;
        padding: 25px;
        max-width: 405px;
        z-index: 10;
        box-shadow: 0px 0px 30px -10px rgba(0, 0, 0, 0.2);
        opacity: 0;
        visibility: hidden;
        transform: translate3d(0, 15px, 0);
        transition: ease opacity 300ms, ease transform 300ms;

        .botiga-bhfb-elements-wrapper {
            display: flex;
            flex-wrap: wrap;

            > .botiga-bhfb-elements-desktop,
            > .botiga-bhfb-elements-mobile {
                display: grid;
                grid-template-columns: repeat(3, 110px);
                gap: 10px;
            }

            .botiga-bhfb-element {
                display: flex;
                .bhfb-button {
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    justify-content: center;
                    width: 100%;
                    height: 100%;
                    text-align: center;
                    padding: 12px;
                    white-space: normal;
                }
            }

            .bhfb-elements-message {
                grid-column: 1/4;
                text-align: center;
                margin: 0;
            }
        }

        &.show {
            opacity: 1;
            visibility: visible;
            transform: none;
        }
    }

    // Rows
    .botiga-bhfb-rows-wrapper {
        .botiga-bhfb-row {
            position: relative;
            display: flex;

            & + .botiga-bhfb-row {
                margin-top: 15px;
            }

            .botiga-bhfb-row-controls {
                position: absolute;
                bottom: 100%;
                left: 0;
                display: inline-flex;
                align-items: center;
                width: 100px;
                height: 30px;
                padding: 6px 8px;
                background-color: #1E1E1E;
                color: #FFF;
                font-size: 10px;
                line-height: 12px;
                z-index: 3;
                opacity: 0;
                visibility: hidden;

                .settings {
                    margin-right: 6px;
                    &:before {
                        content: '';
                        width: 100%;
                        position: absolute;
                        top: 0;
                        left: 0;
                        right: 0;
                        bottom: 0;
                    }
                }
            }

            &.botiga-bhfb-row-top {
                .botiga-bhfb-row-controls {
                    width: 86px;
                }
            }

            &.botiga-bhfb-row-bottom {
                .botiga-bhfb-row-controls {
                    width: 110px;
                }
            }

            .botiga-bhfb-area {
                display: grid;
                gap: 10px;
                grid-auto-flow: column;
                justify-content: flex-start;
                flex: 1 1 0%;
                background: #FFF;
                padding: 10px;
                min-height: 56px;
                border: 1px dashed #1E1E1E;
                cursor: pointer;

                &.botiga-bhfb-area-center {
                    flex: 0 0 auto;
                    min-width: 150px;
                }

                &.botiga-bhfb-area-right {
                    text-align: right;
                }

                & + .botiga-bhfb-area {
                    border-left: 0;
                }

                .botiga-bhfb-element {
                    position: relative;
                    display: inline-flex;
                    align-items: center;
                    z-index: 2;
                }

                .bhfb-edit-column {
                    position: absolute;
                    right: 0px;
                    top: 0px;
                    background: rgba(0, 0, 0, 0.5);
                    padding: 6px;
                    width: 25px;
                    height: 27px;
                    opacity: 0;
                    visibility: hidden;
                    z-index: 3;
                    svg {
                        width: 100%;
                    }

                    &:hover {
                        background: rgba(0, 0, 0, 1);
                    }
                }

                &:hover {
                    .bhfb-edit-column {
                        opacity: 1;
                        visibility: visible;
                    }
                }
            }

            .bhfb-button {
                cursor: grab; 

                i {
                    color: #787878;
                    font-size: 1.3em;
                    line-height: 1.3;
                    transition: ease color 300ms;
                    cursor: pointer;
                }

                &:hover {
                    i {
                        color: #1E1E1E;
                    }
                }
            }

            &:hover {
                .botiga-bhfb-row-controls {
                    opacity: 1;
                    visibility: visible;
                }

                .botiga-bhfb-area {
                    border-style: solid;
                }
            }
        }
    }

    .botiga-bhfb-area {
        position: relative;
        &:after {
            content: '+';
            position: absolute;
            top: 46%;
            left: 50%;
            transform: translate3d(-50%, -50%, 0);
            color: #686868;
            font-size: 20px;
            opacity: 0;
            visibility: hidden;
            transition: ease opacity 300ms;
            z-index: 0;
        }
        &:hover {
            &:after {
                opacity: 1;
                visibility: visible;
            }
        }
    }

    .botiga-bhfb-bottom {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 46px;
        display: none;
        border: 1px solid #dcdcde;
        border-left: 0;
        border-bottom: 0;
        background-color: #EEE;
        z-index: 1;

        > div, 
        > a {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .botiga-bhfb-bottom-upsell {
            width: 100%;
            justify-content: flex-start;
            padding: 0px 25px;
        }
        .botiga-bhfb-bottom-settings {
            width: 50px;
            color: #1E1E1E;
            border-left: 1px solid #dcdcde;
            border-right: 1px solid #dcdcde;   
            text-decoration: none;
            &:hover {
                color: #2271b1;
            }
            span {
                font-size: 16px;
                line-height: 1;
            }
        }
        .botiga-bhfb-bottom-display {
            width: 150px;
            text-decoration: none;
            color: #1E1E1E;
            &:hover {
                color: #2271b1;
            }
            &.show .botiga-bhfb-bottom-display-hide,
            &:not(.show) .botiga-bhfb-bottom-display-show {
                display: none;
                opacity: 0;
                visibility: hidden;
            }
            
            .botiga-bhfb-bottom-display-hide,
            .botiga-bhfb-bottom-display-show {
                display: flex;
                align-items: center;
                span {
                    font-size: 16px;
                    line-height: 1.4;
                    margin-right: 5px;       
                }
            }
        }
    }

    /*
     * Mobile
     */
    .botiga-bhfb-mobile {
        display: flex;
        .bhfb-offcanvas {
            position: relative;
            width: 20%;
            padding-right: 15px;
            .bhfb-offcanvas-settings {
                position: absolute;
                bottom: 100%;
                left: 0;
                display: inline-flex;
                align-items: center;
                width: 100px;
                height: 30px;
                padding: 6px 8px;
                background-color: #1E1E1E;
                color: #FFF;
                font-size: 10px;
                line-height: 12px;
                z-index: 0;
                opacity: 0;
                visibility: hidden;

                .settings {
                    margin-right: 6px;
                    &:before {
                        content: '';
                        width: 100%;
                        position: absolute;
                        top: 0;
                        left: 0;
                        right: 0;
                        bottom: 0;
                    }
                }
            }

            .bhfb-offcanvas-components-wrapper {
                height: 100%;
            }

            .botiga-bhfb-area {
                position: relative;
                width: 100%;
                background: #FFF;
                padding: 10px;
                height: 100%;
                border: 1px dashed #1E1E1E;
                cursor: pointer;

                .botiga-bhfb-element {
                    position: relative;
                    display: inline-flex;
                    align-items: center;
                    width: 100%;
                    z-index: 2;
                    & + .botiga-bhfb-element {
                        margin-top: 10px;
                    }
                }
            }

            .bhfb-button {
                display: flex;
                justify-content: space-between;
                width: 100%;
                i {
                    color: #787878;
                    font-size: 1.3em;
                    line-height: 1.3;
                    transition: ease color 300ms;
                }

                &:hover {
                    i {
                        color: #1E1E1E;
                    }
                }
            }

            &:hover {
                .bhfb-offcanvas-settings {
                    opacity: 1;
                    visibility: visible;
                }

                .botiga-bhfb-area {
                    border-style: solid;
                }
            }
        }
        .botiga-bhfb-rows-wrapper {
            width: 80%;
        }
    }
}

/*
 * Columns Layout
 */
.botiga-bhfb-row-columns-layout-bigleft {
    &.botiga-bhfb-row-2-columns {
        > .botiga-bhfb-area:nth-child(2) {
            flex: 0 0 75%;
        }
    }
    &.botiga-bhfb-row-3-columns {
        > .botiga-bhfb-area:nth-child(2) {
            flex: 0 0 50%;
        }
    }
    &.botiga-bhfb-row-4-columns {
        > .botiga-bhfb-area:nth-child(2) {
            flex: 0 0 40%;
        }
    }
}

.botiga-bhfb-row-columns-layout-bigright {
    &.botiga-bhfb-row-2-columns {
        > .botiga-bhfb-area:nth-child(2) {
            flex: 0 0 25%;
        }
    }
    &.botiga-bhfb-row-3-columns {
        > .botiga-bhfb-area:nth-child(4) {
            flex: 0 0 50%;
        }
    }
    &.botiga-bhfb-row-4-columns {
        > .botiga-bhfb-area:nth-child(5) {
            flex: 0 0 40%;
        }
    }
}

/*
 * Available Columns
 */
.bhfb-available-columns {
    .bhfb-available-columns-items-wrapper {
        display: grid;
        gap: 8px;
        .bhfb-available-columns-item {
            margin-bottom: 0;
            padding: 8px 10px;
            &.hide {
                display: none;
            }
            .dashicons {
                font-size: 1rem;
                position: relative;
                top: 2px;
                color: #777;
                transition: ease color 300ms;
            }

            &:hover {
                .dashicons {
                    color: #212121;
                }
            }
        }
    }

    &.bhfb-always-show {
        display: grid !important;
    }
}

.preview-desktop {
    .bhfb-available-columns-tablet {
        display: none;
    }
}

.preview-tablet,
.preview-mobile {
    .bhfb-available-columns-desktop {
        display: none;
    }
}

/*
 * Available Components Areas
 */
.bhfb-available-components {
    .botiga-bhfb-element {
        &.ui-sortable-helper {
            width: 0 !important;
            .bhfb-button {
                position: fixed;
                height: auto;
            }
        }
    }
}

.bhfb-available-components {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    border: 1px dashed #CCC;
    padding: 10px;
    margin-top: 10px;
    .bhfb-button {
        display: flex;
        background: #FFF;
        color: #212121;
        text-decoration: none;
        font-style: normal;
        padding: 6px 12px;
        border: 1px solid #CCC;
        height: 100%;
        box-sizing: border-box;
        align-items: center;

        &:hover {
            border-color: #212121;    
        }
    }
    .bhfb-elements-message {
        grid-column: 3;   
    }
}

.preview-desktop {
    #customize-control-botiga_section_hb_wrapper__header_builder_available_mobile_components {
        display: none;
    }
}

.preview-tablet,
.preview-mobile {
    #customize-control-botiga_section_hb_wrapper__header_builder_available_components {
        display: none;
    }
}

.preview-tablet,
.preview-mobile {
    .bhfb-available-components {
        &.botiga-header-builder-available-mobile-components {
            display: grid;
        }
    }
}

/*
 * Responsive Display
 */
.preview-desktop {
    .botiga-bhfb {
        .botiga-bhfb-mobile {
            display: none;
        }

        // Elements
        .botiga-bhfb-elements {
            .botiga-bhfb-elements-mobile {
                display: none;
            }
        }
    }
}

.preview-tablet, 
.preview-mobile {
    .botiga-bhfb:not(.botiga-bhfb-footer) {
        .botiga-bhfb-desktop {
            display: none;
        }

        // Elements
        .botiga-bhfb-elements {
            .botiga-bhfb-elements-desktop {
                display: none;
            }
        }
    }

    .botiga-bhfb-footer {
        .botiga-bhfb-mobile {
            display: none;
        }
    }
}

/*
 * Footer Builder
 */
.botiga-bhfb-footer {
    .botiga-bhfb-elements-mobile {
        display: none !important;
    }
    .botiga-bhfb-area {
        // text-align: center;
        white-space: nowrap;
    }
}

/*
 * Upsell
 */
.bhfb-customizer-sidebar-upsell {
    background: #fff;
    font-style: normal;
    margin-left: -25px;
    margin-right: -25px;
    padding: 25px 25px;

    p {
        margin-top: 0;
    }
}

.bhfb-upsell-button {
    background-color: #2271b1;
    display: block;
    text-align: center;
    color: #FFF !important;
    text-decoration: none;
    padding: 10px;
    border-radius: 4px;
    transition: ease background-color 300ms;

    &:hover {
        background-color: #2c84cb;
    }
}

.botiga-bhfb-upsell-components-wrapper {
    width: 100%;
    text-align: center;

    h4 {
        text-align: left;
        margin: 25px 0 0;
    }
    .botiga-bhfb-upsell-components {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        margin: 10px 0;
        opacity: 0.5;
        .bhfb-button {
            position: relative;
            pointer-events: none;

            .bhfb-lock-icon {
                position: absolute;
                top: 5px;
                right: 4px;
                width: 17px;
                height: 17px;
                fill: #2271b1;
            }
        }
    }
    p {
        margin: 0 0 5px;
        opacity: 0.5;
    }

}