/* ——————————————
   1. Contenedor flotante
   —————————————— */
#ai-chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
}

/* ——————————————
   2. Botón flotante (toggle)
   —————————————— */
#ai-chat-toggle {
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  font-size: 28px;
  line-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
#ai-chat-toggle:hover { background: #20b858; }

/* ——————————————
   3. Modal
   —————————————— */
#ai-chat-modal {
  display: none;           /* JS alterna a flex */
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 350px;
  max-width: 90%;
  height: 500px;
  background: #ece5dd;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  flex-direction: column;  /* hijos apilados (cabecera, mensajes, footer) */
}

/* ——— Cabecera ——— */
#ai-chat-header {
  background: #075E54;
  color: #fff;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#ai-chat-header strong { font-size: 16px; }

/* ——— Área de mensajes ——— */
#ai-chat-messages {
  flex: 1 1 auto;          /* ocupa todo lo que queda */
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: #f9f9f9;
}

/* Burbuja base */
.message {
  max-width: 75%;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 7.5px;
  line-height: 1.4;
  word-wrap: break-word;
}
/* Usuario (derecha) */
.message-user {
  align-self: flex-end;
  background: #dcf8c6;
  border-bottom-right-radius: 0;
}
/* Bot (izquierda) */
.message-bot {
  align-self: flex-start;
  background: #fff;
  border-bottom-left-radius: 0;
}

/* ——————————————
   4. Pie: botón PDF + formulario
   —————————————— */
#ai-chat-footer {
  display: flex;
  flex-direction: column;
  background: #f0f0f0;
}

#ai-chat-pdf {
  width: 100%;
  background: #075E54;
  color: #fff;
  border: none;
  padding: 10px 0;
  cursor: pointer;
  font-weight: 600;
  transition: background .2s;
}
#ai-chat-pdf:hover { background: #064b44; }

/* Formulario (input + botón “Enviar”) */
#ai-chat-form {
  display: flex;
  padding: 8px;
  background: #f0f0f0;
}
#ai-chat-input {
  flex: 1;
  border: none;
  border-radius: 20px;
  padding: 8px 12px;
  outline: none;
}
#ai-chat-form button {
  background: #25D366;
  border: none;
  color: #fff;
  margin-left: 8px;
  padding: 0 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: background .2s;
}
#ai-chat-form button:hover { background: #20b858; }

/* ——————————————
   5. Responsividad
   —————————————— */
@media (max-width: 767px) {
  #ai-chat-toggle {
    width: 50px;
    height: 50px;
    font-size: 24px;
    line-height: 50px;
  }
  #ai-chat-modal {
    width: calc(100% - 20px);
    height: 60vh;
    bottom: 80px;
    right: 10px;
    border-radius: 8px;
  }
  #ai-chat-header { padding: 8px; }
  #ai-chat-messages { padding: 8px; }
  #ai-chat-input  { padding: 6px 10px; }
  #ai-chat-form button { padding: 0 12px; }
}
