/* ===== Contenedor y Botón flotante ===== */
#chatbot-button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 90px;
  height: 90px;
  background: linear-gradient(145deg, #001f3f, #003366);
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 36px;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(0,0,0,0.25);
  transition: transform 0.3s, box-shadow 0.3s;
  animation: bounce 2s infinite;
  z-index: 9999;
}

#chatbot-button:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* ===== Animación de rebote del botón ===== */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ===== Ventana de chat ===== */
#chatbot-window {
  position: fixed;
  bottom: 50px; /* separada del botón flotante */
  right: 30px;
  z-index: 9999;
  width: 420px;
  max-height: 550px;
  background-color: #fefefe;
  border-radius: 22px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.25);
  overflow: hidden;
  display: none; /* se muestra con JS */
  flex-direction: column;
  border: 2px solid #001f3f;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ===== Encabezado ===== */
#chatbot-header {
  background-color: #001f3f;
  color: #ffffff;
  padding: 16px 20px;
  font-weight: bold;
  font-size: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #003366;
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
}

/* Indicador de online */
#chatbot-online {
  color: #00ff00;
  font-size: 16px;
}

/* Botón de cerrar */
#chatbot-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.2s, color 0.2s;
}

#chatbot-close:hover {
  color: #ff5555;
  transform: scale(1.2);
}

/* ===== Mensajes ===== */
#chatbot-messages {
  padding: 16px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: #001f3f #e0e0e0;
}

#chatbot-messages::-webkit-scrollbar {
  width: 10px;
}

#chatbot-messages::-webkit-scrollbar-track {
  background: #e0e0e0;
  border-radius: 5px;
}

#chatbot-messages::-webkit-scrollbar-thumb {
  background-color: #001f3f;
  border-radius: 5px;
}

.typing {
  display: inline-block;
  background-color: #e6f0ff;
  color: #001f3f;
  align-self: flex-start;
  padding: 14px 18px;
  border-radius: 20px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
  font-size: 1rem;
  max-width: 60%;
}

.typing::after {
  content: '...';
  animation: dots 1s steps(3, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* Animación fade-in para mensajes */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Mensajes del Bot ===== */
.bot-message {
  background-color: #e6f0ff;
  color: #001f3f;
  align-self: flex-start;
  padding: 16px 20px;
  border-radius: 22px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  max-width: 75%;
  word-wrap: break-word;
  font-size: 1rem;
  animation: fadeIn 0.4s ease-in;
}

/* Mensajes del Usuario */
.user-message {
  background-color: #001f3f;
  color: white;
  align-self: flex-end;
  padding: 16px 20px;
  border-radius: 22px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  max-width: 75%;
  word-wrap: break-word;
  font-size: 1rem;
  animation: fadeIn 0.4s ease-in;
}

/* ===== Opciones como enlaces tipo burbuja ===== */
.option-message {
  background-color: #003366;
  color: white;
  align-self: flex-start;
  padding: 14px 20px;
  border-radius: 22px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s;
  font-size: 1rem;
  animation: fadeIn 0.4s ease-in;
}

.option-message:hover {
  background-color: #001f3f;
  transform: scale(1.05);
  box-shadow: 0 3px 12px rgba(0,0,0,0.2);
}

/* ===== Animación de cierre ===== */
@keyframes closeChat {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(30px); }
}

.chat-closing {
  animation: closeChat 0.4s forwards;
}


/* ===== Chatbot Responsivo para móviles pequeños ===== */
@media (max-width: 480px) {
  /* Botón flotante más pequeño */
  #chatbot-button {
    width: 60px;
    height: 60px;
    font-size: 24px;
    bottom: 20px;
    right: 20px;
  }

  /* Ventana de chat más compacta */
  #chatbot-window {
    width: 90vw;       /* ocupa casi todo el ancho del móvil */
    max-height: 70vh;  /* menos alto que en escritorio */
    bottom: 60px;      /* un poco más arriba del botón */
    right: 5vw;        /* centrado horizontalmente dentro de la pantalla */
    border-radius: 16px;
  }

  /* Encabezado más pequeño */
  #chatbot-header {
    padding: 12px 16px;
    font-size: 1rem;
  }

  /* Mensajes más pequeños */
  .typing, .bot-message, .user-message, .option-message {
    font-size: 0.85rem;
    padding: 10px 14px;
    max-width: 80%;   /* mensajes más estrechos */
  }

  /* Ajustes de scrollbar si se ve demasiado grande */
  #chatbot-messages {
    padding: 12px;
    gap: 10px;
  }

  /* Botón cerrar más pequeño */
  #chatbot-close {
    font-size: 18px;
  }
}








