/* Виджет чата. Плавающая кнопка и окно, в цветах сайта. */

.bchat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 900;
  font-family: Inter, Manrope, Arial, sans-serif;
}

.bchat-fab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 18px 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(118, 183, 255, 0.45);
  background: rgba(14, 18, 24, 0.92);
  color: #fff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(118, 183, 255, 0.12);
  backdrop-filter: blur(12px);
  transition: transform 0.2s, border-color 0.2s;
}

.bchat-fab:hover { transform: translateY(-2px); border-color: var(--accent, #76b7ff); }
.bchat-fab svg { color: var(--accent, #76b7ff); }
.bchat-fab.is-open span { display: none; }

/* display:flex на классе перебивает браузерное [hidden]{display:none} — возвращаем явно */
.bchat-win[hidden] { display: none; }

.bchat-win {
  position: absolute;
  right: 0;
  bottom: 62px;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 14, 18, 0.97);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  animation: bchat-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes bchat-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.bchat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.bchat-head strong { display: block; font-size: 15px; }
.bchat-head span { display: block; font-size: 12px; color: rgba(255, 255, 255, 0.5); margin-top: 2px; }

.bchat-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.bchat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bchat-msg {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.bchat-user {
  align-self: flex-end;
  background: rgba(118, 183, 255, 0.18);
  border: 1px solid rgba(118, 183, 255, 0.3);
  border-bottom-right-radius: 6px;
}

.bchat-assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 6px;
}

.bchat-typing { display: flex; gap: 5px; padding: 12px 14px; }
.bchat-typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  animation: bchat-dot 1.1s infinite;
}
.bchat-typing i:nth-child(2) { animation-delay: 0.15s; }
.bchat-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bchat-dot { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }

.bchat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.bchat-form textarea {
  flex: 1;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
}

.bchat-form textarea:focus { outline: none; border-color: var(--accent, #76b7ff); }

.bchat-form button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: var(--accent, #76b7ff);
  color: #0b0b0b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bchat-honey { position: absolute; left: -9999px; opacity: 0; height: 0; }

.bchat-note {
  margin: 0;
  padding: 0 14px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.45);
}
.bchat-note a { color: var(--accent, #76b7ff); }

@media (max-width: 560px) {
  .bchat { right: 12px; bottom: 12px; }
  .bchat-fab span { display: none; }
  .bchat-fab { padding: 12px 14px; }
}
