/* =========================================================================
   Notificações de mensagens: sino na navbar, toasts, contadores por ticket
   e divisor "mensagens não lidas" no chat. Usa só tokens (--rb-*).
   ========================================================================= */

/* ---------- Sino ---------- */
.notif-bell { position: relative; }

.notif-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--rb-radius-pill);
  background: transparent;
  color: var(--rb-text-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--rb-dur) var(--rb-ease), color var(--rb-dur) var(--rb-ease);
}
.notif-bell-btn:hover,
.notif-bell-btn[aria-expanded="true"] {
  background: var(--rb-surface-2);
  color: var(--rb-text);
}
.notif-bell-btn:focus-visible {
  outline: 2px solid var(--rb-primary);
  outline-offset: 2px;
}
.notif-bell.has-unread .notif-bell-btn { color: var(--rb-text); }

.notif-count {
  position: absolute;
  top: 1px;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--rb-radius-pill);
  background: var(--rb-danger);
  color: var(--rb-on-solid);
  font-size: 11px;
  font-weight: var(--rb-fw-bold);
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--rb-surface);
  pointer-events: none;
}

@keyframes notif-ring {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-12deg); }
  45% { transform: rotate(8deg); }
  60% { transform: rotate(-6deg); }
  75% { transform: rotate(3deg); }
}
.notif-bell.ring .notif-bell-btn i {
  transform-origin: 50% 0;
  animation: notif-ring .9s ease-in-out 1;
}

/* ---------- Menu do sino ---------- */
.notif-menu {
  width: min(380px, calc(100vw - 24px));
  padding: 0;
  overflow: hidden;
}
.notif-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rb-space-3);
  padding: 12px 14px;
  border-bottom: 1px solid var(--rb-border);
  font-size: var(--rb-fs-sm);
}
.notif-markall,
.notif-enable {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--rb-primary);
  font-size: var(--rb-fs-xs);
  font-weight: var(--rb-fw-semibold);
  cursor: pointer;
}
.notif-markall:hover,
.notif-enable:hover { text-decoration: underline; }
.notif-markall[disabled] { color: var(--rb-text-subtle); cursor: default; text-decoration: none; }

.notif-list { max-height: min(60vh, 420px); overflow-y: auto; }

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rb-border);
  color: var(--rb-text);
  text-decoration: none;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--rb-surface-2); color: var(--rb-text); }
.notif-item-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--rb-primary);
}
.notif-item-body { min-width: 0; flex: 1 1 auto; }
.notif-item-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--rb-fs-sm);
}
.notif-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--rb-fw-semibold);
}
.notif-item-time { flex: 0 0 auto; color: var(--rb-text-subtle); font-size: var(--rb-fs-xs); }
.notif-item-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--rb-text-muted);
  font-size: var(--rb-fs-sm);
}
.notif-item-text strong { color: var(--rb-text); font-weight: var(--rb-fw-semibold); }
.notif-item-badge { flex: 0 0 auto; align-self: center; }

.notif-empty {
  padding: 28px 14px;
  text-align: center;
  color: var(--rb-text-muted);
  font-size: var(--rb-fs-sm);
}
.notif-empty i { display: block; margin-bottom: 6px; font-size: 1.6rem; color: var(--rb-text-subtle); }

.notif-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rb-space-3);
  padding: 10px 14px;
  border-top: 1px solid var(--rb-border);
  background: var(--rb-surface-2);
  font-size: var(--rb-fs-xs);
}
.notif-footer a { color: var(--rb-primary); font-weight: var(--rb-fw-semibold); text-decoration: none; }
.notif-footer a:hover { text-decoration: underline; }
.notif-hint { color: var(--rb-text-muted); }

/* ---------- Contador por ticket (lista de tickets e conversas do chat) ---------- */
.unread-badge {
  display: inline-block;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--rb-radius-pill);
  background: var(--rb-primary);
  color: var(--rb-on-solid);
  font-size: 11px;
  font-weight: var(--rb-fw-bold);
  line-height: 20px;
  text-align: center;
  vertical-align: middle;
}
.unread-badge.d-none { display: none !important; }

/* ---------- Toasts ---------- */
.tf-toasts {
  position: fixed;
  top: 68px;
  right: 16px;
  z-index: 20000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.tf-toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 36px 12px 12px;
  border: 1px solid var(--rb-border);
  border-left: 4px solid var(--rb-primary);
  border-radius: var(--rb-radius-lg, 12px);
  background: var(--rb-surface);
  color: var(--rb-text);
  box-shadow: var(--rb-shadow-lg);
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(16px);
  transition: opacity .18s ease, transform .18s ease;
}
.tf-toast.show { opacity: 1; transform: none; }
.tf-toast-icon { margin-top: 2px; color: var(--rb-primary); font-size: 1.1rem; }
.tf-toast-body { min-width: 0; }
.tf-toast-title { font-size: var(--rb-fs-sm); font-weight: var(--rb-fw-semibold); }
.tf-toast-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--rb-text-muted);
  font-size: var(--rb-fs-sm);
  overflow-wrap: anywhere;
}
.tf-toast-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: 0;
  background: transparent;
  color: var(--rb-text-subtle);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.tf-toast-close:hover { color: var(--rb-text); }

@media (max-width: 575.98px) {
  .tf-toasts { top: 64px; right: 8px; width: calc(100vw - 16px); }
}

/* ---------- Divisor "mensagens não lidas" no chat ---------- */
.unread-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 10px;
  color: var(--rb-primary);
  font-size: var(--rb-fs-xs);
  font-weight: var(--rb-fw-semibold);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.unread-divider::before,
.unread-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--rb-primary);
  opacity: .45;
}

@media (prefers-reduced-motion: reduce) {
  .notif-bell.ring .notif-bell-btn i { animation: none; }
  .tf-toast { transition: none; }
}

/* aviso de erro (ex.: anexo recusado) */
.tf-toast-danger { border-left-color: var(--rb-danger); }
.tf-toast-danger .tf-toast-icon { color: var(--rb-danger); }

/* Sino encaixado ao lado do menu do usuário (tela grande): sem as margens da posição do celular */
.notif-bell.docked { margin: 0 !important; }
