@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --n8n-chat-width: 400px;
  --n8n-chat-bg: #faf8ff;
  --n8n-chat-surface: #ffffff;
  --n8n-chat-surface-soft: #f2f3ff;
  --n8n-chat-text: #131b2e;
  --n8n-chat-muted: #58635a;
  --n8n-chat-border: #becabc;
  --n8n-chat-primary: #005f2e;
  --n8n-chat-secondary: #3a608e;
  --n8n-chat-secondary-soft: #d3e4ff;
  --n8n-chat-danger: #ba1a1a;
}

#n8n-chat-widget-root,
#n8n-chat-widget-root * {
  box-sizing: border-box;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (min-width: 761px) {
  body.n8n-chat-sidebar-open {
    padding-right: var(--n8n-chat-width) !important;
    transition: padding-right 0.24s ease;
  }
}

.n8n-chat-sidebar {
  background: var(--n8n-chat-surface);
  border-left: 1px solid var(--n8n-chat-border);
  bottom: 0;
  box-shadow: -12px 0 32px rgba(19, 27, 46, 0.08);
  color: var(--n8n-chat-text);
  display: flex;
  flex-direction: column;
  max-width: 100vw;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateX(100%);
  transition: transform 0.24s ease;
  width: var(--n8n-chat-width);
  z-index: 99999;
}

.n8n-chat-sidebar.is-open {
  transform: translateX(0);
}

.n8n-chat-header {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--n8n-chat-border);
  display: flex;
  gap: 12px;
  min-height: 70px;
  padding: 14px 16px;
}

.n8n-chat-avatar,
.n8n-chat-message-avatar {
  align-items: center;
  background: var(--n8n-chat-secondary);
  border-radius: 999px;
  color: #ffffff;
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 800;
  justify-content: center;
}

.n8n-chat-avatar {
  height: 40px;
  width: 40px;
}

.n8n-chat-message-avatar {
  font-size: 10px;
  height: 28px;
  width: 28px;
}

.n8n-chat-heading {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.n8n-chat-heading strong {
  color: var(--n8n-chat-primary);
  font-size: 14px;
  font-weight: 800;
  line-height: 20px;
}

.n8n-chat-heading span {
  align-items: center;
  color: var(--n8n-chat-muted);
  display: flex;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  line-height: 16px;
}

.n8n-chat-heading i {
  background: var(--n8n-chat-primary);
  border-radius: 999px;
  display: inline-flex;
  height: 7px;
  width: 7px;
}

.n8n-chat-icon-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--n8n-chat-muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 28px;
  height: 36px;
  justify-content: center;
  line-height: 1;
  width: 36px;
}

.n8n-chat-icon-button:hover {
  background: var(--n8n-chat-surface-soft);
  color: var(--n8n-chat-text);
}

.n8n-chat-context {
  background: #ffffff;
  border-bottom: 1px solid var(--n8n-chat-border);
  color: var(--n8n-chat-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  padding: 12px 16px;
}

.n8n-chat-messages {
  background: var(--n8n-chat-bg);
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.n8n-chat-message {
  align-items: flex-start;
  display: flex;
  gap: 10px;
  max-width: 100%;
}

.n8n-chat-message.is-user {
  justify-content: flex-end;
}

.n8n-chat-bubble-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 82%;
}

.n8n-chat-message.is-user .n8n-chat-bubble-wrap {
  align-items: flex-end;
}

.n8n-chat-bubble {
  background: #ffffff;
  border: 1px solid var(--n8n-chat-border);
  border-radius: 8px;
  color: var(--n8n-chat-text);
  font-size: 14px;
  line-height: 21px;
  overflow-wrap: anywhere;
  padding: 11px 13px;
}

.n8n-chat-message.is-user .n8n-chat-bubble {
  background: var(--n8n-chat-secondary);
  border-color: var(--n8n-chat-secondary);
  color: #ffffff;
}

.n8n-chat-time {
  color: var(--n8n-chat-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 15px;
}

.n8n-chat-typing {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--n8n-chat-border);
  border-radius: 8px;
  display: inline-flex;
  gap: 5px;
  padding: 12px 14px;
}

.n8n-chat-typing span {
  animation: n8nTypingDot 1.1s ease-in-out infinite;
  background: var(--n8n-chat-primary);
  border-radius: 999px;
  height: 7px;
  width: 7px;
}

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

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

.n8n-chat-footer {
  background: #ffffff;
  border-top: 1px solid var(--n8n-chat-border);
  padding: 14px 16px 16px;
}

.n8n-chat-suggestions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  margin-bottom: 12px;
}

.n8n-chat-suggestion {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--n8n-chat-border);
  border-radius: 8px;
  color: var(--n8n-chat-text);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  justify-content: flex-start;
  line-height: 16px;
  min-height: 36px;
  padding: 8px 10px;
  text-align: left;
}

.n8n-chat-suggestion:hover {
  background: var(--n8n-chat-surface-soft);
  border-color: var(--n8n-chat-secondary);
}

.n8n-chat-form {
  align-items: center;
  display: flex;
  gap: 8px;
  margin: 0;
}

.n8n-chat-form input {
  background: #ffffff;
  border: 1px solid var(--n8n-chat-border);
  border-radius: 8px;
  color: var(--n8n-chat-text);
  flex: 1;
  font-size: 15px;
  line-height: 22px;
  min-height: 46px;
  min-width: 0;
  outline: none;
  padding: 11px 13px;
}

.n8n-chat-form input:focus {
  border-color: var(--n8n-chat-secondary);
  box-shadow: 0 0 0 3px rgba(58, 96, 142, 0.16);
}

.n8n-chat-form button {
  align-items: center;
  background: var(--n8n-chat-primary);
  border: 1px solid var(--n8n-chat-primary);
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 46px;
  font-size: 18px;
  height: 46px;
  justify-content: center;
  width: 46px;
}

.n8n-chat-form button:disabled {
  background: #dfe7e2;
  border-color: #dfe7e2;
  color: #7a857c;
  cursor: not-allowed;
}

.n8n-chat-toggle {
  align-items: center;
  background: var(--n8n-chat-primary);
  border: 1px solid var(--n8n-chat-primary);
  border-radius: 8px 0 0 8px;
  box-shadow: 0 8px 20px rgba(19, 27, 46, 0.16);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  height: 54px;
  justify-content: center;
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 0.2s ease, visibility 0.2s ease;
  width: 44px;
  z-index: 99998;
}

.n8n-chat-toggle.is-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.n8n-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.n8n-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.n8n-chat-messages::-webkit-scrollbar-thumb {
  background: #d9e3dd;
  border-radius: 999px;
}

@keyframes n8nTypingDot {
  0%, 65%, 100% {
    transform: translateY(0);
  }
  35% {
    transform: translateY(-5px);
  }
}

@media (max-width: 760px) {
  body.n8n-chat-sidebar-open {
    padding-right: 0 !important;
  }

  .n8n-chat-sidebar {
    width: min(100vw, 420px);
  }

  .n8n-chat-sidebar.is-open {
    transform: translateX(0);
  }

  .n8n-chat-toggle {
    bottom: 18px;
    height: 48px;
    right: 14px;
    top: auto;
    transform: none;
    width: 48px;
  }
}
