/* =========================================================
   StudioEsagono - Search Widget
   ========================================================= */
.cew-search {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}
.cew-search *,
.cew-search *::before,
.cew-search *::after { box-sizing: border-box; }

/* Form */
.cew-search__form {
    display: flex;
    align-items: stretch;
    width: 100%;
    gap: 0;
}

/* Field (contiene input + icona assoluta) */
.cew-search__field {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    min-width: 0;
}

/* Input */
.cew-search__input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 12px 16px;
    font-size: inherit;
    line-height: 1.4;
    color: #1f2933;
    background-color: #ffffff;
    border: 1px solid #d0d5db;
    border-radius: 6px;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.cew-search__input::placeholder { color: #8a8f99; opacity: 1; }
.cew-search__input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    margin-left: 6px;
    background: no-repeat center/contain
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%238a8f99'%3E%3Cpath d='M10 8.586L4.707 3.293 3.293 4.707 8.586 10l-5.293 5.293 1.414 1.414L10 11.414l5.293 5.293 1.414-1.414L11.414 10l5.293-5.293-1.414-1.414L10 8.586z'/%3E%3C/svg%3E");
    cursor: pointer;
}
.cew-search__input:focus { outline: none; border-color: #2271b1; }

/* Icona dentro input */
.cew-search__icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #8a8f99;
    font-size: 16px;
    line-height: 1;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cew-search__icon svg { width: 1em; height: 1em; display: block; }

/* Posizione icona (left/right) + padding input corrispondente */
.cew-search--icon-left .cew-search__icon  { left: 14px; }
.cew-search--icon-right .cew-search__icon { right: 14px; }
.cew-search--icon-left .cew-search__input  { padding-left: 44px; }
.cew-search--icon-right .cew-search__input { padding-right: 44px; }

/* Pulsante submit */
.cew-search__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    font-size: inherit;
    font-weight: 600;
    line-height: 1.2;
    color: #ffffff;
    background-color: #2271b1;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s, color 0.15s, transform 0.1s;
}
.cew-search__submit:hover { background-color: #135e96; }
.cew-search__submit:active { transform: translateY(1px); }
.cew-search__submit svg { width: 1em; height: 1em; }

/* Layout: attached (input + button senza spazio, bordi uniti) */
.cew-search--layout-attached .cew-search__form { gap: 0; }
.cew-search--layout-attached .cew-search__input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right-width: 0;
}
.cew-search--layout-attached .cew-search__submit {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Layout: inline (gap tra input e button) */
.cew-search--layout-inline .cew-search__form { gap: 8px; }

/* Layout: below (pulsante sotto l'input) */
.cew-search--layout-below .cew-search__form {
    flex-direction: column;
    gap: 10px;
}
.cew-search--layout-below .cew-search__submit {
    align-self: flex-start;
}

/* "Ricerca attiva" chip */
.cew-search__active {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 0.95em;
    color: #1f2933;
}
.cew-search__active-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background-color: #eef4fb;
    border-radius: 999px;
    font-weight: 600;
}
.cew-search__active-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,0.08);
    color: inherit;
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
}
.cew-search__active-remove:hover { background: rgba(0,0,0,0.16); }

/* Messaggio nessun risultato */
.cew-search__no-results {
    margin-top: 12px;
    padding: 12px 16px;
    background-color: #fff2f2;
    color: #8a2a2a;
    border-radius: 6px;
    line-height: 1.4;
}
