/* Chatbot Styles */
.chatbot-toggler {
  position: fixed;
  bottom: 30px;
  right: 35px;
  outline: none;
  border: none;
  height: 60px;
  width: 60px;
  display: flex;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  transition: all 0.3s ease;
  z-index: 9999;
  box-shadow: 0 5px 25px rgba(79, 70, 229, 0.4);
}

.chatbot-toggler:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 30px rgba(79, 70, 229, 0.5);
}

.chatbot-toggler span {
  color: #fff;
  position: absolute;
  font-size: 1.5rem;
}

.chatbot-toggler span:last-child,
body.show-chatbot .chatbot-toggler span:first-child  {
  opacity: 0;
}

body.show-chatbot .chatbot-toggler span:last-child {
  opacity: 1;
}

.chatbot {
  position: fixed;
  right: 35px;
  bottom: 100px;
  width: 380px;
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.5) translateY(20px);
  transform-origin: bottom right;
  box-shadow: 0 10px 50px rgba(0,0,0,0.15),
              0 0 0 1px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
  z-index: 9999;
}

body.show-chatbot .chatbot {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1) translateY(0);
}

.chatbot header {
  padding: 1.25rem;
  position: relative;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #8b5cf6);
}

.chatbot header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.chatbot header span {
  position: absolute;
  right: 15px;
  top: 50%;
  display: none;
  cursor: pointer;
  transform: translateY(-50%);
  font-size: 1.25rem;
}

.chatbot .chatbox {
  overflow-y: auto;
  height: 350px;
  padding: 1.5rem 1rem 5rem;
  background: #f8fafc;
}

.chatbot :where(.chatbox, textarea)::-webkit-scrollbar {
  width: 6px;
}

.chatbot :where(.chatbox, textarea)::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 25px;
}

.chatbot :where(.chatbox, textarea)::-webkit-scrollbar-thumb {
  background: #4f46e5;
  border-radius: 25px;
}

.chatbox .chat {
  display: flex;
  list-style: none;
  margin-bottom: 1rem;
}

.chatbox .outgoing {
  justify-content: flex-end;
}

.chatbox .incoming span {
  width: 36px;
  height: 36px;
  color: #fff;
  cursor: default;
  text-align: center;
  line-height: 36px;
  align-self: flex-end;
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  border-radius: 50%;
  margin: 0 0.75rem 0.5rem 0;
  font-size: 1.25rem;
}

.chatbox .chat p {
  white-space: pre-wrap;
  padding: 0.875rem 1rem;
  border-radius: 1rem 1rem 0.25rem 1rem;
  max-width: 80%;
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.5;
  background: linear-gradient(135deg, #4f46e5, #8b5cf6);
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.2);
}

.chatbox .chat p a {
  color: #93c5fd;
  text-decoration: underline;
}

.chatbox .chat p a:hover {
  color: #fff;
}

.chatbox .incoming p {
  border-radius: 1rem 1rem 1rem 0.25rem;
  color: #1e293b;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.chatbox .incoming p a {
  color: #4f46e5;
  font-weight: 600;
}

.chatbox .incoming p a:hover {
  color: #0ea5e9;
}

.chatbot .chat-input {
  display: flex;
  gap: 0.5rem;
  position: absolute;
  bottom: 0;
  width: 100%;
  background: #fff;
  padding: 0.75rem 1rem;
  border-top: 1px solid #e2e8f0;
}

.chat-input textarea {
  height: 45px;
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  outline: none;
  resize: none;
  max-height: 100px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  background: #f8fafc;
  transition: all 0.3s;
}

.chat-input textarea:focus {
  border-color: #4f46e5;
  background: #fff;
}

.chat-input span {
  align-self: center;
  color: #4f46e5;
  cursor: pointer;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  font-size: 1.5rem;
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  color: white;
  border-radius: 0.5rem;
  transition: all 0.3s;
}

.chat-input span:hover {
  transform: scale(1.05);
}

.chat-input textarea:valid ~ span {
  visibility: visible;
}

@media (max-width: 490px) {
  .chatbot-toggler {
    right: 20px;
    bottom: 20px;
    height: 55px;
    width: 55px;
  }
  .chatbot {
    right: 0;
    bottom: 0;
    height: 100%;
    border-radius: 0;
    width: 100%;
  }
  .chatbot .chatbox {
    height: calc(100% - 130px);
    padding: 1.5rem 1rem 5rem;
  }
  .chatbot .chat-input {
    padding: 0.75rem;
  }
  .chatbot header span {
    display: block;
  }
}
