#procomex-chatbot-root {
  --pcx-blue: #165a8f;
  --pcx-aqua: #00AAD4;
  --pcx-green: #2e7d32;
  --pcx-text: #1f2933;
  --pcx-muted: #65717f;
  --pcx-line: #d7e2ea;
  --pcx-surface: #ffffff;
  --pcx-soft: #f3f7fa;
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999999;
  font-family: Arial, Helvetica, sans-serif;
}

@keyframes pcx-bounce-soft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.pcx-chat-launcher {
  width: 140px;
  height: 140px;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-image: var(--pcx-robot-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  color: #ffffff;
  box-shadow: none;
  cursor: pointer;
  font-size: 24px;
  font-weight: 700;
  position: relative;
  animation: pcx-bounce-soft 2s infinite;
}

.pcx-chat-launcher::before {
  content: "¡Pregúntame!";
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--pcx-aqua);
  color: #ffffff;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  font-weight: 700;
}

.pcx-chat-launcher-icon {
  display: none;
}

.pcx-chat-panel {
  display: none;
  width: min(380px, calc(100vw - 28px));
  height: min(620px, calc(100vh - 100px));
  margin-bottom: 12px;
  background: var(--pcx-surface);
  border: 1px solid var(--pcx-line);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(31, 41, 51, 0.24);
  overflow: hidden;
}

.pcx-chat-panel.is-open {
  display: flex;
  flex-direction: column;
}

.pcx-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--pcx-aqua);
  color: #ffffff;
}

.pcx-chat-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pcx-chat-title {
  font-size: 15px;
  line-height: 1.2;
}

.pcx-chat-subtitle {
  font-size: 12px;
  line-height: 1.2;
  opacity: 0.86;
}

.pcx-chat-close {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  font-size: 16px;
}

.pcx-chat-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  background: var(--pcx-soft);
}

.pcx-chat-message {
  max-width: 86%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
}

.pcx-chat-message.is-assistant {
  background: #ffffff;
  color: var(--pcx-text);
  border: 1px solid var(--pcx-line);
}

.pcx-chat-message.is-user {
  margin-left: auto;
  background: var(--pcx-green);
  color: #ffffff;
}

.pcx-chat-message a {
  color: var(--pcx-blue);
  text-decoration: underline;
  overflow-wrap: anywhere;
}

.pcx-chat-message.is-user a {
  color: #ffffff;
}

.pcx-chat-quick {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  border-top: 1px solid var(--pcx-line);
  background: #ffffff;
}

.pcx-chat-chip {
  flex: 0 0 auto;
  border: 1px solid var(--pcx-line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--pcx-text);
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
}

.pcx-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--pcx-line);
  background: #ffffff;
}

.pcx-chat-brand {
  min-height: 58px;
  border-top: 1px solid var(--pcx-line);
  background-color: #ffffff;
  background-image: var(--pcx-footer-logo);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 150px auto;
}

.pcx-chat-input {
  flex: 1;
  min-height: 42px;
  max-height: 90px;
  resize: vertical;
  border: 1px solid var(--pcx-line);
  border-radius: 8px;
  padding: 10px;
  color: var(--pcx-text);
  font-size: 14px;
}

.pcx-chat-send {
  min-width: 76px;
  border: 0;
  border-radius: 8px;
  background: var(--pcx-aqua);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

#procomex-chatbot-root.is-loading .pcx-chat-send {
  opacity: 0.6;
  cursor: wait;
}

@media (max-width: 480px) {
  #procomex-chatbot-root {
    right: 12px;
    bottom: 12px;
  }

  .pcx-chat-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 92px);
  }

  .pcx-chat-launcher {
    width: 112px;
    height: 112px;
  }
}
