/* Floating help assistant widget */
.help-chat-widget {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  font-family: "Open Sans", system-ui, sans-serif;
}

.help-chat-bubble {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 9999px;
  background: linear-gradient(135deg, rgb(37 99 235), rgb(29 78 216));
  color: white;
  padding: 0.875rem 1.125rem;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    0 4px 14px rgba(37, 99, 235, 0.35),
    0 2px 6px rgba(15, 23, 42, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.help-chat-bubble:hover {
  transform: translateY(-1px);
  box-shadow:
    0 8px 20px rgba(37, 99, 235, 0.4),
    0 4px 10px rgba(15, 23, 42, 0.14);
}

.help-chat-bubble-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}

.help-chat-bubble-icon--close {
  display: none;
}

.help-chat-widget.is-open .help-chat-bubble-icon--open {
  display: none;
}

.help-chat-widget.is-open .help-chat-bubble-icon--close {
  display: block;
}

.help-chat-bubble-label {
  line-height: 1;
}

.help-chat-panel {
  width: min(24rem, calc(100vw - 2rem));
  max-height: min(32rem, calc(100vh - 6rem));
  border-radius: 1rem;
  background: white;
  border: 1px solid rgb(226 232 240);
  box-shadow:
    0 4px 6px rgba(15, 23, 42, 0.04),
    0 20px 40px rgba(15, 23, 42, 0.16);
  overflow: hidden;
  text-align: left;
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  animation: help-chat-panel-in 0.2s ease;
}

.help-chat-panel[hidden] {
  display: none;
}

@keyframes help-chat-panel-in {
  from {
    opacity: 0;
    transform: translateY(0.5rem) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.help-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  background: linear-gradient(180deg, rgb(239 246 255), white);
  border-bottom: 1px solid rgb(226 232 240);
}

.help-chat-header-text {
  min-width: 0;
}

.help-chat-title {
  font-family: Poppins, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: rgb(15 23 42);
  line-height: 1.3;
}

.help-chat-subtitle {
  margin-top: 0.125rem;
  font-size: 0.8125rem;
  color: rgb(100 116 139);
  line-height: 1.4;
}

.help-chat-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: rgb(100 116 139);
  cursor: pointer;
}

.help-chat-close:hover {
  background: rgb(241 245 249);
  color: rgb(51 65 85);
}

.help-chat-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  max-height: min(26rem, calc(100vh - 10rem));
}

.help-chat-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.75rem 1rem 0.5rem;
}

.help-chat-starter {
  border: 1px solid rgb(226 232 240);
  background: rgb(248 250 252);
  color: rgb(51 65 85);
  border-radius: 9999px;
  padding: 0.3125rem 0.625rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.help-chat-starter:hover {
  border-color: rgb(191 219 254);
  color: rgb(29 78 216);
  background: rgb(239 246 255);
}

.help-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  min-height: 8rem;
}

.help-chat-empty {
  margin: auto;
  max-width: 16rem;
  text-align: center;
  font-size: 0.8125rem;
  color: rgb(100 116 139);
  line-height: 1.55;
}

.help-chat-message {
  max-width: 92%;
  padding: 0.625rem 0.75rem;
  border-radius: 0.875rem;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.help-chat-message--user {
  align-self: flex-end;
  background: rgb(37 99 235);
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.help-chat-message--assistant {
  align-self: flex-start;
  background: rgb(241 245 249);
  color: rgb(30 41 59);
  border-bottom-left-radius: 0.25rem;
}

.help-chat-sources {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.help-chat-sources a {
  font-size: 0.75rem;
  color: rgb(37 99 235);
  text-decoration: none;
}

.help-chat-sources a:hover {
  text-decoration: underline;
}

.help-chat-typing {
  font-size: 0.75rem;
  color: rgb(100 116 139);
  padding: 0 1rem 0.5rem;
}

.help-chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid rgb(226 232 240);
  background: rgb(248 250 252);
}

.help-chat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgb(226 232 240);
  border-radius: 9999px;
  padding: 0.5625rem 0.875rem;
  font-size: 0.875rem;
  background: white;
}

.help-chat-input:focus {
  outline: none;
  border-color: rgb(37 99 235);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.help-chat-send {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.375rem;
  height: 2.375rem;
  border: 0;
  border-radius: 9999px;
  background: rgb(249 115 22);
  color: white;
  cursor: pointer;
}

.help-chat-send:hover:not(:disabled) {
  background: rgb(234 88 12);
}

.help-chat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.help-search-ask-ai {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: rgb(100 116 139);
}

.help-search-ask-ai button {
  color: rgb(37 99 235);
  font-weight: 600;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.help-search-ask-ai button:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .help-chat-widget {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .help-chat-bubble-label {
    display: none;
  }

  .help-chat-bubble {
    width: 3.25rem;
    height: 3.25rem;
    padding: 0;
    justify-content: center;
    border-radius: 9999px;
  }

  .help-chat-panel {
    width: calc(100vw - 1.5rem);
    max-height: calc(100vh - 5.5rem);
  }

  .help-chat-body {
    max-height: calc(100vh - 9rem);
  }
}
