/**
 * Ricerca, filtri, cuore, preferiti.
 *
 * I colori vengono dai token del tema; i valori di riserva servono perche' il
 * plugin deve reggere anche sotto un tema diverso.
 *
 * Regole che valgono per tutto il file:
 *   · area di tocco minima 44x44
 *   · fuoco sempre visibile
 *   · nessun testo essenziale sotto 12 px
 */

/* --------------------------------------------------------------- ricerca */

.st-search { position: relative; }

.st-search form {
    display: flex;
    align-items: center;
    background: var(--st-white, #fff);
    border: 1.5px solid var(--st-border-strong, #9D8B73);
    border-radius: var(--st-radius-sm, 6px);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.st-search form:focus-within {
    border-color: var(--st-copper, #AE4C0B);
    box-shadow: 0 0 0 3px rgba(var(--st-copper-rgb, 174, 76, 11), .14);
}

.st-search__input {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 10px 14px;
    border: 0;
    background: none;
    font: inherit;
    font-size: .92rem;
    color: var(--st-text, #242424);
}
.st-search__input:focus { outline: none; }

/* `place-items: center` in una griglia allunga il figlio per riempire la
   cella: la lente usciva larga 4 px e alta 20, cioe' uno spillo. `flex` non
   c'entra — bastava dire alla griglia di non stiracchiare niente. */
.st-search__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 44px; height: 44px;
    /* Il pulsante ereditava `padding: 5px 20px` dalle regole dei bottoni:
       dentro 44 px di larghezza restavano 4 px per la lente, che infatti
       usciva alta 20 e larga 4 — uno spillo. */
    padding: 0;
    border: 0; background: none;
    color: var(--st-charcoal, #2F3236);
    cursor: pointer;
}

.st-search__panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    z-index: 200;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    background: var(--st-white, #fff);
    border: 1px solid var(--st-border, #DED8D0);
    border-radius: var(--st-radius, 10px);
    box-shadow: 0 16px 44px rgba(47, 50, 54, .16);
}
.st-search__panel[hidden] { display: none; }

.st-search__group + .st-search__group { border-top: 1px solid var(--st-border, #DED8D0); }
.st-search__group-title {
    margin: 0;
    padding: 12px 16px 6px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--st-muted, #6F6B66);
}
.st-search__group ul { margin: 0; padding: 0 0 8px; list-style: none; }

.st-search__panel [role="option"] > a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    min-height: 44px;
    color: var(--st-text, #242424);
    text-decoration: none;
}
.st-search__panel [role="option"]:hover > a,
.st-search__panel [role="option"][aria-selected="true"] > a {
    background: var(--st-ivory, #F7F4EF);
}
.st-search__panel img,
.st-search__noimg {
    width: 48px; height: 48px;
    flex: 0 0 48px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--st-sand, #E7E2DA);
}
.st-search__text { flex: 1; min-width: 0; }
.st-search__name {
    display: block;
    font-size: .88rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.st-search__cat { display: block; font-size: .76rem; color: var(--st-muted, #6F6B66); }
.st-search__price {
    flex: 0 0 auto;
    font-size: .82rem;
    font-weight: 600;
    color: var(--st-copper, #AE4C0B);
    white-space: nowrap;
}
.st-search__price.is-quote { color: var(--st-muted, #6F6B66); font-weight: 500; }
.st-search__count { color: var(--st-muted, #6F6B66); font-size: .8rem; }

.st-search__more,
.st-search__link {
    display: block;
    padding: 13px 16px;
    text-align: center;
    font-size: .85rem;
    font-weight: 600;
    color: var(--st-copper, #AE4C0B);
    text-decoration: none;
    border-top: 1px solid var(--st-border, #DED8D0);
}
.st-search__loading,
.st-search__empty { padding: 20px 16px; font-size: .88rem; }
.st-search__empty p { margin: 0 0 6px; }
.st-search__empty p:last-of-type { color: var(--st-muted, #6F6B66); }

/* ---------------------------------------------------------------- filtri */

.st-filters { margin: 0 0 24px; }

.st-filters__toggle {
    display: none;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    background: var(--st-white, #fff);
    border: 1.5px solid var(--st-charcoal, #2F3236);
    border-radius: var(--st-radius-sm, 6px);
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
}
.st-filters__badge {
    display: inline-grid;
    place-items: center;
    min-width: 20px; height: 20px;
    padding: 0 5px;
    background: var(--st-copper, #AE4C0B);
    color: #fff;
    font-size: .72rem;
    border-radius: 10px;
}

.st-filters__body {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 20px 28px;
    padding: 18px 20px;
    background: var(--st-ivory, #F7F4EF);
    border-radius: var(--st-radius, 10px);
}

.st-filters__group { border: 0; margin: 0; padding: 0; min-width: 0; }
.st-filters__group legend {
    padding: 0 0 8px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--st-muted, #6F6B66);
}
.st-filters__values { display: flex; flex-wrap: wrap; gap: 8px; }

.st-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 14px;
    background: var(--st-white, #fff);
    border: 1px solid var(--st-border, #DED8D0);
    border-radius: 100px;
    font-size: .85rem;
    color: var(--st-charcoal, #2F3236);
    text-decoration: none;
    transition: border-color .18s ease, background .18s ease;
}
.st-chip:hover { border-color: var(--st-charcoal, #2F3236); }
.st-chip.is-on {
    background: var(--st-copper, #AE4C0B);
    border-color: var(--st-copper, #AE4C0B);
    color: #fff;
}
.st-chip__count { font-size: .76rem; opacity: .7; }

.st-filters__clear {
    align-self: center;
    margin-left: auto;
    font-size: .85rem;
    color: var(--st-copper, #AE4C0B);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* ----------------------------------------------------------------- cuore */

.st-heart {
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
    padding: 0;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--st-border, #DED8D0);
    border-radius: 50%;
    color: var(--st-charcoal, #2F3236);
    cursor: pointer;
    transition: color .18s ease, border-color .18s ease, transform .18s ease;
}
.st-heart:hover { color: var(--st-copper, #AE4C0B); border-color: var(--st-copper, #AE4C0B); }
.st-heart.is-on { color: var(--st-copper, #AE4C0B); border-color: var(--st-copper, #AE4C0B); }
.st-heart.is-on .st-icon { fill: currentColor; }

.st-card__heart {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 3;
}
/* Il cuore e' posizionato in assoluto dentro la scheda, quindi la scheda deve
   essere il suo riferimento. La regola chiedeva un antenato `.woocommerce`,
   che c'e' nel catalogo e non nella pagina dei preferiti: li' i cinque cuori
   si appoggiavano al primo antenato posizionato che trovavano — la fascia di
   testa — e finivano tutti e cinque impilati nell'angolo in alto a destra
   della fotografia. Una scheda di prodotto e' una scheda di prodotto ovunque
   venga stampata. */
ul.products li.product { position: relative; }

/* ------------------------------------------------------------- preferiti */

.st-wishlist__empty {
    padding: 56px 24px;
    text-align: center;
    color: var(--st-muted, #6F6B66);
}
.st-wishlist__empty .st-icon { color: var(--st-sand, #E7E2DA); margin-bottom: 12px; }
.st-wishlist__empty h2 { margin: 0 0 8px; color: var(--st-charcoal, #2F3236); }
.st-wishlist__empty p { margin: 0 0 24px; }
.st-wishlist__note {
    margin-top: 28px;
    padding: 14px 18px;
    background: var(--st-ivory, #F7F4EF);
    border-radius: var(--st-radius-sm, 6px);
    font-size: .88rem;
    color: var(--st-muted, #6F6B66);
}

/* Il fuoco si vede su tutto. */
.st-search :focus-visible,
.st-chip:focus-visible,
.st-heart:focus-visible,
.st-filters__toggle:focus-visible {
    outline: 3px solid var(--st-copper, #AE4C0B);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .st-filters__toggle { display: inline-flex; }
    .st-filters__body { display: none; margin-top: 12px; }
    .st-filters[data-open] .st-filters__body { display: flex; }
    .st-filters__clear { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .st-chip, .st-heart, .st-search form { transition: none; }
}

/* ------------------------------------------------------------ area cliente */
/* WooCommerce da' ordini e indirizzi. Qui ci sono le tre cose per cui un
   cliente di prodotti su misura torna davvero: i preventivi in corso, le
   configurazioni lasciate a meta', i prodotti messi da parte. */

.st-account-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 32px;
}
.st-account-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 20px;
    background: var(--st-ivory, #F7F4EF);
    border: 1px solid var(--st-border, #DED8D0);
    border-radius: var(--st-radius, 10px);
    text-decoration: none;
    color: var(--st-charcoal, #2F3236);
    transition: border-color .18s ease;
}
.st-account-tile:hover { border-color: var(--st-copper, #AE4C0B); }
.st-account-tile__value { font-size: 2rem; font-weight: 700; line-height: 1; }
.st-account-tile__label { font-size: .82rem; color: var(--st-muted, #6F6B66); }

.st-quotes, .st-saved { list-style: none; margin: 0; padding: 0; }
.st-quotes__item, .st-saved__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--st-border, #DED8D0);
}
.st-quotes__badge {
    padding: 3px 10px;
    border-radius: 100px;
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
}
.st-quotes__name, .st-saved__name {
    flex: 1 1 220px;
    font-weight: 600;
    color: var(--st-charcoal, #2F3236);
    text-decoration: none;
}
.st-quotes__name:hover, .st-saved__name:hover { color: var(--st-copper, #AE4C0B); }
.st-quotes__measures, .st-saved__measures,
.st-quotes__date, .st-saved__date {
    font-size: .82rem;
    color: var(--st-muted, #6F6B66);
}
.st-quotes__message { flex: 1 1 100%; font-size: .85rem; }
.st-quotes__amount { font-weight: 700; color: var(--st-copper, #AE4C0B); }

.st-saved__item img { border-radius: 6px; object-fit: cover; }
.st-saved__text { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.st-saved__open { flex: 0 0 auto; }
.st-saved__note {
    margin-top: 20px;
    font-size: .82rem;
    color: var(--st-muted, #6F6B66);
}

.st-account-empty {
    padding: 44px 24px;
    text-align: center;
    background: var(--st-ivory, #F7F4EF);
    border-radius: var(--st-radius, 10px);
}
.st-account-empty h3 { margin: 0 0 8px; }
.st-account-empty p {
    margin: 0 auto 22px;
    max-width: 46ch;
    color: var(--st-muted, #6F6B66);
    font-size: .9rem;
}

/* La lista dei preferiti di chi non ha un account la riempie il browser: il
   messaggio «non hai salvato niente» va nascosto prima che venga disegnato,
   altrimenti compare per un istante e dice il falso. La classe la mette uno
   script di tre righe che gira mentre la pagina si sta ancora leggendo. */
.st-ha-preferiti .st-wishlist__empty { display: none; }

.st-wishlist__attesa {
    margin: 0;
    padding: 40px 24px;
    text-align: center;
    color: var(--st-muted, #6F6B66);
}

/* La griglia e' `ul.products`, la stessa del catalogo: qui serve solo togliere
   il rientro che il browser da' a ogni elenco. */
.st-wishlist__grid { margin: 0; padding: 0; list-style: none; }
