/* Виджет интервью Roboworks — стиль командной строки (как главная страница):
   JetBrains Mono, тёмный фон, зелёный акцент, плоско, минимум хрома. */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap');

.ishka-root {
  --t-green: #4ade80;
  --t-green-dim: #2f9e5a;
  --t-bg: #0b0c0f;
  --t-surface: #0e1013;
  --t-border: #1e2228;
  --t-ink: #d7dbe0;
  --t-dim: #7d848e;
  --t-faint: #565d66;
  --t-user: #6ee7a8;
  --t-danger: #f87171;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  -webkit-font-smoothing: antialiased;
}

/* ─── Кнопка-вход (терминальная) ───────────────────────────────────────── */
.ishka-launch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 20px;
  background: transparent;
  color: var(--t-green);
  border: 1px solid var(--t-green-dim);
  border-radius: 6px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.ishka-launch:hover { background: rgba(74, 222, 128, 0.08); border-color: var(--t-green); }
.ishka-launch svg { width: 18px; height: 18px; }

/* ─── Оверлей ──────────────────────────────────────────────────────────── */
.ishka-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 8, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 24px;
}
.ishka-overlay.ishka-open { display: flex; animation: ishka-fade 0.18s ease; }
@keyframes ishka-fade { from { opacity: 0; } to { opacity: 1; } }

.ishka-window {
  display: flex;
  flex-direction: column;
  text-align: left;       /* терминал: всегда влево (не наследуем center со страницы) */
  width: 100%;
  max-width: 560px;       /* окно крупнее */
  height: 100%;
  max-height: 780px;
  background: var(--t-bg);
  border: 1px solid var(--t-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

/* ─── Шапка (строка терминала) ─────────────────────────────────────────── */
.ishka-header {
  display: flex;
  align-items: baseline;
  flex-wrap: nowrap;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--t-border);
  background: var(--t-surface);
  font-size: 13.5px;
}
.ishka-prompt { color: var(--t-ink); font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.ishka-prompt::before { content: '>_ '; color: var(--t-green); }
.ishka-sub { color: var(--t-faint); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ishka-close {
  margin-left: auto;
  background: transparent; border: none; color: var(--t-dim);
  cursor: pointer; padding: 2px 4px; font-family: inherit; font-size: 12.5px;
  white-space: nowrap; flex-shrink: 0;
  transition: color 0.15s;
}
.ishka-close:hover { color: var(--t-green); }

/* ─── Поле вопроса (один вопрос, по центру) ────────────────────────────── */
.ishka-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;          /* Firefox — скрыть полосу */
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;        /* единственный вопрос — по центру по вертикали */
  gap: 12px;
}
.ishka-feed::-webkit-scrollbar { width: 0; height: 0; } /* скрыть полосу, скролл работает */

/* Текущий вопрос — печатается посимвольно. Префикс «›», крупнее обычного. */
.ishka-q {
  font-size: 17px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  padding-left: 18px;
  position: relative;
  color: var(--t-ink);
  min-height: 1.6em;
}
.ishka-q::before {
  content: '›';
  position: absolute; left: 0; top: 0;
  color: var(--t-green); font-weight: 700;
}
/* мигающий блок-курсор, пока печатает / пока ждём ответ */
.ishka-q.ishka-typing-on::after {
  content: '';
  display: inline-block;
  width: 9px; height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--t-green);
  animation: ishka-blink 1s steps(1) infinite;
}
@keyframes ishka-blink { 50% { opacity: 0; } }

.ishka-error, .ishka-note {
  font-size: 13px; line-height: 1.5; padding-left: 16px; position: relative;
}
.ishka-error { color: var(--t-dim); }
.ishka-error::before { content: '!'; position: absolute; left: 0; color: var(--t-danger); font-weight: 700; }
.ishka-error button {
  margin-left: 8px; background: transparent; border: none; color: var(--t-green);
  font-family: inherit; cursor: pointer; font-size: 13px; text-decoration: underline;
}
.ishka-note { color: #d8b25e; }
.ishka-note::before { content: '#'; position: absolute; left: 0; color: var(--t-faint); font-weight: 700; }

/* ─── Нижняя строка ввода (как команда) ────────────────────────────────── */
.ishka-inputbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--t-border);
  background: var(--t-surface);
}
.ishka-textwrap {
  flex: 1; min-width: 0;
  display: flex; align-items: flex-start;
}
.ishka-textwrap::before {
  content: '>';
  color: var(--t-green); font-weight: 700;
  margin-right: 8px; line-height: 1.5; font-size: 14px;
}
.ishka-input {
  flex: 1; min-width: 0;
  resize: none;
  overflow: hidden;            /* без полосы прокрутки/стрелок */
  max-height: 96px;
  min-height: 21px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--t-ink);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  caret-color: var(--t-green);
}
.ishka-input::placeholder { color: var(--t-faint); }

