.lc-n8n-chatbot-root {
  --lc-chat-primary: #1f6feb;
  --lc-chat-secondary: #0b1220;
  --lc-chat-bg: #ffffff;
  --lc-chat-bot-bg: #f3f6fb;
  --lc-chat-user-bg: #1f6feb;
  --lc-chat-bot-text: #111827;
  --lc-chat-user-text: #ffffff;
  --lc-chat-text: #111827;
  --lc-chat-width: 380px;
  --lc-chat-height: 560px;
  --lc-chat-radius: 22px;
  --lc-launcher-size: 62px;
  --lc-launcher-width: 62px;
  --lc-launcher-height: 62px;
  --lc-launcher-icon-size: 35px;
  --lc-launcher-border-width: 0px;
  --lc-launcher-border-color: #ffffff;
  --lc-launcher-border-radius: 999px;
  font-family: inherit;
  color: var(--lc-chat-text);
  box-sizing: border-box;
  z-index: 2147483000;
}

/* Evita que estilos del tema alteren el comportamiento flotante del widget. */
.lc-n8n-chatbot-root.lc-n8n-floating {
  position: fixed !important;
  bottom: 22px !important;
  top: auto !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 2147483000 !important;
}


.lc-n8n-chatbot-root *,
.lc-n8n-chatbot-root *::before,
.lc-n8n-chatbot-root *::after {
  box-sizing: border-box;
}

.lc-n8n-floating {
  position: fixed !important;
  bottom: 22px !important;
}

.lc-n8n-right {
  right: 22px !important;
  left: auto !important;
}

.lc-n8n-left {
  left: 22px !important;
  right: auto !important;
}

.lc-n8n-inline {
  width: min(100%, var(--lc-chat-width));
  max-width: 100%;
}

.lc-n8n-launcher {
  display: inline-grid;
  place-items: center;
  width: var(--lc-launcher-width);
  height: var(--lc-launcher-height);
  min-width: var(--lc-launcher-width);
  min-height: var(--lc-launcher-height);
  border: var(--lc-launcher-border-width) solid var(--lc-launcher-border-color);
  border-radius: var(--lc-launcher-border-radius);
  background: var(--lc-chat-primary);
  color: #fff;
  padding: 0;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.24);
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  overflow: hidden;
  position: relative;
  z-index: 2;
  transform-origin: center center;
  will-change: transform;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.lc-n8n-launcher:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.30);
  outline: none;
}

.lc-n8n-launcher:focus-visible {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.30);
  outline: 2px solid rgba(31, 111, 235, 0.35);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .lc-n8n-launcher {
    transition: box-shadow 0.2s ease, opacity 0.2s ease;
  }

  .lc-n8n-launcher:hover,
  .lc-n8n-launcher:focus-visible {
    transform: none;
  }
}

.lc-n8n-launcher-icon {
  display: inline-grid;
  place-items: center;
  width: var(--lc-launcher-icon-size);
  height: var(--lc-launcher-icon-size);
  font-size: calc(var(--lc-launcher-icon-size) * 0.64);
  overflow: hidden;
}

.lc-n8n-launcher.has-image .lc-n8n-launcher-icon {
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.lc-n8n-launcher.has-image .lc-n8n-launcher-icon-img {
  width: 100%;
  height: 100%;
}

.lc-n8n-launcher-text {
  display: none !important;
}

.lc-n8n-launcher-icon-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  border-radius: inherit;
  max-width: none !important;
  max-height: none !important;
}

.lc-n8n-panel {
  display: none !important;
  width: min(calc(100vw - 28px), var(--lc-chat-width));
  height: min(calc(100vh - 110px), var(--lc-chat-height));
  min-height: 360px;
  overflow: hidden;
  background: var(--lc-chat-bg);
  border-radius: var(--lc-chat-radius);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.26);
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.lc-n8n-floating .lc-n8n-panel {
  position: absolute;
  bottom: calc(var(--lc-launcher-size) + 10px);
  z-index: 1;
}

.lc-n8n-right .lc-n8n-panel {
  right: 0;
}

.lc-n8n-left .lc-n8n-panel {
  left: 0;
}

.lc-n8n-inline .lc-n8n-panel {
  display: flex !important;
  position: static;
  width: 100%;
  height: var(--lc-chat-height);
  max-height: 78vh;
}

.lc-n8n-chatbot-root.is-open .lc-n8n-panel {
  display: flex !important;
  flex-direction: column;
  animation: lcN8NPanelIn 0.22s ease-out;
}

