/* Polyquant-X — support chat widget (2026-10-22)
   Только оформление плавающего чата. Поведение — pqx-support-chat.js.
   Цвет бренда #7367f0 — как у cookie-баннера и основного фиолетового сайта. */
.support-chat {
  --pqx-chat-accent: #7367f0;
  position: fixed;
  z-index: 1095; /* выше cookie-баннера (1090) */
  right: 24px;
  bottom: 24px;
  font-family: inherit;
}
.support-toggle {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--pqx-chat-accent);
  box-shadow: 0 12px 32px rgba(58, 46, 145, .28);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.support-toggle:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(58, 46, 145, .34); }
.support-toggle svg { width: 27px; height: 27px; }
.support-chat button:focus-visible,
.support-chat textarea:focus-visible { outline: 3px solid rgba(115, 103, 240, .35); outline-offset: 3px; }
.support-chat button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: flex;
  flex-direction: column;
  width: min(370px, calc(100vw - 32px));
  height: min(520px, calc(100dvh - 130px));
  min-height: 380px;
  overflow: hidden;
  border: 1px solid #e8e8f0;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(28, 31, 55, .2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
.support-chat.is-open .chat-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition: opacity .18s ease, transform .18s ease;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  color: #fff;
  background: linear-gradient(135deg, #6554df, #7566ed);
}
.chat-avatar {
  display: grid;
  flex: 0 0 42px;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .36);
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
}
.chat-avatar svg { width: 22px; height: 22px; }
.chat-headings { flex: 1; min-width: 0; }
.chat-title { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.3; }
.chat-status { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; font-size: 12px; opacity: .9; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #d8d0ff; }
.chat-close {
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: transparent;
  cursor: pointer;
}
.chat-close:hover { background: rgba(255, 255, 255, .14); }
.chat-close svg { width: 19px; height: 19px; }
.chat-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 16px;
  background: #fafaff;
}
.chat-day { margin: 0 0 2px; color: #71758a; font-size: 12px; text-align: center; }
.chat-bubble {
  max-width: 86%;
  padding: 11px 13px;
  border-radius: 15px;
  color: #202238;
  background: #fff;
  box-shadow: 0 2px 8px rgba(37, 39, 71, .07);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.chat-bubble--visitor { align-self: flex-end; border-bottom-right-radius: 5px; color: #fff; background: var(--pqx-chat-accent); }
.chat-bubble--support { align-self: flex-start; border-bottom-left-radius: 5px; }
.chat-note {
  margin: 0;
  padding: 9px 12px;
  border: 1px solid #eee8c9;
  border-radius: 10px;
  color: #6f5d22;
  background: #fffbed;
  font-size: 11px;
  line-height: 1.45;
}
.chat-composer { padding: 12px 14px 14px; border-top: 1px solid #ededf3; background: #fff; }
.chat-intake { display: flex; flex-direction: column; gap: 8px; }
.chat-intake-title { margin: 0 0 2px; color: #202238; font-size: 14px; font-weight: 700; }
.chat-intake-label { margin: 2px 1px 0; color: #55596e; font-size: 12px; font-weight: 600; }
.chat-intake-input {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #e6e6ef;
  border-radius: 10px;
  color: #202238;
  background: #fafaff;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
}
.chat-intake-input:focus-visible { outline: 3px solid rgba(115, 103, 240, .25); outline-offset: 1px; }
.chat-intake-question { min-height: 72px; max-height: 112px; resize: vertical; }
.chat-intake-error { margin: 0; color: #b42318; font-size: 12px; line-height: 1.4; }
.chat-intake-submit {
  min-height: 42px;
  margin-top: 2px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--pqx-chat-accent);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}
.chat-intake-submit:hover:not(:disabled) { filter: brightness(1.06); }
.chat-intake-submit:disabled { opacity: .55; cursor: wait; }
.chat-intake [hidden], .chat-composer-live[hidden] { display: none !important; }
.input-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-input {
  display: block;
  flex: 1;
  min-width: 0;
  max-height: 96px;
  resize: none;
  padding: 11px 12px;
  border: 1px solid #e6e6ef;
  border-radius: 12px;
  color: #202238;
  background: #fafaff;
  font: inherit;
  font-size: 16px; /* на телефоне не зуммит страницу (порог iOS) */
  line-height: 1.4;
}
.chat-input::placeholder { color: #9396a8; }
.chat-send {
  display: grid;
  flex: 0 0 40px;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--pqx-chat-accent);
  cursor: pointer;
}
.chat-send:hover:not(:disabled) { filter: brightness(1.08); }
.chat-send:disabled { opacity: .42; cursor: default; }
.chat-send svg { width: 18px; height: 18px; }
.chat-hint { margin: 8px 2px 0; color: #9295a6; font-size: 10px; }

@media (max-width: 700px) {
  .support-chat { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
  .support-toggle { width: 56px; height: 56px; }
  .chat-panel { right: -4px; bottom: 68px; width: min(370px, calc(100vw - 24px)); height: min(520px, calc(100dvh - 112px)); }
}
@media (prefers-reduced-motion: reduce) {
  .support-toggle, .chat-panel { transition: none; }
}
