/*
  Кнопка «Помощь» и окно чат-бота (app/help_bot.py).
  Цвета и шрифт — как у кнопки «Отзыв» (feedback_widget.css): тёмный #1C1C1C,
  зелёный акцент #A9CE9A / #6B9C5A, рамки #E2E2DB, шрифт Inter.
  Кнопка — в левом нижнем углу, чтобы не спорить с «Отзывом» справа.
  Все классы начинаются с hb-.
*/

.hb-button {
  position: fixed;
  left: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px 0 14px;
  border: 0;
  border-radius: 999px;
  background: #A9CE9A;
  color: #1C1C1C;
  font: 600 14px/1 'Inter', system-ui, sans-serif;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}
.hb-button:hover { background: #98C287; }
.hb-button:focus-visible, .hb-close:focus-visible, .hb-send:focus-visible {
  outline: 3px solid #6B9C5A;
  outline-offset: 3px;
}
.hb-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.hb-panel {
  position: fixed;
  left: 20px;
  bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 61;
  display: flex;
  flex-direction: column;
  width: 380px;
  height: min(560px, calc(100vh - 120px));
  padding: 16px;
  border: 1px solid #E2E2DB;
  border-radius: 16px;
  background: #FFFFFF;
  color: #1C1C1C;
  font: 400 14px/1.5 'Inter', system-ui, sans-serif;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}
.hb-panel[hidden] { display: none; }
.hb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.hb-title { margin: 0; font-size: 18px; font-weight: 700; }
.hb-close {
  flex: none; width: 36px; height: 36px; border: 0; border-radius: 8px;
  background: #F6F6F3; color: #1C1C1C; font-size: 22px; line-height: 1; cursor: pointer;
}

.hb-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 10px; }
.hb-msg {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.hb-msg-bot { align-self: flex-start; background: #F6F6F3; border-bottom-left-radius: 4px; }
.hb-msg-user { align-self: flex-end; background: #1C1C1C; color: #FFFFFF; border-bottom-right-radius: 4px; }
.hb-msg-pending { color: #6E6E6A; font-style: italic; }
.hb-msg-error { background: #FBEEEC; color: #9B3328; }

.hb-form { display: flex; gap: 8px; align-items: flex-end; padding-top: 10px; border-top: 1px solid #E2E2DB; }
.hb-input {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #E2E2DB;
  border-radius: 10px;
  background: #FFFFFF;
  color: #1C1C1C;
  font: 400 15px/1.4 'Inter', system-ui, sans-serif;
  resize: none;
}
.hb-input:focus { outline: 2px solid #A9CE9A; border-color: #6B9C5A; }
.hb-send {
  flex: none; width: 42px; height: 42px; border: 0; border-radius: 10px;
  background: #A9CE9A; color: #1C1C1C; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.hb-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hb-send:disabled { opacity: 0.6; cursor: progress; }
.hb-note { margin: 8px 0 0; font-size: 12px; color: #6E6E6A; }

@media (max-width: 640px) {
  .hb-button { left: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); width: 48px; height: 48px; padding: 0; justify-content: center; }
  .hb-button-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  html.has-hb body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .hb-panel {
    left: 0; right: 0; bottom: 0; width: auto; height: 85vh;
    border-radius: 18px 18px 0 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .hb-input { font-size: 16px; } /* 16px — чтобы iPhone не увеличивал страницу при вводе */
}
