/* ═══════════════════════════════════════════════════════
   PCEFACT PERU — Chatbot Premium v5.0
   Diseño profesional + Totalmente Responsive
   ═══════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────── */
:root {
  --cb-blue:     #0056b3;
  --cb-blue2:    #0070e0;
  --cb-teal:     #00b894;
  --cb-dark:     #0a1628;
  --cb-red:      #ff4757;
  --cb-white:    #ffffff;
  --cb-bg:       #f4f7fc;
  --cb-border:   #e8eef6;
  --cb-text:     #1e293b;
  --cb-muted:    #64748b;
  --cb-radius:   20px;
  --cb-shadow:   0 20px 60px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.05);
  --cb-w:        390px;   /* ancho ventana desktop */
  --cb-h:        600px;   /* alto ventana desktop  */
}

/* ══════════════════════════════════════════════════════
   1. BOTÓN FLOTANTE TRIGGER
══════════════════════════════════════════════════════ */
.chatbot-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1050;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

/* ── Botón robot ─────────────────────────────────────── */
.chatbot-trigger-btn {
  -webkit-tap-highlight-color: transparent;  /* elimina flash azul en iOS/Android */
  -webkit-touch-callout: none;               /* sin menú contextual al mantener presionado */
  touch-action: manipulation;                /* respuesta táctil inmediata */
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: none;
  outline: none;
  cursor: pointer;
  background: linear-gradient(145deg, #0070e0 0%, #0056b3 45%, #004494 70%, #00b894 100%);
  box-shadow:
    0 8px 32px rgba(0,86,179,.45),
    0 0 0 0 rgba(0,86,179,.2),
    inset 0 1px 0 rgba(255,255,255,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), box-shadow .3s;
  flex-shrink: 0;
}

/* Anillo 1 — rápido */
.chatbot-trigger-btn::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(0,112,224,.5) 0%,
    rgba(0,184,148,.5) 50%,
    rgba(0,112,224,.5) 100%
  );
  animation: cb-spin-ring 4s linear infinite;
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), white calc(100% - 3px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), white calc(100% - 3px));
}

/* Anillo 2 — pulso suave */
.chatbot-trigger-btn::after {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 2px solid rgba(0,86,179,.2);
  animation: cb-pulse-ring 2.5s ease-out infinite;
}

@keyframes cb-spin-ring {
  to { transform: rotate(360deg); }
}

@keyframes cb-pulse-ring {
  0%   { transform: scale(1);   opacity: .7; }
  70%  { transform: scale(1.15); opacity: 0; }
  100% { transform: scale(1);   opacity: 0; }
}

.chatbot-trigger-btn:hover {
  transform: scale(1.1) rotate(8deg);
  box-shadow:
    0 14px 44px rgba(0,86,179,.55),
    0 0 0 4px rgba(0,184,148,.2),
    inset 0 1px 0 rgba(255,255,255,.3);
}

/* ── Ícono robot ─────────────────────────────────────── */
.chatbot-trigger-btn .robot-icon {
  font-size: 30px;
  color: #fff;
  position: relative;
  z-index: 1;
  animation: cb-robot-breathe 3s ease-in-out infinite;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.3));
  line-height: 1;
}

@keyframes cb-robot-breathe {
  0%, 100% { transform: scale(1) translateY(0); }
  50%       { transform: scale(1.08) translateY(-2px); }
}

/* ── Badge notificación ──────────────────────────────── */
.chatbot-notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  background: linear-gradient(135deg, #ff4757, #ff3344);
  color: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  font-family: 'Poppins', sans-serif;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 10px rgba(255,71,87,.5);
  animation: cb-badge-beat 1.4s ease-in-out infinite;
  z-index: 2;
}

@keyframes cb-badge-beat {
  0%, 100% { transform: scale(1); }
  14%       { transform: scale(1.25); }
  28%       { transform: scale(1); }
  42%       { transform: scale(1.15); }
  70%       { transform: scale(1); }
}

