/* ══════════════════════════════════════════════════════════════════════════════
   robot.css — Widget de chat FAQ flotante
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Burbuja de saludo ───────────────────────────────────────────────────────── */
#robot-greeting {
  position: fixed;
  bottom: 80px;
  left: 16px;
  background: #1a1a2e;
  color: #fff;
  padding: 9px 12px 9px 15px;
  border-radius: 20px;
  font-size: .82rem;
  z-index: 9998;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
  white-space: nowrap;
}
#robot-greeting.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#robot-greeting-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.55);
  cursor: pointer;
  font-size: .75rem;
  padding: 0 3px;
  line-height: 1;
  flex-shrink: 0;
}
#robot-greeting-close:hover { color: #fff; }

/* ── Botón flotante ──────────────────────────────────────────────────────────── */
#robot-bubble {
  position: fixed;
  bottom: 20px;
  left: 16px;
  width: 52px;
  height: 52px;
  background: #1a1a2e;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 150;
  box-shadow: 0 3px 12px rgba(0,0,0,.3);
  border: none;
  transition: transform .2s, box-shadow .2s;
}
#robot-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 5px 18px rgba(0,0,0,.35);
}
#robot-bubble svg { width: 26px; height: 26px; fill: #fff; }
#robot-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  background: #c0392b;
  border-radius: 50%;
  font-size: .62rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ── Panel del chat ──────────────────────────────────────────────────────────── */
#robot-panel {
  position: fixed;
  bottom: 82px;
  left: 16px;
  width: 380px;
  max-height: 560px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 149;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(.97);
  transition: opacity .22s, transform .22s;
}
#robot-panel.abierto {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* Header */
#robot-header {
  background: #1a1a2e;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
#robot-avatar {
  width: 34px;
  height: 34px;
  background: #c0392b;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#robot-avatar svg { width: 18px; height: 18px; fill: #fff; }
#robot-header-info { flex: 1; }
#robot-header-info strong {
  display: block;
  color: #fff;
  font-size: .88rem;
  font-weight: 700;
}
#robot-header-info span {
  font-size: .7rem;
  color: #22c55e;
}
#robot-cerrar {
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}
#robot-cerrar:hover { color: #fff; }

/* Mensajes */
#robot-mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
  scroll-behavior: smooth;
}
.robot-msg {
  display: flex;
  gap: 7px;
  align-items: flex-end;
  max-width: 88%;
}
.robot-msg.bot { align-self: flex-start; }
.robot-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.robot-msg-icon {
  width: 26px;
  height: 26px;
  background: #1a1a2e;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 2px;
}
.robot-msg-icon svg { width: 13px; height: 13px; fill: #fff; }

.robot-msg-bubble {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: .82rem;
  line-height: 1.45;
  max-width: 100%;
}
.robot-msg.bot .robot-msg-bubble {
  background: #fff;
  color: #1a1a1a;
  border-bottom-left-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.robot-msg.user .robot-msg-bubble {
  background: #1a1a2e;
  color: #fff;
  border-bottom-right-radius: 3px;
}

/* Chips de sugerencias */
.robot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 12px 8px;
  background: #f8fafc;
}
.robot-chip {
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 20px;
  padding: 5px 11px;
  font-size: .75rem;
  font-weight: 600;
  color: #1a1a2e;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  white-space: nowrap;
}
.robot-chip:hover {
  border-color: #1a1a2e;
  background: #f0f2ff;
}

/* Input */
#robot-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}
#robot-input {
  flex: 1;
  border: 1.5px solid #e0e0e0;
  border-radius: 20px;
  padding: 7px 14px;
  font-size: .82rem;
  font-family: inherit;
  outline: none;
  background: #f8fafc;
}
#robot-input:focus { border-color: #1a1a2e; background: #fff; }
#robot-send {
  width: 34px;
  height: 34px;
  background: #1a1a2e;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
#robot-send:hover { background: #c0392b; }
#robot-send svg { width: 15px; height: 15px; fill: #fff; }

/* Typing indicator */
.robot-typing .robot-msg-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 14px;
}
.robot-dot {
  width: 7px; height: 7px;
  background: #aaa;
  border-radius: 50%;
  animation: robotDot .9s infinite;
}
.robot-dot:nth-child(2) { animation-delay: .2s; }
.robot-dot:nth-child(3) { animation-delay: .4s; }
@keyframes robotDot {
  0%, 80%, 100% { transform: translateY(0); opacity: .4; }
  40%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  #robot-panel {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: 76px;
  }
  #robot-bubble { bottom: 16px; left: 12px; width: 46px; height: 46px; }
  #robot-greeting {
    left: 12px !important;
    bottom: 74px !important;
    white-space: normal !important;
    width: calc(100vw - 24px) !important;
    box-sizing: border-box;
    font-size: .78rem;
  }
}
