/* ═══════════════════════════════════════════════════════════════════════════════
   23. SISTEMA DE ETIQUETAS
   Tags para categorizar contactos y conversaciones
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Filtro de etiquetas en sidebar */
.tag-filter-container {
    background: #111b21;
    border-bottom: 1px solid #313d45;
}

.tag-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    color: #8696a0;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-filter-header:hover {
    background: #1a2328;
    color: #00a884;
}

.tag-filter-header i:first-child {
    margin-right: 8px;
}

#tagFilterArrow {
    transition: transform 0.3s;
}

.tag-filter-container.expanded #tagFilterArrow {
    transform: rotate(180deg);
}

.tag-filter-list {
    max-height: 200px;
    overflow-y: auto;
    background: #0b141a;
}

.tag-filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 13px;
    color: #aebac1;
}

.tag-filter-item:hover {
    background: #1a2328;
}

.tag-filter-item.active {
    background: #0c3d2f;
    color: #00a884;
}

.tag-filter-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag-filter-count {
    margin-left: auto;
    background: #313d45;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: #8696a0;
}

.tag-filter-item.active .tag-filter-count {
    background: #00a884;
    color: white;
}

/* Header de gestión de etiquetas */
.tags-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Lista de etiquetas */
.tags-list {
    max-height: 400px;
    overflow-y: auto;
}

.tags-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    color: #8696a0;
    gap: 12px;
}

.tag-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #313d45;
    transition: background 0.2s;
}

.tag-item:hover {
    background: #1a2328;
}

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

.tag-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.tag-info {
    flex: 1;
    min-width: 0;
}

.tag-name {
    color: #e9edef;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
}

.tag-description {
    color: #8696a0;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag-priority {
    background: #313d45;
    color: #aebac1;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.tag-actions {
    display: flex;
    gap: 4px;
}

.tag-action-btn {
    background: none;
    border: none;
    color: #8696a0;
    padding: 6px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.tag-action-btn:hover {
    background: #313d45;
    color: #e9edef;
}

.tag-action-btn.delete:hover {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

/* Formulario de etiqueta */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker-wrapper input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
}

.color-preview {
    color: #8696a0;
    font-family: monospace;
    font-size: 13px;
}

.icon-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-input-wrapper input {
    flex: 1;
}

.icon-preview {
    width: 40px;
    height: 40px;
    background: #00a884;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

/* Etiquetas del contacto */
.contact-tags-info {
    background: #1a2328;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.contact-tags-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#contactTagsName {
    color: #e9edef;
    font-weight: 500;
    font-size: 16px;
}

.contact-phone {
    color: #8696a0;
    font-size: 13px;
}

.contact-tags-section {
    margin-bottom: 20px;
}

.contact-tags-section h4 {
    color: #aebac1;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.assigned-tags, .available-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-badge i {
    font-size: 12px;
}

.tag-badge.assigned {
    color: white;
}

.tag-badge.assigned .remove-tag {
    opacity: 0.7;
    margin-left: 4px;
}

.tag-badge.assigned:hover .remove-tag {
    opacity: 1;
}

.tag-badge.available {
    background: #313d45;
    color: #aebac1;
    border: 1px dashed #4a5568;
}

.tag-badge.available:hover {
    background: #3b4a54;
    color: #e9edef;
    border-style: solid;
}

.no-tags {
    color: #8696a0;
    font-size: 13px;
    font-style: italic;
}

/* Etiquetas en lista de contactos */
.chat-tags {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.chat-tag-mini {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    color: white;
}

.chat-tag-mini i {
    font-size: 8px;
}

/* Etiquetas en header del chat */
.contact-header-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.header-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: white;
    font-weight: 500;
    flex-shrink: 0;
}

.header-tag i {
    font-size: 9px;
}

.header-tags-more {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: #aebac1;
    background: #313d45;
    font-weight: 500;
}

/* En móvil: solo una fila de etiquetas */
@media (max-width: 768px) {
    .contact-header-tags {
        flex-wrap: nowrap;
        overflow: hidden;
        max-width: calc(100vw - 140px);
    }
    
    .header-tag {
        padding: 1px 6px;
        font-size: 10px;
    }
    
    .header-tag i {
        font-size: 8px;
    }
}

/* Botón de etiquetas destacado */
#tagsBtn {
    position: relative;
}

/* Menú de etiquetas destacado */
#menuContactTags {
    color: #00a884;
}

#menuContactTags i {
    color: #00a884;
}

#menuContactTags:hover {
    background: rgba(0, 168, 132, 0.1);
}

/* Responsive para etiquetas */
@media (max-width: 768px) {
    .tag-item {
        padding: 10px 12px;
    }
    
    .tag-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .tag-badge {
        padding: 4px 10px;
        font-size: 12px;
    }
    
    .assigned-tags, .available-tags {
        gap: 6px;
    }
}

