/* ============================================================
   BizBarrel emote picker — reusable popover
   Author: Dave Greenlaw
   Tokens: --surface, --text, --border, --surface-muted, --accent
============================================================ */

.bb-emote-picker {
  position: fixed;
  z-index: 100250;
  display: flex;
  flex-direction: column;
  width: min(320px, calc(100vw - 16px));
  max-height: min(320px, calc(100dvh - 24px));
  margin: 0;
  padding: 0;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 12px;
  background: var(--surface, #fff);
  color: var(--text, #0f172a);
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}

.bb-emote-picker[hidden] {
  display: none !important;
}

.bb-emote-picker__chrome {
  flex-shrink: 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: color-mix(in srgb, var(--surface-muted, #f8fafc) 90%, var(--surface, #fff));
}

.bb-emote-picker__search-label {
  display: block;
  margin: 0;
}

.bb-emote-picker__search {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text, #0f172a);
  font-size: 14px;
  color-scheme: light dark;
}

.bb-emote-picker__search:focus {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 1px;
}

.bb-emote-picker__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 10px 12px;
}

.bb-emote-picker__group {
  margin: 0 0 10px;
}

.bb-emote-picker__group:last-child {
  margin-bottom: 0;
}

.bb-emote-picker__group-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted, #64748b);
}

.bb-emote-picker__grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
}

.bb-emote-picker__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.bb-emote-picker__btn:hover,
.bb-emote-picker__btn:focus-visible {
  background: color-mix(in srgb, var(--accent, #2563eb) 14%, var(--surface, #fff));
  border-color: var(--border, #cbd5e1);
  outline: none;
}

.bb-emote-picker__btn:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 1px;
}

.bb-emote-picker__empty {
  margin: 12px 4px;
  font-size: 13px;
  color: var(--text-muted, #64748b);
}

/* Theme companions */
html[data-theme="dark"] .bb-emote-picker,
html[data-theme="soft"] .bb-emote-picker {
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .bb-emote-picker__search,
html[data-theme="glass"] .bb-emote-picker__search {
  color-scheme: dark;
}

html[data-theme="glass"] .bb-emote-picker {
  background: var(--surface, rgba(20, 24, 36, 0.92));
  border-color: var(--border, rgba(255, 255, 255, 0.18));
  backdrop-filter: blur(12px);
}

html[data-theme="glass"] .bb-emote-picker__chrome {
  background: color-mix(in srgb, var(--surface-muted, rgba(255, 255, 255, 0.08)) 80%, transparent);
}

/* Reply toolbar affordance (forums consumer) */
.pf-reply-emote-btn {
  flex-shrink: 0;
}