/* ===== Contenedor y Botón flotante WhatsApp ===== */
#whatsapp-button {
  position: fixed;
  bottom: 140px;       /* un poco más arriba del chatbot */
  right: 30px;         /* misma alineación horizontal que el chatbot */
  width: 90px;         /* mismo tamaño que el chatbot */
  height: 90px;
  background: #25D366; /* verde WhatsApp */
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 36px;     /* mismo tamaño de ícono que el chatbot */
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(0,0,0,0.25);
  transition: transform 0.3s, box-shadow 0.3s, opacity 0.4s;
  animation: bounce 2s infinite;
  z-index: 10000;
}

#whatsapp-button:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* ===== Animación de rebote ===== */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ===== Ventana de WhatsApp ===== */
/* ===== Ventana de WhatsApp ajustada ===== */
#whatsapp-window {
  position: fixed;
  bottom: 150px;      /* más abajo que antes */
  right: 30px;
  width: 400px;       /* más ancho */
  max-height: 600px;  /* límite de altura */
  background: white;
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  display: none;      /* se muestra con JS */
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
  font-family: Arial, sans-serif;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}


/* Mostrar ventana */
#whatsapp-window.show {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* ===== Encabezado verde ===== */
#whatsapp-header {
  background: #25D366;
  color: white;
  padding: 10px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Botón de cerrar ventana WhatsApp */
#whatsapp-header button {
  background: none;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
}

/* ===== Cuerpo de la ventana ===== */
#whatsapp-body {
  padding: 20px;
  color: #333;
  font-size: 16px;   /* más grande que antes */
  line-height: 1.5;  /* un poco más de espacio entre líneas */
}

/* ===== Botón verde "Ir a WhatsApp" ===== */
#whatsapp-link {
  display: block;
  margin-top: 15px;
  padding: 14px;
  background: #25D366;
  color: white;
  text-align: center;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  font-size: 16px;   /* más grande */
  transition: background 0.3s, transform 0.2s;
}

#whatsapp-link:hover {
  background: #1ebe57;
  transform: scale(1.05);
}


/* ===== Ocultar botón cuando la ventana está abierta ===== */
#whatsapp-button.hide {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

/* ===== Responsivo WhatsApp ===== */
@media (max-width: 480px) {
  #whatsapp-button {
    width: 60px;
    height: 60px;
    font-size: 24px;
    bottom: 95px;   /* justo encima del chatbot móvil */
    right: 20px;
  }

  #whatsapp-window {
    width: 90vw;
    bottom: 105px;
    right: 5vw;
    border-radius: 12px;
  }

  #whatsapp-body {
    font-size: 0.85rem;
    padding: 12px;
  }

  #whatsapp-link {
    font-size: 0.85rem;
    padding: 8px;
  }

  #whatsapp-header {
    font-size: 1rem;
    padding: 10px 12px;
  }
}


#scroll-top-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 70px;
  height: 70px;
  background-color: #007bff;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  font-size: 26px;
  z-index: 9999; /* mucho más alto */
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, background-color 0.3s ease;
}

#scroll-top-btn.show {
  opacity: 1;
  pointer-events: auto;
  animation: bounceIn 0.6s ease;
}

#scroll-top-btn:hover {
  transform: scale(1.1);
  background-color: #0056b3;
}


/* Animación de rebote */
@keyframes bounceIn {
  0%   { transform: scale(0.5) translateY(100px); opacity: 0; }
  60%  { transform: scale(1.2) translateY(-20px); opacity: 1; }
  80%  { transform: scale(0.9) translateY(10px); }
  100% { transform: scale(1) translateY(0); }
}
















/* ===== Burbuja flotante de suscripción ===== */
#suscripcion-button {
  position: fixed;
  bottom: 250px;  /* encima de las otras burbujas */
  right: 30px;
  width: 90px;
  height: 90px;
  background-color: #007bff; /* azul */
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 36px;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(0,0,0,0.25);
  transition: transform 0.3s, box-shadow 0.3s;
  z-index: 11000;
  animation: bounce 2s infinite; /* rebote sutil */
}

