/* === ai-chat.css — SubSección 2.1 (Personalización del Chat) === */
.ai-chat-theme {
  --ai-brand: #2563eb;
  --ai-accent: #10b981;
  --ai-radius: 16px;
  --ai-font: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    --ai-font-size: 14px;
  --ai-avatar-size: 28px;
}

/* Aplica tamaño de texto global al chat y al botón */
.ai-chat-window,
.ai-chat-fab,
.ai-chat-input textarea,
.ai-msg .bubble { font-size: var(--ai-font-size); }

/* Botón flotante (FAB) */
.ai-chat-fab {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 99999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ai-brand);
  color: #fff;
  font-family: var(--ai-font);
  border-radius: calc(var(--ai-radius) + 12px);
  padding: 12px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  cursor: pointer;
  user-select: none;
}
.ai-chat-fab:hover { filter: brightness(1.05); }

/* Icono del FAB (si usas imagen o emoji) */
.ai-fab-icon { width: 16px; height: 16px; object-fit: contain; }
.ai-fab-emoji { line-height: 1; font-size: 1.1em; }

/* (dejamos la bolita por si no configuras icono) */
.ai-chat-fab .ai-dot {
  width: 10px; height: 10px; border-radius: 999px; background: var(--ai-accent);
}

/* Ventana del chat */
.ai-chat-window {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: min(380px, 92vw);
  height: 566px;
  z-index: 99999;
  background: #fff;
  border-radius: var(--ai-radius);
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
  display: none;
  overflow: hidden;
  font-family: var(--ai-font);
}

/* Header */
.ai-chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(180deg, var(--ai-brand), #1e3a8a);
  color: #fff;
}
.ai-chat-header img.logo { height: 24px; width: auto; object-fit: contain; border-radius: 4px;}
.ai-chat-header .title { font-weight: 600; letter-spacing: .2px; }
.ai-chat-header .close { margin-left: auto; cursor: pointer; opacity: .9; font-size: 18px; }
.ai-chat-header .close:hover { opacity: 1; }

/* Bloque de títulos en el header (título + estado) */
.ai-chat-header .head-titles{ display:flex; flex-direction:column; line-height:1.15; }

/* Línea de estado: “Disponible ahora” */
.ai-status{
  display:flex; align-items:center; gap:6px;
  font-size:12px; opacity:.95;
}
.ai-status-dot{
  width:8px; height:8px; border-radius:999px;
  background: var(--ai-accent);
  box-shadow: 0 0 0 2px rgba(255,255,255,.35);
}

/* Etiqueta con el nombre del bot arriba de su burbuja */
.ai-msg.ai-bot .ai-author{
  font-size:12px; color:#94a3b8; margin:0 0 2px 2px;
}

/* Body */
.ai-chat-body {
  height: calc(520px - 56px - 64px);
  overflow-y: auto; padding: 14px;
  background: #f8fafc;
}

/* Input */
.ai-chat-input {
  display: flex; gap: 8px; align-items: center;
  padding: 10px; background: #fff; border-top: 1px solid #e5e7eb;
}
.ai-chat-input textarea {
  flex: 1; resize: none; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 10px 12px; min-height: 42px; max-height: 120px;
  font-family: var(--ai-font);
}
.ai-chat-input button {
  background: var(--ai-brand); color:#fff; border:0; border-radius: 12px; padding: 10px 14px; cursor:pointer;
}
.ai-chat-input button:hover { filter:brightness(1.05); }

/* Mensajes */
.ai-msg { display: flex; gap: 10px; margin-bottom: 12px; }
.ai-msg .bubble {
  max-width: 80%;
  padding: 10px 12px; border-radius: 14px; line-height: 1.35;
  background: #fff; border: 1px solid #e5e7eb; color: #0f172a;
  white-space: pre-wrap; word-wrap: break-word;
}
.ai-msg.user { justify-content: flex-end; }
.ai-msg.user .bubble { background: var(--ai-brand); color: #fff; border-color: transparent; }
.ai-avatar {
  width: var(--ai-avatar-size);
  height: var(--ai-avatar-size);
  border-radius: 999px;
  object-fit: cover;
  background:#e2e8f0;
}

/* Fuente (opcional) */
.ai-source { margin-top: 6px; font-size: 12px; color: #64748b; }

/* Indicador typing */
.ai-typing {
  width: 44px; height: 20px; background: #fff; border-radius: 12px; border:1px solid #e5e7eb; padding:4px 8px;
  display:flex; gap:4px; align-items:center; justify-content:center;
}
.ai-typing span { width:6px; height:6px; background:#94a3b8; border-radius:999px; animation: ai-bounce 1.2s infinite; }
.ai-typing span:nth-child(2){ animation-delay:.15s } .ai-typing span:nth-child(3){ animation-delay:.3s }
@keyframes ai-bounce { 0%,80%,100%{ transform: translateY(0); opacity:.7 } 40%{ transform: translateY(-6px); opacity:1 } }

.ai-chat-body { display:flex; flex-direction:column; gap:8px; font-family: inherit; }
.ai-msg { display:flex; max-width: 80%; }
.ai-msg.user { align-self: flex-end; justify-content:flex-end; background: transparent; }
.ai-msg.ai-bot { align-self: flex-start; justify-content:flex-start; }
.ai-msg.ai-bot .bubble { background: #f1f1f1; color:#111; border-radius: 12px; padding:8px 10px; }
.ai-msg .bubble { word-break: break-word; white-space: pre-wrap; } 

/* estado disabled */
.ai-chat-input textarea[disabled] { opacity: .6; cursor: not-allowed; }
/* estilo botón disabled */
#aiChatSend.disabled { opacity:.6; cursor:not-allowed; pointer-events:none; }
/* botón nueva conversación */
#aiChatNewConvo { background:#10b981;color:#fff;border:none;padding:8px 10px;border-radius:10px; cursor:pointer; }
#aiChatNewConvo[style*="display:none"] { display:none !important; }

