/**
 * Sidebar Sequential Control
 * ========================================================================== */
body{
    &.emulsion-has-sidebar{
        .sidebar-widget-area {
            min-height:calc(100vh - 80px);
            padding-bottom:80px;
        }
        .has-column{
            max-width:calc( var(--thm_sidebar_width) + var(--thm_main_width) );
            margin-left:auto;
            margin-right:auto;
        }
    }
    .emulsion-no-sidebar{
        .sidebar-widget-area{
            display:none;
        }

    }
    &:not(.emulsion-has-sidebar) .sidebar-widget-area{
        visibility:hidden;
        position:absolute;
        right:0;
    }
}

/**
 * Sidebar table wrapper
 * ========================================================================== */
/**
 * table wrapper
 * The table element is wrapped in the emulsion-table-wrapper class
 * with javascript to preserve the responsive style.
 */
.textwidget .emulsion-table-wrapper{
    position:relative;
    overflow:auto;
    clear:none;
    display:table;
    display:-ms-flexbox;
    display:flex;
    max-width:100%;
    margin-bottom:2em;
    padding-bottom:1px;
    width:100%;
    padding-top:3px;
}
.textwidget .emulsion-table-wrapper.alignleft,
.textwidget .emulsion-table-wrapper.alignright{
    display:block;
    max-width:50%;
    max-width:calc(50% - 1.5em );
    padding-left:0;
    padding-right:0;
}
.textwidget .emulsion-table-wrapper.alignleft{
    clear:left;
    margin:0 1.5em .75em 0;
}
.textwidget .emulsion-table-wrapper.alignright{
    clear:right;
    margin:0 0 .75em 1.5em;
    position:relative;
}
.textwidget .emulsion-table-wrapper.alignright > .alignright{
    /* @see emulsion_width_class_and_relate_settings() */
    position:relative;
    float:none;
    left:calc(-50% - 1.5em );
    -webkit-transform: translate(calc(50% + 1.5em),0);
    -ms-transform: translate(calc(50% + 1.5em),0);
    transform: translate(calc(50% + 1.5em),0);
}
.textwidget .emulsion-table-wrapper::-webkit-scrollbar{
    width: 0;
    height:.5em;
}
.textwidget .emulsion-table-wrapper::-webkit-scrollbar-thumb{
    background-color: var(--thm_black_color);
    outline: 1px solid var(--thm_black_color);
}
.safari .widgettext .emulsion-table-wrapper{
    display:block;
}
/**
 * Sidebar fallback
 * ========================================================================== */

.widget{
    h1,h2,h3,h4,h5,div,form{
        padding-left:0;
        padding-right:0;
    }
    p{
        line-height:1.5;
        padding-left:0;
        padding-right:0;
        img{
            margin-left:0;
            margin-right:0;
            max-width:100%;
            height:auto;
        }
    }
    li{
        position:relative;
    }
    img{
        max-width:100%;
        height:auto;
    }
    .widget_media_image{
        text-align:center;
    }
    .textwidget{
        ol,
        ul{
            padding-left:40px;
            margin-top:1.5rem;
            margin-bottom:.75rem;
            li{
                list-style:disc;
                border:none;
                margin-top:.375rem;
                margin-bottom:.375rem;
                ol,
                ul{
                    margin-top:0;
                    margin-bottom:0;
                }
                &:empty{
                    display:none;
                }
            }
        }
        & > ul,
        &:not(ul) ul{
            list-style-type:disc;
        }
        & ul ul{
            list-style-type:circle;
        }
        & ul ul ul{
            list-style-type:square;
        }
    }
}
.footer-widget-area,
.sidebar-widget-area{
    .widget[id]{
        & > .widgettitle{
            padding-left:0;
            padding-right:0;
        }
        & > div,
        & > ol,
        & > ul{
            overflow:hidden;
            padding-left:0;
            padding-right:0;
            box-sizing:border-box;
            .flex-control-nav{
                display:flex;
            }
        }
    }
    .widget[id]{
        & > .gallery{
            padding-left:0;
            padding-right:0;
            max-width:100%;
        }
    }
}
/**
 * Widget tag cloud
 * ========================================================================== */
