/**
 * Instant Search — dropdown autocomplete styles
 *
 * Aleide Framework v3.0.0 — it-ricambi.com
 */

/* ── Wrapper ── */
/* position: relative necessario per l'ancoraggio del dropdown autocomplete */
#cerca {
    position: relative;
}

/* Necessario per ereditare correttamente l'altezza dal contenitore #cerca */
.search-wrapper {
    height: 100%;
}

/* Consenti al dropdown di uscire dal contenitore #cerca-wrp */
#header-wrp #cerca-wrp {
    overflow: visible;
}

/* ── Dropdown ── */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e8ccc8;
    border-top: 2px solid #c3010e;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 8px 24px rgba(195, 1, 14, 0.13);
    z-index: 9999;
    max-height: 65vh;
    overflow-y: auto;
}

/* Desktop: dropdown allargato del 50% */
@media (min-width: 769px) {
    .search-dropdown {
        left: -25%;
        right: -25%;
    }
}

/* ── Lista risultati ── */
.search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.search-results-list li {
    border-bottom: 1px solid #f0dfdb;
}

.search-results-list li:last-child {
    border-bottom: none;
}

.search-results-list li a {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    text-decoration: none;
    color: #000;
    gap: 14px;
}

.search-results-list li a:hover,
.search-item.selected a {
    background-color: #fdf0eb;
}

/* ── Info risultato ── */
.search-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    min-width: 0; /* permette ellipsis */
    flex: 1;
}

.search-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-price {
    font-size: 14px;
    font-weight: 700;
    color: #ff5c26;
}

.search-price-vip {
    font-size: 12px;
    color: #666;
}

/* ── Highlight termine cercato ── */
.search-highlight {
    color: #d32f2f;
    background: transparent;
    font-weight: 700;
}

/* ── Codice prodotto ── */
.search-code {
    font-size: 13px;
    font-weight: 600;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Intestazione gruppo categoria (cappello) ── */
.search-category-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    background: #fdf0eb;
    border-bottom: 1px solid #e8ccc8;
    border-left: 3px solid #c3010e;
}

.search-category-group-title {
    display: block;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 700;
    color: #000;
    text-transform: uppercase;
    pointer-events: none;
}

/* Link che avvolge il titolo categoria (categorie matchate per titolo) */
.search-category-group-link {
    display: block;
    text-decoration: none;
    color: inherit;
    flex: 1;
}

.search-category-group-link:hover {
    background: #f5d0c8;
}

.search-category-group-link .search-category-group-title {
    pointer-events: auto;
}

.search-category-group-count {
    flex-shrink: 0;
    margin-right: 14px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #000;
    background: #f5d0c8;
    border-radius: 10px;
    pointer-events: none;
}

/* ── Nessun risultato ── */
.no-results {
    padding: 16px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* ── Link "Vedi tutti" ── */
.search-view-all {
    display: block;
    text-align: center;
    padding: 11px;
    background: #fef5f2;
    color: #c3010e;
    font-weight: 600;
    text-decoration: none;
    border-top: 1px solid #e8ccc8;
    border-radius: 0 0 6px 6px;
    transition: background 0.2s ease;
}

.search-view-all:hover {
    background: #c60b1e;
    color: #fff;
}

/* ── Responsive: mobile ── */
@media (max-width: 768px) {
    #cerca {
        position: relative !important;
    }

    .search-dropdown {
        left: 0;
        right: 0;
        min-width: auto;
        max-height: 50vh;
    }

    .search-category-group-title {
        font-size: 14px;
        padding: 6px 12px;
    }
}