/* ── Label flotante ──────────────────────────────────── */
.chatbot-trigger-label {
  background: linear-gradient(135deg, #0056b3 0%, #00b894 100%);
  color: #fff;
  padding: 11px 20px 11px 16px;
  border-radius: 30px;
  font-size: 13.5px;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
  white-space: nowrap;
  letter-spacing: .2px;
  box-shadow:
    0 6px 24px rgba(0,86,179,.35),
    inset 0 1px 0 rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.15);
  order: -1;
  animation: cb-label-shine 4s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

/* Shimmer interno del label */
.chatbot-trigger-label::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
  animation: cb-label-shimmer 3.5s ease-in-out infinite;
}

@keyframes cb-label-shimmer {
  0%   { left: -60%; }
  50%  { left: 120%; }
  100% { left: 120%; }
}

@keyframes cb-label-shine {
  0%, 100% { box-shadow: 0 6px 24px rgba(0,86,179,.35), inset 0 1px 0 rgba(255,255,255,.2); }
  50%       { box-shadow: 0 8px 30px rgba(0,86,179,.5),  inset 0 1px 0 rgba(255,255,255,.25); }
}

/* ══════════════════════════════════════════════════════
   2. VENTANA DEL CHAT
══════════════════════════════════════════════════════ */
.chatbot-window {
  position: fixed;
  bottom: calc(28px + 68px + 18px);   /* trigger bottom + height + gap */
  right: 28px;
  width: var(--cb-w);
  max-height: var(--cb-h);
  background: var(--cb-white);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow);
  z-index: 1051;
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(.85) translateY(16px);
  opacity: 0;
  transition:
    transform .38s cubic-bezier(.34,1.56,.64,1),
    opacity .28s ease;
}

.chatbot-window.active {
  display: flex;
  animation: cb-window-open .38s cubic-bezier(.34,1.56,.64,1) forwards;
}

@keyframes cb-window-open {
  from { transform: scale(.85) translateY(16px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

/* ══════════════════════════════════════════════════════
   3. HEADER PREMIUM
══════════════════════════════════════════════════════ */
.chatbot-header {
  background: linear-gradient(145deg, #0a1628 0%, #0056b3 60%, #004494 100%);
  padding: 18px 18px 16px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  transition: background .5s ease;
}

/* Patrón de fondo header */
.chatbot-header::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='20' cy='20' r='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

/* Shimmer línea superior */
.chatbot-header::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
  animation: shimmer 5s infinite;
}

@keyframes shimmer {
  0%   { left: -100%; }
  100% { left: 100%;  }
}

.chatbot-header.live-mode {
  background: linear-gradient(145deg, #064e3b 0%, #00b894 60%, #00a381 100%);
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 13px;
  position: relative;
  z-index: 1;
}

/* ── Avatar ──────────────────────────────────────────── */
.chatbot-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  position: relative;
  border: 2px solid rgba(255,255,255,.2);
  flex-shrink: 0;
  overflow: hidden;
}

/* Gradiente interno avatar */
.chatbot-avatar::before {
  content: '';
  position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,.15), rgba(255,255,255,.05));
}

/* Punto "online" */
.chatbot-avatar::after {
  content: '';
  position: absolute;
  bottom: 1px; right: 1px;
  width: 13px; height: 13px;
  background: #2ecc71;
  border-radius: 50%;
  border: 2.5px solid #0056b3;
  box-shadow: 0 0 8px rgba(46,204,113,.7);
  animation: cb-online-pulse 2s ease-in-out infinite;
}

@keyframes cb-online-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(46,204,113,.6); }
  50%       { box-shadow: 0 0 14px rgba(46,204,113,.9); }
}

/* ── Textos header ───────────────────────────────────── */
.chatbot-header-text {
  position: relative; z-index: 1;
}

