/* PREVIEW PEQUEÑO SOBRE EL BOTÓN */
#chatbot-preview {
  position: fixed;
  bottom: 90px;
  right: 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 12px 16px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  color: #333;
  max-width: 280px;
  z-index: 1500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#chatbot-preview button#close-preview {
  position: fixed; 
  bottom: 130px;
  right: 22px;
  background: transparent;
  border: none;
  font-size: 18px;
  color: #92419f;
  cursor: pointer;
  font-weight: bold;
  padding: 0 6px;
  line-height: 1;
}

/* BOTÓN CHATBOT */
#chatbot-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 64px;
  height: 64px;
  background: linear-gradient(145deg, #fafafa, #e3e3e3);
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #92419f;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 8px 8px 16px rgba(0,0,0,0.15);
  transition: transform 0.2s ease;
  user-select: none;
}
#chatbot-button:hover { transform: scale(1.1); }

/* PROFILE CIRCLE */
#profile-container { position: relative; display: inline-block; margin-left: 8px; vertical-align: middle; width: 28px; height: 28px; border-radius: 50%; background: #ffffff; box-shadow: 0 0 2px rgba(0,0,0,0.2); cursor: default; }
#profile-container svg { width: 20px; height: 20px; margin: 4px; fill: #520030; }
#online-indicator { position: absolute; bottom: 17px; right: 0px; width: 8px; height: 8px; background: #4CAF50; border: 2px solid white; border-radius: 50%; box-shadow: 0 0 4px #51ff00aa; }

/* MODAL CHATBOT */
#chatbot-modal {
  display: none;
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 360px;
  height: 480px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  z-index: 10000;
}

/* HEADER */
#chatbot-header { background: #92419f; color: #fff; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; }
#chatbot-title { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
#close-chatbot { background: transparent; border: none; color: #fff; font-size: 24px; font-weight: 700; cursor: pointer; padding: 0 6px; line-height: 1; transition: color 0.2s ease; }

#chatbot-body { flex: 1; display: flex; flex-direction: column; background: #f9f8f2; padding: 12px 16px; overflow: hidden; }
#chat-messages { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }

/* BUBBLES */
.message { max-width: 75%; margin-bottom: 4px; padding: 12px 18px; border-radius: 24px; line-height: 1.4; word-wrap: break-word; font-size: 15px; box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.message.bot { background: #fff; color: #333; align-self: flex-start; border-top-left-radius: 0; }
.message.user { background: #92419f; color: #fff; align-self: flex-end; border-top-right-radius: 0; box-shadow: 0 2px 10px rgba(146,65,159,0.4); }

/* INPUT CONTAINER */
#chat-input-container {
  display: flex;
  padding: 12px 12px;
  margin-right: -12px;
  margin-left: -12px;
  border-top: 1px solid #ddd;
  background: #fff;
  gap: 12px;
  position: relative; /* necesario para posicionar el icono dentro */
}

/* TEXTAREA que crece hasta max-height */
#chat-input {
  flex-grow: 1;
  resize: none;
  min-height: 30px;
  max-height: 120px;
  border: 1.8px solid #92419f;
  border-radius: 12px;
  padding: 10px 14px;
  padding-right: 40px; /* espacio para el icono */
  font-size: 15px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: #333;
  transition: border-color 0.3s ease;
}
#chat-input:focus { border-color: #e64386; outline: none; box-shadow: 0 0 8px #e64386aa; }

/* ESTILO BASE COMPARTIDO (botón enviar y botones de rol) */
.btn-send-style {
  background: #e64386;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 4px 14px #e6438655;
  transition: background-color 0.3s ease, transform 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-send-style:hover:not(:disabled) { background: #d23575; transform: translateY(-1px); }
.btn-send-style:disabled { opacity: 0.5; cursor: default; }

/* BTN SEND (ICONO) dentro del input: tamaño reducido y absoluto */
#send-chat {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 50px;
  height: 50px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background-color: transparent !important;
}


/* BOTONES DE ROL: heredan estilo pero no absolute */
.role-btn {
  margin-right: 8px;
  margin-bottom: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.9em;
}

/* TYPING INDICATOR */
.typing { background: #fff; align-self: flex-start; border-top-left-radius: 0; padding: 12px 18px; display: flex; gap: 6px; }
.typing span { width: 8px; height: 8px; background: #999; border-radius: 50%; animation: blink 1.2s infinite; }
.typing span:nth-child(1) { animation-delay: 0s; }
.typing span:nth-child(2) { animation-delay: 0.3s; }
.typing span:nth-child(3) { animation-delay: 0.6s; }
@keyframes blink { 0%, 80%, 100% {opacity: 0.3;} 40% {opacity: 1;} }

/* Responsive móvil */
@media (max-width: 768px) {
  #chatbot-modal { bottom: 0; right: 0; width: 100vw; height: 100dvh; border-radius: 0; box-shadow: none; }
  #chatbot-preview { bottom: 90px; right: 20px; max-width: 240px; font-size: 13px; }
  #chatbot-button { bottom: 20px; right: 20px; width: 54px; height: 54px; font-size: 28px; }
  #chat-input { font-size: 16px; min-height: 36px; max-height: 100px; margin-bottom: 20px}
  #chatbot-preview button#close-preview {
  bottom: 125px;
}
  #send-chat{
    margin-bottom: 25px;
  }
}
