.bg-chat {
  --bg-chat-blue: #0672cb;
  --bg-chat-blue-dark: #0559a1;
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.bg-chat *,
.bg-chat *::before,
.bg-chat *::after {
  box-sizing: border-box;
}

.bg-chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 85;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--bg-chat-blue);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(6, 114, 203, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.bg-chat-launcher:hover,
.bg-chat-launcher:focus-visible {
  background: var(--bg-chat-blue-dark);
  transform: translateY(-1px);
  outline: none;
}

.bg-chat-launcher svg {
  width: 24px;
  height: 24px;
}

.bg-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 86;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 120px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e4e4e7;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
}

.bg-chat-panel.is-open {
  display: flex;
}

.bg-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background: #0672cb;
  color: #fff;
}

.bg-chat-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.bg-chat-header p {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.88;
  font-weight: 500;
}

.bg-chat-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.bg-chat-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.bg-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 8px;
  background: #fafafa;
}

.bg-chat-msg {
  max-width: 92%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bg-chat-msg a {
  color: #0672cb;
  font-weight: 600;
  text-decoration: underline;
}

.bg-chat-msg--bot {
  background: #fff;
  border: 1px solid #ececee;
  color: #18181b;
  border-bottom-left-radius: 4px;
}

.bg-chat-msg--user {
  margin-left: auto;
  background: #0672cb;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bg-chat-msg--error {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
}

.bg-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 12px 12px;
  background: #fafafa;
}

.bg-chat-suggestions button {
  border: 1px solid #e4e4e7;
  background: #fff;
  color: #3f3f46;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
}

.bg-chat-suggestions button:hover {
  border-color: #0672cb;
  color: #0672cb;
}

.bg-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #ececee;
  background: #fff;
}

.bg-chat-form textarea {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 96px;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.4;
}

.bg-chat-form textarea:focus {
  outline: 2px solid rgba(6, 114, 203, 0.25);
  border-color: #0672cb;
}

.bg-chat-form button[type="submit"] {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: #0672cb;
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
}

.bg-chat-form button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: default;
}

.bg-chat-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-height: 18px;
}

.bg-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a1a1aa;
  animation: bg-chat-bounce 1s infinite ease-in-out;
}

.bg-chat-typing span:nth-child(2) {
  animation-delay: 0.12s;
}

.bg-chat-typing span:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes bg-chat-bounce {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 900px) {
  .bg-chat-launcher {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .bg-chat-panel {
    right: 12px;
    bottom: calc(136px + env(safe-area-inset-bottom, 0px));
    height: min(520px, calc(100vh - 180px));
  }
}

@media print {
  .bg-chat {
    display: none !important;
  }
}
