/* ============================================================
   Cercami Tag Search — Stili
   ============================================================ */

.cts-tag-search-wrapper {
    position: relative;
    margin-top: 8px;
    width: 100%;
    font-family: inherit;
}

/* Barra filtro attivo — evidenziata in giallo quando ci sono tag selezionate */
.cts-tag-search-wrapper.cts-has-active-tags {
    background: #fffbea;
    border: 1px solid #f0c040;
    border-radius: 8px;
    padding: 8px 10px;
    margin-top: 6px;
}

.cts-tag-search-wrapper.cts-has-active-tags .cts-tag-input-wrap {
    background: #fff;
}

/* Messaggio filtro attivo */
.cts-active-filter-notice {
    font-size: .78rem;
    color: #856404;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.cts-active-filter-notice svg {
    flex-shrink: 0;
}

/* Riga input */
.cts-tag-input-row {
    position: relative;
}

.cts-tag-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0 10px;
    transition: border-color .2s;
}

.cts-tag-input-wrap:focus-within {
    border-color: #4a9d6f;
    box-shadow: 0 0 0 3px rgba(74,157,111,.12);
}

.cts-tag-icon {
    color: #adb5bd;
    margin-right: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.cts-tag-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 8px 0;
    font-size: .9rem;
    color: #343a40;
    background: transparent;
    min-width: 0;
}

.cts-tag-input::placeholder {
    color: #adb5bd;
}

/* Bottone info */
.cts-info-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #adb5bd;
    padding: 4px;
    margin-left: 4px;
    display: flex;
    align-items: center;
    transition: color .2s;
    flex-shrink: 0;
}

.cts-info-btn:hover {
    color: #4a9d6f;
}

/* Tooltip info */
.cts-info-tooltip {
    background: #2c3e50;
    color: #ecf0f1;
    font-size: .8rem;
    border-radius: 6px;
    padding: 10px 14px;
    margin-top: 6px;
    line-height: 1.5;
}

/* Dropdown autocompletamento */
.cts-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    z-index: 9999;
    max-height: 240px;
    overflow-y: auto;
}

.cts-autocomplete-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    cursor: pointer;
    font-size: .9rem;
    color: #343a40;
    border-bottom: 1px solid #f1f3f5;
    transition: background .15s;
}

.cts-autocomplete-item:last-child {
    border-bottom: none;
}

.cts-autocomplete-item:hover,
.cts-autocomplete-item.cts-active {
    background: #f0f9f4;
    color: #2d7a4f;
}

.cts-autocomplete-item-name {
    font-weight: 500;
}

.cts-autocomplete-item-name mark {
    background: none;
    color: #4a9d6f;
    font-weight: 700;
    padding: 0;
}

.cts-autocomplete-item-count {
    font-size: .75rem;
    color: #adb5bd;
    margin-left: 8px;
    flex-shrink: 0;
}

.cts-no-results {
    padding: 10px 14px;
    font-size: .85rem;
    color: #adb5bd;
    text-align: center;
}

/* Badge tag selezionate */
.cts-selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.cts-tag-badge {
    display: inline-flex;
    align-items: center;
    background: #e8f5ee;
    color: #2d7a4f;
    border: 1px solid #b7dfca;
    border-radius: 20px;
    padding: 4px 10px 4px 12px;
    font-size: .82rem;
    font-weight: 500;
    gap: 6px;
}

.cts-tag-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #6c9e82;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    transition: color .15s;
}

.cts-tag-remove:hover {
    color: #c0392b;
}

/* Label "Filtra per:" */
.cts-filter-label {
    font-size: .78rem;
    color: #6c757d;
    margin-bottom: 4px;
    display: block;
}

/* Mobile */
@media (max-width: 576px) {
    .cts-tag-input {
        font-size: .85rem;
    }

    .cts-autocomplete-item {
        padding: 10px 12px;
    }
}
