
#scrollUp {
    z-index: 999 !important;
    right: 25px !important;
    bottom: 20px !important;
}
#chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(-45deg, #7e57c2, #9c27b0, #512da8, #b388ff);
  color: white;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  z-index: 9999;
}

#chat {
  position: fixed;
  bottom: 90px;
  right: 30px;
  z-index: 9998;
  transform-origin: bottom right; /* expand from button */
  transform: scale(0);
  opacity: 0;
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
}

#chat.show {
  transform: scale(1);
  opacity: 1;
}

.hidden {
  display: none;
}

.chat-container {
  flex: 1;
  min-height: 650px;
  height: 650px;
  max-height: 650px;
  width: 450px;
  background: white;
  border-radius: 30px;
  padding: 1rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
}

.chat-header {
  display: flex;
  align-items: flex-start;
  border-bottom: 1px solid #eee;     
  gap: 16px;
  padding: 8px;
}

.chat-header img {
  width: 36px; 
  height: 36px;
}

.chat-messages { 
  flex: 1; 
  overflow-y: auto; 
  padding: 1rem; 
  border-bottom: 1px solid #eee; 
}

.message { 
  display: flex; 
  align-items: flex-start; 
  gap: 0.6rem; 
  margin-bottom: 1rem; 
}

.message.user { 
  flex-direction: row-reverse; 
  text-align: right; 
}

.message img { 
  width: 36px; 
  height: 36px; 
  border-radius: 50%; 
}

.bubble {
  padding: 0.6rem 1rem;
  border-radius: 15px;
  max-width: 70%;
  background: #f0f0f5;
  word-wrap: break-word;       
  overflow-wrap: break-word;   
  white-space: pre-wrap;       
  overflow-x: auto;            
}

.message.user .bubble { 
  background: #7e57c2; 
  color: white; 
}

.chat-input-area { 
  display: flex; 
  gap: 0.5rem; 
  margin-top: 0.5rem; 
  flex-wrap: nowrap; 
}

.chat-input-area input { 
  flex: 1; 
  padding: 0.7rem; 
  border: 1px solid #ddd; 
  border-radius: 10px; 
  font-size: 1rem;
}

.chat-input-area button {
flex-shrink: 0; /* don’t let button shrink too small */
  background: linear-gradient(-45deg, #7e57c2, #9c27b0, #512da8, #b388ff); 
  color: white; 
  border: none; 
  padding: 0.7rem 1.5rem; 
  border-radius: 25px;
  cursor: pointer; 
  font-size: 1rem; 
  transition: transform 0.2s ease;
}

.chat-input-area button:hover { 
  transform: scale(1.05); 
}


/* Mobile adjustments */
@media (max-width: 768px) {
    .chat-container {
        width: 90vw;
        max-width: 90vw;
        height: 70vh;
        max-height: 70vh;
        bottom: 80px; /* leave space for toggle button */
        right: 5vw;
        border-radius: 15px;
        padding: 0.8rem;
    }
    .chat-input-area {
        flex-direction: column;
        gap: 0.4rem;
    }
    .chat-input-area input {
        flex: unset;
        width: 100%;
    }
    .chat-input-area button {
        width: 100%;
        border-radius: 15px;
    }
}