#chatbox {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 60%;
  margin: 20px auto;
  padding: 12px 16px;
  background: #f9f9f9;
  border: 1px solid #ccc;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  font-size: 16px;
  position: relative;
}

#chat-response a {
  color: #007bff;             /* Make it look like a typical link */
  text-decoration: underline; /* Optional, but helps users recognize it */
  cursor: pointer;            /* Show pointer on hover */
}

#chatbox input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #bbb;
  border-radius: 6px;
  width: 100%;
  font-size: 15px;
}

#chatbox input::placeholder {
  color: #888;
}

#chatbox button {
  padding: 10px 16px;
  background-color: #2962ff;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
}

#chatbox button:hover {
  background-color: #0039cb;
}

#chat-response {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 10px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 12px;
  font-size: 15px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  display: none;
   z-index: 1000;
}
#chat-content ul, #chat-content ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}
#chat-content li {
  margin: 0.3rem 0;
}
#chat-content pre, #chat-content code {
  white-space: pre-wrap;
  word-wrap: break-word;
}
/* Make images responsive inside the chat */
#chat-content img {
  max-width: 100%;
  height: auto;
  display: block;          /* put each image on its own line */
  margin: 0.5rem 0;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  object-fit: contain;     /* keep aspect ratio if a max-height is set */
}

/* (Optional) cap very tall images; remove if you want full height */
#chat-content img {
  max-height: 420px;
}

/* Let the response panel scroll if content is long */
#chat-response {
  max-height: 60vh;
  overflow-y: auto;
}

/* Keep long code from breaking layout */
#chat-content pre, #chat-content code {
  white-space: pre-wrap;
  word-break: normal;
  overflow-x: auto;
}

/*Animate indicator*/
.typing-indicator {
  display: inline-flex;
  align-items: center;
  height: 20px;
  gap: 4px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: #666;
  border-radius: 50%;
  display: inline-block;
  animation: blink 1.4s infinite both;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%   { opacity: 0.2; transform: translateY(0); }
  20%  { opacity: 1;   transform: translateY(-3px); }
  100% { opacity: 0.2; transform: translateY(0); }
}
/* layout rows */
.chat-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* options toolbar */
.chat-controls {
  margin-top: 8px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 14px;
  color: #374151;
}
.chat-controls fieldset {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 10px;
  align-items: center;
}
.chat-controls legend {
  margin-right: 6px;
  font-weight: 600;
}

/* response visibility toggle via class */
#chat-response.is-visible {
  display: block;
}

/* close button */
.close-btn {
  position: absolute;
  top: 4px;
  right: 8px;
  border: none;
  background: transparent;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  color: #6b7280;
}
.close-btn:hover { color: #111827; }

/* disabled ask button */
#ask-btn[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Make chatbox vertical and full-width inside */
#chatbox {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

/* Top row: large input + primary button */
.chat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

#ask-btn {
  min-height: 44px;
  padding: 0 16px;
  font-weight: 600;
}

/* Bigger, nicer input */
#chat-input {
  font-size: 16px;
  padding: 12px 14px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid #bbb;
  outline: none;
}
#chat-input:focus {
  border-color: #2962ff;
  box-shadow: 0 0 0 3px rgba(41, 98, 255, 0.15);
}

/* Options toolbar */
.chat-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  color: #374151;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 10px;
}

/* Segmented radio group (coverage) */
.seg-group {
  display: inline-flex;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #f9fafb;
}
.seg {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.seg span {
  display: inline-block;
  padding: 8px 12px;
  font-weight: 500;
  user-select: none;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.seg + .seg span { border-left: 1px solid #e5e7eb; }
.seg input:checked + span {
  background: #2962ff;
  color: #fff;
}

/* Checkboxes styling */
.chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chk input { accent-color: #2962ff; }

/* Show response panel via class, not inline style */
#chat-response.is-visible { display: block; }

/* Close button style */
.close-btn {
  position: absolute;
  top: 4px;
  right: 8px;
  border: none;
  background: transparent;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  color: #6b7280;
}
.close-btn:hover { color: #111827; }

/* Responsive width on small screens */
@media (max-width: 860px) {
  #chatbox { width: 92%; }
}
