/*** Search ***********************************************************************************************************/

/** Nav triggers **/

.hn_search_icon{
    background: transparent;
    color: var(--corporate-red-2);
    font-size: 1.15rem;
    padding: 0 0 0 12px;
    line-height: 1;
    cursor: pointer;
}

.hn_search_trigger{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 120px;
    height: 38px;
    padding: 0 14px;
    border: 1px solid var(--grey-85) !important;
    border-radius: 100px;
    background-color: white;
    color: var(--grey-80);
    font-size: .9rem;
    text-align: left;
    cursor: text;
    transition: border-color .2s ease, box-shadow .2s ease;
}

/* Variant shown within the mobile header, from 576px until the desktop nav takes over */
.hn_search_trigger_sm{
    display: none;
    width: 160px;
    height: 34px;
    margin-left: 12px;
}

.hn_search_trigger .fa-search{
    color: var(--corporate-red-2);
}

.hn_search_trigger:hover{
    border-color: var(--grey-80) !important;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .08);
}

/** Layer **/

body.search_open{
    overflow: hidden;
}

.search_overlay{
    position: fixed;
    inset: 0;
    z-index: 1060;
    background-color: rgba(0, 0, 0, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
}

.search_overlay.is_open{
    opacity: 1;
    visibility: visible;
}

.search_panel{
    background-color: white;
    padding: 14px 16px 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .15);
    transform: translateY(-20px);
    transition: transform .2s ease;
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

.search_overlay.is_open .search_panel{
    transform: translateY(0);
}

.search_form{
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
}

.search_form_icon{
    position: absolute;
    left: 16px;
    color: var(--grey-80);
    pointer-events: none;
}

.search_input{
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0 16px 0 42px;
    border: 1px solid var(--grey-85);
    border-radius: 100px;
    font-size: 1rem;
    color: var(--black-text);
    outline: none;
}

.search_input:focus{
    border-color: var(--corporate-red-2);
    box-shadow: 0 0 0 3px rgba(221, 51, 51, .15);
}

.search_input::-webkit-search-cancel-button{
    cursor: pointer;
}

.search_submit{
    display: none;
    flex: 0 0 auto;
    width: auto;
    height: 48px;
    margin: 0;
    padding: 0 26px;
    border-radius: 100px;
    color: white;
    line-height: 48px;
}

.search_close{
    background: transparent;
    color: var(--black-text);
    font-size: 1.3rem;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    cursor: pointer;
}

.search_suggestions{
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    overflow-y: auto;
}

.search_suggestions:not(:empty){
    margin-top: 10px;
    border-top: 1px solid var(--grey-93);
}

.search_suggest_item{
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--black-text);
    text-decoration: none;
}

.search_suggest_item:hover,
.search_suggest_item.is_active{
    background-color: var(--grey-95);
    color: var(--black-text);
}

.search_suggest_image{
    flex: 0 0 64px;
    width: 64px;
    height: 48px;
    object-fit: contain;
}

.search_suggest_text{
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}

.search_suggest_brand{
    display: block;
    font-size: .72rem;
    font-weight: bold;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--corporate-red-2);
}

