/* Chat Icon */
.chat-icon {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(135deg, #1E90FF, #00FF7F);
  color: white;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 30px;
  z-index: 9999; /* On top */
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.3s, box-shadow 0.3s;
}

.chat-icon:hover {
  transform: scale(1.2);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

/* Chat Window */
.chat-window {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 340px;
  height: 480px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
  padding: 10px;
  display: none; /* Hidden by default */
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  animation: slideUp 0.5s ease-out;
  z-index: 9998; /* Slightly below icon */
}

/* Slide Up Animation */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(50px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 5px;
}

.message {
  margin: 5px 0;
  display: inline-block;
  padding: 10px 15px;
  border-radius: 15px;
  max-width: 80%;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease-in;
}

.message.bot {
  background: #f1f1f1;
  color: #333;
  text-align: left;
}

.message.user {
  background: linear-gradient(135deg, #1E90FF, #00FF7F);
  color: white;
  text-align: right;
  margin-left: auto;
}

/* Fade In Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Input Box */
.chat-input {
  display: flex;
  margin-top: 5px;
}

.chat-input input {
  width: 100%;
  padding: 10px;
  border-radius: 15px;
  border: 1px solid #ccc;
  outline: none;
  font-size: 14px;
  transition: all 0.2s;
}

.chat-input input:focus {
  border-color: #1E90FF;
  box-shadow: 0 0 8px rgba(30, 144, 255, 0.4);
}

/* Typing Indicator */
.typing {
  width: 50px;
  height: 10px;
  display: flex;
  justify-content: space-between;
  margin: 5px 0;
}

.typing span {
  width: 10px;
  height: 10px;
  background: #1E90FF;
  border-radius: 50%;
  animation: bounce 0.6s infinite alternate;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

/* User info form */
.user-form input, .user-form textarea {
  width: 95%;
  margin: 5px 0;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid #ccc;
  resize: none;
}

.user-form button {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #1E90FF, #00FF7F);
  color: white;
  font-weight: bold;
  cursor: pointer;
}

/* Responsive for Mobile Devices */
@media screen and (max-width: 768px) {
  .chat-window {
    width: 90%;
    height: 400px;
    bottom: 80px;
    right: 5%;
  }

  .chat-icon {
    width: 50px;
    height: 50px;
    font-size: 26px;
    bottom: 15px;
    right: 15px;
  }

  .message {
    max-width: 90%;
    font-size: 14px;
  }

  .chat-input input {
    font-size: 13px;
    padding: 8px;
  }
}

@media screen and (max-width: 480px) {
  .chat-window {
    width: 95%;
    height: 380px;
    bottom: 70px;
    right: 2.5%;
  }

  .chat-icon {
    width: 45px;
    height: 45px;
    font-size: 24px;
    bottom: 12px;
    right: 12px;
  }

  .message {
    font-size: 13px;
  }

  .chat-input input {
    font-size: 12px;
    padding: 7px;
  }
}