/* кнопки-иконки: плоские, зелёные, без фона (терминальный минимализм) */
.ishka-tbtn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  color: var(--t-green);
  cursor: pointer;
  padding: 6px;
  line-height: 0;
  transition: color 0.15s, opacity 0.15s, transform 0.1s;
}
.ishka-tbtn svg { width: 22px; height: 22px; }
.ishka-tbtn:hover { color: #86efac; }
.ishka-tbtn:active { transform: scale(0.92); }
.ishka-tbtn:disabled { opacity: 0.35; cursor: default; }
.ishka-tbtn.ishka-btn-danger { color: var(--t-dim); }
.ishka-tbtn.ishka-btn-danger:hover { color: var(--t-danger); }
.ishka-tbtn.ishka-btn-ok { color: var(--t-green); }

/* транзиентное «отправленное сообщение»: видно, что ушло, но в чате не остаётся */
.ishka-sent {
  position: relative;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--t-user);
  white-space: pre-wrap;
  word-wrap: break-word;
  align-self: stretch;
  animation: ishka-sent-fly 1.25s ease forwards;
}
.ishka-sent::before { content: '$'; position: absolute; left: 0; top: 0; color: var(--t-dim); font-weight: 700; }
@keyframes ishka-sent-fly {
  0%   { opacity: 0; transform: translateY(6px); }
  18%  { opacity: 1; transform: translateY(0); }
  70%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* ─── Запись (терминальная строка) ─────────────────────────────────────── */
.ishka-recording {
  flex: 1 1 0; min-width: 0;
  display: flex; align-items: center; gap: 9px;
  background: transparent; border: none; padding: 0;
  font-family: inherit;
}
.ishka-rec-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--t-danger);
  animation: ishka-pulse 1s infinite; flex-shrink: 0;
}
@keyframes ishka-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
.ishka-rec-time { color: var(--t-ink); font-variant-numeric: tabular-nums; font-size: 13px; min-width: 38px; }
.ishka-wave { flex: 0 0 auto; display: flex; align-items: center; gap: 2px; height: 16px; max-width: 90px; overflow: hidden; }
.ishka-wave i { display: block; width: 2px; border-radius: 0; background: var(--t-green); height: 20%; }
.ishka-rec-live { flex: 1 1 0; min-width: 0; color: var(--t-dim); font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Кнопка «мои ответы» в шапке ──────────────────────────────────────── */
.ishka-hbtn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: none; color: var(--t-dim);
  cursor: pointer; padding: 2px 4px; font-family: inherit; font-size: 12.5px;
  white-space: nowrap; flex-shrink: 0; transition: color 0.15s;
}
.ishka-hbtn:hover { color: var(--t-green); }
.ishka-hbtn svg { width: 14px; height: 14px; }
.ishka-newint-btn { margin-left: auto; align-self: center; padding: 2px; }
.ishka-newint-btn svg { width: 17px; height: 17px; }
.ishka-answers-btn { align-self: center; }

/* ─── Диалог-подтверждение (новое интервью и т.п.) ─────────────────────── */
.ishka-confirm-dialog {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 6, 8, 0.7); padding: 24px;
  animation: ishka-fade 0.15s ease;
}
.ishka-confirm-card {
  width: 100%; max-width: 340px;
  background: var(--t-surface); border: 1px solid var(--t-border);
  border-radius: 8px; padding: 18px;
}
.ishka-confirm-msg { color: var(--t-ink); font-size: 14.5px; line-height: 1.5; }
.ishka-confirm-subnote { color: var(--t-faint); font-size: 12.5px; line-height: 1.5; margin-top: 7px; }
.ishka-confirm-actions { display: flex; gap: 10px; margin-top: 16px; }
.ishka-confirm-actions .ishka-pbtn { flex: 1; margin-top: 0; }

/* ─── Панель «мои ответы» (поверх всего окна) ──────────────────────────── */
.ishka-panel {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column;
  background: var(--t-bg);
  animation: ishka-panel-in 0.16s ease;
}
@keyframes ishka-panel-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
.ishka-panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--t-border);
  background: var(--t-surface); font-size: 13.5px;
}
.ishka-panel-title { color: var(--t-ink); font-weight: 700; flex: 1; text-align: center; }
.ishka-panel-title::before { content: '>_ '; color: var(--t-green); }
.ishka-phbtn {
  background: transparent; border: none; color: var(--t-dim);
  cursor: pointer; padding: 2px 4px; font-family: inherit; font-size: 12.5px;
  white-space: nowrap; flex-shrink: 0; transition: color 0.15s;
}
.ishka-phbtn:hover { color: var(--t-green); }
.ishka-panel-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
}
.ishka-panel-body::-webkit-scrollbar { width: 0; height: 0; }
.ishka-panel-empty, .ishka-panel-intro { color: var(--t-dim); font-size: 13px; line-height: 1.5; }
.ishka-panel-intro { margin-bottom: 4px; }

