/* ═════════════════════════════════════════════════════════
   ROBI ASSISTANT · Chat widget flotante + panel
   ═════════════════════════════════════════════════════════ */
#robi-assistant { position: fixed; z-index: 9000; pointer-events: none; }
#robi-assistant * { pointer-events: auto; }
/* Cuando el panel está cerrado, NADA dentro de él debe capturar clics —
   si no, los quick-prompts invisibles disparan al asistente al hacer clic
   en el rincón inferior derecho de la web (footer, etc.). */
.robi-panel:not(.open),
.robi-panel:not(.open) * {
  pointer-events: none !important;
}

/* FAB · oculto siempre. ORI solo se abre vía botón "ORI" del menú o
   "Hablar con ORI" al final del quiz (elementos con [data-robi-trigger]). */
.robi-fab,
.robi-fab-pulse { display: none !important; }

/* Panel del chat */
.robi-panel {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 40px);
  background: var(--bg-2, #14171f);
  border: 1px solid var(--border-2, rgba(255,255,255,0.08));
  border-radius: 18px;
  box-shadow: 0 30px 80px -10px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity .28s var(--ease), transform .28s var(--ease);
  z-index: 9002;
  overflow: hidden;
  isolation: isolate;
}
.robi-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.robi-panel::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #f59e0b, #ec4899, #2563eb);
  z-index: 1;
}

/* Header */
.robi-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}
.robi-panel-avatar {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(245,158,11,0.25), rgba(37,99,235,0.18));
  padding: 4px;
  object-fit: contain;
}
.robi-panel-title { flex: 1; min-width: 0; }
.robi-panel-title h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-strong, #fff);
  line-height: 1.2;
}
.robi-panel-title small {
  color: var(--text-dim, #94a3b8);
  font-size: 0.72rem;
}
.ori-icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-dim, #94a3b8);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .2s, color .2s;
  font-size: 1.2rem;
  padding: 0;
}
.ori-icon-btn:hover { background: var(--surface, rgba(255,255,255,0.06)); color: var(--text-strong, #fff); }
.ori-icon-btn svg { width: 16px; height: 16px; }
.ori-icon-btn.muted { color: #ef4444; }
.robi-close { font-size: 1.5rem; font-weight: 300; line-height: 1; }

/* Mensajes */
.robi-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}
.robi-messages::-webkit-scrollbar { width: 6px; }
.robi-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
.robi-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: robiMsgIn .3s var(--ease);
}
@keyframes robiMsgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.robi-msg-user { justify-content: flex-end; }
.robi-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(245,158,11,0.25), rgba(37,99,235,0.18));
  padding: 2px;
  flex-shrink: 0;
  object-fit: contain;
}
.robi-msg-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
  color: var(--text, #e2e8f0);
}
.robi-msg-assistant .robi-msg-bubble {
  background: var(--surface, rgba(255,255,255,0.05));
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-bottom-left-radius: 4px;
}
.robi-msg-user .robi-msg-bubble {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: white;
  border-bottom-right-radius: 4px;
}

/* "Pensando..." */
.robi-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 14px;
}
.robi-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-dim, #94a3b8);
  animation: robiDot 1.2s ease-in-out infinite;
}
.robi-dots span:nth-child(2) { animation-delay: .15s; }
.robi-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes robiDot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* Quick prompts */
.robi-quick {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 14px 10px;
}
.robi-chip {
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.robi-chip:hover {
  background: rgba(245, 158, 11, 0.18);
  transform: translateY(-1px);
}

/* Input bar */
.robi-input-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
  background: rgba(0, 0, 0, 0.15);
}
.robi-input-bar input {
  flex: 1;
  min-width: 0;
  background: var(--surface, rgba(255,255,255,0.05));
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--text-strong, #fff);
  font-size: 0.88rem;
  outline: none;
  transition: border-color .2s, background .2s;
  font-family: inherit;
}
.robi-input-bar input:focus {
  border-color: rgba(245, 158, 11, 0.5);
  background: var(--surface-2, rgba(255,255,255,0.08));
}
.robi-mic.active {
  background: #ef4444;
  color: white;
  animation: robiMicPulse 1s ease-in-out infinite;
}
@keyframes robiMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50%      { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}
.robi-send {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: white;
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform .2s, opacity .2s;
}
.robi-send:hover { transform: scale(1.06); }
.robi-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.robi-send svg { width: 16px; height: 16px; }

/* Botón discreto del navbar para abrir ORI */
.nav-robi {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  color: var(--text-dim, #94a3b8);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  font-family: inherit;
}
.nav-robi:hover {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.06);
}
.nav-robi-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  padding: 2px;
  object-fit: contain;
}

/* Responsive */
@media (max-width: 540px) {
  .robi-fab { bottom: 16px; right: 16px; width: 56px; height: 56px; }
  .robi-panel {
    width: calc(100vw - 16px);
    right: 8px; bottom: 8px;
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
  }
}
