﻿/* SOLO AUTOCOMPLETE + FILTRI. NON CONTIENE SELETTORI DELLA LISTA NATIVA TERMOBOZZO. */
/* TERMOBOZZO RICERCA V2 - SOLO POPUP + FILTRI.
   NON MODIFICA LA LISTA PRODOTTI TERMOBOZZO.
   2026-09-03 */


/* =========================================================
   AUTOCOMPLETE: piu' largo e leggibile su desktop
   ========================================================= */
#divRicerca.ricerca-v2-panel {
    /* CLEAN REBUILD: popup dentro la navbar originale Termobozzo. */
    position: absolute !important;
    /* Il nav e' piu' alto del campo desktop: risaliamo fino al bordo del campo. */
    top: calc(100% - 48px) !important;
    right: 12px !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 9999 !important;
    width: min(720px, calc(100vw - 24px)) !important;
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: min(78vh, 760px);
    margin: 0 !important;
    overflow-x: hidden;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dedede;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 22px 52px rgba(0,0,0,.20);
    transform: none !important;
    overscroll-behavior: contain;
}

#divRicerca.ricerca-v2-panel.ricercaAperta { display: block !important; }

.ricerca-v2-topbar {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    min-height: 46px;
    align-items: center;
    justify-content: space-between;
    padding: .7rem 1rem;
    color: #5f5f5f;
    background: #fff;
    border-bottom: 1px solid #ececec;
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.ricerca-v2-close {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #444;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.ricerca-v2-close:hover,
.ricerca-v2-close:focus {
    color: #000;
    background: #f3f3f3;
    outline: none;
}

.ricerca-v2-loading {
    display: flex;
    min-height: 88px;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    color: #666;
    font-size: .88rem;
}

#ricercaV2Contenuto:empty { display: none; }

.ricerca-v2-section {
    padding: .9rem 1rem;
    border-bottom: 1px solid #efefef;
}

.ricerca-v2-heading {
    margin-bottom: .7rem;
    color: #6f6f6f;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.ricerca-v2-products {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem;
}

.ricerca-v2-product {
    display: flex;
    min-width: 0;
    min-height: 118px;
    align-items: center;
    gap: .85rem;
    padding: .75rem;
    color: #111 !important;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    text-decoration: none !important;
}

.ricerca-v2-product:hover,
.ricerca-v2-product.is-active {
    color: #111 !important;
    background: #fafafa;
    border-color: #d7d7d7;
}

.ricerca-v2-image {
    display: flex;
    flex: 0 0 92px;
    width: 92px;
    height: 92px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
    border: 1px solid #efefef;
    border-radius: 6px;
}

.ricerca-v2-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ricerca-v2-product-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: .25rem;
}

.ricerca-v2-title {
    display: -webkit-box;
    overflow: hidden;
    color: #111;
    font-size: .98rem;
    font-weight: 700;
    line-height: 1.28;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.ricerca-v2-code {
    overflow: hidden;
    color: #777;
    font-size: .73rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ricerca-v2-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem .55rem;
    margin-top: .18rem;
}

.ricerca-v2-old-price {
    color: #888;
    font-size: .79rem;
    text-decoration: line-through;
}

.ricerca-v2-price {
    color: #c12300;
    font-size: 1.05rem;
    font-weight: 800;
}

.ricerca-v2-ready {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    padding: .2rem .45rem;
    color: #157347;
    background: #eefbf3;
    border: 1px solid #b8e6c6;
    border-radius: 999px;
    font-size: .66rem;
    font-weight: 700;
    white-space: nowrap;
}

.ricerca-v2-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .38rem;
}

.ricerca-v2-links .ricerca-v2-heading { grid-column: 1 / -1; }

.ricerca-v2-link {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: .62rem;
    padding: .76rem .82rem;
    color: #171717 !important;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none !important;
}

.ricerca-v2-link:hover,
.ricerca-v2-link.is-active {
    color: #000 !important;
    background: #f8f8f8;
    border-color: #e5e5e5;
}

.ricerca-v2-link-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    line-height: 1.18;
}

.ricerca-v2-link-copy > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ricerca-v2-highlight {
    padding: 0 .07em;
    color: inherit;
    background: #fff0a8;
    border-radius: 2px;
}

.ricerca-v2-all {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    padding: .95rem 1rem;
    color: #fff !important;
    background: #111;
    font-size: .96rem;
    font-weight: 700;
    text-decoration: none !important;
}

/* =========================================================
   BARRA FILTRI PAGINA RICERCA
   ATTENZIONE: nessuna regola qui modifica la lista prodotti Termobozzo.
   ========================================================= */
.termobozzo-search-toolbar {
    padding: 1rem 1.1rem !important;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

.termobozzo-search-toolbar label {
    display: block;
    margin-bottom: .35rem;
    color: #333;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.termobozzo-search-toolbar .form-select,
.termobozzo-search-toolbar .form-control {
    min-height: 44px;
    background-color: #fff;
    border-color: #dedede;
    border-radius: 4px;
    font-size: .92rem;
}

.termobozzo-search-toolbar .form-select:focus,
.termobozzo-search-toolbar .form-control:focus {
    border-color: #9c9c9c;
    box-shadow: none;
}

.termobozzo-search-reset {
    min-height: 44px;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

#lazyLoadRallyPoint {
    min-height: 8px;
}

@media (max-width: 991px) {
    #divRicerca.ricerca-v2-panel {
        top: calc(100% - 42px) !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        border-right: 0;
        border-left: 0;
        border-radius: 0 0 8px 8px;
    }

    .ricerca-v2-products {
        grid-template-columns: 1fr;
    }
}

/* Sotto md viene usato #ricercaMobile. Il nav ha altezza fissa e il campo
   sporge sotto di esso: il popup deve quindi scendere sotto il campo, non partire
   dal fondo del nav. */
@media (max-width: 767px) {
    #divRicerca.ricerca-v2-panel {
        top: calc(100% + 40px) !important;
    }
}

@media (max-width: 575px) {
    .ricerca-v2-links {
        grid-template-columns: 1fr;
    }

    .ricerca-v2-section {
        padding: .7rem;
    }

    .termobozzo-search-toolbar {
        padding: .85rem !important;
    }
}
