/* Enhanced Chatbot Styles */

/* Chatbot Container */
.chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
}

/* Chatbot Button */
.chatbot-button {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background-color: var(--secondary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.chatbot-button:hover {
  background-color: var(--accent-color);
  transform: scale(1.1) rotate(10deg);
}

.chatbot-button:after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%);
  transform-origin: 50% 50%;
}

.chatbot-button:hover:after {
  animation: ripple 1s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 0.5;
  }
  100% {
    transform: scale(20, 20);
    opacity: 0;
  }
}

.chatbot-icon {
  color: var(--light-color);
  font-size: 1.8rem;
}

/* Chatbot Interface */
.chatbot-interface {
  position: absolute;
  bottom: 90px;
  right: 0;
  width: 380px;
  height: 500px;
  background-color: var(--light-color);
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
  transform-origin: bottom right;
  animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes pop-in {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.chatbot-header {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: var(--light-color);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.chatbot-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.chatbot-header h3:before {
  content: "🤖";
  margin-right: 8px;
  font-size: 1.4rem;
}

.close-chatbot {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--light-color);
  cursor: pointer;
  font-size: 1.2rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-chatbot:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Messages Area */
.chatbot-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background-color: #f8f9fa;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23e0e0e0' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* Message Bubbles */
.bot-message,
.user-message {
  max-width: 85%;
  padding: 12px 18px;
  border-radius: 18px;
  margin-bottom: 5px;
  word-wrap: break-word;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  line-height: 1.5;
  position: relative;
  animation: message-pop 0.3s ease forwards;
}

@keyframes message-pop {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.bot-message {
  background: linear-gradient(135deg, var(--primary-color), #336699);
  color: var(--light-color);
  align-self: flex-start;
  border-bottom-left-radius: 5px;
}

.bot-message::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: -10px;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, var(--primary-color), #336699);
  border-bottom-right-radius: 15px;
  z-index: -1;
}

.user-message {
  background: linear-gradient(135deg, var(--secondary-color), #ff7e5f);
  color: var(--light-color);
  align-self: flex-end;
  border-bottom-right-radius: 5px;
}

.user-message::before {
  content: "";
  position: absolute;
  bottom: 0;
  right: -10px;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, var(--secondary-color), #ff7e5f);
  border-bottom-left-radius: 15px;
  z-index: -1;
}

/* Input Area */
.chatbot-input {
  display: flex;
  padding: 15px;
  background-color: #fff;
  border-top: 1px solid #eaeaea;
}

.chatbot-input input {
  flex: 1;
  padding: 12px 20px;
  border: 1px solid #ddd;
  border-radius: 25px;
  outline: none;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.chatbot-input input:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chatbot-input input::placeholder {
  color: #aaa;
}

.send-message {
  background: linear-gradient(135deg, var(--secondary-color), #ff7e5f);
  color: var(--light-color);
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  margin-left: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.send-message:hover {
  transform: scale(1.1) rotate(10deg);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.3);
}

.send-message i {
  font-size: 1.2rem;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  align-self: flex-start;
  background-color: rgba(230, 230, 230, 0.7);
  padding: 12px 18px;
  border-radius: 18px;
  margin-bottom: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.typing-indicator span {
  height: 8px;
  width: 8px;
  background-color: #777;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
  animation: typing 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
  animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
  margin-right: 0;
}

@keyframes typing {
  0% {
    transform: translateY(0px);
    background-color: #777;
  }
  50% {
    transform: translateY(-5px);
    background-color: #555;
  }
  100% {
    transform: translateY(0px);
    background-color: #777;
  }
}

/* Responsive Adjustments */
@media screen and (max-width: 768px) {
  .chatbot-interface {
    width: 320px;
    height: 450px;
    bottom: 80px;
    right: 10px;
  }

  .chatbot-button {
    width: 60px;
    height: 60px;
    right: 10px;
    bottom: 10px;
  }

  .chatbot-header h3 {
    font-size: 1.1rem;
  }

  .bot-message,
  .user-message {
    max-width: 90%;
    padding: 10px 15px;
  }

  .chatbot-input input {
    padding: 10px 15px;
    font-size: 14px;
  }

  .send-message {
    width: 40px;
    height: 40px;
  }
}

@media screen and (max-width: 480px) {
  .chatbot-interface {
    width: 280px;
    height: 400px;
    bottom: 70px;
  }

  .chatbot-button {
    width: 50px;
    height: 50px;
  }

  .chatbot-icon {
    font-size: 1.4rem;
  }

  .chatbot-header {
    padding: 12px 15px;
  }

  .chatbot-header h3 {
    font-size: 1rem;
  }

  .chatbot-messages {
    padding: 15px;
  }

  .bot-message,
  .user-message {
    font-size: 14px;
    padding: 8px 12px;
  }

  .chatbot-input {
    padding: 10px;
  }

  .chatbot-input input {
    padding: 8px 12px;
  }

  .send-message {
    width: 35px;
    height: 35px;
  }
}

/* Landscape orientation adjustments */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .chatbot-interface {
    height: 350px;
    width: 300px;
  }

  .chatbot-messages {
    max-height: 200px;
  }
}
