/* ========================================================
   BÚHO SMART ERP - ASISTENTE DE AYUDA CON IA (WIDGET CSS)
   ======================================================== */

#buho-assistant-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #f97316;
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.35), 0 4px 12px rgba(0,0,0,0.15);
  cursor: pointer;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  user-select: none;
  padding: 4px;
}

#buho-assistant-launcher:hover {
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 12px 28px rgba(249, 115, 22, 0.45), 0 6px 16px rgba(0,0,0,0.2);
}

#buho-assistant-launcher img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

#buho-assistant-tooltip {
  position: absolute;
  right: 74px;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(10px);
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

#buho-assistant-launcher:hover #buho-assistant-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* --- VENTANA DE CHAT --- */
#buho-assistant-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.06);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#buho-assistant-window.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* --- CABECERA --- */
.buho-chat-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #f97316;
}

.buho-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.buho-chat-header-avatar {
  width: 38px;
  height: 38px;
  background: #ffffff;
  border-radius: 50%;
  padding: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.buho-chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.buho-chat-header-text h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.buho-chat-header-text span {
  font-size: 11px;
  color: #94a3b8;
  display: block;
}

.buho-chat-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.buho-chat-close-btn:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.1);
}

/* --- CUERPO DE MENSAJES --- */
.buho-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fafc;
}

.buho-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  font-size: 13.5px;
  line-height: 1.45;
  animation: buhoFadeIn 0.25s ease-out;
}

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

.buho-chat-msg.buho-msg-assistant {
  align-self: flex-start;
}

.buho-chat-msg.buho-msg-user {
  align-self: flex-end;
}

.buho-chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  word-break: break-word;
}

.buho-msg-assistant .buho-chat-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-top-left-radius: 4px;
}

.buho-msg-user .buho-chat-bubble {
  background: #0284c7;
  color: #ffffff;
  border-top-right-radius: 4px;
}

.buho-msg-user .buho-chat-bubble p {
  color: #ffffff;
  margin: 0;
}

.buho-chat-bubble p {
  margin: 0 0 8px 0;
}

.buho-chat-bubble p:last-child {
  margin-bottom: 0;
}

.buho-chat-bubble ul, .buho-chat-bubble ol {
  margin: 4px 0 8px 0;
  padding-left: 20px;
}

.buho-chat-bubble li {
  margin-bottom: 4px;
}

.buho-chat-bubble strong {
  font-weight: 700;
  color: inherit;
}

.buho-chat-bubble a {
  color: #0284c7;
  text-decoration: underline;
}

.buho-chat-img-preview {
  max-width: 100%;
  max-height: 160px;
  border-radius: 8px;
  margin-bottom: 6px;
  display: block;
  border: 1px solid rgba(0,0,0,0.1);
}

/* Botones de preguntas rápidas */
.buho-quick-prompts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.buho-quick-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.buho-quick-btn:hover {
  background: #e2e8f0;
  border-color: #f97316;
  color: #ea580c;
}

/* Indicador de carga */
.buho-typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.buho-typing-dot {
  width: 6px;
  height: 6px;
  background: #f97316;
  border-radius: 50%;
  animation: buhoPulse 1.4s infinite ease-in-out both;
}

.buho-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.buho-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes buhoPulse {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* --- BANNER DE CAPTURA ADJUNTA --- */
.buho-chat-attachment-bar {
  background: #f1f5f9;
  padding: 6px 14px;
  border-top: 1px solid #e2e8f0;
  display: none;
  align-items: center;
  justify-content: space-between;
}

.buho-chat-attachment-bar.has-file {
  display: flex;
}

.buho-attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.buho-attachment-thumb {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
}

.buho-remove-attachment {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
}

/* --- PIE DE CHAT (INPUT) --- */
.buho-chat-footer {
  background: #ffffff;
  padding: 10px 14px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.buho-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.buho-chat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-family: inherit;
  resize: none;
  max-height: 90px;
  min-height: 38px;
  line-height: 1.35;
  outline: none;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.buho-chat-input:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.15);
}

.buho-chat-btn-action {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.buho-chat-btn-action:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.buho-chat-btn-send {
  background: #f97316;
  border: none;
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.buho-chat-btn-send:hover {
  background: #ea580c;
  transform: scale(1.05);
}

.buho-chat-btn-send:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  transform: none;
}

.buho-chat-footer-hint {
  font-size: 10.5px;
  color: #94a3b8;
  text-align: center;
}
