/* =============================================
   SERENA SPA — Widget de Chatbot
   chatbot.css
   ============================================= */

/* ── Botón flotante (fijo, independiente) ── */
#chatbot-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9001;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #2C5F2E;
  color: #fff;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  padding: 0;
  margin: 0;
  font-family: 'Lato', sans-serif;
  transition: background-color 0.12s;
}

#chatbot-toggle:hover        { background-color: #3a7a3c; }
#chatbot-toggle:focus-visible { outline: 3px solid rgba(44,95,46,0.4); outline-offset: 3px; }
#chatbot-toggle svg           { width: 24px; height: 24px; display: block; }

/* ── Panel de chat (fijo, independiente) ── */
#chatbot-panel {
  position: fixed;
  bottom: calc(1.5rem + 56px + 0.75rem);
  right: 1.5rem;
  z-index: 9000;
  width: 340px;
  height: 480px;
  background-color: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.85) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.15s ease-out, opacity 0.15s ease-out;
  font-family: 'Lato', sans-serif;
}

#chatbot-panel.abierto {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Cabecera ── */
#chatbot-cabecera {
  background-color: #2C5F2E;
  color: #fff;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#chatbot-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

#chatbot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 600;
  flex-shrink: 0;
}

#chatbot-nombre {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
  color: #f5f0e8;
}

#chatbot-estado {
  font-size: 0.7rem;
  margin: 0;
  color: #d6cfc4;
}

#chatbot-cerrar {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  transition: background-color 0.15s;
  line-height: 1;
}

#chatbot-cerrar:hover { background-color: rgba(255,255,255,0.15); color: #fff; }

/* ── Área de mensajes ── */
#chatbot-mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scroll-behavior: smooth;
}

#chatbot-mensajes::-webkit-scrollbar { width: 4px; }
#chatbot-mensajes::-webkit-scrollbar-track { background: transparent; }
#chatbot-mensajes::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* ── Burbujas ── */
.chatbot-burbuja {
  max-width: 82%;
  padding: 0.6rem 0.9rem;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.55;
  word-wrap: break-word;
  animation: chatbot-aparecer 0.18s ease;
}

@keyframes chatbot-aparecer {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chatbot-burbuja--bot {
  background-color: #f3f4f6;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.chatbot-burbuja--usuario {
  background-color: #2C5F2E;
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* ── Indicador de escritura ── */
.chatbot-escribiendo {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.55rem 0.9rem;
  background-color: #f3f4f6;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  animation: chatbot-aparecer 0.18s ease;
}

.chatbot-escribiendo span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #9ca3af;
  animation: chatbot-punto 1.2s infinite;
}
.chatbot-escribiendo span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-escribiendo span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatbot-punto {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Área de entrada ── */
#chatbot-entrada {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
  background-color: #fff;
}

#chatbot-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  padding: 0.5rem 0.9rem;
  font-size: 0.84rem;
  font-family: 'Lato', sans-serif;
  outline: none;
  transition: border-color 0.15s;
  background-color: #f9fafb;
}

#chatbot-input:focus { border-color: #2C5F2E; background-color: #fff; }
#chatbot-input::placeholder { color: #9ca3af; }

#chatbot-enviar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #2C5F2E;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s, opacity 0.15s;
}

#chatbot-enviar:hover    { background-color: #3a7a3c; }
#chatbot-enviar:disabled { opacity: 0.5; cursor: default; }
#chatbot-enviar svg      { width: 16px; height: 16px; }

/* ── Responsive ── */
@media (max-width: 420px) {
  #chatbot-toggle { bottom: 1rem; right: 1rem; }

  #chatbot-panel {
    bottom: calc(1rem + 56px + 0.75rem);
    right: 1rem;
    width: calc(100vw - 2rem);
    height: 420px;
  }
}
