@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600&display=swap');

/* Estilo global */
body {
  font-family: 'Nunito', sans-serif;
  background-color: #f4f4f9;
  margin: 0;
  padding: 0;
}

/* Ícono flotante */
#chat-icon {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: #f48020;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  transition: transform 0.2s ease;
}

#chat-icon:hover {
  transform: scale(1.1);
}

#chat-icon svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

/* Chat */
#chat-container {
  display: none;
  width: 280px;
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: linear-gradient(90deg, #0054a6, #003d75);
  border-radius: 10px;
  padding: 12px 15px;
  box-shadow: 0 0 15px rgba(0, 84, 166, 0.7);
  z-index: 9998;
  color: #fff;
  font-weight: 600;
  /* Permitimos seleccionar texto */
  user-select: text;
}

#chat-container h3 {
  margin: 0 0 10px 0;
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

/* Chat box */
#chat-box {
  height: 180px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 8px;
  background: #e0f1ff;
  border-radius: 6px;
  color: #222;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.5;
  user-select: text;
}

/* Bot messages */
.bot-message {
  background: #0054a6;
  color: #fff;
  padding: 7px 10px;
  margin: 6px 0;
  border-radius: 6px;
  line-height: 1.4;
  white-space: pre-line;
  transition: background-color 0.3s, box-shadow 0.3s;
}

.bot-message:hover {
  background-color: #0066cc;
  box-shadow: 0 0 6px #66aaff;
}

/* User messages */
.user-message {
  background: #f48020;
  color: #222;
  padding: 7px 10px;
  margin: 6px 0;
  border-radius: 6px;
  line-height: 1.4;
  white-space: pre-line;
  text-align: right;
  transition: background-color 0.3s, box-shadow 0.3s;
}

.user-message:hover {
  background-color: #ffa733;
  box-shadow: 0 0 6px #ffc97a;
}

/* Botones rápidos */
.button-container {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Botones */
.button {
  background-color: #f48020;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.3s, box-shadow 0.3s, transform 0.2s;
  text-decoration: none;
}

.button:hover {
  background-color: #ff7700;
  box-shadow: 0 0 8px rgba(255, 119, 0, 0.6);
  transform: scale(1.03);
}

/* Botón asesoría personalizado */
.button.action-button {
  background-color: #ff7700;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: normal;
  padding: 8px 10px;
  text-decoration: underline;
}

/* Input + enviar */
.input-container {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Input de texto */
.input-container input[type="text"] {
  flex-grow: 1;
  min-width: 0; /* Para evitar desbordamiento en pantallas pequeñas */
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 0.9rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.input-container input[type="text"]:hover,
.input-container input[type="text"]:focus {
  border-color: #0054a6;
  box-shadow: 0 0 4px #80c1ff;
  outline: none;
}

/* Botón enviar */
.input-container button {
  flex-shrink: 0;
  white-space: nowrap;
  background-color: #f48020;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

.input-container button:hover {
  background-color: #ff7700;
  transform: scale(1.05);
  box-shadow: 0 0 6px rgba(255, 119, 0, 0.6);
}

.input-container button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}


/* Añadido: foco visible para accesibilidad */
button:focus, input[type="text"]:focus {
  outline: 3px solid #ff7700;
  outline-offset: 2px;
}

/* Botón enviar */
#chat-form button[type="submit"],
button#send-button {
  background-color: #f48020;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

/* Añadido: estilo para botón deshabilitado */
button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

#chat-form button:hover,
button#send-button:hover {
  background-color: #ff7700;
  transform: scale(1.05);
  box-shadow: 0 0 6px rgba(255, 119, 0, 0.6);
}

/* Escribiendo... */
#typing-indicator {
  font-style: italic;
  color: #666;
  background: transparent;
  padding: 5px 10px;
  margin: 6px 0;
  border-radius: 6px;
  text-align: left;
  user-select: none;
}

/* Accesibilidad oculta */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Responsive: ajuste para móviles muy pequeños */
@media (max-width: 360px) {
  #chat-container {
    width: 95vw;
    right: 2.5vw;
    bottom: 80px;
  }
}

/* Animación de puntos para "Escribiendo..." */
#typing-indicator::after {
  content: '';
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: blink-dots 1.5s steps(3, end) infinite;
}

@keyframes blink-dots {
  0%, 20% {
    content: '';
  }
  40% {
    content: '.';
  }
  60% {
    content: '..';
  }
  80%, 100% {
    content: '...';
  }
}

