/* Make body full height */
body, html {
  height: 100%;
  margin: 0;
}

/* Chat container should fill available space */
.container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Chat container background */
.chat-container {
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  flex-grow: 1; /* take remaining space */
  padding: 10px;
  overflow: hidden; /* contain chat-box scroll */
}

/* Chat box scrollable area */
.chat-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex-grow: 1; /* take remaining vertical space */
  padding-right: 5px;

  /* Hide scrollbar for all browsers */
  scrollbar-width: none;   /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

/* Hide scrollbar for WebKit browsers (Chrome, Safari, Opera) */
.chat-box::-webkit-scrollbar {
  display: none;
}

/* Chat bubbles / box-style messages */
.chat-bubble {
  max-width: 70%;
  padding: 12px 18px;
  border-radius: 15px;
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
}

/* User message box colors */
.chat-bubble.user {
  background-color: #67C090; /* dark mode user bubble */
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 5px;
}

/* Bot message box */
.chat-bubble.bot {
  background-color: #2c2c2c; /* dark mode bot bubble */
  color: #f1f1f1;
  align-self: flex-start;
  border-bottom-left-radius: 5px;
}

/* Light theme overrides */
body.bg-light .chat-container {
  background-color: #f8f9fa;
}

body.bg-light .chat-bubble.user {
  background-color: #124170;
  color: white;
}

body.bg-light .chat-bubble.bot {
  background-color: #e9ecef;
  color: #212529;
}

/* Input focus styling */
#user-input:focus {
  box-shadow: 0 0 5px rgba(13,110,253,0.5);
  outline: none;
}

/* Form styling (fixed at bottom inside flex layout) */
#chat-form {
  margin-top: 10px;
  display: flex;
  align-items: center;
  border: 1px solid #444;
  border-radius: 25px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.05);
}

/* Multiline input tweaks */
#user-input {
  flex: 1;
  resize: none; /* disable manual resize */
  overflow: hidden; /* hide scroll until needed */
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  font-size: 14px;
  line-height: 1.4;
  border-radius: 25px; /* default pill shape */
  padding: 10px 15px;
  transition: border-radius 0.2s ease;
  max-height: 120px;
}

/* When expanded (multi-line), make radius smaller */
#user-input.expanded {
  border-radius: 12px;
}

/* Send button inside input bar */
#send-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-left: 5px;
}

#send-btn svg {
  width: 22px;
  height: 22px;
}

/* Spinner inside send button */
#loading-spinner {
  display: none;
  margin-left: 5px;
}

#send-btn.loading svg {
  display: none;
}

#send-btn.loading #loading-spinner {
  display: inline-block;
}

/* Typing dots animation */
.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background-color: currentColor;
  border-radius: 50%;
  opacity: 0.4;
  animation: blink 1.4s infinite;
}

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

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%, 80%, 100% { opacity: 0.4; }
  40% { opacity: 1; }
}