.search_suggest_name{
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search_suggest_type{
    font-size: .75rem;
    color: var(--grey-80);
}

.search_suggest_price{
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-weight: bold;
    white-space: nowrap;
}

.search_suggest_price_old{
    font-weight: normal;
    font-size: .8rem;
    color: var(--grey-80);
    text-decoration: line-through;
}

.search_suggest_message{
    padding: 14px 10px;
    color: var(--grey-80);
    font-size: .9rem;
}

.search_suggest_all{
    display: block;
    padding: 12px 10px 6px;
    text-align: center;
    font-weight: bold;
    color: var(--corporate-red-2);
}

/** Results page **/

.search_page{
    padding-left: 16px;
    padding-right: 16px;
}

.search_page_header{
    margin-bottom: 1rem;
}

.search_page_header .h1{
    font-size: 1.5rem;
    margin-bottom: .25rem;
    word-break: break-word;
}

.search_page_count{
    color: var(--grey-80);
    margin: 0;
}

.search_layout{
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.search_results{
    flex: 1;
    min-width: 0;
}

.search_results_toolbar{
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: .75rem;
}

.search_filters_toggle{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--grey-85) !important;
    border-radius: 100px;
    background-color: white;
    color: var(--black-text);
}

.search_filters_toggle:hover,
.search_filters_toggle:focus{
    color: var(--black-text);
    background-color: var(--grey-95);
}

.search_filters_badge{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background-color: var(--corporate-red-2);
    color: white;
    font-size: .75rem;
}

.search_chips{
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.search_chip{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 100px;
    background-color: var(--grey-93);
    color: var(--black-text);
    font-size: .85rem;
    text-decoration: none;
}

.search_chip:hover{
    background-color: var(--grey-85);
    color: var(--black-text);
}

.search_chip_clear{
    background-color: transparent;
    text-decoration: underline;
}

.search_products{
    justify-content: flex-start;
}

/* Type and subcategory above the product name. Inherits the subcategory color on motos, like the rest of the texts */
.search_card_meta{
    margin-bottom: .35rem;
    font-size: .72rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    opacity: .7;
}

.search_pagination{
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.search_pagination .page-link{
    color: var(--black-text);
}

.search_pagination .page-item.active .page-link{
    background-color: var(--corporate-red-2);
    border-color: var(--corporate-red-2);
    color: white;
}

.search_empty{
    text-align: center;
    padding: 3rem 1rem;
    color: var(--grey-80);
}

.search_empty .fa-search{
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/** Filters (mobile: slide-in panel) **/

.search_filters{
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1060;
    width: min(340px, 90vw);
    background-color: white;
    box-shadow: 4px 0 30px rgba(0, 0, 0, .15);
    transform: translateX(-105%);
    transition: transform .25s ease;
    overflow-y: auto;
    padding: 0 16px;
}

.search_filters.is_open{
    transform: translateX(0);
}

.search_filters_head{
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    background-color: white;
    border-bottom: 1px solid var(--grey-93);
}

.search_filters_heading{
    margin: 0;
    font-weight: bold;
    font-size: 1.1rem;
}

.search_filter_group{
    padding: 14px 0;
    border-bottom: 1px solid var(--grey-93);
}

.search_filter_title{
    font-weight: bold;
    margin-bottom: 8px;
}

.search_filter_subtitle{
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--grey-80);
    margin: 10px 0 4px;
}

.search_filter_option label{
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    cursor: pointer;
    font-size: .92rem;
}

.search_filter_option input[type="checkbox"]{
    accent-color: var(--corporate-red-2);
    flex: 0 0 auto;
}

.search_filter_suboptions{
    padding-left: 22px;
}

.search_filter_suboptions label{
    font-size: .85rem;
}

.search_filter_count{
    margin-left: auto;
    color: var(--grey-80);
    font-size: .8rem;
}

.search_filter_collapsible:not(.show_all) .search_filter_extra{
    display: none;
}

.search_size_options{
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.search_size_option{
    position: relative;
    display: inline-flex;
    margin: 0;
    cursor: pointer;
}

/* The checkbox stays in the DOM (keyboard and form submit), only the pill is visible */
.search_size_option input{
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.search_size_option span{
    display: inline-block;
    min-width: 40px;
    padding: 5px 10px;
    border: 1px solid var(--grey-85);
    border-radius: 100px;
    background-color: white;
    color: var(--black-text);
    font-size: .82rem;
    text-align: center;
    transition: border-color .15s ease, background-color .15s ease;
}

.search_size_option:hover span{
    border-color: var(--grey-80);
}

.search_size_option input:focus-visible + span{
    outline: 2px solid var(--corporate-red-2);
    outline-offset: 2px;
}

.search_size_option input:checked + span{
    background-color: var(--corporate-red-2);
    border-color: var(--corporate-red-2);
    color: white;
}

.search_filter_more{
    background: transparent;
    padding: 6px 0 0;
    color: var(--corporate-red-2);
    text-decoration: underline;
    font-size: .85rem;
}

.search_type_switch{
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.search_type_option{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--grey-85);
    border-radius: 100px;
    color: var(--black-text);
    font-size: .88rem;
    text-decoration: none;
}

.search_type_option span{
    color: var(--grey-80);
    font-size: .78rem;
}

.search_type_option:hover{
    border-color: var(--grey-80);
    color: var(--black-text);
}

.search_type_option.active{
    background-color: var(--corporate-red-2);
    border-color: var(--corporate-red-2);
    color: white;
}

.search_type_option.active span{
    color: white;
}

.search_type_option.disabled{
    opacity: .45;
    pointer-events: none;
}

.search_price_range{
    display: flex;
    align-items: center;
    gap: 6px;
}

.search_price_range .form-control{
    min-width: 0;
    padding-left: 10px;
    padding-right: 6px;
    font-size: .85rem;
}

.search_price_apply{
    width: 100%;
    margin-top: 8px;
    border-radius: 100px;
    color: white;
}

.search_filters_footer{
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 0;
    background-color: white;
}

.search_filters_footer .btn{
    border-radius: 100px;
    color: white;
}

.search_clear_filters{
    color: var(--black-text);
    text-decoration: underline;
    font-size: .9rem;
}

body.search_filters_open::after{
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1059;
    background-color: rgba(0, 0, 0, .45);
}

body.search_filters_open{
    overflow: hidden;
}

/*** Media queries ***/

@media (min-width: 576px){

    .search_submit{
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .hn_search_icon{
        display: none;
    }

    .hn_search_trigger_sm{
        display: inline-flex;
    }

    .search_panel{
        padding: 20px 24px 14px;
    }
}

@media (min-width: 992px){

    .search_page{
        padding-left: 15px;
        padding-right: 15px;
    }

    .search_page_header .h1{
        font-size: 1.9rem;
    }

    /* Filters become a static sidebar */

    .search_filters{
        position: sticky;
        top: 75px;
        z-index: auto;
        flex: 0 0 300px;
        width: 300px;
        max-height: calc(100vh - 90px);
        padding: 4px 22px 0;
        border-radius: 12px;
        box-shadow: none;
        transform: none;
        transition: none;
    }

    .search_filters_head .search_close,
    .search_filters_toggle,
    .js-search-filters-close.btn{
        display: none;
    }

    .search_filters_footer{
        position: static;
        padding-top: 14px;
    }

    body.search_filters_open::after{
        display: none;
    }

    .search_products .outer_product_card{
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (min-width: 1200px){

    .search_products .outer_product_card{
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }

    .hn_search_trigger{
        width: 150px;
    }
}

@media (min-width: 1600px){

    .search_products .outer_product_card{
        flex: 0 0 25%;
        max-width: 25%;
    }
    .hn_search_trigger{
        width: 200px;
    }
}
