/**
 * Widget de chat flotante he_chatbot.
 * Prefijo .he-chatbot- para no colisionar con el tema useit.
 * Colores tomados del tema: primario #D12B39, hover #a7222d.
 */

#he-chatbot {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
}

/* Botón flotante. */
.he-chatbot-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background-color: #D12B39;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.he-chatbot-launcher:hover,
.he-chatbot-launcher:focus {
  background-color: #a7222d;
}

/* Panel. */
.he-chatbot-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  width: 360px;
  height: 520px;
  max-height: calc(100vh - 110px);
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

/* Cabecera. */
.he-chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background-color: #D12B39;
  color: #fff;
}

.he-chatbot-title {
  font-weight: bold;
}

.he-chatbot-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.he-chatbot-reset {
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: transparent;
  color: #fff;
  border-radius: 4px;
  font-size: 12px;
  padding: 3px 8px;
  cursor: pointer;
}

.he-chatbot-reset:hover,
.he-chatbot-reset:focus {
  background: rgba(255, 255, 255, 0.15);
}

.he-chatbot-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}

/* Mensajes. */
.he-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f7f7f7;
}

.he-chatbot-msg {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.he-chatbot-msg--user {
  align-items: flex-end;
}

.he-chatbot-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e3e3e3;
  color: #333;
  word-wrap: break-word;
}

.he-chatbot-msg--user .he-chatbot-bubble {
  background-color: #D12B39;
  border-color: #bc2733;
  color: #fff;
}

.he-chatbot-msg--system .he-chatbot-bubble {
  background: #fdf0f1;
  border-color: #f0c4c8;
  color: #8a1f28;
  font-style: italic;
}

/* Fuentes / enlaces. */
.he-chatbot-sources-title {
  margin-top: 8px;
  font-size: 12px;
  font-weight: bold;
  color: #777;
  text-transform: uppercase;
}

.he-chatbot-sources {
  margin: 4px 0 0;
  padding-left: 18px;
}

.he-chatbot-sources li {
  margin: 2px 0;
}

.he-chatbot-sources a {
  color: #D12B39;
  text-decoration: underline;
}

.he-chatbot-sources a:hover,
.he-chatbot-sources a:focus {
  color: #a7222d;
}

/* Quick replies. */
.he-chatbot-chips {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.he-chatbot-chip {
  border: 1px solid #D12B39;
  background: #fff;
  color: #D12B39;
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
}

.he-chatbot-chip:hover:enabled,
.he-chatbot-chip:focus:enabled {
  background-color: #D12B39;
  color: #fff;
}

.he-chatbot-chip:disabled {
  border-color: #ccc;
  color: #999;
  cursor: default;
}

/* Indicador de actividad. */
.he-chatbot-typing {
  display: flex;
  gap: 4px;
  padding: 6px 12px;
}

.he-chatbot-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #bbb;
  animation: he-chatbot-blink 1.2s infinite ease-in-out;
}

.he-chatbot-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.he-chatbot-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes he-chatbot-blink {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

/* Pie: entrada de texto. */
.he-chatbot-footer {
  border-top: 1px solid #e3e3e3;
  padding: 8px 12px;
  background: #fff;
}

.he-chatbot-input {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  box-sizing: border-box;
}

.he-chatbot-input:focus {
  outline: none;
  border-color: #D12B39;
}

.he-chatbot-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.he-chatbot-counter {
  font-size: 12px;
  color: #999;
}

.he-chatbot-counter--over {
  color: #D12B39;
  font-weight: bold;
}

.he-chatbot-send {
  border: none;
  border-radius: 6px;
  background-color: #D12B39;
  color: #fff;
  padding: 6px 16px;
  font-size: 14px;
  cursor: pointer;
}

.he-chatbot-send:hover:enabled,
.he-chatbot-send:focus:enabled {
  background-color: #a7222d;
}

.he-chatbot-send:disabled {
  background-color: #ccc;
  cursor: default;
}

/* Responsive: móvil a pantalla completa. */
@media (max-width: 575px) {
  .he-chatbot-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }
}
