/* Asistente de Richelmis - estilos del chat */

/* Botón flotante con avatar */
#ifab-chat-btn {
  position: fixed; right: 22px; bottom: 22px; z-index: 99999;
  width: 62px; height: 62px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.9); cursor: pointer; padding: 0;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  overflow: hidden; background: #111;
  transition: transform .15s ease;
}
#ifab-chat-btn:hover { transform: scale(1.06); }
#ifab-chat-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Panel del chat: pantalla completa estilo app (móvil y escritorio) */
#ifab-chat-panel {
  position: fixed; inset: 0; z-index: 99999;
  width: 100%; height: 100dvh;
  background: #101010; overflow: hidden;
  display: none; flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  animation: ifab-entrar .2s ease;
}
#ifab-chat-panel.ifab-abierto { display: flex; }
@keyframes ifab-entrar {
  from { opacity: 0; }
  to { opacity: 1; }
}
/* Cuando el chat está abierto: ocultar el botón flotante y fijar el fondo */
body.ifab-chat-abierto { overflow: hidden; }
body.ifab-chat-abierto #ifab-chat-btn { display: none; }

/* Encabezado */
#ifab-chat-head {
  background: linear-gradient(135deg, #141414, #2c2c2c);
  color: #fff; padding: 12px 14px;
  display: flex; align-items: center; gap: 11px;
}
#ifab-chat-avatar {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(255,255,255,.3); flex-shrink: 0;
}
#ifab-chat-nombre { font-size: 15px; font-weight: 600; line-height: 1.25; }
#ifab-chat-estado { font-size: 12px; opacity: .85; display: flex; align-items: center; gap: 6px; }
#ifab-chat-estado::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: #4ade80; display: inline-block;
  box-shadow: 0 0 6px #4ade80;
}
#ifab-chat-close {
  margin-left: auto; background: rgba(255,255,255,.14); border: none; color: #fff;
  width: 34px; height: 34px; border-radius: 50%;
  font-size: 20px; cursor: pointer; line-height: 1; flex-shrink: 0;
}
#ifab-chat-close:hover { background: rgba(255,255,255,.28); }

/* Mensajes (tema oscuro) */
#ifab-chat-msgs { flex: 1; overflow-y: auto; padding: 16px 14px; background: #101010; }
.ifab-msg {
  max-width: 82%; padding: 10px 13px; border-radius: 14px; margin: 7px 0;
  font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.ifab-bot { background: #1d1d1f; border: 1px solid #2c2c2e; border-bottom-left-radius: 4px; color: #f2f2f2; }
.ifab-user { background: #f5f5f5; color: #111; margin-left: auto; border-bottom-right-radius: 4px; }
.ifab-escribiendo { font-style: italic; opacity: .6; }

/* Formulario (tema oscuro) */
#ifab-chat-form { display: flex; border-top: 1px solid #2a2a2a; background: #161616; margin: 0; padding: 10px; gap: 8px; }
#ifab-chat-input {
  flex: 1; border: 1px solid #333; border-radius: 20px;
  padding: 11px 14px; font-size: 16px; outline: none; min-width: 0; background: #222; color: #fff;
}
#ifab-chat-input:focus { border-color: #666; background: #1a1a1a; }
#ifab-chat-input::placeholder { color: #888; }
#ifab-chat-send {
  background: #f5f5f5; color: #111; border: none; border-radius: 20px;
  padding: 0 20px; font-size: 14px; font-weight: 600; cursor: pointer;
}
#ifab-chat-send:hover { background: #ddd; }
#ifab-chat-send:disabled { opacity: .5; cursor: default; }

/* Indicador de modo entrenamiento */
.ifab-entrenando #ifab-chat-estado::before {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

/* Preguntas sugeridas y botones de acción (tema oscuro) */
.ifab-sugerencias { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.ifab-sugerencia {
  background: #1d1d1f; border: 1px solid #3a3a3c; border-radius: 18px;
  padding: 8px 14px; font-size: 13px; color: #f2f2f2; cursor: pointer;
}
.ifab-sugerencia:hover { background: #f5f5f5; color: #111; border-color: #f5f5f5; }
.ifab-botones { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.ifab-boton {
  display: inline-block; background: #f5f5f5; color: #111 !important;
  border-radius: 18px; padding: 9px 16px; font-size: 13px; font-weight: 600;
  text-decoration: none;
}
.ifab-boton:hover { background: #ddd; }

/* Botón destacado para continuar por WhatsApp ([WHATSAPP]) */
.ifab-whatsapp-btn {
  display: block; width: 100%; max-width: 420px; box-sizing: border-box;
  margin: 8px auto; padding: 13px; text-align: center;
  background: #25d366; color: #062b16 !important;
  font-size: 14px; font-weight: 700; border-radius: 14px; text-decoration: none;
}
.ifab-whatsapp-btn:hover { background: #1fb857; }

/* Tarjeta de contacto estilo vCard ([CONTACTO]): tarjeta de presentación
   digital — foto destacada, nombre, empresa y debajo los botones de acción */
.ifab-contacto {
  background: linear-gradient(160deg, #1a1a1a, #262626);
  color: #fff; border-radius: 20px; padding: 26px 18px 16px;
  margin: 10px auto; text-align: center; max-width: 420px; width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.ifab-contacto img {
  width: 108px; height: 108px; border-radius: 50%; object-fit: cover;
  border: 3px solid rgba(255,255,255,.3); display: block; margin: 0 auto;
  box-shadow: 0 0 24px rgba(120,170,255,.25);
}
.ifab-contacto-nombre { font-size: 20px; font-weight: 700; margin: 12px 0 3px; letter-spacing: .2px; }
.ifab-contacto-sub { font-size: 13px; opacity: .65; margin-bottom: 16px; }
.ifab-contacto-btn {
  display: block; width: 100%; box-sizing: border-box;
  background: rgba(255,255,255,.09); color: #fff;
  border: 1px solid rgba(255,255,255,.15); border-radius: 12px;
  padding: 12px; margin: 7px 0; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; font-family: inherit;
}
.ifab-contacto-btn:hover { background: rgba(255,255,255,.18); }
.ifab-contacto-btn.ifab-primario { background: #fff; color: #141414; border-color: #fff; }
.ifab-contacto-btn.ifab-primario:hover { background: #e8e8e8; }

/* Botón de micrófono (v1.3.0-alfa): entrada por voz */
#ifab-chat-mic {
  background: #2a2a2a; color: #fff; border: 1px solid #3a3a3a;
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
#ifab-chat-mic:hover { background: #3a3a3a; }
#ifab-chat-mic.ifab-escuchando {
  background: #e02424; border-color: #e02424;
  animation: ifab-pulso 1s ease-in-out infinite;
}
@keyframes ifab-pulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,36,36,.5); }
  50% { box-shadow: 0 0 0 8px rgba(224,36,36,0); }
}

/* Botón "Reintentar" bajo los mensajes de error (v1.3.0-alfa) */
.ifab-reintentar {
  display: inline-block; margin: 2px 0 8px;
  background: transparent; color: #8ab4ff;
  border: 1px solid #3a3a3c; border-radius: 18px;
  padding: 7px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.ifab-reintentar:hover { background: rgba(138,180,255,.12); }
