/* Kuulaportti 2.0 marketplace browse layout
   Modern baseline: evergreen browsers, CSS flexbox and Bootstrap 4 utilities. */

.kp-market-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-right: -12px;
    margin-left: -12px;
}
.kp-market-filter-column,
.kp-market-content-column {
    position: relative;
    width: 100%;
    min-width: 0;
    padding-right: 12px;
    padding-left: 12px;
}
.kp-market-filter-column {
    flex: 0 0 clamp(228px, 18vw, 258px);
    max-width: clamp(228px, 18vw, 258px);
}
.kp-market-content-column {
    flex: 1 1 0;
    max-width: calc(100% - clamp(228px, 18vw, 258px));
}
.kp-market-layout.filters-collapsed .kp-market-content-column {
    flex-basis: 100%;
    max-width: 100%;
}
.kp-market-compact-tools {
    display: none;
}
.kp-market-wide-action {
    display: inline-flex;
    align-items: center;
}
.kp-market-toolbar .card-body > .d-flex {
    min-width: 0;
}
.kp-market-chip-row {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.kp-market-chip-row .kp-category-chip {
    flex: 0 0 auto;
}

@media (max-width: 1399.98px) {
    .kp-market-compact-tools {
        display: block;
    }
    .kp-market-wide-action {
        display: none !important;
    }
    .kp-card-title {
        display: -webkit-box !important;
        overflow: hidden;
        white-space: normal !important;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        min-height: 2.6em;
    }
    .kp-market-card-main .kp-line-clamp {
        -webkit-line-clamp: 1;
    }
}

/* One responsive listing grid replaces the old user-selectable view modes. */
@media (min-width: 1400px) {
    body.kp-marketplace-browse-page #market-grid > .kp-market-grid-item {
        flex: 0 0 25%;
        max-width: 25%;
    }
}
@media (min-width: 1200px) and (max-width: 1399.98px) {
    body.kp-marketplace-browse-page #market-grid > .kp-market-grid-item {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}
@media (min-width: 576px) and (max-width: 1199.98px) {
    body.kp-marketplace-browse-page #market-grid > .kp-market-grid-item {
        flex: 0 0 50%;
        max-width: 50%;
    }
}
@media (max-width: 991.98px) {
    .kp-market-layout {
        display: block;
        margin: 0;
    }
    .kp-market-filter-column,
    .kp-market-content-column,
    .kp-market-layout.filters-collapsed .kp-market-content-column {
        width: 100%;
        max-width: 100%;
        padding: 0;
    }
}
@media (max-width: 575.98px) {
    body.kp-marketplace-browse-page #market-grid > .kp-market-grid-item {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Select2 4.1 renders the clear control next to the arrow. Keep both controls
   independently clickable and reserve enough room for them in the label. */
body.kp-marketplace-browse-page #market-filter-col .select2-container .select2-selection--single {
    position: relative;
}
body.kp-marketplace-browse-page #market-filter-col .select2-container .select2-selection--single .select2-selection__rendered {
    padding-right: 3.35rem !important;
}
body.kp-marketplace-browse-page #market-filter-col .select2-container .select2-selection--single .select2-selection__clear {
    position: absolute;
    top: 50%;
    right: 1.75rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    float: none;
    width: 1.3rem;
    height: 1.3rem;
    margin: 0;
    padding: 0;
    overflow: hidden;
    color: inherit;
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
    background: rgba(152, 166, 173, .2);
    border: 0;
    border-radius: 50%;
    transform: translateY(-50%);
}
body.kp-marketplace-browse-page #market-filter-col .select2-container .select2-selection--single .select2-selection__clear:hover,
body.kp-marketplace-browse-page #market-filter-col .select2-container .select2-selection--single .select2-selection__clear:focus {
    background: rgba(152, 166, 173, .36);
}
body.kp-marketplace-browse-page #market-filter-col .select2-container .select2-selection--single .select2-selection__clear > span {
    font-size: 1rem;
    line-height: 1;
}
body.kp-marketplace-browse-page #market-filter-col .select2-container .select2-selection--single .select2-selection__arrow {
    right: .2rem;
    z-index: 1;
}
