/* Estilos para funcionalidades de tempo real */

/* Header Status */
.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection-indicator {
  font-size: 0.9em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Seção de Status em Tempo Real */
.realtime-status {
  margin-top: 8px;
  padding: 12px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px;
  border-left: 4px solid #28a745;
  font-size: 0.85em;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.connection-text {
  font-weight: 600;
  color: #495057;
}

.realtime-features {
  font-size: 0.75em;
  color: #6c757d;
  margin-left: auto;
  opacity: 0.8;
}

/* Seção de Presença */
.presence-section {
  margin-top: 8px;
}

.active-users, .read-by-users, .unread-status {
  margin-bottom: 6px;
}

.active-users-label, .read-by-label {
  font-weight: 600;
  color: #495057;
  margin-right: 6px;
}

.users-list, .readers-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.active-user {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  color: #1976d2;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.current-user-indicator {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  color: #2e7d32;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.read-by-user {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  color: #2e7d32;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 500;
  cursor: help;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.read-by-user small {
  opacity: 0.7;
  margin-left: 4px;
}

.unread-indicator {
  background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
  color: #c62828;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Botões de filtro */
.toggle-btn.unread-filter {
  background-color: #4CAF50;
  border: 1px solid #4CAF50;
  color: white;
}

.toggle-btn.unread-filter.active {
  background-color: #4CAF50;
  color: white;
}

.toggle-btn.unread-filter:hover {
  background-color: #45a049;
  color: white;
}

/* Status de tempo real no cabeçalho da conversa */
.realtime-status {
  margin-top: 8px;
  padding: 8px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  font-size: 0.85em;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.connection-text {
  font-weight: 500;
}

/* Usuários ativos */
.active-users {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.active-users-label {
  font-weight: 600;
  color: #666;
  font-size: 0.8em;
}

.active-user {
  background-color: #e3f2fd;
  color: #1976d2;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 500;
}

/* Usuários que leram */
.read-by-users {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.read-by-label {
  font-weight: 600;
  color: #666;
  font-size: 0.8em;
}

.read-by-user {
  background-color: #e8f5e8;
  color: #2e7d2e;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 500;
  cursor: help;
}

/* Indicador de digitação */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background-color: #f5f5f5;
  border-top: 1px solid #e0e0e0;
  font-size: 0.9em;
  color: #666;
  margin-top: 8px;
}

.typing-text {
  font-style: italic;
}

.typing-dots {
  display: flex;
  gap: 3px;
}

.typing-dots span {
  width: 4px;
  height: 4px;
  background-color: #666;
  border-radius: 50%;
  animation: typing-blink 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-blink {
  0%, 80%, 100% {
    opacity: 0.3;
  }
  40% {
    opacity: 1;
  }
}

/* Estados de conexão */
.connection-indicator.connected {
  color: #4CAF50;
}

.connection-indicator.connecting {
  color: #FF9800;
}

.connection-indicator.error,
.connection-indicator.disconnected {
  color: #f44336;
}

/* Melhorias no filtro de não lidas */
.sidebar-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sidebar-controls .toggle-btn {
  flex: 1;
  min-width: 90px;
  text-align: center;
}

/* Indicador visual de ticket lido por outros */
.ticket-item.read-by-others::after {
  content: "👥";
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.8em;
  opacity: 0.7;
}

/* Melhorias responsivas */
@media (max-width: 768px) {
  .header-status {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }
  
  .realtime-status {
    font-size: 0.75em;
  }
  
  .active-users,
  .read-by-users {
    font-size: 0.7em;
  }
  
  .sidebar-controls {
    flex-direction: column;
  }
  
  .sidebar-controls .toggle-btn {
    flex: none;
  }
}