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

//
//  Common
//  _____________________________________________

& when (@media-common = true) {
    .page-layout-1column-fullwidth,
    .page-layout-1column{
        .filter {
            &.block {                
                display:none;                
            }
        }
    }
    .ox-slideout{
        .filter {
            &.block {
                display:block;
                &.ox-block-filter{                    
                    padding: 35px;
                }
            }
        }        
    }
    .sidebar-nobg{
        .filter {
            &.block {
                .content{
                    padding:0;
                    border-top: none;
                    background-color: transparent;
                    margin-bottom: 23px;
                }
            }
        }
    }
    .filter {
        &.block {
            margin-bottom: 0;
            > .title{
                display:none;
            }
            .content{
                margin: 0;
                border: 0;
                padding: 20px;
                border-top: 6px solid #ffe51e;
                background-color: #f8f8f8;
                margin-bottom: 15px;
                dl.options{
                    margin:0;
                    dt{
                        .ox-toggle-title();
                    }
                    dd{
                        margin: 0;
                        padding-top: 17px;
                        font-family: @tiny-font;
                        font-size: 13px;
                        line-height: 16px;
                        li {
                            a {
                                margin-left: -5px;
                                margin-right: -5px;
                                padding: 5px 8px 4px;
                                display: inline-block;
                                line-height:1.3;

                                &:hover {
                                    background-color: #000000;
                                    color:#ffffff;
                                    text-decoration: none;

                                    & + .count {
                                        background-color: @color-gray91;
                                        color:#333333;

                                        -o-transition: all 10ms ease-in-out;
                                        transition: all 10ms ease-in-out;
                                    }
                                }
                            }

                            .count {
                                .lib-css(color, #adadad);
                                padding: 5px 8px 4px;
                                float: right;
                                line-height:16px;

                                -o-transition: all 600ms ease-in-out;
                                transition: all 600ms ease-in-out;
                            }
                        }
                        
                    }
                }
            }
        }

        &-title {
            strong {
                display:none;
            }
        }

        .block-subtitle {
                .lib-heading(h5);
                font-weight: @font-weight__black;
                letter-spacing: -0.03em;
                text-transform:uppercase;
                line-height: 1;
                margin: 0;
                display: block;
                padding: 0 0 14px;
        }
        .subtitle,
        &-subtitle {
            display: none;
        }

        &-current {
            margin: 0;
            .toggle-minus{
                margin-left: auto;
                flex: 0 0 24px;
                margin-left:10px;
                order: 2;
            }
            .ox-toggle-content{
                max-height: max-content;
                transition: none;
            }
            &-subtitle {
                .ox-toggle-title();
                &:hover {
                    .toggle-minus{
                        .ox-toggle-minus-hover();
                    }
                }
            }
            &.open {
                .toggle-minus {
                    .ox-toggle-minus-opened();
                }
            }
            .items {
                display:block;
                padding: @indent__xs @indent__s;
                margin: 0;
            }

            .item {
                position: relative;
                font-weight: @font-weight__bold;
                background: #f8f8f8;
                padding: 5px 10px 5px 40px;
                color: #000000;
                display: inline-block;
                margin-right: 10px;
                margin-bottom: 4px;
                .filter-label{
                    display: none;
                }
            }

            .filter &-subtitle {
                border: none;
                display: block;
                padding-bottom: 14px;
            }

            .action.remove {
                .lib-icon-font(
                    @icon-remove,
                    @_icon-font-size: 10px,
                    @_icon-font-line-height: 30px,
                    @_icon-font-text-hide: true,
                    @_icon-font-color: #ffffff,
                    @_icon-font-color-hover: #000000,
                    @_icon-font-color-active: #000000
                );

                left: 0;
                position: absolute;
                top: 0;
                width: 100%;
                &:hover{
                    &:before{
                       background: @main-color;

                        -o-transition: all 10ms ease-in-out;
                        transition: all 10ms ease-in-out;
                    }
                }
                &:before{
                        width: 32px;
                        font-weight: @font-weight__black;
                        background: #000000;

                        -o-transition: all 600ms ease-in-out;
                        transition: all 600ms ease-in-out;
                }
            }
        }

        &-actions {
            margin-bottom: @indent__m;
            padding: 0 @indent__s;
        }

        &-label {
            font-weight: @font-weight__bold;

            &:after {
                content: ': ';
            }
        }

        &-options {
            margin: 0;
            border: 0;
            padding: 20px;
            border-top: 6px solid @main-color;
            background-color: #f8f8f8;
            margin-bottom: 15px;
            
            &.open {
                .toggle-minus {
                    .ox-toggle-minus-opened();
                }
            }
            // &:not(.open){
            //     .filter-options-content{
            //         margin-top: 0;
            //         margin-bottom:0;
            //         padding-top:0;
            //         padding-bottom: 0;
            //     }
            // }
            // &-item {
            //     border-bottom: @border-width__base solid @border-color__base;
            //     padding-bottom: @indent__s;
            // }

            &-title {
            .ox-toggle-title();
                &:hover {
                    .toggle-minus{
                        .ox-toggle-minus-hover();
                    }
                }
            }

            &-content {
                margin: 0;
                padding-top:17px;
                font-family: @tiny-font;
                font-size: 13px;
                line-height: 16px;
                // transition: 300ms;
                // transition-property: max-height, padding, margin;
                // display: block!important;
                // overflow: hidden;
                // max-height: 0;
                .item {
                    display:flex;
                    line-height: 1.5em;
                    margin: @indent__s 0;
                    input {
                        margin: 6px 7px 0 0;
                        top: 0;
                    }
                    .ox-checkbox {
                        width:16px;
                        height: 16px;
                        position:relative;
                        line-height: 0;
                        display: inline-block;
                        border: 2px solid;
                        vertical-align: text-top;
                        margin: 0 7px 0 0;
                        cursor:pointer;
                        &:after {
                            content: "";
                            position: absolute;
                            display: none;
                            left: 2px;
                            top: 6px;
                            width: 4px;
                            height: 2px;
                            transform: rotate(45deg);
                            background: currentColor;
                        }
                        &:before{
                            content: "";
                            position: absolute;
                            display: none;
                            left: 4px;
                            top: 5px;
                            width: 6px;
                            height: 2px;
                            transform: rotate(-45deg);
                            background: currentColor;
                        }
                    }
                    input:checked + label {
                        .ox-checkbox{
                            &:before,
                            &:after {
                                display: block;
                            }
                        }
                    }
                }
                .ui-slider,
                .ox-price-slider{
                    height: 6px;
                    background: #e4e4e4;

                    border-radius: 0;
                    margin: 10px 5px 15px;
                    .ui-slider-handle{

                        -o-transition: none;
                        transition: none;
                        position: absolute;
                        z-index: 2;
                        cursor: w-resize;
                        top: -4px;
                        background: #000;
                        height: 14px;
                        width: 10px;
                        line-height: 0;
                        padding: 0;

                        border-radius: 0;
                        &:hover{
                            background: #000;
                        }
                    }
                    .ui-slider-range{
                        background: @main-color;
                        height: 6px;
                        position:relative;
                    }
                }
                .ox-seleted-item{
                    .label,
                    a {
                        background-color: #000000;
                        color:#ffffff;
                    }
                }
                .ox-layered__items--checkbox .label,
                a {
                    margin-left: -5px;
                    margin-right: -5px;
                    padding: 5px 8px 4px;
                    display: inline-block;
                    line-height:1.3;
                    transition: all 600ms ease-in-out;
                    &:hover {
                        background-color: #000000;
                        color:#ffffff;
                        text-decoration: none;
                        transition: all 10ms ease-in-out;
                    }
                    &.swatch-option-link-layered{
                        display: block;
                    }
                }

                .count {
                    .lib-css(color, #adadad);
                    padding: 5px 8px 4px;
                    float: right;
                    line-height:16px;
                    margin-left:auto;
                    transition: all 600ms ease-in-out;
                }
                .ox-layered__items--checkbox label,
                a {
                    &:hover {
                        & + .count {
                            background-color: @color-gray91;
                            color:#333333;
                            transition: all 10ms ease-in-out;
                        }
                    }
                }
                .filter-count-label {
                    &:extend(.abs-visually-hidden all);
                }
            }
        }
    }
    .sidebar-nobg{
        .filter-actions {
            .action.clear,
            .filter-clear {
                background: none;
                color: inherit;
                border-bottom: 2px solid;
                padding: 0;
                margin-top: 10px;
                &:hover{
                    background: none;
                }
                &:after{
                    content:none;
                }
            }
        }
        .filter-current {
            .action.remove {
                &:hover:before,
                &:before {
                    background: none;
                    color: inherit;
                }
                &:after{
                    background: none;
                }
            }
            .item{
                padding: 5px 10px 5px 32px;
            }
        }
        .filter-options{
            padding: 23px 0;
            //border-top: 1px solid #e4e4e4;
            background-color: transparent;
            margin-bottom: 0;
            &:first-child{
                border:none;
                padding-top: 0;
            }
        }
        .filter-options-content{
            font-family: inherit;           
        }
    }
    .filters-toggle-hide ~ .filter-content .filter-current{
            padding-top: 23px;
    }
    .ox-slideout{
        .filters-slideout-content{
            padding:35px;
            display:block;
            position:relative;
        }
    }
}

//
//  Mobile
//  _____________________________________________
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__xs) {
    .ox-slideout{
        .filters-slideout-content{
            padding:25px;
        }
    }
}

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
    .filters-slideout-content{
        display:none;
    }

    .filter {
        &.active {
            position: relative;
            visibility: visible;
            z-index: 99;

            // .filter-options-item:last-child {
            //     margin-bottom: @indent__xl;
            // }

            .filter-title {
                border-bottom: 1px solid @border-color__base;
                height: 48px;
                left: 0;
                position: fixed;
                right: 0;
                top: 0;
                z-index: 2;

                strong {
                    .lib-css(box-shadow, none);
                    background: none;
                    border: 0;
                    color: transparent;
                    left: auto;
                    right: 3px;
                    top: 10px;
                    /*.lib-icon-font(
                    @icon-remove,
                    @_icon-font-color: @text__color__muted,
                    @_icon-font-size: 16px,
                    @_icon-font-position: after
                    );*/
                }
            }

            .filter-subtitle {
                //.lib-css(background, @toolbar-background);
                display: block;
                height: 50px;
                left: 0;
                line-height: 32px;
                position: fixed;
                right: 0;
                top: 0;
                z-index: 1;
            }

            .filter-options {
                .lib-css(background, @color-white);
                bottom: 0;
                display: block;
                left: 0;
                overflow: scroll;
                position: fixed;
                right: 0;
                top: 50px;
                z-index: 10;
            }
        }
        &-actions{
            margin-bottom:0;
        }
        &-options{
            &:last-child{
                margin-bottom:0;
            }
        }
    }

    .filter {
        & &-subtitle {
            font-size: 20px;
            font-weight: @font-weight__light;
        }

    }
    .filter .filter-current {
            padding: 20px 10px;
            min-height: 52px;
            background: #f8f8f8;
            display:flex;

            flex-flow: row wrap;

            align-items: center;
            margin-bottom: 15px;
        .items {
            /*display: none;*/
            margin: 5px 0 0 10px;
            padding: 10px 0 0 0;
            width: 100%;
            border-top: none;
        }

        &-subtitle {
            min-height: 24px;
            padding: 0 10px;
            position: relative;
            text-transform: uppercase;
            z-index: 1;
            width: 100%;
            display: flex;
            align-items: center;
            word-break: initial;
            &:after {
                content: ' (' attr(data-count) ')';
                margin-left: 5px;
                margin-right:auto;
                order: 1;
            }
        }

        &.active {
            /*.toggle-minus{
                .ox-toggle-minus-opened();
            }*/
            .items {
                display: block;
            }

            & + .block-actions {
                display: block;
                padding: 0 20px 20px 20px;
                background: #f8f8f8;
            }
        }

        & + .block-actions {
            display: none;
        }
    }
    .sidebar-nobg {
        .filter {
            .filter-current {
                padding: 8px 0 23px 0;
                background-color: transparent;
                margin-bottom: 0;
                .items{
                    margin-left: 0;
                }
            }
            .filter-current-subtitle{
                padding: 0;
            }
        }
    }
    .filter-no-options {
        .filter-title {
            &:before {
                background: rgba(255,255,255,.5);
                content: '';
                display: block;
                height: 40px;
                left: -15px;
                margin-top: -60px;
                position: relative;
                width: 100px;
                z-index: 99;
            }
        }

        .filter-content {
            margin-bottom: @indent__base;
        }
    }

    .page-with-filter {
        .columns {
            .sidebar-main {
                margin:0;
                order:0;
            }
        }
    }
}

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {

    .filter {
        &.block {
            display:block;
        }
        &-title {
            display: none;
        }

        &-actions {
            margin-bottom: @indent__l;
        }
        &-subtitle {
            display: block;
            position: static;
        }
    }
}
