/* ──────────────────────────────────────────────────────────────
   Topbar — 56px height, contains hamburger (mobile), search trigger,
   theme toggle, notifications, user menu.
   Source: docs/handoff/src/admin-shell.jsx (AdminTopBar) + DESIGN-SYSTEM 3.1
   ────────────────────────────────────────────────────────────── */

.wt-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 16px;
  background: var(--wt-card);
  border-bottom: 1px solid var(--wt-border);
  flex-shrink: 0;
}

/* Search trigger (opens command palette via Ctrl+K) */
.wt-topbar-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  background: var(--wt-bg-2);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-r);
  color: var(--wt-fg-4);
  cursor: pointer;
  font-family: var(--wt-font);
  font-size: 12px;
  width: 100%;
  max-width: 320px;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.wt-topbar-search:hover {
  border-color: var(--wt-border-2);
  color: var(--wt-fg-3);
}
.wt-topbar-search > svg {
  flex-shrink: 0;
  width: 14px; height: 14px;
  color: var(--wt-fg-4);
}
.wt-topbar-search-text {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Spacer between search and right-side actions */
.wt-topbar-spacer { flex: 1; }

/* Right-side actions group */
.wt-topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* User trigger button (opens dropdown) */
.wt-topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 4px;
  border: none;
  background: transparent;
  border-radius: var(--wt-r);
  color: var(--wt-fg);
  cursor: pointer;
  font-family: var(--wt-font);
  transition: background 0.12s;
}
.wt-topbar-user:hover { background: var(--wt-bg-3); }
.wt-topbar-user-name {
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .wt-topbar-user-name { display: none; }
}

/* "Painel de Atendimentos" link in the topbar — green pill with WhatsApp accent. */
.wt-topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 32px;
  font-size: 12px;
  font-weight: 600;
  color: var(--wt-fg);
  text-decoration: none;
  border-radius: var(--wt-r);
  transition: background 0.12s;
}
.wt-topbar-link:hover { background: var(--wt-bg-3); }
@media (max-width: 768px) {
  .wt-topbar-link span { display: none; }
}

/* Popup wrapper used by the "Recentes" button — anchors the absolute-positioned popup. */
.wt-topbar-popup-wrap {
  position: relative;
}
.wt-topbar-popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: transparent;
}

.recent-popup {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 50;
  width: 360px;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  background: var(--wt-card);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-r-md);
  box-shadow: var(--wt-shadow-lg);
  overflow: hidden;
}
.recent-popup-head {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--wt-fg);
  border-bottom: 1px solid var(--wt-border);
}
.recent-popup-list {
  list-style: none;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
}
.recent-popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
}
.recent-popup-item:hover { background: var(--wt-bg-2); }
.recent-popup-num {
  font-family: var(--wt-font-mono, monospace);
  font-weight: 700;
  color: var(--wt-primary);
  flex-shrink: 0;
}
.recent-popup-title {
  color: var(--wt-fg-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.recent-popup-empty {
  padding: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--wt-fg-4);
}

/* Notification badge dot on the bell icon */
.wt-topbar-bell {
  position: relative;
}
.wt-topbar-bell-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  background: var(--wt-danger);
  color: white;
  border-radius: 99px;
  font-family: var(--wt-font);
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  pointer-events: none;
}

/* Mobile hamburger (visible only on small screens) */
.wt-topbar-hamburger {
  display: none;
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  color: var(--wt-fg-2);
  border-radius: var(--wt-r);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.wt-topbar-hamburger:hover { background: var(--wt-bg-3); color: var(--wt-fg); }
.wt-topbar-hamburger svg { width: 18px; height: 18px; }

@media (max-width: 1023px) {
  .wt-topbar-hamburger { display: inline-flex; }
}
