body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #121212;
  color: #e0e0e0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
  font-size: 22px;
}

.chat-container {
  width: 90%;
  max-width: 1000px;
  background: #1e1e1e;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow-y: auto;        /* Allow vertical scrolling on container */
  border: 1px solid #333;
  max-height: 90vh;        /* Max height near full viewport */
  opacity: 1;
  transition: opacity 0.5s ease;
}

.chat-box {
  flex-grow: 1;
  padding: 20px;
  overflow-y: visible;     /* Let chat-box grow with content */
  border-bottom: 1px solid #333;
  font-size: 18px;
  scrollbar-width: thin;
  scrollbar-color: #444 #1e1e1e;
  max-height: none;        /* Remove height restriction */
}

.chat-box::-webkit-scrollbar {
  width: 8px;
}
.chat-box::-webkit-scrollbar-track {
  background: #1e1e1e;
}
.chat-box::-webkit-scrollbar-thumb {
  background-color: #444;
  border-radius: 4px;
}

.chat-box div {
  margin: 10px 0;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.user {
  margin-left: auto;
  max-width: 100%;
  background: #007acc;
  color: white;
  text-align: right;
  box-shadow: 0 2px 5px rgba(0, 122, 204, 0.6);
}

.bot {
  margin-right: auto;
  max-width: 100%;
  background: #2d2d2d;
  color: #ccc;
  text-align: left;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
}

form {
  display: flex;
  padding: 15px;
  background: #1e1e1e;
  border-top: 1px solid #333;
  align-items: center;
  opacity: 1;
  transition: opacity 0.5s ease;
  will-change: opacity; /* for smoother fade transitions */
  flex-shrink: 0;       /* Prevent form from shrinking */
}

/* Fade-out state */
form.hide {
  opacity: 0;
  pointer-events: none;       /* disable interaction during fade */
  user-select: none;          /* prevent text selection */
  caret-color: transparent;   /* hide input cursor */
}

input, textarea {
  flex-grow: 1;
  margin-right: 12px;
  padding: 10px 15px;
  font-size: 18px;
  border-radius: 12px;
  border: 1px solid #ccc;
  background: #f5f5f5;
  color: #121212;
}

input:focus, textarea:focus {
  outline: none;
  border-color: #007acc;
  box-shadow: 0 0 8px #007acc;
}

button {
  flex-shrink: 0;
  padding: 12px 24px;
  background: #007acc;
  border: none;
  border-radius: 20px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-size: 25px;
  transition: background 0.3s ease;
}

button:hover {
  background: #005f99;
}

/* Optional: Style source buttons appended after answer */
.source-button {
  margin: 5px 8px 5px 0;
  padding: 8px 14px;
  border-radius: 14px;
  border: none;
  background: #007acc;
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.3s ease;
}

.source-button:hover {
  background: #005f99;
}

/* Spinner for "typing..." message */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #007acc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.chat-container.hide {
  opacity: 0;
  pointer-events: none;  /* disable interaction */
  user-select: none;
}

.references-header {
  font-size: 1.4rem;   
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;

  margin-top: 20px;
  margin-bottom: 10px;

  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);

  opacity: 0.85;
}
