@import url('https://use.fontawesome.com/releases/v5.6.3/css/all.css');
@import './variables.scss';

$color-checkbox-background: #fff;

.category-filter {
    box-sizing: border-box;
    width: 100%;
    padding: 0 20px;
    
    font: inherit;
}

.category-filter__icon-base {
    box-sizing: border-box;
    width: 18px;
    height: 18px;
    padding: 4px;
    outline: none;

    color: $colorGreyLight;
    cursor:pointer;
}

/* the collapse/expand icon */
.category-filter__collapse {
    @extend .category-filter__icon-base;
    transition: transform 200ms;
}

.category-filter__collapse--open {
    @extend .category-filter__icon-base;
    
    transform:rotate(0deg);
}

.category-filter__collapse--semi-open {
    @extend .category-filter__icon-base;
    
    transform:rotate(90deg);
}

.category-filter__collapse--closed {
    @extend .category-filter__icon-base;
    
    transform:rotate(180deg);
}

/* the wrapper around the checkbox values */
%category-filter__value-set-shared { 
    height:auto; 
    overflow: hidden;
    overflow-y:auto;
    
    font-family: $font;
    font-size: $fontSizeXS;

    margin-bottom: 10px;
    color: $colorLight;
}

.category-filter__value-set--open {   
   @extend %category-filter__value-set-shared;
}

.category-filter__value-set--closed {   
   @extend %category-filter__value-set-shared; 
    max-height: 0px;  
}

.category-filter-name__wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;

    .category-filter-name {
        font-weight: bold;
        font-family: $font;
        font-size: $fontSizeS;
        color: $colorGreyLight;
        cursor: pointer;

        // Prevent the counts from being selectable..
        user-select: none;
    }
}

.category-filter-value__wrapper {
    position: relative;
    display: flex;
    justify-content: flex-start;
    align-items: center;

    // Prevent the counts from being selectable..
    user-select: none;

    margin-top: 0.75rem;

    .category-filter-value {
        cursor: pointer;
        min-width: 0;
        flex-shrink: 1;
        margin-right: 5px;
    }

    .highlighted-value-match {
        color: $colorBrandLight;
        font-weight: bold;
    }

    .category-filter-value__count {
        margin-left: auto;
        color: $colorGreyLight;
        cursor: default;
    }
}

.category-filter__checkbox {
    background: transparent;
    position: relative;
    width: 16px;
    height: 16px;
    overflow: visible;
    font-family: $fontIcon;
    margin: 6px 11px;
    appearance: none;
    cursor: pointer;

    &:before {
        display: block;
        box-sizing: border-box;
        content: ' ';

        position: relative;
        top: 0;
        left: 0;

        background-color: $colorNavyMedium;
        border: 2px solid $colorBrandLight;
        border-radius: 2px;
    
        width: 16px;
        height: 16px;
    }

    &:checked:after {
        display: block;
        box-sizing: border-box;

        font-family: $fontIcon;
        font-weight: 900;
        font-size: 10px;
        -webkit-font-smoothing: antialiased;
        content: '\f00c';
        color: $colorBrandLight;

        position: absolute;
        top: 0;
        left: 0;

        font-style: normal;
        font-variant: normal;
        text-rendering: auto;
        line-height: 1;

        width: 16px;
        height: 16px;
        padding: 3px 3px 2px 3px;
    }
}
