/* ============================================================
   ASISTENTE VIRTUAL CIAFBA — ciafba-chat.css
   Versión 1.0
   ============================================================ */

/* Botón flotante */
#ciafba-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #1a5c38;
  color: #fff;
  border: none;
  cursor: pointer;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .28);
  transition: transform .2s;
}

#ciafba-fab:hover {
  transform: scale(1.08);
}

/* Ventana del chat */
#ciafba-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 360px;
  height: 520px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e0e0e0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .14);
  display: flex;
  flex-direction: column;
  z-index: 99998;
  overflow: hidden;
  transition: opacity .2s, transform .2s;
  font-family: Arial, sans-serif;
}

#ciafba-window.oculto {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

/* Burbuja de invitación */
#ciafba-bubble {
  position: fixed;
  bottom: 92px;
  right: 24px;
  background: #fff;
  color: #1a5c38;
  border-radius: 16px 16px 16px 4px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: bold;
  font-family: sans-serif;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
  white-space: nowrap;
  z-index: 99997;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: aparecer .3s ease;
  animation-fill-mode: forwards;
}

#ciafba-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 20px;
  border: 8px solid transparent;
  border-top-color: #fff;
  border-bottom: none;
}

#ciafba-bubble-cerrar {
  background: #e0e0e0;
  border: none;
  cursor: pointer;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
}

@keyframes aparecer {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
#ciafba-header {
  background: #1a5c38;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.ch-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.ch-info {
  flex: 1;
}

.ch-titulo {
  font-size: 14px;
  font-weight: bold;
}

.ch-sub {
  font-size: 11px;
  opacity: .78;
  margin-top: 2px;
}

.ch-cerrar {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  opacity: .8;
  padding: 4px;
  line-height: 1;
}

.ch-cerrar:hover {
  opacity: 1;
}

/* Área de mensajes */
#ciafba-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f9f9f9;
}

/* Burbujas */
.cm {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.cm.usuario {
  flex-direction: row-reverse;
}

.cm-burbuja {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.55;
  word-wrap: break-word;
}

.cm.bot .cm-burbuja {
  background: #fff;
  color: #222;
  border: 1px solid #e8e8e8;
  border-bottom-left-radius: 4px;
}

.cm.usuario .cm-burbuja {
  background: #1a5c38;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.cm-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #e8f5ee;
  border: 1px solid #d0e8d8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* Botón CTA */
.cm-cta {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: #1a5c38;
  border: 1px solid #1a5c38;
  border-radius: 12px;
  padding: 4px 12px;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.cm-cta:hover {
  background: #1a5c38;
  color: #fff;
}

/* Sugerencias */
.sugerencias {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 10px;
}

.sugerencia-btn {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 14px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  color: #333;
}

.sugerencia-btn:hover {
  border-color: #1a5c38;
  color: #1a5c38;
}

/* Input */
#ciafba-input-area {
  padding: 10px 12px;
  border-top: 1px solid #e8e8e8;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: #fff;
}

#ciafba-input {
  flex: 1;
  resize: none;
  padding: 9px 13px;
  border: 1px solid #ddd;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  font-family: Arial, sans-serif;
  max-height: 100px;
  overflow-y: auto;
  background: #f7f7f7;
  color: #222;
}

#ciafba-input:focus {
  border-color: #1a5c38;
  background: #fff;
}

#ciafba-enviar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #1a5c38;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity .2s;
}

#ciafba-enviar:hover {
  opacity: .85;
}

/* Pie */
#ciafba-pie {
  font-size: 10px;
  color: #bbb;
  text-align: center;
  padding: 4px 0 8px;
  background: #fff;
  flex-shrink: 0;
}

/* Mobile */
@media (max-width: 480px) {
  #ciafba-window {
    width: calc(100vw - 20px);
    right: 10px;
  }
}