/* Import Google font - Poppins */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap");

/* Base styling for the chat bar */
.chat-bar-collapsible {
  position: fixed;
  bottom: 0;
  right: 1rem;
  box-shadow: 0 0 128px 0 rgba(0, 0, 0, 0.1),
    0 32px 64px -48px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
  width: 25rem;
  z-index: 999999; /* High but reasonable z-index */
}

/* Styling for the collapsible button */
.collapsible {
  background: linear-gradient(135deg, #724ae8, #5f3cc6);
  color: white;
  cursor: pointer;
  padding: 1.2rem;
  inset: 0;
  margin: 0;
  width: 100%;
  text-align: center;
  outline: none;
  font-size: 1.4rem;
  border-radius: 18px 18px 0 0;
  border: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: "Poppins", sans-serif;
  box-shadow: 0 4px 20px rgba(114, 74, 232, 0.2);
  position: relative;
  overflow: hidden;
}

.collapsible:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 25px rgba(114, 74, 232, 0.3);
}

.collapsible::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s;
}

.collapsible:hover::before {
  left: 100%;
}

/* Styling for the chat content */
.content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background-color: rgba(114, 74, 232, 0.05);
}

/* Styling for the full chat block */
.full-chat-block {
  width: 100%;
  height: 100%;
  background: #fff;
  text-align: center;
  overflow: auto;
  scrollbar-width: none;
  height: max-content;
  transition: max-height 0.3s ease;
}

/* Styling for the outer container */
.outer-container {
  min-height: 500px;
  bottom: 0%;
  position: relative;
}

/* Styling for the chat container */
.chat-container {
  max-height: 500px;
  width: 100%;
  position: absolute;
  bottom: 0;
  background: linear-gradient(145deg, #ffffff, #f8fafc);
  background-attachment: local;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  font-family: "Poppins", sans-serif;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Hide scrollbar for Webkit browsers */
.chat-container::-webkit-scrollbar {
  display: none;
}

/* Styling for the chat bar input block */
.chat-bar-input-block {
  display: flex;
  box-sizing: border-box;
  justify-content: space-between;
  width: 100%;
  align-items: center;
  background-color: #fff;
  border-top: 1px solid #ddd;
  border-radius: 15px 15px 0 0;
  padding: 15px;
}

/* Styling for the chat bar icons */
.chat-bar-icons {
  display: flex;
  justify-content: space-evenly;
  box-sizing: border-box;
  width: 25%;
  font-size: 24px;
  transition: all 0.3s ease;
}

/* Styling for the user input */
#userInput {
  width: 95%;
}

/* Styling for the input box */
.input-box {
  border: none;
  box-sizing: border-box;
  width: 85%;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 0.95rem;
  color: #2d3748;
  background-color: #f8fafc;
  outline: none;
  font-family: "Poppins", sans-serif;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.input-box::placeholder {
  color: #a0aec0;
  font-weight: 400;
}

.input-box:focus {
  background-color: #fff;
  border-color: #724ae8;
  box-shadow: 0 0 0 3px rgba(114, 74, 232, 0.1), 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

/* Styling for user and bot text */
.userText,
.botText {
  font-family: "Poppins", sans-serif;
  font-size: 0.95rem;
  font-weight: normal;
  animation: floatup 0.5s forwards;
  clear: both;
}

/* Styling for user text */
.userText {
  text-align: right;
}

.userText span {
  color: white;
  background: #724ae8;
  padding: 12px 16px;
  border-radius: 10px 10px 0 10px;
  max-width: 75%;
  margin-right: 12px;
  display: flex;
  float: right;
}

/* Styling for bot text */
.botText {
  text-align: left;
}

.botText span {
  color: #000;
  background: #f2f2f2;
  padding: 12px 16px;
  border-radius: 10px 10px 10px 0;
  max-width: 75%;
  margin-left: 12px;
  display: flex;
}

.active {
  display: block;
}

/* Animation for floating up */
@keyframes floatup {
  from {
    transform: translateY(14px);
    opacity: 0;
  }
  to {
    transform: translateY(0px);
    opacity: 1;
  }
}

/* Media query for responsiveness - matches iframe.css breakpoint */
@media screen and (max-width: 490px) {
  /* Full-screen chat window */
  .chat-bar-collapsible {
    width: 100%;
    bottom: 0;
    position: fixed;
    right: 0;
    border-radius: 0;
  }

  /* Reset padding and margin */
  .full-chat-block,
  .outer-container,
  .chat-container {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  /* Adjusting other elements for full screen */
  .outer-container {
    min-height: 100vh;
  }
  .chat-container {
    max-height: 100vh;
  }
}

/* Modern Loading Animations */
.loader {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(114, 74, 232, 0.08), rgba(114, 74, 232, 0.04));
  border-radius: 14px;
  backdrop-filter: blur(8px);
  animation: pulse-bg 2s ease-in-out infinite;
  border: 1px solid rgba(114, 74, 232, 0.1);
}

.loader::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top: 2px solid #724ae8;
  border-right: 2px solid #724ae8;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loader::after {
  content: 'AI is thinking...';
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
  animation: typing-dots 1.8s ease-in-out infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse-bg {
  0%, 100% {
    background: linear-gradient(135deg, rgba(114, 74, 232, 0.08), rgba(114, 74, 232, 0.04));
    transform: scale(1);
  }
  50% {
    background: linear-gradient(135deg, rgba(114, 74, 232, 0.12), rgba(114, 74, 232, 0.06));
    transform: scale(1.02);
  }
}

@keyframes typing-dots {
  0%, 60%, 100% {
    opacity: 0.6;
  }
  30% {
    opacity: 1;
  }
}

/* Enhanced message appearance */
.botText span {
  color: #2d3748;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  padding: 14px 18px;
  border-radius: 18px 18px 18px 4px;
  max-width: 80%;
  margin-left: 12px;
  display: flex;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.userText span {
  color: white;
  background: linear-gradient(135deg, #724ae8, #5f3cc6);
  padding: 14px 18px;
  border-radius: 18px 18px 4px 18px;
  max-width: 80%;
  margin-right: 12px;
  display: flex;
  float: right;
  box-shadow: 0 2px 16px rgba(114, 74, 232, 0.25);
  transition: all 0.2s ease;
}

.input-box.disabled {
  background-color: #f1f1f1;
  cursor: not-allowed;
}