.chatbot-header-text h4 {
  margin: 0 0 3px;
  font-size: 15.5px;
  font-weight: 800;
  color: #fff;
  letter-spacing: .2px;
  font-family: 'Poppins', sans-serif;
}

.chatbot-header-text span {
  font-size: 11.5px;
  color: rgba(255,255,255,.8);
  font-weight: 500;
  font-family: 'Poppins', sans-serif;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Punto vivo en subtitle */
.live-status-dot {
  width: 7px; height: 7px;
  background: #2ecc71;
  border-radius: 50%;
  animation: cb-online-pulse 1.5s ease-in-out infinite;
  display: inline-block;
  flex-shrink: 0;
}

/* Acciones header (derecha) */
.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.chatbot-close {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .25s ease;
  font-size: 15px;
  flex-shrink: 0;
}

.chatbot-close:hover {
  background: rgba(255,255,255,.25);
  transform: rotate(90deg) scale(1.1);
  border-color: rgba(255,255,255,.35);
}

/* ── Barra respuesta rápida promedio ─────────────────── */
.chatbot-response-bar {
  background: rgba(255,255,255,.1);
  padding: 6px 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: rgba(255,255,255,.75);
  font-family: 'Poppins', sans-serif;
  border-top: 1px solid rgba(255,255,255,.08);
  position: relative; z-index: 1;
}

.chatbot-response-bar i { font-size: 9px; }

/* ══════════════════════════════════════════════════════
   4. ÁREA DE MENSAJES
══════════════════════════════════════════════════════ */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  background: var(--cb-bg);
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
}

/* Scrollbar custom */
.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(0,86,179,.2);
  border-radius: 2px;
}
.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0,86,179,.4);
}

/* ── Burbujas ────────────────────────────────────────── */
.chatbot-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 90%;
  animation: cb-msg-in .28s cubic-bezier(.34,1.56,.64,1);
}

@keyframes cb-msg-in {
  from { opacity: 0; transform: translateY(10px) scale(.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1);  }
}

.chatbot-msg.bot  { align-self: flex-start; }
.chatbot-msg.user { align-self: flex-end; flex-direction: row-reverse; }

/* Avatar del bot en mensajes */
.chatbot-msg-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #0056b3, #00b894);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,86,179,.3);
}

/* Avatar admin en mensajes live */
.chatbot-msg.admin-msg .chatbot-msg-avatar.admin-avatar {
  background: linear-gradient(135deg, #00b894, #00a381);
}

/* Burbuja bot */
.chatbot-msg.bot .chatbot-msg-bubble {
  background: #fff;
  color: var(--cb-text);
  border-radius: 18px 18px 18px 4px;
  padding: 11px 15px;
  font-size: 13.5px;
  line-height: 1.6;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  border: 1px solid var(--cb-border);
  font-family: 'Poppins', sans-serif;
  max-width: 100%;
  word-break: break-word;
}

/* Burbuja usuario */
.chatbot-msg.user .chatbot-msg-bubble {
  background: linear-gradient(135deg, #0056b3, #0070e0);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  padding: 11px 15px;
  font-size: 13.5px;
  line-height: 1.6;
  box-shadow: 0 4px 14px rgba(0,86,179,.35);
  font-family: 'Poppins', sans-serif;
  max-width: 100%;
  word-break: break-word;
}

.chatbot-msg-time {
  font-size: 10.5px;
  color: var(--cb-muted);
  margin-top: 4px;
  display: block;
  padding: 0 4px;
}

.chatbot-msg.user .chatbot-msg-time {
  text-align: right;
}

/* Categoría tag */
.chatbot-category-tag {
  display: inline-block;
  background: rgba(0,86,179,.08);
  color: var(--cb-blue);
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
  margin-bottom: 6px;
  font-family: 'Poppins', sans-serif;
}

/* Links en mensajes */
.chatbot-msg-bubble a {
  color: var(--cb-blue);
  text-decoration: underline;
  font-weight: 600;
}
.chatbot-msg.user .chatbot-msg-bubble a { color: rgba(255,255,255,.9); }

/* ── Typing indicator ───────────────────────────────── */
.chatbot-typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.chatbot-typing-indicator .chatbot-msg-avatar {
  width: 28px; height: 28px; font-size: 13px;
}

.chatbot-typing-dots {
  background: #fff;
  border-radius: 16px;
  padding: 10px 15px;
  display: flex;
  gap: 5px;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  border: 1px solid var(--cb-border);
}

.chatbot-typing-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: linear-gradient(135deg, #0056b3, #00b894);
  animation: cb-typing 1.4s ease-in-out infinite;
}

.chatbot-typing-dots span:nth-child(2) { animation-delay: .2s; }
.chatbot-typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes cb-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%            { transform: translateY(-7px); opacity: 1; }
}

/* ══════════════════════════════════════════════════════
   5. BOTONES RÁPIDOS (QUICK REPLIES)
══════════════════════════════════════════════════════ */
.chatbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 16px 12px;
  background: var(--cb-bg);
  border-top: 1px solid var(--cb-border);
}

