/*
Filter panel
==============================================
Styling for filter panel component.
This file contains the generic styling for all filter items.
*/

.filter-panel {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    margin-bottom: 8px;
}

.icon.icon-filter-panel-item-toggle {
    margin-left: 8px;

    > svg {
        top: 4px;
    }
}

.filter-panel-items-container {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    margin-bottom: 8px;
    width: 100%;
}

.filter-panel-item {
    margin-right: 12px;
    margin-bottom: 12px;

    .filter-panel-item-toggle {
        border: 1px solid $border-color;
        font-weight: $font-weight-normal;
    }
}

.filter-panel-item-toggle.show {
    color: $primary;
    border-color: $primary;

    .icon-filter-panel-item-toggle svg {
        color: $primary;
        transform: rotate(180deg);
    }
}

.filter-panel-item-dropdown {
    min-width: 240px;
    max-height: 200px;
    overflow: auto;
    padding: 13px 0;
}

.filter-panel-submit {
    height: 40px;
    margin-bottom: 12px;
    border: 1px solid $primary;
    background-color: $white;
    color: $dark;
}

.filter-active {
    @include text-truncate();
    display: inline-block;
    align-items: center;
    padding: 2px 35px 2px 14px;
    border-radius: 50px;
    height: 32px;
    line-height: 26px;
    border: 1px solid $border-color;
    margin-right: 6px;
    margin-bottom: 8px;
    vertical-align: top;
    position: relative;
    max-width: 245px;
}

.filter-active-preview {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid $border-color;
    margin-right: 8px;
    background-position: center center;
    background-size: cover;
    vertical-align: text-bottom;
}

.filter-active-remove {
    padding: 0 12px;
    margin: 0;
    line-height: 1;
    border: 0 none;
    font-weight: $font-weight-bold;
    color: $dark;
    font-size: 16px;
    background-color: transparent;
    appearance: none;
    position: absolute;
    top: 0;
    right: 0;
    display: block;
    height: 100%;
    bottom: 0;
    width: 35px;
    text-align: left;

    &:focus {
        outline: none;
    }

    &:hover {
        color: $primary;
    }
}

.btn.filter-reset-all {
    display: inline-block;
    border-radius: 50px;
    height: 32px;
    line-height: 26px;
    font-weight: $font-weight-normal;
    vertical-align: top;
    margin-right: 8px;
}

.is--sidebar {
    .filter-panel,
    .filter-panel-items-container {
        display: block;
    }

    .filter-panel-item-dropdown {
        min-width: 100%;
        border: 1px solid $primary;
        border-top: 0;
        border-radius: 0 0 4px 4px;
    }

    .filter-panel-item {
        margin-right: 0;
        width: 100%;
    }

    .filter-panel-item-toggle {
        text-align: left;
        display: flex;

        &[aria-expanded='true'] {
            color: $primary;
            border-color: $primary;
            border-bottom-left-radius: 0;
            border-bottom-right-radius: 0;
            border-bottom: 0 none;

            svg {
                color: $primary;
                transform: rotate(180deg);
            }
        }
    }

    .icon-filter-panel-item-toggle {
        margin-left: auto;

        > svg {
            top: 0;
        }
    }
}

.is-loading {
    .filter-panel-item-toggle,
    .filter-active,
    .filter-reset-all,
    .filter-boolean,
    .filter-panel-submit {
        pointer-events: none;
        opacity: 0.6;
    }
}

.btn.filter-panel-wrapper-toggle {
    display: none;
    width: 100%;
    padding: 6px;

    .icon {
        color: $primary;
        width: 20px;
        height: 20px;
        margin-right: 6px;
    }

    &:hover {
        background-color: $gray-200;
        color: $primary;
    }
}

.filter-panel-offcanvas-only {
    display: none;
}

.filter-panel-offcanvas-header {
    height: 80px;
    align-items: center;
    padding: 25px;
    display: none;
}

.filter-panel-offcanvas-title {
    margin-bottom: 0;
    font-size: $h3-font-size;
    font-weight: $font-weight-bold;
    color: $headings-color;
}

.filter-panel-offcanvas-close {
    cursor: pointer;
    margin-left: auto;
}

@include media-breakpoint-down(lg) {
    .btn.filter-panel-wrapper-toggle {
        display: block;
    }

    .filter-panel-wrapper {
        display: none;
    }
}

.offcanvas-filter {
    overflow: hidden;

    .filter-panel-offcanvas-close {
        display: block;
    }

    .filter-panel {
        height: calc(100% - 80px);
        overflow-y: auto;
        width: 100%;
        padding: 0 25px 25px;
    }

    .filter-panel-offcanvas-header {
        display: flex;
    }

    .filter-panel-offcanvas-only {
        display: inherit;
    }
}
