/* ====== ESTILOS DEL CHATBOT ====== */
:root {
  --cb-grad-1: #6366f1;   /* índigo */
  --cb-grad-2: #8b5cf6;   /* violeta */
  --cb-grad-3: #ec4899;   /* rosa */
  --cb-accent: #6366f1;
  --cb-bg: #f3f4ff;
  --cb-shadow: rgba(99, 102, 241, 0.25);
}

* {
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Botón flotante ---------- */
#chatbot-button {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--cb-grad-1), var(--cb-grad-2), var(--cb-grad-3));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--cb-shadow);
  z-index: 9999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: cb-pulse 2.6s ease-in-out infinite;
}

#chatbot-button:hover {
  transform: scale(1.12) rotate(6deg);
  box-shadow: 0 10px 32px rgba(139, 92, 246, 0.45);
  animation: none;
}

@keyframes cb-pulse {
  0%, 100% { box-shadow: 0 8px 24px var(--cb-shadow), 0 0 0 0 rgba(236, 72, 153, 0.45); }
  50%      { box-shadow: 0 8px 24px var(--cb-shadow), 0 0 0 14px rgba(236, 72, 153, 0); }
}

/* ---------- Ventana ---------- */
#chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 25px;
  width: 360px;
  max-width: 92vw;
  height: 520px;
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(30, 27, 75, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  opacity: 0;
  transform: translateY(24px) scale(0.96);
  pointer-events: none;
  transition: all 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

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

/* ---------- Header ---------- */
.chatbot-header {
  background: linear-gradient(135deg, var(--cb-grad-1), var(--cb-grad-2), var(--cb-grad-3));
  color: white;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.chatbot-header::before {
  display: none;
}

#chatbot-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chatbot-close:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: rotate(90deg);
}

/* ---------- Mensajes ---------- */
#chatbot-messages {
  flex: 1;
  min-height: 0; /* permite que el área de mensajes se encoja para que quepan los botones */
  padding: 18px 14px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.07), transparent 45%),
    radial-gradient(circle at 90% 70%, rgba(236, 72, 153, 0.07), transparent 45%),
    linear-gradient(180deg, #f7f7ff, #f1f0ff);
}

#chatbot-messages::-webkit-scrollbar,
#chatbot-quick-replies::-webkit-scrollbar {
  width: 6px;
}

#chatbot-messages::-webkit-scrollbar-thumb,
#chatbot-quick-replies::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.35);
  border-radius: 10px;
}

.message {
  margin-bottom: 12px;
  max-width: 85%;
  padding: 11px 15px;
  border-radius: 18px;
  line-height: 1.5;
  white-space: pre-wrap;
  font-size: 14px;
  word-break: break-word;
  animation: cb-pop 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes cb-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.message.bot {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #ece9ff;
  border-bottom-left-radius: 6px;
  box-shadow: 0 3px 10px rgba(30, 27, 75, 0.07);
}

.message.bot a {
  color: var(--cb-accent);
  font-weight: 600;
}

.message.user {
  background: linear-gradient(135deg, var(--cb-grad-1), var(--cb-grad-3));
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 14px var(--cb-shadow);
}

/* ---------- Indicador "escribiendo..." ---------- */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 14px 18px;
  background: #ffffff;
  border: 1px solid #ece9ff;
  border-bottom-left-radius: 6px;
  box-shadow: 0 3px 10px rgba(30, 27, 75, 0.07);
  width: fit-content;
}

.typing-indicator .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cb-grad-1), var(--cb-grad-3));
  animation: cb-bounce 1.2s ease-in-out infinite;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes cb-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ---------- Área de entrada ---------- */
.chatbot-input-area {
  display: flex;
  align-items: center;
  padding: 12px;
  border-top: 1px solid #eceaf6;
  background: #ffffff;
}

#chatbot-input {
  flex: 1;
  border: 2px solid #e6e4f5;
  background: #f7f6ff;
  border-radius: 24px;
  padding: 11px 18px;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#chatbot-input::placeholder {
  color: #a8a3c8;
}

#chatbot-input:focus {
  border-color: var(--cb-accent);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

#chatbot-send {
  background: linear-gradient(135deg, var(--cb-grad-1), var(--cb-grad-3));
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  margin-left: 10px;
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--cb-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

#chatbot-send:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 18px rgba(236, 72, 153, 0.4);
}

#chatbot-send:active {
  transform: scale(0.92);
}

/* ---------- Botones rápidos ---------- */
#chatbot-quick-replies {
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: #f4f2ff;
  border-top: 1px solid #e6e4f5;
  max-height: 150px;
  overflow-y: auto;
}

.quick-btn {
  background: #ffffff;
  border: 2px solid #e6e4f5;
  color: #4f46a8;
  border-radius: 22px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.quick-btn:hover {
  background: linear-gradient(135deg, var(--cb-grad-1), var(--cb-grad-2));
  border-color: transparent;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--cb-shadow);
}

.quick-btn:active {
  transform: scale(0.95);
}
