/**
 * Styles pour le composant TagsInput
 * Réseau sémantique : synonymes, contraires, champs lexicaux
 */

/* Container principal */
.tags-input-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--white, #fff);
    border: 2px solid var(--border, #e0e0e0);
    border-radius: var(--radius, 8px);
    min-height: 44px;
    cursor: text;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tags-input-wrapper:focus-within {
    border-color: var(--primary, #4a7c59);
    box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.1);
}

/* Liste des tags */
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Tag individuel */
.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--primary-light, #e8f0ea);
    color: var(--primary-dark, #3a5c45);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: tagAppear 0.2s ease-out;
}

@keyframes tagAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tag-text {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Bouton supprimer */
.tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--primary-dark, #3a5c45);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.tag-remove:hover {
    background: var(--primary, #4a7c59);
    color: white;
}

/* Champ de saisie */
.tags-input-field {
    flex: 1;
    min-width: 120px;
    padding: 4px 0;
    border: none;
    outline: none;
    font-size: 0.95rem;
    background: transparent;
}

.tags-input-field::placeholder {
    color: var(--text-muted, #999);
}

/* Suggestions */
.tags-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--white, #fff);
    border: 1px solid var(--border, #e0e0e0);
    border-radius: var(--radius, 8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
}

.tags-suggestions.hidden {
    display: none;
}

.tags-suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.tags-suggestion-item:hover {
    background: var(--background, #f5f5f5);
}

.tags-suggestion-item:first-child {
    border-radius: var(--radius, 8px) var(--radius, 8px) 0 0;
}

.tags-suggestion-item:last-child {
    border-radius: 0 0 var(--radius, 8px) var(--radius, 8px);
}

/* Animation shake pour doublon */
.tags-input-wrapper.shake {
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Container avec position relative pour les suggestions */
.tags-input-container {
    position: relative;
}

/* ============================================
   Section Réseau sémantique dans formulaire
   ============================================ */

.reseau-semantique-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px dashed var(--border, #e0e0e0);
}

.reseau-semantique-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    color: var(--primary, #4a7c59);
    font-size: 1.1rem;
}

.reseau-semantique-section h3::before {
    content: "🔗";
}

.reseau-semantique-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.reseau-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reseau-field label {
    font-weight: 600;
    color: var(--text, #333);
    font-size: 0.95rem;
}

.reseau-field .field-help {
    font-size: 0.85rem;
    color: var(--text-muted, #666);
    margin-top: 4px;
}

/* Responsive */
@media (max-width: 600px) {
    .reseau-semantique-grid {
        grid-template-columns: 1fr;
    }

    .tag-item {
        font-size: 0.85rem;
    }

    .tags-input-field {
        min-width: 80px;
    }
}