.chatbot-quick-btn {
  background: #fff;
  border: 1.5px solid var(--cb-border);
  color: var(--cb-text);
  padding: 7px 13px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .22s ease;
  font-family: 'Poppins', sans-serif;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
}

.chatbot-quick-btn:hover {
  background: linear-gradient(135deg, #0056b3, #0070e0);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(0,86,179,.3);
}

.chatbot-quick-btn.live-chat-btn {
  border-color: var(--cb-teal);
  color: var(--cb-teal);
  background: rgba(0,184,148,.05);
}

.chatbot-quick-btn.live-chat-btn:hover {
  background: linear-gradient(135deg, #00b894, #00a381);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 5px 16px rgba(0,184,148,.35);
}

.chatbot-quick-btn.switch-bot-btn {
  border-color: var(--cb-blue);
  color: var(--cb-blue);
  background: rgba(0,86,179,.05);
}

.chatbot-quick-btn.switch-bot-btn:hover {
  background: linear-gradient(135deg, #0056b3, #004494);
  color: #fff;
  border-color: transparent;
}

/* ══════════════════════════════════════════════════════
   6. INPUT AREA
══════════════════════════════════════════════════════ */
.chatbot-input-area {
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid var(--cb-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.chatbot-input {
  flex: 1;
  padding: 11px 18px;
  border: 2px solid var(--cb-border);
  border-radius: 28px;
  font-size: 16px;           /* ≥16px → evita zoom automático en iOS Safari */
  outline: none;
  transition: all .25s ease;
  font-family: 'Poppins', sans-serif;
  background: var(--cb-bg);
  color: var(--cb-text);
  resize: none;
  min-height: 44px;          /* touch target mínimo */
  max-height: 90px;
  -webkit-appearance: none;  /* elimina estilos nativos iOS */
  -webkit-tap-highlight-color: transparent;
}

.chatbot-input:focus {
  border-color: var(--cb-blue);
  box-shadow: 0 0 0 4px rgba(0,86,179,.09);
  background: #fff;
}

.chatbot-input::placeholder {
  color: #a0aec0;
  font-weight: 500;
}

/* Botón enviar */
.chatbot-send {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, #0056b3, #0070e0);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .25s ease;
  font-size: 17px;
  flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(0,86,179,.35);
}

.chatbot-send:hover {
  transform: scale(1.12) rotate(-5deg);
  box-shadow: 0 6px 20px rgba(0,86,179,.45);
}

.chatbot-send:active { transform: scale(.95); }

.chatbot-send:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ══════════════════════════════════════════════════════
   7. FOOTER DEL CHAT
══════════════════════════════════════════════════════ */
.chatbot-powered {
  text-align: center;
  padding: 8px 12px;
  font-size: 11px;
  color: #a0aec0;
  background: #fff;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  border-top: 1px solid var(--cb-border);
  flex-shrink: 0;
}

.chatbot-powered a {
  color: var(--cb-blue);
  text-decoration: none;
  font-weight: 700;
}

.chatbot-powered a:hover { text-decoration: underline; }

.live-indicator {
  color: var(--cb-teal); font-weight: 700;
}

.live-indicator i {
  font-size: 7px;
  vertical-align: middle;
  margin-right: 3px;
  animation: cb-online-pulse 1.5s ease infinite;
}

/* ══════════════════════════════════════════════════════
   8. FORMULARIO CHAT EN VIVO
══════════════════════════════════════════════════════ */
.chatbot-live-form {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 22px;
  background: linear-gradient(180deg, #f0f7ff 0%, #fff 100%);
  flex: 1;
  min-height: 300px;
  animation: cb-msg-in .3s ease;
}

.chatbot-live-form-content { width: 100%; text-align: center; }

.chatbot-live-form-icon {
  width: 70px; height: 70px; border-radius: 50%;
  background: linear-gradient(135deg, #00b894, #00cec9);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
  font-size: 30px; color: #fff;
  box-shadow: 0 10px 28px rgba(0,184,148,.35);
  animation: cb-robot-breathe 3s ease-in-out infinite;
}

.chatbot-live-form-content h5 {
  font-size: 17px; font-weight: 800;
  color: #1a1a2e; margin: 0 0 7px;
  font-family: 'Poppins', sans-serif;
}

.chatbot-live-form-content p {
  font-size: 12.5px; color: #888;
  margin: 0 0 20px;
  font-family: 'Poppins', sans-serif;
}

.chatbot-live-input {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--cb-border);
  border-radius: 14px;
  font-size: 16px;           /* ≥16px → sin zoom en iOS */
  -webkit-appearance: none;
  outline: none;
  transition: all .25s ease;
  font-family: 'Poppins', sans-serif;
  margin-bottom: 10px;
  box-sizing: border-box;
  background: #fff;
  color: var(--cb-text);
}

.chatbot-live-input:focus {
  border-color: var(--cb-teal);
  box-shadow: 0 0 0 4px rgba(0,184,148,.1);
}

.chatbot-live-input.error {
  border-color: var(--cb-red);
  box-shadow: 0 0 0 4px rgba(255,71,87,.1);
  animation: cb-shake .4s ease;
}

@keyframes cb-shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-6px); }
  75%       { transform: translateX(6px); }
}

.chatbot-live-connect-btn {
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, #00b894, #00a381);
  color: #fff; border: none; border-radius: 14px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: all .25s ease;
  font-family: 'Poppins', sans-serif;
  margin-bottom: 9px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
}

.chatbot-live-connect-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,184,148,.4);
}

.chatbot-live-cancel-btn {
  width: 100%;
  padding: 11px 18px;
  background: transparent;
  color: #888;
  border: 2px solid var(--cb-border);
  border-radius: 14px;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: all .25s ease;
  font-family: 'Poppins', sans-serif;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

.chatbot-live-cancel-btn:hover {
  border-color: var(--cb-blue);
  color: var(--cb-blue);
}

/* ══════════════════════════════════════════════════════
   9. SCROLL TO TOP
══════════════════════════════════════════════════════ */
.scroll-top-btn {
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #0056b3, #0070e0);
  color: #fff;
  border: none; border-radius: 50%;
  display: none;
  align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
  box-shadow: 0 4px 16px rgba(0,86,179,.35);
  transition: all .25s ease;
  z-index: 1040;
}

.scroll-top-btn.visible { display: flex; animation: cb-msg-in .3s ease; }

.scroll-top-btn:hover {
  transform: translateY(-3px) scale(1.08);
  box-shadow: 0 8px 24px rgba(0,86,179,.45);
}

/* ══════════════════════════════════════════════════════
   10. ANIMACIONES BASE
══════════════════════════════════════════════════════ */
@keyframes cb-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

@keyframes cb-msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════
   11. RESPONSIVE — TABLET (max 900px)
══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  :root {
    --cb-w: 360px;
    --cb-h: 580px;
  }
}

/* ══════════════════════════════════════════════════════
   12a. RESPONSIVE — TABLET / MÓVIL GRANDE (481px – 576px)
        Ventana flotante ajustada, NO pantalla completa
══════════════════════════════════════════════════════ */
@media (max-width: 576px) {
  /* Trigger más pequeño */
  .chatbot-trigger {
    right: 14px;
    bottom: 16px;
    gap: 10px;
  }

  .chatbot-trigger-label {
    font-size: 12.5px;
    padding: 9px 14px 9px 12px;
    max-width: 180px;
  }

  .chatbot-trigger-btn {
    width: 60px;
    height: 60px;
  }

  .chatbot-trigger-btn .robot-icon { font-size: 26px; }
  .chatbot-trigger-btn::before { inset: -7px; }
  .chatbot-trigger-btn::after  { inset: -12px; }

  /* Ventana: ancho = viewport - 28px margen total, posicionada como flotante */
  .chatbot-window {
    right: 14px;
    left: 14px;
    width: auto;                 /* deja los márgenes laterales */
    bottom: calc(16px + 60px + 14px); /* bottom trigger + btn height + gap */
    max-height: 72vh;
    border-radius: 20px;         /* esquinas redondeadas en todos los lados */
    box-shadow: 0 12px 48px rgba(0,0,0,.22), 0 0 0 1px rgba(0,0,0,.05);
    transform-origin: bottom right;
  }

  /* Header compacto */
  .chatbot-header { padding: 13px 14px 11px; }
  .chatbot-avatar { width: 40px; height: 40px; font-size: 19px; }
  .chatbot-header-text h4 { font-size: 13.5px; }
  .chatbot-header-text span { font-size: 10.5px; }

  /* Mensajes */
  .chatbot-messages { padding: 12px 11px; }

  /* Quick replies */
  .chatbot-quick-btn { font-size: 12px; padding: 6px 10px; }

  /* Input — font-size 16px mínimo para evitar zoom automático en iOS */
  .chatbot-input-area { padding: 9px 11px; }
  .chatbot-input { font-size: 16px; padding: 9px 15px; }

  .scroll-top-btn { display: none !important; }
}

/* ══════════════════════════════════════════════════════
   12b. RESPONSIVE — MÓVIL REAL (max 430px)
        Ventana tipo hoja desde la base, con márgenes
══════════════════════════════════════════════════════ */
@media (max-width: 430px) {
  .chatbot-trigger {
    right: 12px;
    bottom: 14px;
    gap: 8px;
  }

  /* Ocultar label desde 430px - la ventana cubre el trigger */
  .chatbot-trigger-label { display: none; }
  /* Reducir anillo para no salir del viewport */
  .chatbot-trigger-btn::after { inset: -10px; }

  .chatbot-trigger-label {
    font-size: 12px;
    padding: 8px 12px;
    max-width: 160px;
  }

  .chatbot-trigger-btn { width: 58px; height: 58px; }
  .chatbot-trigger-btn .robot-icon { font-size: 24px; }

  /* Ventana hoja desde abajo, con 10px de margen en cada lado */
  .chatbot-window {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 0;
    max-height: 85vh;
    max-height: calc(85vh - env(safe-area-inset-bottom, 0px)); /* iPhone notch */
    border-radius: 20px 20px 14px 14px;
    box-shadow: 0 -6px 36px rgba(0,0,0,.22);
    transform-origin: bottom center;
    padding-bottom: env(safe-area-inset-bottom, 0px); /* espacio botón home iPhone */
  }

  .chatbot-window.active {
    animation: cb-sheet-open .35s cubic-bezier(.34,1.4,.64,1) forwards;
  }
}

@keyframes cb-sheet-open {
  from { transform: translateY(50px) scale(.97); opacity: 0; }
  to   { transform: translateY(0)    scale(1);   opacity: 1; }
}

/* ══════════════════════════════════════════════════════
   13. RESPONSIVE — MÓVIL PEQUEÑO (max 380px)
══════════════════════════════════════════════════════ */
@media (max-width: 380px) {
  .chatbot-trigger-label {
    display: none;    /* muy pequeño → ocultar label */
  }

  .chatbot-trigger-btn {
    width: 56px;
    height: 56px;
  }

  .chatbot-trigger-btn .robot-icon {
    font-size: 24px;
  }

  .chatbot-header-text h4 { font-size: 13.5px; }
}

/* ══════════════════════════════════════════════════════
   320px — Pantallas muy pequeñas
══════════════════════════════════════════════════════ */
@media (max-width: 320px) {
  .chatbot-trigger {
    right: 10px;
    bottom: 10px;
    gap: 0;
  }
  .chatbot-window {
    left: 6px;
    right: 6px;
    max-height: 88vh;
    max-height: calc(88vh - env(safe-area-inset-bottom, 0px));
  }
  .chatbot-header { padding: 10px 12px 9px; }
  .chatbot-header-text h4 { font-size: 12.5px; }
  .chatbot-quick-btn { font-size: 11.5px; padding: 5px 9px; }
  .chatbot-input { font-size: 16px; padding: 8px 13px; }
}

/* ══════════════════════════════════════════════════════
   14. LANDSCAPE MÓVIL (orientación horizontal)
══════════════════════════════════════════════════════ */
@media (max-height: 500px) and (orientation: landscape) {
  .chatbot-window {
    max-height: 85vh;
    bottom: 0;
    right: auto;
    left: 0;
    width: 360px;
    border-radius: 0 22px 22px 0;
  }

  .chatbot-trigger {
    bottom: 12px;
    right: 12px;
  }

  .chatbot-trigger-label { display: none; }
}

/* ═══════════════════════════════════════════════════════
   AVATAR HUMANO "VALENTINA" — Diseño Asesora Comercial
═══════════════════════════════════════════════════════ */

/* Avatar humano del trigger (botón flotante) */
.chatbot-trigger-btn .robot-icon.human-avatar {
    width: 56px !important;
    height: 56px !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 50% !important;
    box-shadow: inset 0 0 0 3px rgba(255,255,255,.95), 0 4px 14px rgba(0,86,179,.25) !important;
    background: #fff !important;
}
.chatbot-trigger-btn .robot-icon.human-avatar svg {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
}

/* Pulse de "online" en el trigger */
.chatbot-trigger-pulse {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border-radius: 50%;
    border: 2.5px solid #fff;
    z-index: 3;
}
.chatbot-trigger-pulse::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: #22c55e;
    opacity: .4;
    animation: vpulse 1.6s ease infinite;
}
@keyframes vpulse {
    0%   { transform: scale(1); opacity: .5; }
    100% { transform: scale(2.2); opacity: 0; }
}

