/* Чат-виджет FAQ. Использует цветовые переменные из :root в index.html
   (--ink, --ink-soft, --parchment, --honey, --dusk, --ivory, --line) —
   значения-дублёры ниже нужны только как запасной вариант, если файл
   когда-нибудь подключат на странице без этой палитры. */

.cw-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--honey, #c79a3e);
  color: var(--ink, #211b17);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}
.cw-launcher:hover {
  transform: translateY(-2px);
}
.cw-launcher:focus-visible {
  outline: 3px solid var(--ivory, #f6f0e2);
  outline-offset: 3px;
}

.cw-panel {
  position: fixed;
  right: 20px;
  bottom: 92px;
  z-index: 9999;
  width: min(360px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 140px));
  background: var(--ink-soft, #2c2620);
  color: var(--ivory, #f6f0e2);
  border: 1px solid var(--line, rgba(246, 240, 226, 0.14));
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  font-family: "PT Serif", Georgia, serif;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.cw-panel.cw-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.cw-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line, rgba(246, 240, 226, 0.14));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cw-header strong {
  font-family: "Unbounded", sans-serif;
  font-size: 14px;
  font-weight: 600;
}
.cw-header span {
  display: block;
  font-size: 12px;
  opacity: 0.65;
  margin-top: 2px;
}
.cw-close {
  background: none;
  border: none;
  color: var(--ivory, #f6f0e2);
  opacity: 0.6;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.cw-close:hover {
  opacity: 1;
}

.cw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 15px;
  line-height: 1.5;
}
.cw-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 10px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.cw-msg.cw-bot {
  align-self: flex-start;
  background: rgba(246, 240, 226, 0.08);
  border: 1px solid var(--line, rgba(246, 240, 226, 0.14));
  border-bottom-left-radius: 2px;
}
.cw-msg.cw-user {
  align-self: flex-end;
  background: var(--honey, #c79a3e);
  color: var(--ink, #211b17);
  border-bottom-right-radius: 2px;
}
.cw-msg.cw-error {
  align-self: flex-start;
  background: rgba(122, 82, 102, 0.25);
  border: 1px solid var(--dusk, #7a5266);
}
.cw-typing {
  align-self: flex-start;
  opacity: 0.6;
  font-size: 14px;
  font-style: italic;
}

.cw-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line, rgba(246, 240, 226, 0.14));
}
.cw-input {
  flex: 1;
  background: var(--ink, #211b17);
  color: var(--ivory, #f6f0e2);
  border: 1px solid var(--line, rgba(246, 240, 226, 0.14));
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
}
.cw-input:focus {
  outline: 2px solid var(--honey, #c79a3e);
  outline-offset: 1px;
}
.cw-send {
  background: var(--honey, #c79a3e);
  color: var(--ink, #211b17);
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: "Unbounded", sans-serif;
  font-size: 13px;
}
.cw-send:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (max-width: 420px) {
  .cw-panel {
    right: 16px;
    left: 16px;
    width: auto;
    bottom: 88px;
  }
  .cw-launcher {
    right: 16px;
    bottom: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cw-panel,
  .cw-launcher {
    transition: none !important;
  }
}
