/* ════════════════════════════════════════════════════════════
   Speech Combat — панель «Приёмы» и выбранные приёмы (чипы).
   Стиль перенесён из оригинального проекта speechcombat (красный акцент,
   сетка групп с иконками, floating-панель).
   //
   Speech Combat — the "Приёмы" panel and the selected techniques (chips).
   Style ported from the original speechcombat project (red accent, group grid
   with icons, floating panel).
   ════════════════════════════════════════════════════════════ */

/* ───── Композер: чипы над строкой ввода / Composer: chips above the input row ───── */
.chat-compose { flex-direction: column; align-items: stretch; }
.chat-compose-row { display: flex; align-items: flex-end; gap: 10px; }

/* Кнопка открытия панели приёмов. / Techniques panel toggle button. */
.compose-btn.tech-toggle {
  background: var(--bg); color: var(--red); border: 1px solid var(--border); border-radius: 10px;
  width: 48px; height: 46px; flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.compose-btn.tech-toggle .material-symbols-rounded { font-size: 22px; }
.compose-btn.tech-toggle:hover { border-color: var(--red); background: var(--surface); }
.compose-btn.tech-toggle.active {
  background: var(--red); color: #fff; border-color: var(--red);
  box-shadow: 0 4px 12px var(--red-glow);
}

/* ───── Чипы выбранных приёмов / Selected technique chips ───── */
.tech-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tech-chips[hidden] { display: none; }
.tech-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--red); border-radius: 999px;
  padding: 5px 10px 5px 5px; font-size: 13px; color: var(--text); font-weight: 600;
}
.tech-chip-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
}
.tech-chip-remove {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--red); cursor: pointer;
  padding: 0; line-height: 1;
}
.tech-chip-remove .material-symbols-rounded { font-size: 16px; }

/* Затемнение под панелью (показывается только на мобильных).
   Backdrop under the panel (shown on mobile only). */
.tech-overlay { display: none; }

/* ───── Панель приёмов (floating card) / Techniques panel (floating card) ───── */
.tech-panel {
  position: fixed; right: 24px; bottom: 96px; z-index: 60;
  width: 320px; max-width: calc(100vw - 32px); max-height: 70vh;
  flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: 0 18px 48px rgba(20, 25, 45, 0.18);
  overflow: hidden;
  display: none;                 /* закрыта по умолчанию / closed by default */
}
.tech-panel.open { display: flex; }
.tech-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
}
.tech-panel-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; color: var(--text); }
.tech-panel-title .material-symbols-rounded { color: var(--red); font-size: 20px; }
.tech-panel-close {
  border: none; background: transparent; color: var(--text3); cursor: pointer;
  display: flex; align-items: center; padding: 3px; border-radius: 6px;
}
.tech-panel-close:hover { color: var(--text); background: var(--surface-hover); }

/* Группы приёмов — сетка кнопок с иконками. / Technique groups — icon-button grid. */
.tech-groups {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  padding: 4px 16px 14px;
}
.tech-group-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-width: 0; min-height: 64px; padding: 10px 6px; overflow: hidden;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text2); cursor: pointer;
  font-size: 12px; font-weight: 600; text-align: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.tech-group-btn > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-group-btn .material-symbols-rounded { font-size: 22px; }
.tech-group-btn:hover { border-color: var(--border-strong); color: var(--text); transform: translateY(-1px); }
.tech-group-btn.active {
  background: var(--red); border-color: var(--red); color: #fff;
  box-shadow: 0 6px 16px var(--red-glow);
}
.tech-group-btn.active .material-symbols-rounded { color: #fff; font-variation-settings: 'FILL' 1; }

/* Список приёмов выбранной группы. / Technique list of the selected group. */
.tech-list {
  padding: 4px 12px 14px; overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 6px;
  border-top: 1px solid var(--border);
}
.tech-item {
  width: 100%; text-align: left; display: block;
  padding: 11px 14px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--text); cursor: pointer; font-size: 14px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.tech-item:hover { background: var(--surface-hover); }
.tech-item.selected { border-color: var(--red); background: var(--red-glow); color: var(--red); font-weight: 600; }
.tech-list-empty { color: var(--text3); font-size: 13px; text-align: center; padding: 16px 0; }

/* ───── Мобильные: панель как «bottom sheet» / Mobile: panel as a bottom sheet ───── */
@media (max-width: 700px) {
  .tech-overlay {
    display: block; position: fixed; inset: 0; z-index: 59;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0; pointer-events: none; transition: opacity 0.25s;
  }
  .tech-overlay.open { opacity: 1; pointer-events: auto; }

  /* Панель всегда в DOM (display:flex), скрываем/показываем через transform,
     чтобы работала анимация выезда снизу.
     The panel stays in the DOM (display:flex); we hide/show it via transform so
     the slide-up animation works. */
  .tech-panel,
  .tech-panel.open {
    display: flex;
    left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; max-width: 100%; max-height: 78vh;
    border: none; border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 32px rgba(0, 0, 0, 0.28);
  }
  .tech-panel {
    transform: translateY(110%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .tech-panel.open { transform: translateY(0); }
}