/* строка вопроса в списке */
.ishka-qrow {
  display: block; width: 100%; text-align: left;
  background: var(--t-surface); border: 1px solid var(--t-border);
  border-radius: 6px; padding: 11px 13px; cursor: pointer;
  font-family: inherit; transition: border-color 0.15s, background 0.15s;
}
.ishka-qrow:hover { border-color: var(--t-green-dim); background: rgba(74, 222, 128, 0.04); }
.ishka-qrow-q { color: var(--t-ink); font-size: 13.5px; line-height: 1.45; margin-bottom: 5px; }
.ishka-qrow-a { color: var(--t-user); font-size: 12.5px; line-height: 1.4; opacity: 0.85; }
.ishka-qrow-a::before { content: '$ '; color: var(--t-faint); }

/* деталь вопрос/ответ */
.ishka-d-label { color: var(--t-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 6px; }
.ishka-d-q {
  color: var(--t-ink); font-size: 15px; line-height: 1.55; white-space: pre-wrap;
  word-wrap: break-word; padding-left: 16px; position: relative;
}
.ishka-d-q::before { content: '›'; position: absolute; left: 0; top: 0; color: var(--t-green); font-weight: 700; }
.ishka-d-a {
  color: var(--t-user); font-size: 14px; line-height: 1.55; white-space: pre-wrap;
  word-wrap: break-word; padding-left: 16px; position: relative;
}
.ishka-d-a::before { content: '$'; position: absolute; left: 0; top: 0; color: var(--t-dim); font-weight: 700; }

/* кнопки в панели */
.ishka-pbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; background: transparent; color: var(--t-dim);
  border: 1px solid var(--t-border); border-radius: 6px;
  font-family: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ishka-pbtn:hover { color: var(--t-ink); border-color: var(--t-dim); }
.ishka-pbtn:disabled { opacity: 0.4; cursor: default; }
.ishka-pbtn svg { width: 16px; height: 16px; }
.ishka-pbtn-primary { color: var(--t-green); border-color: var(--t-green-dim); margin-top: 8px; }
.ishka-pbtn-primary:hover { color: var(--t-green); border-color: var(--t-green); background: rgba(74, 222, 128, 0.08); }

/* режим правки */
.ishka-edit-input {
  width: 100%; resize: vertical; min-height: 80px;
  background: var(--t-surface); border: 1px solid var(--t-border); border-radius: 6px;
  color: var(--t-ink); font-family: inherit; font-size: 14px; line-height: 1.5;
  padding: 10px 12px; outline: none; caret-color: var(--t-green);
}
.ishka-edit-input:focus { border-color: var(--t-green-dim); }
.ishka-edit-status { color: var(--t-dim); font-size: 12.5px; line-height: 1.4; min-height: 1em; }
.ishka-edit-status.ishka-edit-busy { color: #d8b25e; }
.ishka-edit-actions { display: flex; gap: 10px; margin-top: 4px; }
.ishka-edit-actions .ishka-pbtn { flex: 1; margin-top: 0; }

/* подтверждение «другие вопросы поплывут» */
.ishka-confirm-lead { color: var(--t-ink); font-size: 14px; line-height: 1.5; }
.ishka-confirm-list { display: flex; flex-direction: column; gap: 6px; }
.ishka-confirm-item {
  color: var(--t-dim); font-size: 13px; line-height: 1.45;
  padding: 8px 11px; background: var(--t-surface); border: 1px solid var(--t-border); border-radius: 6px;
}
.ishka-confirm-note { color: var(--t-faint); font-size: 12.5px; line-height: 1.5; }

/* временное уведомление в панели */
.ishka-ptoast {
  color: var(--t-green); font-size: 13px; line-height: 1.4;
  padding: 8px 11px; border: 1px solid var(--t-green-dim); border-radius: 6px;
  background: rgba(74, 222, 128, 0.06);
  animation: ishka-fade 0.18s ease;
}

.ishka-hidden { display: none !important; }

/* ─── Мобильный (приоритет) ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .ishka-overlay { padding: 0; }
  .ishka-window {
    max-width: 100%; max-height: 100%;
    height: 100%; height: 100dvh;
    border-radius: 0; border: none;
  }
  .ishka-input { font-size: 16px; } /* iOS не зумит при фокусе */
  .ishka-header { font-size: 13px; padding: 12px 14px; }
  .ishka-sub { display: none; }    /* на узком экране подзаголовок прячем — шапка не едет */
  .ishka-feed { padding: 20px 16px; }
  .ishka-q { font-size: 16px; }
  .ishka-answers-btn span { display: none; } /* узкий экран — только иконка */
  .ishka-panel-body { padding: 16px; }
}