.lc-n8n-chatbot-root.is-open .lc-n8n-launcher {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.lc-n8n-chatbot-root.is-open .lc-n8n-launcher:hover,
.lc-n8n-chatbot-root.is-open .lc-n8n-launcher:focus-visible {
  transform: translateY(-2px) scale(1.06);
}


/* En modo flotante el panel debe permanecer cerrado hasta pulsar el icono,
salvo que la opción "Abrir por defecto" esté activa. */
.lc-n8n-chatbot-root.lc-n8n-floating:not(.is-open) .lc-n8n-panel {
  display: none !important;
}

.lc-n8n-chatbot-root.lc-n8n-floating.is-open .lc-n8n-panel {
  display: flex !important;
  flex-direction: column;
}

@keyframes lcN8NPanelIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.lc-n8n-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px;
  color: #fff;
  background: var(--lc-chat-secondary);
}

.lc-n8n-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lc-n8n-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 22px;
  background-size: cover;
  background-position: center;
}

.lc-n8n-avatar-image {
  color: transparent;
}

.lc-n8n-title-wrap {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.lc-n8n-title {
  color: #fff;
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lc-n8n-subtitle {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  line-height: 1.2;
}

.lc-n8n-close {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.lc-n8n-close:hover,
.lc-n8n-close:focus {
  background: rgba(255, 255, 255, 0.22);
  outline: none;
}

.lc-n8n-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px;
  background:
    radial-gradient(circle at top right, rgba(31, 111, 235, 0.08), transparent 34%),
    var(--lc-chat-bg);
  scrollbar-width: thin;
}

.lc-n8n-message {
  display: flex;
  margin: 0 0 12px;
}

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

.lc-n8n-message-bot {
  justify-content: flex-start;
}

.lc-n8n-bubble {
  max-width: 82%;
  padding: 11px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.lc-n8n-message-bot .lc-n8n-bubble {
  background: var(--lc-chat-bot-bg);
  color: var(--lc-chat-bot-text);
  border-bottom-left-radius: 5px;
}

.lc-n8n-message-user .lc-n8n-bubble {
  background: var(--lc-chat-user-bg);
  color: var(--lc-chat-user-text);
  border-bottom-right-radius: 5px;
}

.lc-n8n-bubble a,
.lc-n8n-bubble .lc-n8n-message-link {
  color: currentColor;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.lc-n8n-bubble a:hover,
.lc-n8n-bubble .lc-n8n-message-link:hover {
  text-decoration-thickness: 2px;
}

.lc-n8n-bubble a:focus-visible,
.lc-n8n-bubble .lc-n8n-message-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: 3px;
}

.lc-n8n-typing .lc-n8n-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--lc-chat-bot-text);
  opacity: 0.66;
}

.lc-n8n-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  animation: lcN8NDot 1s infinite ease-in-out;
}

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

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

.lc-n8n-typing em {
  margin-left: 4px;
  font-style: normal;
  font-size: 12px;
}

@keyframes lcN8NDot {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-3px);
    opacity: 0.9;
  }
}

.lc-n8n-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
}

.lc-n8n-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  max-height: 110px;
  resize: none;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 14px;
  padding: 11px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  color: var(--lc-chat-text);
  background: #fff;
}

.lc-n8n-input:focus {
  border-color: var(--lc-chat-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lc-chat-primary), transparent 82%);
  outline: none;
}

.lc-n8n-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  padding: 0 15px;
  color: #fff;
  background: var(--lc-chat-primary);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.lc-n8n-send-icon,
.lc-n8n-send-text {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.lc-n8n-send-icon-img {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.lc-n8n-send:hover,
.lc-n8n-send:focus {
  opacity: 0.92;
  transform: translateY(-1px);
  outline: none;
}

.lc-n8n-powered {
  padding: 0 14px 12px;
  text-align: center;
  font-size: 11px;
  color: rgba(17, 24, 39, 0.48);
  background: var(--lc-chat-bg);
}

@media (max-width: 520px) {
  .lc-n8n-chatbot-root.lc-n8n-floating {
    right: 14px !important;
    left: 14px !important;
    bottom: 14px !important;
  }

  .lc-n8n-floating .lc-n8n-panel {
    left: 0;
    right: 0;
    bottom: calc(var(--lc-launcher-size) + 10px);
    width: 100%;
    height: min(calc(100vh - var(--lc-launcher-size) - 44px), var(--lc-chat-height));
  }

  .lc-n8n-launcher {
    float: right;
  }

  .lc-n8n-left .lc-n8n-launcher {
    float: left;
  }

  .lc-n8n-bubble {
    max-width: 88%;
  }
}
