:root {
  --color-primario: -webkit-linear-gradient(180deg, #101325,#1c1f38,#101426);
  --color-secundario: -webkit-linear-gradient(180deg, #0d0f1f,#161a2f,#0d0f1f);
  --color-acento: #0a2441;
  --fondo-claro: #f8f9fa;
  --texto-oscuro: #212529;
  --texto-claro: #f8f9fa;
  --fondo-mensaje-usuario: #e9ecef;
  --fondo-mensaje-bot: #e0f5ff;
  --sombra: 0 4px 6px rgba(0, 0, 0, 0.1);
  --radio-borde: 12px;
}

#chat-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--color-primario);
  color: white;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  cursor: pointer;
  box-shadow: var(--sombra);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000; 
  opacity: 0; 
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  animation: aparecer 0.5s ease-out 0.5s forwards; 
} 

@keyframes aparecer {
  from {
    opacity: 0;
    transform: translateY(20px); /* Opcional: pequeño efecto de desplazamiento */
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}



#chat-button:hover {
  background: var(--color-secundario);
  transform: scale(1.05);
}

#chat-box {
  display: none;
  position: fixed;
  bottom: 90px;
  right: 20px; /* Mantenemos en la derecha */
  width: 320px; /* Ancho un poco más estrecho */
  height: 400px; /* Altura reducida (antes era 500px) */
  background: white;
  border-radius: var(--radio-borde);
  box-shadow: var(--sombra);
  flex-direction: column;
  overflow: hidden;
  z-index: 999;
  transition: all 0.3s ease;
}

/* Resto del CSS se mantiene igual que en la versión anterior */
#chat-header {
  background: var(--color-primario);
  color: var(--texto-claro);
  padding: 12px 15px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

#close-chat {
  background: none;
  border: none;
  color: var(--texto-claro);
  cursor: pointer;
  font-size: 14px;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-acento) transparent;
  max-height: 240px; /* Limitamos la altura del área de mensajes */
}

#prompt-suggestions {
  padding: 8px;
  background: #f5f7fa;
  color: #0d0f1f;
  border-top: 1px solid #e1e4e8;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prompt-suggestion {
  background: white;
  color: #0d0f1f;
  border: 1px solid #e1e4e8;
  border-radius: 16px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.prompt-suggestion:hover {
  background: #f0f4f8;
  transform: translateY(-2px);
}

/* Resto del CSS se mantiene igual */
#chat-messages::-webkit-scrollbar {
  width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 10px;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: #101325;
  background: -webkit-linear-gradient(180deg, #101325, #1c1f38, #101426);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#chat-messages::-webkit-scrollbar-thumb:hover {
  background: #0d0f1f;
  background: -webkit-linear-gradient(180deg, #0d0f1f, #161a2f, #0d0f1f);
}

.message {
  margin-bottom: 12px;
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 18px;
  position: relative;
  word-wrap: break-word;
  font-size: 13px;
}


.header-title-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
  }
.header-title-chat svg {
    margin-right: 6px;
  }
.user {
  background-color: var(--fondo-mensaje-usuario);
  margin-left: auto;
  border-bottom-right-radius: 5px;
  color: #0d0f1f;
}

.bot {
  background-color: var(--fondo-mensaje-bot);
  margin-right: auto;
  border-bottom-left-radius: 5px;
  color: #0d0f1f;
}

.message-content {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: #0d0f1f;
}

.message-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.message-text {
  flex-grow: 1;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.typing-dot {
  width: 5px;
  height: 5px;
  background: var(--texto-oscuro);
  border-radius: 50%;
  opacity: 0.6;
}

@keyframes blink {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.typing-dot:nth-child(1) { animation: blink 1.4s infinite 0.2s; }
.typing-dot:nth-child(2) { animation: blink 1.4s infinite 0.4s; }
.typing-dot:nth-child(3) { animation: blink 1.4s infinite 0.6s; }

#chat-input-container {
  padding: 10px 12px;
  border-top: 1px solid #eee;
  background-color: white;
}

#chat-input {
  display: flex;
  gap: 8px;
  position: relative;
}

#user-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: var(--radio-borde);
  font-size: 13px;
  transition: border 0.3s ease;
}

#user-input:focus {
  outline: none;
  border-color: var(--color-acento);
}

#send-button {
  background: var(--color-primario);
  color: white;
  border: none;
  border-radius: var(--radio-borde);
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

#send-button:hover {
  background: var(--color-secundario);
}

.message-appear {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 415px) {
  #chat-button {  
    bottom: 15px;
    right: 15px;
    width: 48px;
    height: 48px; 
  }
  
  #chat-box {
    width: calc(100% - 100px);
    max-width: none;
    height: 60vh;
    max-height: 500px;
    bottom: 70px;
    right: 15px;
    left: auto;
    border-radius: var(--radio-borde) var(--radio-borde) 0 0;
  }

}

@media (max-width: 390px) {
  #chat-button {   
    left: 29px;  
  }
  #chat-box {
    right: auto; 
  }
}