/* Tagify CSS integrazione */
.tagify {
    --tag-bg: #3b82f6;
    --tag-hover: #2563eb;
    --tag-text-color: #ffffff;
    --tag-text-color--edit: #111827;
    --tag-pad: 0.3em 0.5em;
    --tag-inset-shadow-size: 1.1em;
    --tag-invalid-color: #ef4444;
    --tag-invalid-bg: #fef2f2;
    --tag-remove-bg: #ef4444;
    --tag-remove-btn-color: #ffffff;
    --placeholder-color: #9ca3af;
    --input-color: #111827;
    --tag--min-width: 1ch;
    --tag--max-width: auto;
    --tag-hide-transition: 0.3s;
    --loader-size: 0.8em;
}

.tagify__tag {
    transition: all 0.2s ease;
}

.tagify__tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tagify__input {
    min-width: 110px;
    margin: 5px;
    padding: 0.3em 0.5em;
    border-radius: 0.375rem;
}

.tagify--focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.tagify__dropdown {
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #d1d5db;
    max-height: 200px;
    overflow-y: auto;
    z-index: 9999 !important; /* Assicura che sia sopra gli altri elementi */
    background: white;
    min-width: 200px;
}

.tagify__dropdown__item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.tagify__dropdown__item:hover,
.tagify__dropdown__item--active {
    background: #f3f4f6 !important;
    color: #1f2937;
}

.tagify__dropdown__item--active {
    color: #3b82f6;
    font-weight: 500;
    background: #dbeafe !important;
}

/* Evidenzia il testo corrispondente */
.tagify__dropdown__item .allergia-nome {
    font-weight: 500;
    color: #1f2937;
}

.tagify__dropdown__item--active .allergia-nome {
    color: #3b82f6;
}

/* Stile per la lista di allergie nel form */
#input_lista_alimenti_intolleranze_ragazzo.tagify {
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.25rem;
    min-height: 48px;
    font-size: 0.875rem;
}

/* Migliora la visibilità e l'interazione del dropdown */
.tagify__dropdown {
    z-index: 9999 !important;
    background: white !important;
    border: 2px solid #3b82f6 !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15) !important;
}

.tagify__dropdown__item {
    padding: 12px 16px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    cursor: pointer !important;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
}

.tagify__dropdown__item:hover {
    background: #dbeafe !important;
    color: #1e40af !important;
}

.tagify__dropdown__item--active {
    background: #3b82f6 !important;
    color: white !important;
    font-weight: 500 !important;
}

/* Evidenzia meglio l'input quando è attivo */
.tagify--focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

/* Animazioni per i tag */
@keyframes tagify--tag-enter {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tagify__tag {
    animation: tagify--tag-enter 0.2s ease-out;
}

/* Responsive */
@media (max-width: 640px) {
    .tagify__tag {
        font-size: 0.75rem;
        --tag-pad: 0.25em 0.4em;
    }

    .tagify__input {
        min-width: 80px;
    }
}
