/**
 * Notificações e Alertas - CAPPES WhatsApp Manager
 */

/* ========================================
   BARRA DE FILTROS
   ======================================== */

.filter-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #f0f2f5;
  border-bottom: 1px solid #e9edef;
}

.filter-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: white;
  color: #667781;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
}

.filter-btn:hover {
  background: #f5f6f6;
}

.filter-btn.active {
  background: #00a884;
  color: white;
}

.filter-count {
  font-size: 11px;
  opacity: 0.8;
}

.alert-badge {
  background: #ff3b30;
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}

/* ========================================
   ALERTA VISUAL - BOTÃO PISCANDO
   ======================================== */

.filter-btn.alert-pending {
  animation: pulse-alert 2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
}

@keyframes pulse-alert {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
    background-color: white;
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 59, 48, 0);
    background-color: #fff5f5;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
    background-color: white;
  }
}

.filter-btn.alert-pending .alert-badge {
  animation: bounce-badge 2s ease-in-out infinite;
}

@keyframes bounce-badge {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

/* ========================================
   CONVERSAS QUE PRECISAM ATENÇÃO
   ======================================== */

.conversation-item.needs-attention {
  background: #fff9f9 !important;
  border-left: 3px solid #ff3b30;
}

.conversation-item.needs-attention:hover {
  background: #fff5f5 !important;
}

.conversation-item.needs-attention.active {
  background: #ffe8e8 !important;
}

.attention-badge {
  background: #ff3b30;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  margin-top: 4px;
  animation: pulse-badge 1.5s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.8;
  }
}

/* ========================================
   INSTALAÇÃO PWA BANNER
   ======================================== */

.pwa-install-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #00a884;
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 10000;
  animation: slide-up 0.3s ease-out;
}

@keyframes slide-up {
  from {
    bottom: -100px;
    opacity: 0;
  }
  to {
    bottom: 20px;
    opacity: 1;
  }
}

.pwa-install-banner button {
  background: white;
  color: #00a884;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.pwa-install-banner button:hover {
  background: #f0f2f5;
}

.pwa-install-banner .close-btn {
  background: transparent;
  color: white;
  border: 1px solid white;
  padding: 4px 12px;
}

.pwa-install-banner .close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ========================================
   NOTIFICAÇÃO TOAST
   ======================================== */

.notification-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 16px;
  min-width: 300px;
  max-width: 400px;
  z-index: 10001;
  animation: slide-in-right 0.3s ease-out;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

@keyframes slide-in-right {
  from {
    right: -400px;
    opacity: 0;
  }
  to {
    right: 20px;
    opacity: 1;
  }
}

.notification-toast.success {
  border-left: 4px solid #00a884;
}

.notification-toast.alert {
  border-left: 4px solid #ff3b30;
}

.notification-toast.info {
  border-left: 4px solid #007aff;
}

.notification-toast .icon {
  font-size: 24px;
  flex-shrink: 0;
}

.notification-toast .content {
  flex: 1;
}

.notification-toast .title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #111b21;
}

.notification-toast .message {
  font-size: 13px;
  color: #667781;
}

.notification-toast .close-toast {
  background: none;
  border: none;
  color: #667781;
  cursor: pointer;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.notification-toast .close-toast:hover {
  color: #111b21;
}

/* ========================================
   BADGE DE NOTIFICAÇÃO NO TÍTULO
   ======================================== */

.badge-count-title {
  background: #ff3b30;
  color: white;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
  vertical-align: middle;
}

/* ========================================
   MOBILE RESPONSIVO
   ======================================== */

@media (max-width: 768px) {
  .filter-bar {
    padding: 8px;
    gap: 4px;
  }

  .filter-btn {
    font-size: 11px;
    padding: 6px 8px;
  }

  .pwa-install-banner {
    left: 10px;
    right: 10px;
    bottom: 10px;
    transform: none;
    flex-direction: column;
    text-align: center;
  }

  .notification-toast {
    left: 10px;
    right: 10px;
    max-width: none;
    min-width: 0;
  }
}

/* ========================================
   INDICADOR DE ATIVIDADE (online/offline)
   ======================================== */

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-indicator.online {
  background: #00a884;
  box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.3);
  animation: pulse-online 2s ease-in-out infinite;
}

@keyframes pulse-online {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.status-indicator.offline {
  background: #8696a0;
}

/* ========================================
   ANIMAÇÃO DE DIGITANDO...
   ======================================== */

.typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 8px 12px;
  background: #e9edef;
  border-radius: 8px;
  align-items: center;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #667781;
  animation: typing-bounce 1.4s ease-in-out infinite;
}

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

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

@keyframes typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}
