body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #f7f7f7;
}

/* === Auto-resize inteligente en móviles === */

#chatbox {
  width: 100%;
  height: calc(100vh - 40px);  /* antes 100vh */
  max-width: 100%;
  margin: 0 ;
  display: flex;
  flex-direction: column;
  background: white;
}



/* HEADER */
#chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #006e51;            /* VERDE principal */
  color: white;
  flex-shrink: 0;
}

.eco-avatar img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.title {
  font-size: 1.3em;
  font-weight: bold;
}

.subtitle {
  font-size: 0.85em;
  opacity: 0.9;
}

/* MENSAJES */
/* Área de mensajes scrolleable */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 80px;  /* evita que la caja tape mensajes */
  box-sizing: border-box;

  /* fuerza que el área tenga altura propia sin depender de WordPress */
  height: calc(100vh - 120px); 
}


.message {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  max-width: 85%;
  line-height: 1.4;
}

/* Burbuja usuario: celeste suave, se puede ajustar si quieres más verde */
.from-user {
  background: #d2e5ff;
  align-self: flex-end;
}

/* Burbuja bot: tono claro con borde verde */
.from-bot {
  background: #e0f7f1;
  align-self: flex-start;
  border-left: 4px solid #006e51;  /* VERDE borde bot */
}

/* Contenido enriquecido */
.from-bot h3 { margin: 0 0 8px 0; color: #004d38; }
.from-bot h4 { margin: 0 0 6px 0; color: #004d38; }
.from-bot p  { margin: 0 0 8px 0; }
.from-bot ul,
.from-bot ol { margin: 4px 0 4px 20px; }

/* INPUT */
/* INPUT fijo abajo */
#chat-input {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;

  display: flex;
  padding: 10px;
  background: #eee;

  border-top: 1px solid #ccc;
  flex-shrink: 0;
  z-index: 20; /* por encima de mensajes */
}


#user-input {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #aaa;
  font-size: 1em;
}

/* Botón Enviar en verde Madrigal */
#btn-send {
  margin-left: 10px;
  background: #006e51;     /* VERDE */
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
}

#btn-send:hover {
  background: #005a41;     /* Verde más oscuro al hover */
}

/* === Indicador “Madrigalin está escribiendo…” === */
.typing {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  font-size: 0.9em;
  opacity: 1;
  transition: opacity 0.3s ease-in-out;
}

.typing.hidden {
  opacity: 0;
  height: 0;
  overflow: hidden;
}

.typing-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  animation: pulse 1.2s infinite ease-in-out;
}

/* Avatar animado (también en la línea verde) */
.eco-avatar img.typing {
  animation: ecoPulse 1s infinite alternate ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: .5; }
  50% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: .5; }
}

@keyframes ecoPulse {
  0% { transform: scale(1); opacity: .75; }
  100% { transform: scale(1.12); opacity: 1; }
}