/* Avatar humano en el header (cuando el chat está abierto) */
.chatbot-avatar.human-avatar {
    width: 46px !important;
    height: 46px !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 50% !important;
    background: #fff !important;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,.95) !important;
    position: relative;
}
.chatbot-avatar.human-avatar::before,
.chatbot-avatar.human-avatar::after {
    display: none !important;
}
.chatbot-avatar.human-avatar svg {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
}

/* Punto verde "en línea" sobre el avatar del header */
.chatbot-status-online {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #fff;
    z-index: 2;
    box-shadow: 0 0 0 1px rgba(34,197,94,.3);
}
.chatbot-status-online::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #22c55e;
    opacity: .5;
    animation: vpulse 2s ease infinite;
}

/* Dot verde "En línea" del subtítulo */
.online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
    animation: vpulse-small 1.4s ease infinite;
    box-shadow: 0 0 0 0 rgba(34,197,94,.7);
}
@keyframes vpulse-small {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); }
    50%       { box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

/* Subtítulo del header en verde claro para "En línea" */
.chatbot-header-text span {
    color: rgba(255,255,255,.92) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    letter-spacing: .02em;
}

/* Avatar humano en los mensajes (bubble de Valentina) */
.chatbot-msg-avatar.human-msg-avatar {
    width: 36px !important;
    height: 36px !important;
    background: #fff !important;
    border: 2px solid rgba(0,86,179,.15) !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    padding: 0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    flex-shrink: 0;
}
.chatbot-msg-avatar.human-msg-avatar svg {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
}

/* Nombre "Valentina" arriba del mensaje */
.chatbot-msg-name {
    font-size: 11px;
    font-weight: 700;
    color: #0056b3;
    margin-bottom: 4px;
    letter-spacing: .02em;
}

/* Typing indicator humanizado */
.chatbot-typing-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #f1f5f9;
    border-radius: 18px 18px 18px 4px;
}
.chatbot-typing-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
    font-style: italic;
}

