/* chatbot.css — Estilos del widget flotante de Paulini Espichan Abogados */

/* ─── Variables de color (misma paleta que la web del estudio) ──────────── */
:root {
  --c-navy:    #0B1F3A;   /* Azul marino principal */
  --c-gold:    #C0992A;   /* Dorado de acento */
  --c-gold2:   #D4AF5A;   /* Dorado claro */
  --c-white:   #FFFFFF;
  --c-light:   #F8F9FB;   /* Fondo del área de mensajes */
  --c-border:  #DDE1E7;
  --c-text:    #222831;
  --c-gray:    #6B7280;
  --c-bot-bg:  #EFF2F6;   /* Fondo de burbujas del bot */
  --c-shadow:  0 8px 40px rgba(0, 0, 0, 0.18);
  --c-radius:  14px;
}

/* ─── BOTÓN FLOTANTE ────────────────────────────────────────────────────── */
#paulini-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: var(--c-navy);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--c-shadow);
  z-index: 9998;
  border: 3px solid var(--c-gold);
  transition: transform 0.2s ease, background 0.2s ease;
  user-select: none;
}

#paulini-chat-btn:hover {
  transform: scale(1.1);
  background: var(--c-gold);
}

#paulini-chat-btn svg {
  width: 26px;
  height: 26px;
  fill: var(--c-white);
}

/* Punto rojo de notificación */
#paulini-chat-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  background: #E53E3E;
  border-radius: 50%;
  border: 2px solid var(--c-white);
  font-size: 10px;
  color: var(--c-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ─── VENTANA DEL CHAT ──────────────────────────────────────────────────── */
#paulini-chat-window {
  position: fixed;
  bottom: 98px;
  right: 24px;
  width: 370px;
  max-height: 570px;
  background: var(--c-white);
  border-radius: var(--c-radius);
  box-shadow: var(--c-shadow);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Oculto por defecto — se muestra con la clase .abierto */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#paulini-chat-window.abierto {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ─── HEADER ────────────────────────────────────────────────────────────── */
#chat-header {
  background: var(--c-navy);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

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

.chat-avatar {
  width: 40px;
  height: 40px;
  background: var(--c-gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.chat-nombre {
  color: var(--c-white);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}

.chat-online {
  color: rgba(255, 255, 255, 0.65);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.chat-punto-verde {
  width: 7px;
  height: 7px;
  background: #48BB78;
  border-radius: 50%;
  display: inline-block;
}

#btn-cerrar {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}

#btn-cerrar:hover {
  color: var(--c-white);
}

/* ─── ÁREA DE MENSAJES ──────────────────────────────────────────────────── */
#chat-mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--c-light);
  scroll-behavior: smooth;
}

/* Scroll fino y discreto */
#chat-mensajes::-webkit-scrollbar { width: 4px; }
#chat-mensajes::-webkit-scrollbar-track { background: transparent; }
#chat-mensajes::-webkit-scrollbar-thumb {
  background: var(--c-border);
  border-radius: 4px;
}

/* ─── BURBUJAS DE MENSAJE ───────────────────────────────────────────────── */
.burbuja {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  animation: aparecer 0.18s ease;
}

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

/* Mensajes del bot — alineados a la izquierda */
.burbuja-bot {
  background: var(--c-bot-bg);
  color: var(--c-text);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  border: 1px solid var(--c-border);
}

/* Mensajes del usuario — alineados a la derecha */
.burbuja-usuario {
  background: var(--c-navy);
  color: var(--c-white);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Negritas dentro de burbujas */
.burbuja strong { font-weight: 700; }

/* ─── INDICADOR DE ESCRITURA (puntos animados) ──────────────────────────── */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--c-gray);
  border-radius: 50%;
  animation: typing 1.1s infinite;
}

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

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.35; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ─── BOTONES DE OPCIONES RÁPIDAS ───────────────────────────────────────── */
.wrap-botones {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
  align-self: flex-start;
  max-width: 100%;
  animation: aparecer 0.2s ease;
}

.btn-opcion {
  background: var(--c-white);
  border: 1.5px solid var(--c-gold);
  color: var(--c-navy);
  padding: 6px 13px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  font-family: inherit;
}

.btn-opcion:hover:not(:disabled) {
  background: var(--c-gold);
  color: var(--c-white);
}

/* Estado deshabilitado — cuando ya se seleccionó una opción */
.btn-opcion:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Botón especial para WhatsApp */
.btn-whatsapp {
  background: #25D366;
  border-color: #25D366;
  color: var(--c-white);
}

.btn-whatsapp:hover:not(:disabled) {
  background: #1EBE5A;
  border-color: #1EBE5A;
  color: var(--c-white);
}

/* ─── INPUT DEL USUARIO ─────────────────────────────────────────────────── */
#chat-input-area {
  padding: 10px 12px;
  border-top: 1px solid var(--c-border);
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--c-white);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  border: 1.5px solid var(--c-border);
  border-radius: 22px;
  padding: 9px 15px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  color: var(--c-text);
  background: var(--c-light);
  transition: border-color 0.18s;
}

#chat-input:focus {
  border-color: var(--c-gold);
  background: var(--c-white);
}

#chat-input::placeholder { color: var(--c-gray); }

#btn-enviar {
  width: 38px;
  height: 38px;
  background: var(--c-navy);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s;
}

#btn-enviar:hover { background: var(--c-gold); }

#btn-enviar svg {
  width: 17px;
  height: 17px;
  fill: var(--c-white);
}

/* ─── PIE DEL CHAT ──────────────────────────────────────────────────────── */
#chat-footer {
  text-align: center;
  font-size: 10px;
  color: var(--c-gray);
  padding: 5px 0 7px;
  background: var(--c-white);
  border-top: 1px solid var(--c-border);
  flex-shrink: 0;
}

/* ─── RESPONSIVE — móviles pequeños ────────────────────────────────────── */
@media (max-width: 420px) {
  #paulini-chat-window {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 88px;
    max-height: 72vh;
  }

  #paulini-chat-btn {
    right: 16px;
    bottom: 16px;
  }
}
