:root {
  --widget-red: #d91f26;
  --widget-red-dark: #b4151b;
  --widget-bg: #ffffff;
  --widget-text: #1f1f1f;
}

/* * {
  box-sizing: border-box;
} */

#chat-widget-root {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: #f6f6f8;
  color: var(--widget-text);
}

.test-page {
  max-width: 780px;
  margin: 48px auto;
  padding: 24px;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
}

.chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 999px;
  background: var(--widget-red);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(217, 31, 38, 0.3);
}

.chat-launcher:hover {
  background: var(--widget-red-dark);
}

.chat-panel {
  position: fixed;
  right: 24px;
  bottom: 92px;
  width: 360px;
  max-width: calc(100vw - 24px);
  height: 500px;
  max-height: calc(100vh - 120px);
  display: none;
  flex-direction: column;
  background: var(--widget-bg);
  border: 1px solid #e8e8e8;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
}

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

.chat-header {
  background: var(--widget-red);
  color: #fff;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 15px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fafafa;
}

.chat-message {
  max-width: 84%;
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.35;
  font-size: 14px;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-message.user {
  align-self: flex-end;
  background: var(--widget-red);
  color: #fff;
}

.chat-message.bot {
  align-self: flex-start;
  background: #ededed;
  color: #222;
}

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

.chat-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d4d4d4;
  border-radius: 10px;
  font-size: 14px;
}

.chat-submit {
  border: none;
  border-radius: 10px;
  padding: 0 14px;
  background: var(--widget-red);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

.chat-submit:hover {
  background: var(--widget-red-dark);
}

@media (max-width: 480px) {
  .chat-panel {
    right: 10px;
    bottom: 84px;
    width: calc(100vw - 20px);
    height: min(70vh, 520px);
  }

  .chat-launcher {
    right: 10px;
    bottom: 14px;
  }
}
