@grid: 960px;
@grid-md: 660px;
@grid-sm: 480px;

@em: 18em;

@c-brand: #6d548d;
@c-line-dark:  #373737;
@c-grey: #636363;

#container #id_image {
    width: 100%;
    background: url(../../img/select-arrow.png) center right 10px no-repeat, #fff;
    background-size: 15px;
    -webkit-appearance: none;
    -moz-appearance: none;
    display: inline;
    padding-right: 40px;

    @media all and (min-width: 960px) {
        width: 40%;
    }

    &:focus {
        outline-color: transparent;
        outline-style: none;
    }
}

::-ms-expand {
    display: none;
}

.btn-holder {
    display: inline-block;

    @media all and (min-width: 960px) {
        display: inline-block;
    }
    a {
        padding: 0 1.11111111em;
        text-decoration: none;
        color: #fff;
        border-right: 1px solid #373737;
        box-sizing: border-box;

        &:last-child {
            border-right: none;
            padding-right: 0;
        }
    }

}
@media all and (max-width: (@grid + 1)) {
    .btn-holder {
        display: block;
        margin: 14/@em 0;
        overflow: hidden;
    }
}

&:first-child {
    @media all and (max-width: 540px){
        a {
            width: auto;
            max-width: auto;
        }
    }
}
&:first-child {
    @media all and (max-width: 420px) {
        .btn-holder {
            margin: 0;
        }
        a {
            display: inline-block;
            float: left;
            width: 50%;
            max-width: 50%;
            border-right: none;
            text-align: left;
            padding: 5/@em 0;
            border-bottom: 1px solid @c-line-dark;
            line-height: 40/@em;
            &:nth-child(2n -1) {
                border-right: 1px solid @c-line-dark;
            }
            &:nth-child(2n) {
                padding-left: 16/@em;
            }
        }
    }
}

.block-image-selector {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
    color: #fff;
    z-index: 99999999999;
    background-color: #000;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    padding: 40/@em;

    .control-area {
        right: 3.5em;
        top: 3.3em;
    }

    .inline-container {
        width: auto;
        &:first-child {
            float: left;
        }
        .field-container {
            display: inline-block;
            float: left;
            width: auto;
            margin-bottom: 10/@em;
            input[type="search"] {
                position: relative;
                background: url(../../img/search.png) center right 10px no-repeat, #fff;
                background-size: 20px;
                border: 1px solid #000;
            }
        }
    }

    select {
        padding: 8.5/@em 8.5/@em 8.5/@em 9.5@em;
        background: #fff;
    }
}

.select-wrapper {
    position: relative;
}
.select-wrapper select {
    z-index:1;
}

.select-wrapper:before {
    display:block;
    position:absolute;
    pointer-events: none;
    content:'';
    right:10px;
    top:5px;
    height:30px;
    width:20px;
    margin:2px;
    background: #fff;
    z-index:5;
}

.select-wrapper:after {
    display:block;
    position:absolute;
    pointer-events: none;
    content: "";
    background-image: url(../../img/select-arrow.png);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 15px;
    right:10px;
    top:15px;
    height:15px;
    width:15px;
    z-index:10;
}


#container select#category {
    padding-right: 40px;
}


.image-grid {
    width: 100%;
    padding: 20/@em;
    padding-bottom: 0;
    overflow: hidden;
    box-sizing: border-box;
    position: relative;
    z-index: 5;
}

.grid-item {
    box-sizing: border-box;
    display: block;
    float: left;
    padding: 20/@em;
    text-align: center;
    border: 1px solid @c-line-dark;
    border-top: 1px solid transparent;
    border-left: 1px solid transparent;
    .image {
        width: 100%;
        overflow: hidden;
        background: @c-line-dark;
        position: relative;
        img {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translateX(-50%) translateY(-50%);
            width: 100%;
            margin: auto;
        }
    }

    .image.spinner {
        background: url(../../img/loader.gif) no-repeat center #373737;
    }


    h5 {
        margin-top: 5/@em;
        margin-bottom: 0;
        color: #fff;
        font-size: 14/@em;
        word-wrap: break-word;
    }
    p {
        font-size: 14/@em;
        margin-bottom: 0;
        color: @c-grey;
        font-weight: 800;
    }
}


@media all and (min-width: @grid) {
    .grid-item {
        width: 20%;
        .image {
            height: calc(20vw ~"-" (68/@em));
        }
    }
    .grid-item:nth-child(5n+5) {
        border-right: 1px solid transparent
    }
    .grid-item:nth-child(5n+1) {
        border-left: 1px solid transparent
    }
}

@media all and (min-width: 741px) and (max-width: @grid) {
    .grid-item {
        width: 25%;
        .image {
            height: calc(25vw ~"-" (72/@em));
        }
    }
    .grid-item:nth-child(4n+4) {
        border-right: 1px solid transparent
    }
    .grid-item:nth-child(4n+1) {
        border-left: 1px solid transparent
    }

}

@media all and (min-width: (@grid-md + 1)) and (max-width: 740px) {
    .grid-item {
        width: 100/3%;
        .image {
            height: calc((100/3vw) ~"-" (82/@em));
        }
    }
    .grid-item:nth-child(3n+3) {
        border-right: 1px solid transparent
    }
    .grid-item:nth-child(3n+1) {
        border-left: 1px solid transparent
    }
}

@media all and (max-width: @grid-md) {
    .grid-item {
        width: 50%;
        .image {
            height: calc(50vw ~"-" (102/@em));
        }
    }
    .grid-item:nth-child(2n+2) {
        border-right: 1px solid transparent
    }
    .grid-item:nth-child(2n) {
        border-left: 1px solid transparent
    }
}

@media all and (max-width: 480px) {
    .block-image-selector {
        padding: 20px;
        .control-area {
            position: absolute;
            right: 20px;
            top: 20px;
        }
    }
    .image-grid {
        padding: 0;
    }
    .grid-item {
        .image {
            height: calc(50vw ~"-" 62px);
        }
        h5 {
            display: none;
        }
        p {
            display: none;
        }
    }
}
.grid-item:hover {
    border: 1px solid #fff;
}

.block-image-selector .btn-row {
    text-align: left;
    position: relative;
    top: -1px;
    text-align: center;
    a {
        color: #fff;
    }
    .back {
        position: absolute;
        left: 0;
        line-height: 50/@em;
    }
    span a {
        vertical-align: center;
        line-height: 50/@em;
        text-decoration: none;
        &.active {
            color: @c-brand;
            font-weight: 800;
        }
    }
    .next {
        position: absolute;
        right: 0;
        line-height: 50/@em;
    }
}

.block-image-selector .btn-row, .block-change-image .btn-row {
    border-top: 1px solid @c-line-dark;
    border-color: @c-line-dark;
    font-size: 16/@em;
}

.block-change-image .btn-row {
    margin-top: 20/@em;
    text-align: right;
    @media all and (max-width: @grid-sm) {
        a {
            display: block;
            text-align: right;
            margin-left: 0;
            font-weight: 400;
        }
    }
}

.btn-row.last-page {
    .next {
        color: @c-line-dark;
        pointer-events: none;
    }
}

.btn-row.first-page {
    .back {
        color: @c-line-dark;
        pointer-events: none;
    }
}