#suscripcion-button:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* ===== Animación de rebote sutil ===== */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ===== Modal ===== */
#suscripcion-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none; /* oculto por defecto */
  justify-content: center;
  align-items: center;
  z-index: 12000;
}

/* overlay oscuro */
#suscripcion-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.4);
}

/* contenido del modal */
#suscripcion-content {
  background: #fff;
  width: 90%;
  max-width: 500px;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 12px 35px rgba(0,0,0,0.3);
  transform: scale(0.7);
  opacity: 0;
  transition: all 0.3s ease;
  position: relative;
  z-index: 12001;
  padding: 25px;
}

/* Mostrar modal */
#suscripcion-modal.show {
  display: flex;
}

#suscripcion-modal.show #suscripcion-content {
  transform: scale(1);
  opacity: 1;
}

/* Botón cerrar */
#suscripcion-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #007bff;
  cursor: pointer;
  transition: transform 0.2s;
}

#suscripcion-close:hover {
  transform: scale(1.2);
}

/* ===== Estilos del formulario ===== */
.suscripcion h2 {
  font-size: 2rem;
  font-weight: 700;
  color: #007bff;
  margin-bottom: 15px;
  text-align: center;
}

.suscripcion p {
  font-size: 1.1rem;
  text-align: center;
  line-height: 1.5;
}

.form-suscripcion {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.form-suscripcion input[type="email"] {
  padding: 12px 18px;
  width: 300px;
  max-width: 90%;
  border: 1px solid #ccc;
  border-radius: 30px;
  outline: none;
  font-size: 1rem;
  color: #333;
  transition: box-shadow 0.3s ease;
}

.form-suscripcion input[type="email"]:focus {
  box-shadow: 0 0 8px rgba(0,123,255,0.4);
}

.form-suscripcion button {
  background-color: #007bff;
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 12px 25px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.form-suscripcion button:hover {
  background-color: #0056b3;
  transform: scale(1.05);
}

.mensaje-confirmacion {
  display: none;
  color: green;
  font-weight: bold;
  margin-top: 10px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.mensaje-confirmacion.show {
  display: block;
  opacity: 1;
}

/* ===== Responsivo para tablets (pantallas medianas) ===== */
@media (max-width: 1024px) {
  #suscripcion-button {
    width: 75px;
    height: 75px;
    font-size: 30px;
    bottom: 220px;
    right: 25px;
  }

  #suscripcion-content {
    width: 85%;
    max-width: 450px;
    padding: 20px;
  }

  .suscripcion h2 {
    font-size: 1.8rem;
  }

  .suscripcion p {
    font-size: 1rem;
  }

  .form-suscripcion input[type="email"],
  .form-suscripcion button {
    font-size: 0.95rem;
    padding: 10px 20px;
  }
}

/* ===== Responsivo para móviles pequeños ===== */
@media (max-width: 480px) {
  /* Burbuja más pequeña y más arriba */
  #suscripcion-button {
    width: 60px;
    height: 60px;
    font-size: 24px;
    bottom: 170px; /* ajusta posición sobre las demás burbujas */
    right: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  }

  /* Modal adaptado a móvil */
  #suscripcion-content {
    width: 90%;
    max-width: 350px;
    padding: 18px;
    border-radius: 12px;
  }

  .suscripcion h2 {
    font-size: 1.4rem;
  }

  .suscripcion p {
    font-size: 0.9rem;
  }

  .form-suscripcion {
    flex-direction: column;
    gap: 12px;
  }

  .form-suscripcion input[type="email"] {
    width: 100%;
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  .form-suscripcion button {
    width: 100%;
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  .mensaje-confirmacion {
    font-size: 0.9rem;
  }

  /* Botón cerrar más grande y más accesible */
  #suscripcion-close {
    font-size: 26px;
    top: 8px;
    right: 12px;
  }
}

/* ===== Responsivo para móviles muy pequeños (menos de 360px) ===== */
@media (max-width: 360px) {
  #suscripcion-button {
    width: 55px;
    height: 55px;
    font-size: 22px;
    bottom: 170px;
    right: 18px;
  }

  #suscripcion-content {
    max-width: 300px;
    padding: 15px;
  }

  .suscripcion h2 {
    font-size: 1.2rem;
  }

  .suscripcion p {
    font-size: 0.85rem;
  }

  .form-suscripcion input[type="email"],
  .form-suscripcion button {
    font-size: 0.85rem;
    padding: 8px 12px;
  }
}
