/* #CHAT-158..161: единый SSOT-пикер «вставка эмодзи» (комментарии/новости/подпись/пересылка).
   Полноразмерные пропорции панели и кнопок зеркалят одобренный пользователем чат-пикер
   (#CHAT-153 «отличный пикер» — НЕ уменьшать, крупные зоны клика). Цвета — глобальные
   theme-переменные (--bs-*/--text-*) с безопасными fallback-значениями. */

/* Универсальная строка «лейбл поля + кнопка-триггер» — для композеров без своего
   textarea-оверлея (новости/подпись вложения): кнопка встаёт рядом с подписью поля. */
.bs-field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.bs-field-label-row label {
  margin-bottom: 0;
}

.bs-emoji-insert-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.bs-emoji-insert-trigger:hover {
  background: var(--bs-surface-2, rgba(100, 116, 139, 0.12));
  color: var(--primary-color, #6366f1);
}

.bs-emoji-insert-trigger:active {
  transform: scale(0.94);
}

.bs-emoji-insert-trigger.active,
.bs-emoji-insert-trigger[aria-expanded="true"] {
  background: var(--bs-surface-2, rgba(99, 102, 241, 0.16));
  color: var(--primary-color, #6366f1);
}

.bs-emoji-insert-trigger i {
  font-size: 18px;
  line-height: 1;
}

/* Панель — синглтон в document.body (как elevated-режим чат-пикера) */
.bs-eip-panel {
  display: none;
  flex-direction: column;
  position: fixed;
  padding: 6px 6px 8px;
  border: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.08));
  border-radius: 16px;
  background: var(--bs-surface-1, #ffffff);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22), 0 4px 14px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.12s ease;
}

.bs-eip-panel--closing {
  opacity: 0;
}

.bs-eip-tabs {
  display: grid;
  grid-template-columns: repeat(var(--bs-eip-tabs-count, 6), minmax(0, 1fr));
  gap: 4px;
  min-height: 42px;
  margin-bottom: 6px;
}

.bs-eip-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 35px;
  height: 35px;
  margin: 0 auto;
  border: none;
  border-radius: 11px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s ease;
}

.bs-eip-tab:hover {
  background: var(--bs-surface-2, rgba(100, 116, 139, 0.12));
}

.bs-eip-tab.active {
  background: var(--bs-surface-3, rgba(99, 102, 241, 0.16));
}

.bs-eip-tab-icon {
  display: inline-flex;
  font-size: 20px;
  line-height: 1;
}

.bs-eip-tab-icon img,
.bs-eip-tab-icon .bs-emoji-fallback {
  width: 22px;
  height: 22px;
}

.bs-eip-body {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}

.bs-eip-section {
  padding: 2px;
}

.bs-eip-section__body {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.06rem;
}

/* Крупные кнопки-эмодзи — пропорции 1:1 с .emoji-btn из одобренного чат-пикера */
.bs-eip-emoji-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  height: 40px;
  min-height: 40px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.12s ease, transform 0.1s ease;
}

.bs-eip-emoji-btn:hover {
  background: var(--bs-surface-2, rgba(100, 116, 139, 0.14));
}

.bs-eip-emoji-btn:active {
  transform: scale(0.94);
}

.bs-eip-emoji-btn img,
.bs-eip-emoji-btn .bs-emoji-fallback {
  width: 32px;
  height: 32px;
  pointer-events: none;
}

.bs-eip-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-secondary, #64748b);
  font-size: 0.9rem;
}

@media (min-width: 1025px) {
  .bs-eip-emoji-btn {
    width: 48px;
    height: 48px;
    font-size: 26px;
  }

  .bs-eip-emoji-btn img,
  .bs-eip-emoji-btn .bs-emoji-fallback {
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 768px) {
  .bs-eip-section__body {
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  }
}
