/* Глобальный ИИ-помощник (components/assistant.js). Основа — классы .cop-* из copilot.css
   (кружок, строка-«вытягивание», карточки ответов); здесь — только своё. Всё под .cqa-app. */

.cqa-app .asst[hidden] { display: none !important; }

/* Поверх содержимого, но под модальными окнами и тостами */
.cqa-app .asst.cop--fab, .cqa-app .asst.cop--dock { z-index: 36; }

/* Ветка разговора над строкой */
.cqa-app .asst-stack { max-height: min(52vh, 480px); }
.cqa-app .asst-thread .cop-sec { padding: 10px 0 4px; }
.cqa-app .asst-thread .cop-answer { margin: 0 0 14px; }
.cqa-app .asst-thread .cop-answer:last-child { margin-bottom: 4px; }
.cqa-app .asst-head-acts { display: inline-flex; gap: 2px; }
.cqa-app .asst-hints { max-width: 560px; }

/* Карточка «Открыл: Диалоги · фильтр …» */
.cqa-app .asst-act {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 8px 8px 10px; border: 1px solid var(--brand-border); border-radius: var(--radius);
  background: var(--brand-50); font-size: 13px; line-height: 1.4; color: var(--text-body);
}
.cqa-app .asst-act b { font-weight: 600; color: var(--text); }
.cqa-app .asst-act__icon {
  flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--brand-500); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.cqa-app .asst-act__icon .cqa-icon { width: 12px; height: 12px; }
.cqa-app .asst-act__text { flex: 1 1 auto; min-width: 0; }
.cqa-app .asst-act__back { margin-left: auto; gap: 6px; }
.cqa-app .asst-act__back .cqa-icon { width: 14px; height: 14px; }
.cqa-app .asst-act.is-skipped { border-color: var(--border-control); background: var(--surface-2); }
.cqa-app .asst-act.is-skipped .asst-act__icon { background: var(--text-muted); }

.cqa-app .asst-note { display: flex; gap: 6px; margin: 0; font-size: 12px; line-height: 1.4; color: var(--text-secondary); }
.cqa-app .asst-note .cqa-icon { flex: none; width: 13px; height: 13px; margin-top: 1px; }
.cqa-app .asst-sugg { margin-top: 2px; }

/* Подсветка целевого блока после перехода: рамка --brand-500, ~1 с */
@keyframes asst-flash {
  0% { box-shadow: 0 0 0 0 rgba(72,168,72,0); }
  15% { box-shadow: 0 0 0 3px var(--brand-500), 0 0 0 9px rgba(72,168,72,.18); }
  70% { box-shadow: 0 0 0 2px var(--brand-500), 0 0 0 6px rgba(72,168,72,.10); }
  100% { box-shadow: 0 0 0 0 rgba(72,168,72,0); }
}
.cqa-app .asst-flash { animation: asst-flash 1.5s ease; position: relative; z-index: 1; }

@media (max-width: 640px) {
  .cqa-app .asst-stack { max-height: 46vh; }
  .cqa-app .asst-act__back { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .cqa-app .asst-flash { animation: none; outline: 2px solid var(--brand-500); outline-offset: 3px; }
}
.cqa-app .asst-thread { padding-bottom: 4px; }
.cqa-app .asst-thread .cop-answer .cop-meta { margin: 0; }

/* Тосты не перекрывают ИИ: над закрытым кружком, а при раскрытой строке — в правый верхний угол */
@media (min-width: 641px) {
  .cqa-app:has(.cop--fab) .cqa-toasts { bottom: 104px; }
  .cqa-app:has(.cop--dock) .cqa-toasts { top: 24px; bottom: auto; }
}

/* Ненавязчивая подсказка у закрытого кружка */
.cqa-app .asst-nudge {
  position: absolute; right: 70px; bottom: 9px; display: flex; align-items: center; gap: 2px;
  padding: 4px 4px 4px 14px; border-radius: 18px 18px 4px 18px; background: var(--surface);
  box-shadow: 0 10px 28px rgba(17,24,39,.16), 0 0 0 1px var(--border); white-space: nowrap;
  animation: asst-nudge-in 260ms cubic-bezier(.2,.8,.2,1) both;
}
.cqa-app .asst-nudge.is-out { animation: asst-nudge-out 180ms ease forwards; }
@keyframes asst-nudge-in { from { opacity: 0; transform: translateX(8px) scale(.96); } }
@keyframes asst-nudge-out { to { opacity: 0; transform: translateX(6px); } }
.cqa-app .asst-nudge__text { border: 0; background: none; padding: 6px 4px; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--text); cursor: pointer; }
.cqa-app .asst-nudge__text:hover { color: var(--brand-700); }
.cqa-app .asst-nudge__x { display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 50%; background: none; color: var(--text-muted); cursor: pointer; }
.cqa-app .asst-nudge__x:hover { background: var(--surface-hover); color: var(--text); }
.cqa-app .asst-nudge button:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 8px; }
@media (max-width: 640px) { .cqa-app .asst-nudge { right: 64px; max-width: calc(100vw - 100px); white-space: normal; } }
@media (prefers-reduced-motion: reduce) { .cqa-app .asst-nudge, .cqa-app .asst-nudge.is-out { animation: none; } }
