@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", sans-serif;
}

.chatbot-toggler {
  position: fixed;
  bottom: 25px;
  right: 10px;
  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, #1e40af 0%, #3b82f6 100%);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 10px 30px rgba(30, 64, 175, 0.4);
  z-index: 1000;
  animation: pulse 2s infinite;
}

.chatbot-toggler:focus,
.chatbot-toggler:active,
.chatbot-toggler:focus-visible {
  outline: none !important;
  border: none !important;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 10px 30px rgba(30, 64, 175, 0.4);
  }
  50% {
    box-shadow: 0 15px 40px rgba(30, 64, 175, 0.6);
  }
}

.chatbot-toggler:hover {
  transform: scale(1.1);
  animation: none;
}

body.show-chatbot .chatbot-toggler {
  transform: rotate(90deg);
}

.chatbot-toggler span {
  color: #fff;
  position: absolute;
  font-size: 2rem;
  transition: all 0.3s ease;
}

.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: 110px;
  width: 380px;
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.5);
  transform-origin: bottom right;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 999;
}

body.show-chatbot .chatbot {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.chatbot header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bot-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  animation: wiggle 3s infinite ease-in-out;
  overflow: hidden;
  padding: 0;   
  border: none;
}

.bot-icon img {
  width: 85%;
  height: 85%;
  object-fit: cover;   
  display: block;
  transform: scale(1); 
  background: transparent; 
  border-radius: 50%;
  padding: 0px;  
}


@keyframes wiggle {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(8deg);
  }
  75% {
    transform: rotate(-8deg);
  }
}

header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.header-right {
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: none;  /
}

.header-right:hover {
  background: rgba(255, 255, 255, 0.2);  
}

.header-right span {
  font-size: 1.5rem;
}

.chatbot .chatbox {
  overflow-y: auto;
  height: 400px;
  padding: 20px 16px 20px 20px;
  background: #f8f9fc;
}

.chatbot .chatbox::-webkit-scrollbar {
  width: 4px;
}

.chatbot .chatbox::-webkit-scrollbar-track {
  background: transparent;
  margin: 10px 4px;
}

.chatbot .chatbox::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 10px;
  transition: background 0.2s ease;
}

.chatbot .chatbox::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

.chat-input textarea::-webkit-scrollbar {
  display: none;
}

.chat-input textarea {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.chatbox .chat {
  display: flex;
  list-style: none;
  animation: superBounceIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes superBounceIn {
  0% {
    opacity: 0;
    transform: translateY(100px) scale(0) rotate(-15deg);
  }
  20% {
    opacity: 0.5;
    transform: translateY(-30px) scale(1.3) rotate(8deg);
  }
  40% {
    opacity: 1;
    transform: translateY(15px) scale(0.85) rotate(-5deg);
  }
  60% {
    transform: translateY(-12px) scale(1.12) rotate(3deg);
  }
  75% {
    transform: translateY(6px) scale(0.95) rotate(-2deg);
  }
  88% {
    transform: translateY(-4px) scale(1.03) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

.chatbox .outgoing {
  justify-content: flex-end;
  margin-bottom: 16px;
}

.chatbox .incoming {
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.message-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
  position: relative;
  overflow: hidden;
  padding: 0;             
  border: none;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;      
  display: block;
  background: transparent; 
  border-radius: 50%;
  padding: 3px;            
}


.message-avatar::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

.chatbox .chat p {
  white-space: pre-wrap;
  padding: 12px 16px;
  border-radius: 16px;
  max-width: 75%;
  font-size: 0.9rem;
  line-height: 1.5;
  position: relative;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  word-wrap: break-word;
}

.chatbox .outgoing p {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 15px rgba(30, 64, 175, 0.3);
}

.chatbox .incoming p {
  background: #fff;
  color: #1a202c;
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.chatbox .chat p:hover {
  transform: translateY(-2px);
}

.chatbox .outgoing p:hover {
  box-shadow: 0 8px 25px rgba(30, 64, 175, 0.5);
}

.chatbox .incoming p:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.chatbot .chat-input {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  background: #fff;
  border-top: 1px solid #e8ecf1;
}

.chat-input textarea {
  height: 50px;
  width: 100%;
  border: 1px solid #cbd5e0;
  outline: none;
  resize: none;
  max-height: 120px;
  padding: 14px 18px;
  font-size: 0.9rem;
  color: #2d3748;
  background: #fff;
  border-radius: 25px;
  transition: all 0.3s ease;
  overflow-y: auto;
}

.chat-input textarea:focus {
  border-color: #3b82f6;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.chat-input textarea::placeholder {
  color: #a0aec0;
}

.chat-input span {
  align-self: flex-end;
  color: #3b82f6;
  cursor: pointer;
  height: 50px;
  width: 50px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all 0.2s ease;
  border-radius: 50%;
  background: #dbeafe;
}

.chat-input span:hover {
  background: #3b82f6;
  color: #fff;
  transform: scale(1.1) rotate(15deg);
}

.chat-input textarea:valid ~ span {
  display: flex;
}

.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  animation: typingBounce 1.4s 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;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0) scale(1);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-12px) scale(1.2);
    opacity: 1;
  }
}

.error {
  color: #e53e3e !important;
  background: #fff5f5 !important;
  border: 1px solid #fc8181 !important;
}

.error a {
  color: #3b82f6;
  text-decoration: underline;
}

@media (max-width: 490px) {
  .chatbot-toggler {
    right: 15px;
    bottom: 100px;
    height: 55px;
    width: 55px;
  }

  .chatbot {
    right: 0;
    bottom: 0;
    height: 100%;
    border-radius: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
  }

  .chatbot header {
    flex-shrink: 0; 
  }

  .chatbot .chatbox {
    flex: 1; 
    overflow-y: auto;
    min-height: 0;  
  }

  .header-right {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  
  .chatbox .chat p {
    max-width: 85%;
  }

  body.show-chatbot .chatbot-toggler {
    display: none;
  }

  .chat-input {
    flex-shrink: 0;  
    position: relative;  
    background: #fff;
    z-index: 10;
    padding: 15px 20px;
    border-top: 1px solid #e8ecf1;
  }

  .chat-input textarea {
    font-size: 16px;  
    height: 45px;
    max-height: 80px;  
  }

  .chat-input span {
    display: none;
  }

  .chat-input textarea:valid ~ span {
    display: flex;
  }
}