.widget_tag_cloud{
    .tagcloud{
        @extend %block;
        max-width:100%;
        padding-left:var(--thm_content_gap, 24px);
        padding-right:var(--thm_content_gap, 24px);
        display:flex;
        flex-wrap:wrap;
        a{
            flex:1 1 auto;
            margin-bottom:2px;
            vertical-align:middle;
            display:inline-block;
            text-align:center;
            padding:2px 3px;
            &:hover{
                background:rgba(188, 188, 188, .2);
            }
        }
    }
}
/**
 * Sidebar widget
 * ========================================================================== */

.sidebar-widget-area{
    position:relative;
    z-index:1;
    flex-basis:var( --thm_sidebar_width, 400px );
    width:var( --thm_sidebar_width, 400px );
    max-width:var( --thm_sidebar_width, 400px );
    flex:1 0;
    margin-top:0;
    margin-bottom:0;
    /**
     * sidebar position control
     * order:0 left sidebar
     * order:2 right sidebar
     * breack point 1249px responsive order issue (sidebar page first)
     */
    @if(  $sidebar_position == 'left') {
        order:0;
    }
    @if(  $sidebar_position == 'right') {
        order:2;
    }
    a[data-title]:hover:after {
        content: attr( data-title );
        max-width:100%;
        display:inline-block;
        background:var(--thm_white_color);
        color:var(--thm_black_color);
        position:absolute;
        top:3rem;
        left:6em;
        right:0;
        padding:1rem;
        z-index:2;
        z-index:10;
    }
    & > ul{
        margin-top:0;
        margin-left:auto;
        margin-right:auto;
        padding:0;
        li{
            margin-top:0;
            margin-bottom:0;
            list-style:none;
            line-height:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) );
            width:100%;
        }
    }
    .widget{
        .widgettitle{
            overflow:hidden;
        }
        & > ul{
            @include font_size(5);
            & > li{
                span,
                a{
                    display:inline-block;
                    padding-top:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 4 );
                    padding-bottom:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 4 );
                    padding-left:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 2 );
                    padding-right:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 2 );
                    margin-top:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 4 );
                    margin-bottom:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 4 );
                    *{
                        margin-top:0;
                        margin-bottom:0;
                        padding:0;
                    }
                }
                .children,
                .sub-menu{
                    padding-left:var(--thm_content_gap);
                }
            }
        }
    }
    .current-cat{
        list-style-type:disc;
    }
    .widget_rss{
        ul{
            li{
                max-width:100%;
                a.rsswidget{
                    display:block;
                    text-align:center;
                    margin-bottom:0;
                    padding-left:var(--thm_content_gap);
                    padding-right:var(--thm_content_gap);
                    width:auto;
                    font-size:var(--thm_common_font_size);
                    font-weight:bold;
                    line-height:var(--thm_common_line_height);
                }
                .rss-date{
                    display:block;
                    margin-top:0;
                    margin-bottom:0;
                    padding-left:var(--thm_content_gap);
                    padding-right:var(--thm_content_gap);
                    width:auto;
                    text-align:center;
                }
                .rssSummary{
                    padding-left:var(--thm_content_gap);
                    padding-right:var(--thm_content_gap);
                    line-height:1.5;
                    margin-top:.75rem;
                    margin-bottom:.75rem;
                }
                .rssSummary:empty{
                    display:none;
                }
                cite{
                    padding-left:var(--thm_content_gap);
                    padding-right:var(--thm_content_gap);
                }
            }
        }
    }
    .widget_media_gallery{
        .gallery{
            padding-left:0;
            padding-right:0;
        }
    }
    .widget_archive{
        select[name="archive-dropdown"]{
            margin-top:1.5rem;
            margin-bottom:.75rem;
            width:calc( 100% - var( --thm_content_gap, 24px ) * 2 );
            max-width:100%;
            padding:.69rem;
        }
    }
    .widget_categories{
        .postform{
            margin-top:1.5rem;
            margin-bottom:.75rem;
            width:calc( 100% - var( --thm_content_gap, 24px ) * 2 );
            max-width:100%;
            padding:.69rem;
        }
    }
    .widget_tag_cloud{
        .tagcloud{
            @extend %block;
            margin-left:auto;
            margin-right:auto;
            padding-left:0;
            padding-right:0;
        }
    }
    .widget_nav_menu{
        .menu{
            @extend %block;
            max-width:100%;
            padding-left:0;
            padding-right:0;
            & > li{
                &  > a{
                    margin-top:0;
                    margin-bottom:0;
                }
            }
        }
        & > div:not(.has-chckbox-control) {
            .menu{
                @extend %block;
                max-width:100%;
                padding-left:0;
                padding-right:0;
                & > li{
                    list-style: none;
                    padding-top: 0.71rem;
                    padding-bottom: 0.71rem;
                    line-height: calc(var(--thm_common_font_size) * var( --thm_content_line_height, 1.5 ));
                    font-size: var(--thm_meta_data_font_size);
                    text-transform: var(--thm_meta_data_font_transform);
                    &  > a{
                        padding-top:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 4 );
                        padding-bottom:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 4 );
                        padding-left:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 2 );
                        padding-right:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 2 );
                        margin-top:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 4 );
                        margin-bottom:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 4 );
                    }
                }
            }
        }
    }
    .wp-caption{
        &.alignnone{
            margin-top:1.5rem;
            margin-bottom:.75rem;
            margin-left:0;
            margin-right:0;
        }
    }
    .widget_calendar{
        @include font_size(5);
        width:100%;
        .calendar_wrap{
            text-align:center;
            width:calc( 100% - var(--thm_content_gap) * 2 );
            margin-left:auto;
            margin-right:auto;
            div.emulsion-table-wrapper{
                padding-left:0;
                padding-right:0;
                max-width:100%;
                overflow:hidden;
                margin-top:1.5rem;
                margin-bottom:.75rem;
                position:static;
                display:inline;
                table{
                    margin:0 auto;
                    width:99%;
                    min-width:0;
                    td{
                        padding:0;
                        position:static;
                        text-align:center;
                        width:14.2857142857%;
                        word-wrap: normal;
                        overflow-wrap: normal;
                        line-height:3;
                    }
                    thead{
                        th{
                            padding:0;
                            border:none;
                            line-height:3;
                        }
                    }
                    tfoot{
                        td{
                            padding-top:.75rem;
                            border:none;
                        }
                        #prev{
                            text-align:left;
                        }
                        #next{
                            text-align:right;
                        }
                    }
                    tbody{
                        a{
                            font-weight:700;
                        }
                    }
                    caption{
                        @include font_size(2);
                        margin:.75rem 0 .75rem;
                        text-align:center;
                        font-weight:var(--thm_heading_font_weight);
                        text-transform:var(--thm_heading-font-transform);
                        font-family:var(--thm_heading_font_family);
                    }
                    a{
                        display:block;
                        height:100%;
                        white-space:nowrap;
                    }
                }
            }
        }
    }
}
/**
 * Footer Widget
 * ========================================================================== */
