/* Tag Input System Styles - nahtlos integriert in VP-LGKA Design */

.tag-input-container {
    /* Kein eigener Hintergrund oder Border - nahtlose Integration */
    transition: all 0.2s ease;
}

.tag-input-container.focused {
    /* Nur subtile Focus-Animation */
    transform: translateY(-1px);
}

.tag-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Eingabefeld oben - identisch mit .form-control */
.tag-input-field {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary, #1f2937);
    background-color: var(--background, #ffffff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: var(--radius-md, 6px);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.tag-input-field:focus {
    border-color: var(--primary-color, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.tag-input-field::placeholder {
    color: var(--text-muted, #9ca3af);
}

.tag-input-field:disabled {
    background-color: var(--background-light, #f9fafb);
    color: var(--text-muted, #9ca3af);
    cursor: not-allowed;
}

/* Tags-Bereich darunter - lila Tags auf transparentem Hintergrund */
.tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 0;
}

.tags-display:empty {
    display: none;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    background: var(--primary-color, #4f46e5);
    color: white;
    border-radius: var(--radius-xl, 12px);
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    animation: fadeIn 0.3s ease-in-out;
    transition: all 0.2s ease;
    border: none;
}

.tag-item:hover {
    background: var(--primary-dark, #3730a3);
    transform: translateY(-1px);
}

.tag-item.tag-added {
    animation: tagAdd 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.tag-item.tag-removing {
    animation: tagRemove 0.2s ease-in-out forwards;
    transform-origin: center;
}

.tag-item.tag-duplicate {
    background: var(--error-color, #ef4444);
    animation: shake 0.5s ease-in-out;
}

.tag-text {
    margin-right: 0.375rem;
    user-select: none;
    color: inherit;
}

.tag-remove {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    font-size: 1.125rem;
    line-height: 1;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    opacity: 0.8;
}

.tag-remove:hover {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
    transform: scale(1.1);
}

.tag-remove:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Info-Bereich - gleiche Breite wie Eingabefeld */
.tag-input-info {
    margin-top: 0.25rem;
}

.tag-input-info small {
    color: var(--text-secondary, #6b7280);
    font-size: 0.875rem;
    display: block;
}

/* Integration mit bestehender Klassenauswahl */
.class-selection-container .tag-input-container {
    margin-top: 0.5rem;
}

.class-selection-container .tag-input-field {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.class-selection-container .tag-item {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md, 6px);
}

.class-selection-container .tag-remove {
    width: 1rem;
    height: 1rem;
    font-size: 0.875rem;
}

.class-selection-container .tag-input-info small {
    font-size: 0.75rem;
}

/* Integration mit Klassenauswahl - nutzt bestehende main.css Styles */
.class-selection-container .tag-input-container {
    margin-top: 0.5rem;
}

.class-selection-container .tag-input-field {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* Animationen */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes tagAdd {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-8px);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes tagRemove {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.3);
    }
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .tag-input-field {
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
    }
    
    .tag-item {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    .class-selection-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

@media (max-width: 430px) {
    .tag-input-field {
        padding: 0.5rem;
        font-size: 1rem;
    }
    
    .tag-item {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Error states - nutzt bestehende Form-Error-Styles */
.form-group .form-error + .tag-input-container .tag-input-field,
.form-group.has-error .tag-input-container .tag-input-field {
    border-color: var(--error-color, #ef4444);
}

.form-group .form-error + .tag-input-container .tag-input-field:focus,
.form-group.has-error .tag-input-container .tag-input-field:focus {
    border-color: var(--error-color, #ef4444);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Success states */
.form-group.has-success .tag-input-container .tag-input-field {
    border-color: var(--success-color, #10b981);
}

.form-group.has-success .tag-input-container .tag-input-field:focus {
    border-color: var(--success-color, #10b981);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Disabled state */
.tag-input-container:has(.tag-input-field:disabled) {
    opacity: 0.6;
}

.tag-input-container:has(.tag-input-field:disabled) .tag-item {
    background: var(--text-secondary, #6b7280);
}

.tag-input-container:has(.tag-input-field:disabled) .tag-remove {
    cursor: not-allowed;
}