/* Contenedor principal: chat + imagen */
.chatbox {
  position: fixed;
  bottom: 20px;
  right: 20px; /* Siempre pegado al borde derecho */
  display: flex;
  align-items: flex-end;
  z-index: 99999;
  font-family: 'Poppins', sans-serif;
  gap: 10px; /* separación entre chat y botón flotante */
}

/* Imagen / botón flotante */
.chatbox-toggle {
  width: 200px;
  height: 300px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
  overflow: hidden;
}

.chatbox-toggle .chat-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chatbox-toggle:hover {
  transform: scale(1.08);
}

/* Ventana del chat */
.chatbox-window {
  display: none; /* Oculta al inicio */
  flex-direction: column;
  width: 340px;
  height: 450px;
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);

  position: fixed;
  bottom: 20px;
  right: 110px; /* Separación respecto al botón flotante */
  z-index: 99999;

  overflow: hidden;
  animation: fadeIn 0.3s ease;
}

/* Header del chat */
.chatbox-header {
  background: linear-gradient(90deg, #00296b, #003f88);
  color: #fff;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 10px; /* Espacio entre avatar y título */
}

.chatbox-avatar img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}

.chatbox-header h4 {
  margin: 0;
  font-weight: 600;
  flex: 1; /* Ocupa el espacio restante */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* Evita que el texto pegue al borde */
}

.chatbox-close {
  background: transparent;
  color: #fff;
  font-size: 20px;
  border: none;
  cursor: pointer;
}

/* Área de mensajes */
.chatbox-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background: #f8f9fa;
}

.msg {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 15px;
  max-width: 80%;
  line-height: 1.4;
}

.msg.bot {
  background: #edf2fb;
  align-self: flex-start;
}

.msg.user {
  background: #e63946;
  color: #fff;
  align-self: flex-end;
  margin-left: auto;
}

/* Input */
.chatbox-input {
  display: flex;
  border-top: 1px solid #ddd;
}

.chatbox-input input {
  flex: 1;
  border: none;
  padding: 10px;
  font-size: 14px;
  border-radius: 0;
}

.chatbox-input input:focus {
  outline: none;
}

.chatbox-input button {
  background: #e63946;
  color: #fff;
  border: none;
  width: 50px;
  cursor: pointer;
  transition: all 0.3s;
}

.chatbox-input button:hover {
  background: #c92030;
}

/* Botones de opciones */
.option-btn {
  display: inline-block;
  background: #003f88;
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  margin: 5px 5px 0 0;
  cursor: pointer;
  font-size: 13px;
  transition: 0.3s;
}

.option-btn:hover {
  background: #00296b;
}

/* Animaciones */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
