/* Benefits Hero Chatbot styles (scoped) */
.twc-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 999999;
  font-family: "Lato", sans-serif;
  --bubble-max-width: 280px;
}

.twc-launcher {
  position: fixed;
  right: 44px;
  bottom: 24px;
  width: 80px;
  height: 80px;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  cursor: pointer;
  padding: 0;
}

.twc-launcher img {
  max-width: 100px;
  max-height: 100px;
  width: auto;
  height: auto;
  object-fit: contain;
  background: none;
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
}

.twc-typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  margin-top: 8px;
  font-family: "Lato", sans-serif;
  font-size: 15px;
  color: #212529;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px 16px;
  max-width: min(100%, var(--bubble-max-width));
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.twc-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3530e0;
  opacity: 0.3;
  animation: bhcTypingBlink 1.2s infinite;
}

.twc-typing-dot:nth-child(2) {
  animation-delay: 0.4s;
}

.twc-typing-dot:nth-child(3) {
  animation-delay: 0.8s;
}

@keyframes bhcTypingBlink {
  0%,
  80%,
  100% {
    opacity: 0.3;
  }
  40% {
    opacity: 1;
  }
}

.twc-chat-window {
  position: fixed;
  width: 420px;
  height: 600px;
  right: 20px;
  bottom: 20px;
  border: 1px solid #e0e0e0;
  box-shadow: 0px 16px 48px rgba(0, 0, 0, 0.176);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.twc-chat-header {
  background: #3530e0;
  height: 77px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 24px;
}

.twc-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.twc-header-titles {
  display: flex;
  flex-direction: column;
}

.twc-title {
  font-family: "Lato", sans-serif;
  font-weight: 700;
  font-size: 16px;
  line-height: 24px;
  color: #fff;
}

.twc-subtitle {
  font-family: "Lato", sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 21px;
  color: #fff;
  opacity: 0.75;
}

.twc-close-btn {
  background: rgba(53, 48, 224, 0.12);
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s;
}

.twc-chat-body {
  background: #f8f9fa;
  height: 441px;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}

.twc-messages-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 0 24px 24px;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
}

.twc-ai-message-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.twc-ai-message-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.twc-welcome-message {
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #212529;
  border-radius: 8px;
  min-height: 40px;
  max-width: min(100%, var(--bubble-max-width));
  box-sizing: border-box;
  padding: 16px;
  font-family: "Lato", sans-serif;
  font-size: 15px;
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.twc-send-arrow {
  font-size: 24px;
  color: #fff;
  display: block;
  line-height: 1;
}

.twc-close-btn:hover {
  background: #524cf3;
}

.twc-avatar {
  width: 19px;
  height: 28px;
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.twc-user-message {
  background: #3530e0;
  color: #fff;
  border-radius: 8px;
  margin-left: auto;
  margin-right: 24px;
  padding: 12px 16px;
  max-width: min(70%, var(--bubble-max-width));
  margin-bottom: 8px;
  font-family: "Lato", sans-serif;
  font-size: 15px;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.twc-ai-message-group .twc-welcome-message {
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #212529;
  border-radius: 8px;
  min-height: 40px;
  max-width: min(100%, var(--bubble-max-width));
  box-sizing: border-box;
  padding: 16px;
  font-family: "Lato", sans-serif;
  font-size: 15px;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.twc-chat-footer {
  background: #fff;
  display: flex;
  align-items: center;
  padding: 24px;
  gap: 12px;
  border-top: 1px solid #dee2e6;
}

.twc-message-input {
  flex: 1 1 auto;
  border: 1px solid #d0d0d0;
  border-radius: 24px;
  padding: 10px 16px;
  font-family: "Lato", sans-serif;
  font-size: 15px;
  font-weight: 400;
  outline: none;
}

.twc-message-input::placeholder {
  opacity: 0.4;
  color: rgba(33, 37, 41, 0.75);
}

.twc-send-btn {
  width: 45px;
  height: 45px;
  background: #3530e0;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.twc-send-btn img {
  width: 24px;
  height: 24px;
}

.twc-launcher:focus {
  outline: 2px solid rgba(46, 49, 141, 0.55);
  outline-offset: 3px;
}

.twc-ai-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 48px;
  max-height: 48px;
  margin-right: 8px;
}

.twc-ai-avatar img {
  max-width: 48px;
  max-height: 48px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.twc-user-message-group {
  display: block;
  width: 100%;
}

.twc-user-message-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  justify-content: flex-end;
  width: 100%;
}

.twc-avatar {
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  box-sizing: border-box;
  margin-right: 12px;
}

.twc-avatar img {
  z-index: 100;
  display: block;
  max-width: 100%;
  height: auto;
  margin: auto;
  background: none;
  border-radius: 0;
  padding: 0;
}

/* Small screens */
@media (max-width: 480px) {
  .twc-root {
    right: 12px;
    bottom: 12px;
  }
  .twc-chat-window {
    width: calc(100vw - 24px);
    height: min(600px, calc(100vh - 24px));
  }
}