/* Trigger label más amigable */
.chatbot-trigger-label {
    background: linear-gradient(135deg, #fff 0%, #f0f9ff 100%) !important;
    border: 1px solid rgba(0,86,179,.12) !important;
    box-shadow: 0 8px 24px rgba(0,86,179,.15) !important;
    color: #0a1628 !important;
}
.chatbot-trigger-label b {
    color: #0056b3;
}

/* Powered con tono más profesional */
.chatbot-powered {
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%) !important;
    color: #475569 !important;
    font-weight: 500 !important;
    padding: 9px 14px !important;
    border-top: 1px solid rgba(0,86,179,.06) !important;
    text-align: center !important;
    font-size: 11px !important;
}
.chatbot-powered b {
    color: #0056b3;
}

/* Header degradado más suave y profesional */
.chatbot-header:not(.live-mode) {
    background: linear-gradient(135deg, #0a1628 0%, #0f2a5c 50%, #0056b3 100%) !important;
}

/* Input placeholder más natural */
.chatbot-input::placeholder {
    color: #94a3b8 !important;
    font-style: italic;
}

/* Notification badge más visible */
.chatbot-notification-badge {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    box-shadow: 0 2px 8px rgba(239,68,68,.5) !important;
}

/* ═══════════════════════════════════════════════════════
   MARKETING: Rotación de labels + Shake + Exit intent
═══════════════════════════════════════════════════════ */

/* Transición suave al rotar labels */
.chatbot-trigger-label {
    transition: opacity .35s ease, transform .35s ease !important;
}

/* Shake del trigger (cuando exit intent) */
.chatbot-trigger-shake {
    animation: chatbotShake .6s cubic-bezier(.36, .07, .19, .97) both;
}
@keyframes chatbotShake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Marcador de pulse para el badge cuando se reactiva */
@keyframes vpulse-small {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.6); transform: scale(1); }
    50%       { box-shadow: 0 0 0 8px rgba(239,68,68,0); transform: scale(1.1); }
}

/* Quick replies con CTA principales destacados */
.chatbot-quick-btn:first-child {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: #fff !important;
    font-weight: 800 !important;
    box-shadow: 0 4px 14px rgba(245,158,11,.4) !important;
    border-color: transparent !important;
}
.chatbot-quick-btn:first-child:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 22px rgba(245,158,11,.55) !important;
}

/* Trigger label con tono persuasivo */
.chatbot-trigger-label {
    max-width: 240px !important;
    text-align: center !important;
    line-height: 1.35 !important;
}
