/* =========================================================================
   Modale di ricerca prodotti (#searchModal)
   Due stati serviti da ProductSearchController: vuoto (categorie + best seller)
   e query (categorie + risultati + «vedi tutti»). Prezzo e stelline delle card
   riusano le classi .wc-card__* di product-card.css.
   ========================================================================= */

.search-modal {
    --ps-accent:       #f5a623;
    --ps-accent-dark:  #e0940f;
    --ps-ink:          #111;
    --ps-radius:       16px;
    --ps-shadow:       0 10px 30px rgba(0, 0, 0, .10);
    --ps-shadow-soft:  0 4px 14px rgba(0, 0, 0, .06);
    --ps-maxw:         1400px;
}

/* L'header del tema arriva a z-index 10050: il modale (Bootstrap di default
   1055) deve stargli sopra, come l'offcanvas del carrello. */
.search-modal.modal { z-index: 10070; }

.search-modal .modal-content {
    background: rgba(236, 236, 236, .72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 0;
}

/* ── Barra in alto: input + chiudi ─────────────────────────────────────── */
.search-modal__header {
    border: 0;
    gap: 14px;
    padding: 22px clamp(16px, 4vw, 48px);
    align-items: stretch;
}

.search-modal .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ps-search {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: var(--ps-radius);
    box-shadow: var(--ps-shadow-soft);
    padding: 0 22px;
}

.ps-search__icon {
    display: inline-flex;
    color: var(--ps-ink);
    flex: 0 0 auto;
}

.ps-search__input {
    flex: 1 1 auto;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 18px;
    color: var(--ps-ink);
    padding: 18px 0;
    min-width: 0;
}

.ps-search__input::placeholder { color: #9a9a9a; }

/* toglie la X nativa di input[type=search] */
.ps-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-modal__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    background: #fff;
    border: 0;
    border-radius: var(--ps-radius);
    box-shadow: var(--ps-shadow-soft);
    color: var(--ps-ink);
    cursor: pointer;
    transition: background .2s ease;
}
.search-modal__close:hover { background: #f2f2f2; }

/* ── Corpo ─────────────────────────────────────────────────────────────── */
.search-modal__body {
    padding: 0 clamp(16px, 4vw, 48px) 40px;
    overflow-y: auto;
}

.ps-results {
    max-width: var(--ps-maxw);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 22px;
    transition: opacity .15s ease;
}
.ps-results.is-loading { opacity: .55; }

.ps-panel {
    background: #fff;
    border-radius: var(--ps-radius);
    box-shadow: var(--ps-shadow);
    padding: clamp(18px, 3vw, 32px);
}

.ps-panel__head {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ps-ink);
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e7e7e7;
}
.ps-panel__head .icon { color: var(--ps-ink); }

/* ── Pillole categoria ─────────────────────────────────────────────────── */
.ps-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ps-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 12px;
    box-shadow: var(--ps-shadow-soft);
    font-size: 14px;
    font-weight: 600;
    color: var(--ps-ink);
    text-decoration: none;
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.ps-pill:hover {
    border-color: var(--ps-accent);
    transform: translateY(-1px);
    color: var(--ps-ink);
}
.ps-pill .icon {
    transform: rotate(-45deg);   /* freccia diagonale ↗ come nel mock */
    opacity: .8;
}

/* pillole dentro il pannello suggerimenti dello stato query: staccale dalla griglia */
.ps-panel .ps-pills + .ps-grid { margin-top: 24px; }

/* ── Titolo «Most Loved» ───────────────────────────────────────────────── */
.ps-loved-title {
    text-align: center;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ps-ink);
    padding-bottom: 18px;
    margin: 0 0 24px;
    border-bottom: 1px solid #e7e7e7;
}
.ps-accent { color: var(--ps-accent); }

/* ── Griglia prodotti ──────────────────────────────────────────────────── */
.ps-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.ps-card {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 14px;
    box-shadow: var(--ps-shadow-soft);
    transition: box-shadow .2s ease, transform .2s ease;
}
.ps-card:hover {
    box-shadow: var(--ps-shadow);
    transform: translateY(-2px);
}

.ps-card__media {
    flex: 0 0 84px;
    width: 84px;
}
.ps-card__img {
    width: 84px;
    height: 84px;
    object-fit: contain;
    display: block;
}

.ps-card__body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ps-card__title {
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
    /* massimo 2 righe */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ps-card__title a {
    color: var(--ps-ink);
    text-decoration: none;
}
.ps-card__title a:hover { color: var(--ps-accent-dark); }

.ps-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
/* Il gap largo dello snippet qui non serve: la riga è stretta e il prezzo sta
   accanto alle stelline. */
.ps-card__meta .wc-card__price { font-weight: 700; font-size: 15px; gap: 4px 8px; }
.ps-card__meta .wc-card__rating { margin: 0; }

.ps-card__btn {
    display: block;
    text-align: center;
    margin-top: auto;
    padding: 8px 12px;
    background: var(--ps-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    transition: background .2s ease;
}
.ps-card__btn:hover { background: var(--ps-accent-dark); color: #fff; }

/* ── «Vedi tutti i prodotti» ───────────────────────────────────────────── */
.ps-seeall {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}
.ps-seeall__btn {
    display: inline-block;
    padding: 14px 34px;
    background: var(--ps-ink);
    color: #fff;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-size: 14px;
    border-radius: 12px;
    text-decoration: none;
    box-shadow: var(--ps-shadow);
    transition: transform .2s ease, background .2s ease;
}
.ps-seeall__btn:hover { background: #000; transform: translateY(-1px); color: #fff; }

.ps-seeall__count {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 9px;
    background: rgba(255, 255, 255, .18);
    border-radius: 20px;
    font-size: 13px;
    line-height: 1.5;
}

/* ── Banner assistenza ─────────────────────────────────────────────────── */
.ps-help {
    text-align: center;
    padding: 16px 20px;
    background: var(--ps-accent);
    border-radius: 12px;
    color: var(--ps-ink);
    font-size: 15px;
}
.ps-help a {
    color: var(--ps-ink);
    font-weight: 700;
    text-decoration: underline;
}

/* ── Nessun risultato ──────────────────────────────────────────────────── */
.ps-empty {
    margin: 0;
    padding: 24px 4px;
    text-align: center;
    color: #666;
    font-size: 15px;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .ps-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
    .ps-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
    .ps-grid { grid-template-columns: 1fr; }
    .search-modal__header { padding: 16px; }
    .ps-search__input { font-size: 16px; padding: 15px 0; }
}
