/* === Base layout === */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  /* background: #f7f7f8; */
  display: flex;
  flex-direction: column;
  height: 100vh;
    background: linear-gradient(180deg, #18181a 0%, #4f234e 50%, #1f2430 100%);

}

#chat-box {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  /* Simulate night sky with subtle stars */
  position: relative;
}
#chat-box::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, #fff 0.5px, transparent 1px),
    radial-gradient(circle, #fff 0.5px, transparent 1px),
    radial-gradient(circle, #fff 0.5px, transparent 1px);
  background-size: 120px 120px, 200px 200px, 80px 80px;
  background-position: 20px 40px, 120px 80px, 60px 160px;
  opacity: 0.25;
  z-index: 0;
}
#chat-box > * {
  position: relative;
  z-index: 1;
}

/* === Messages === */
.message {
  max-width: 75%;
  line-height: 1.5;
  white-space: pre-wrap;
  position: relative;
}

.message.user {
  align-self: flex-end;
  /* background-color: #1a73e8; */
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 12px;
  border-bottom-right-radius: 0;
  position: relative;
}

/* Edit button for user messages */
.message.user .edit-btn {
  position: absolute;
  bottom: -8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #666;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

.message.user:hover .edit-btn {
  display: flex;
}

.message.user .edit-btn:hover {
  background: #ffffff;
  color: #333;
  transform: scale(1.1);
}

.message.bot {
  align-self: flex-start;
  display: flex;
  align-items: flex-start;
  gap: -1px;
  background: transparent;
  padding: 0;
}

.bot-avatar {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
  flex-shrink: 0;
  margin-top: 6px;
}

.bot-content {
  /* background-color: #e4e6eb; */
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 12px;
  border-bottom-left-radius: 0;
  line-height: 1.5;
  white-space: pre-wrap;
  max-width: 100%;
  font-size: 14px;
  position: relative;
}

/* Response switching controls */
.response-controls {
  position: absolute;
  top: -8px;
  right: -8px;
  display: none;
  gap: 4px;
  align-items: center;
}

.message.bot:hover .response-controls {
  display: flex;
}

.response-nav-btn {
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #666;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

.response-nav-btn:hover {
  background: #ffffff;
  color: #333;
}

.response-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.response-indicator {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 4px;
  border-radius: 8px;
  margin: 0 2px;
}

/* === Typing dots animation === */
.bot-content .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #000000;
  border-radius: 50%;
  animation: bounce 1.5s infinite ease-in-out;
}

@keyframes bounce {
  0%, 80%, 100% { 
    transform: translateY(0); 
    opacity: 0.6; 
  }
  40% { 
    transform: translateY(-12px); 
    opacity: 1; 
  }
}


/* === Input bar container (pill) === */
#input-container.chat-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #d0d5dd;
  border-radius: 9999px;
  box-shadow: 0 1px 0 rgba(16,24,40,0.04);
  margin: 8px 12px 40px 12px;
}

/* Contenteditable span as the input */
#input-container.chat-input #user-input {
  flex: 1;
  outline: none;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #111827;
  padding: 10px 12px;
  min-height: 20px;
  max-height: 120px; /* Limit height to prevent too tall input */
  overflow-y: auto; /* Allow scrolling if content exceeds max-height */
  white-space: pre-wrap; /* Preserve line breaks and spaces */
  word-wrap: break-word; /* Wrap long words */
}

/* Placeholder for empty contenteditable */
#input-container.chat-input #user-input:empty:before {
  content: attr(data-placeholder);
  color: #9aa3af;
  pointer-events: none;
}

/* Icon button */
#input-container .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  width: 36px;
  border: none;
  outline: none;
  background: transparent;
  border-radius: 9999px;
  cursor: pointer;
  color: #000000;
}

#input-container .icon-btn:hover { 
  background: #eef4ff; 
}

#input-container .icon-btn:disabled { 
  opacity: 0.45; 
  cursor: not-allowed; 
}

/* Stop button styling in input field */
#stop-input-btn {
  color: #000000 !important;
}

#stop-input-btn:hover {
  background: #f5f5f5 !important;
  color: #000000 !important;
}

/* Edit banner styling - floating above input field */
.edit-banner {
  background: #3a3a3a;
  color: white;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  border-radius: 8px;
  margin: 0 12px 8px 12px;
  border: 1px solid #555;
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.edit-banner-icon {
  width: 14px;
  height: 14px;
  color: #ffffff;
}

.edit-banner-text {
  font-weight: 500;
  margin-right: 4px;
}

.edit-banner-content {
  flex: 1;
  color: #cccccc;
  font-size: 11px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.edit-banner-close {
  width: 16px;
  height: 16px;
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: background-color 0.2s;
}

.edit-banner-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Remove this class as we no longer need special input styling when editing */
/* .input-container-editing {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
} */

/* === Robot GIF === */
#robot-gif {
  display: none;
  width: 120px;
  height: 120px;
  border-radius: 8px;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === Hidden class === */
.hidden {
  display: none;
}

/* === Drag and Drop Styles === */
.drag-over {
  position: relative;
}

.drag-over::after {
  content: "Drop image here";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(59, 130, 246, 0.1);
  border: 2px dashed #3b82f6;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #3b82f6;
  font-weight: 500;
  z-index: 10;
  pointer-events: none;
}

/* Input image preview styling */
#input-image-preview {
  transition: all 0.2s ease;
}

#input-image-preview:hover {
  transform: scale(1.05);
}

#input-image-preview button:hover {
  background: #dc2626 !important;
  transform: scale(1.1);
}