body{
    .template-part-widget-footer{
        @extend .sidebar-widget-area;
        &.footer-widget-area{
            max-width:calc(100vw - 17px);
            width:100vw;
            max-width:100%;
            display:block;
            visibility:visible;
            position:static;
            margin-left:auto;
            margin-right:auto;
            overflow:hidden;
            padding-left:0;
            padding-right:0;
            .footer-widget-area-lists{
                @extend %block_main_wide;
                padding-left:0;
                padding-right:0;
                width:100%;
                display:flex;
                flex-wrap:wrap;
                margin:0 auto 0;
                padding-top:1.5rem;
                padding-bottom:.75rem;
                justify-content:center;
                & > li{
                    // Customizer relate cols
                    flex:1 1 var( --thm_footer_widget_width );
                    padding-left:var(--thm_content_gap);
                    padding-right:var(--thm_content_gap);
                    margin-left:auto;
                    margin-right:auto;
                    min-width:296px;
                    list-style:none;
                    margin:var( --thm_box_gap );
                    .widgettitle{
                        overflow:hidden;
                        width:auto;
                    }
                    .widgettitle{
                        margin-top:1.5rem;
                    }
                    & > div:not(.gallery){
                        max-height:70vh;
                        overflow-y:scroll;
                        overflow-x:hidden;
                        @include font_size(5);
                        margin-bottom:0;
                        margin-top:0;
                        & > .menu{
                            margin-top:0;
                        }
                        &::-webkit-scrollbar {
                            width: .5rem;
                            height:100px;
                        }
                        &::-webkit-scrollbar-thumb{
                            background-color: var(--thm_black_color);
                            outline: 1px solid var(--thm_black_color);
                        }
                    }
                    & > ul{
                        max-height:70vh;
                        overflow-y:scroll;
                        overflow-x:hidden;
                        @include font_size(5);
                        margin-bottom:0;
                        &::-webkit-scrollbar {
                            width: .5rem;
                            height:100px;
                        }
                        &::-webkit-scrollbar-thumb{
                            background-color: var(--thm_black_color);
                            outline: 1px solid var(--thm_black_color);
                        }
                    }
                    ul{
                        width:auto;
                    }
                    .children,
                    .sub-menu{
                        padding-left:var(--thm_content_gap);
                    }
                }
            }
        }
        .widget_nav_menu{
            .menu{
                @extend %block;
                max-width:100%;
                padding-left:0;
                padding-right:0;
                & > li{
                    &  > a{
                        margin-top:0;
                        margin-bottom:0;
                    }
                }
            }
            & > div:not(.has-chckbox-control) {
                .menu{
                    @extend %block;
                    max-width:100%;
                    padding-left:0;
                    padding-right:0;
                    & > li{
                        list-style: none;
                        padding-top: 0.71rem;
                        padding-bottom: 0.71rem;
                        line-height: calc(var(--thm_common_font_size) * var( --thm_content_line_height, 1.5 ));
                        font-size: var(--thm_meta_data_font_size);
                        text-transform: var(--thm_meta_data_font_transform);
                        &  > a{
                            padding-top:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 4 );
                            padding-bottom:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 4 );
                            padding-left:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 2 );
                            padding-right:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 2 );
                            margin-top:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 4 );
                            margin-bottom:calc( var(  --thm_common_font_size, 16px ) * var( --thm_content_line_height, 1.5 ) / 4 );
                        }
                    }
                }
            }
        }
        .wp-caption{
            &.alignnone{
                margin-top:1.5rem;
                margin-bottom:.75rem;
                margin-left:0;
                margin-right:0;
            }
        }
        .widget_calendar{
            @include font_size(5);
            width:100%;
            #calendar_wrap{
                .emulsion-table-wrapper{
                    margin-top:0;
                }
            }
            .calendar_wrap{
                text-align:center;
                max-width:100%;
                div.emulsion-table-wrapper{
                    padding-left:0;
                    padding-right:0;
                    max-width:100%;
                    overflow:hidden;
                    margin-top:0!important;
                    table{
                        margin:0;
                        width:calc( 100% - var(--thm_content_gap) * 2 );
                        td{
                            padding:0;
                            position:static;
                            text-align:center;
                            width:14.2857142857%;
                            word-wrap: normal;
                            overflow-wrap: normal;
                            line-height:3;
                        }
                        thead{
                            th{
                                padding:0;
                                border:none;
                                line-height:3;
                            }
                        }
                        tfoot{
                            td{
                                padding-top:.75rem;
                                border:none;
                            }
                            #prev{
                                text-align:left;
                            }
                            #next{
                                text-align:right;
                            }
                        }
                        tbody{
                            a{
                                font-weight:700;
                            }
                        }
                        caption{
                            @include font_size(2);
                            margin:1.5rem 0 .75rem;
                            text-align:left;
                            font-weight:var(--thm_heading_font_weight);
                            text-transform:var(--thm_heading-font-transform);
                            font-family:var(--thm_heading_font_family);
                        }
                        a{
                            display:block;
                            height:100%;
                            white-space:nowrap;
                        }
                    }
                }
            }
        }
    }
}

/**
 * bbpress
 */
.widget{
    &.widget_display_stats{
        display:block;
        max-width:100%;
        margin-top:0;
        margin-bottom:0;
        dt{
            float:left;
            clear:left;
            margin-top:1.5rem;
            margin-bottom:.75rem;
        }
        dd{
            float:left;
            margin-top:1.5rem;
            margin-bottom:.75rem;
        }

    }
    &.widget_display_search{
        .bbp-search-form{
            #bbp_search{
                width:calc(100% - 70px);
            }
        }
    }
}

/**
 * woocommerce
 */
.widget{
    &.widget_shopping_cart{
        .cart_list{
            li{
                a.remove{
                    line-height: calc(var(--thm_common_font_size) * var( --thm_content_line_height, 1.5 ));
                }
            }
        }
    }

}
