/* ===================================
   WhatsApp ticket alerts: top-bar bell + "awaiting reply" popup.
   Shared by the desktop layout and the mobile PWA layout.
   =================================== */
:root { --tkt-border: #e5e7eb; --tkt-muted: #6b7280; }

/* ---------- Notification bell ---------- */
.bell-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid transparent; background: none; color: #475569;
  font-size: 1.05rem; cursor: pointer;
}
.bell-btn:hover { background: #f1f5f9; }
.bell-btn.has-alerts { color: #b91c1c; }
.bell-btn.has-alerts i { animation: bell-ring 2.4s ease-in-out infinite; transform-origin: top center; }
@keyframes bell-ring {
  0%, 80%, 100% { transform: rotate(0); }
  84% { transform: rotate(14deg); } 88% { transform: rotate(-12deg); }
  92% { transform: rotate(8deg); }  96% { transform: rotate(-4deg); }
}
.bell-count {
  position: absolute; top: 2px; right: 1px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: .625rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #fff; line-height: 1;
}
.bell-count[hidden] { display: none; }
.tkt-menu { position: relative; display: inline-flex; }
.tkt-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--tkt-border); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(15,23,42,.14); z-index: 1100; overflow: hidden;
  text-align: left; color: #111827; font-family: Inter, system-ui, -apple-system, sans-serif;
}
.tkt-dropdown.show { display: block; }
.bell-panel { width: 340px; max-width: calc(100vw - 24px); }
.bell-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem .9rem; border-bottom: 1px solid var(--tkt-border);
  font-size: .8125rem; font-weight: 600;
}
.bell-panel-head span { font-weight: 400; color: var(--tkt-muted); font-size: .75rem; }
.bell-list { max-height: 360px; overflow-y: auto; }
.bell-item {
  display: block; padding: .6rem .9rem; border-bottom: 1px solid #f1f2f4;
  color: inherit; text-decoration: none; font-size: .8125rem;
}
.bell-item:hover { background: #f8fafc; text-decoration: none; color: inherit; }
.bell-item-top { display: flex; justify-content: space-between; gap: .5rem; }
.bell-item-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bell-item-wait { font-size: .6875rem; color: #b91c1c; white-space: nowrap; font-weight: 600; }
.bell-item-msg {
  color: var(--tkt-muted); font-size: .75rem; margin-top: .15rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bell-empty { padding: 1.25rem .9rem; text-align: center; color: var(--tkt-muted); font-size: .8125rem; }
.bell-foot { display: block; text-align: center; padding: .55rem; font-size: .75rem; font-weight: 600; }

/* Mobile top bar bell sits left of the avatar */
.nav-topbar-right { gap: .25rem; }
.nav-topbar-right .bell-btn { width: 36px; height: 36px; }
.nav-topbar-right .bell-panel { position: fixed; top: 60px; right: 12px; left: auto; }

/* ---------- Ticket popup (modal) ---------- */
.tkt-modal-backdrop {
  position: fixed; inset: 0; z-index: 20000;
  background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.tkt-modal-backdrop[hidden] { display: none; }
.tkt-modal {
  width: 440px; max-width: 100%; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(15,23,42,.3);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  animation: tkt-pop .18s ease-out;
}
@keyframes tkt-pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.tkt-modal-head { padding: 1.1rem 1.25rem .9rem; display: flex; gap: .85rem; align-items: flex-start; }
.tkt-modal-icon {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%;
  background: #dcfce7; color: #16a34a; font-size: 1.25rem;
  display: flex; align-items: center; justify-content: center;
}
.tkt-modal-head h2 { font-size: 1rem !important; font-weight: 600; margin: 0 0 .2rem; color: #111827; }
.tkt-modal-head p { font-size: .8125rem; color: var(--tkt-muted); margin: 0; line-height: 1.45; }
.tkt-modal-list { overflow-y: auto; border-top: 1px solid var(--tkt-border); border-bottom: 1px solid var(--tkt-border); }
.tkt-modal-list .bell-item { padding: .65rem 1.25rem; }
.tkt-modal-foot { display: flex; gap: .5rem; justify-content: flex-end; padding: .85rem 1.25rem; flex-wrap: wrap; }
.tkt-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .9rem; border-radius: 6px; font-size: .8125rem; font-weight: 600;
  border: 1px solid var(--tkt-border); background: #fff; color: #374151;
  cursor: pointer; text-decoration: none; min-height: 0;
}
.tkt-btn:hover { background: #f8fafc; text-decoration: none; color: #111827; }
.tkt-btn-primary { background: #16a34a; border-color: #16a34a; color: #fff; }
.tkt-btn-primary:hover { background: #15803d; color: #fff; }

/* ---------- Notifications opt-in + sound switch ---------- */
.tkt-notify-cta {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 1.25rem; background: #eff6ff; color: #1e3a8a;
  font-size: .75rem; line-height: 1.35; border-bottom: 1px solid #dbeafe;
}
.tkt-notify-cta[hidden] { display: none; }
.tkt-notify-cta i { color: #2563eb; }
.tkt-notify-cta span { flex: 1; }
.tkt-notify-cta .tkt-btn { padding: .3rem .7rem; font-size: .75rem; background: #2563eb; border-color: #2563eb; color: #fff; }
.bell-panel .tkt-notify-cta { padding: .55rem .9rem; }
.tkt-sound-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  background: none; border: none; padding: .25rem 0; min-height: 0; min-width: 0;
  font-size: .75rem; color: var(--tkt-muted); cursor: pointer;
}
.tkt-sound-toggle:hover { color: #111827; }
.bell-panel-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 .9rem; border-top: 1px solid var(--tkt-border);
}
.bell-panel-foot .bell-foot { padding: .55rem 0; }
.tkt-modal-foot { align-items: center; }
